This shows you the differences between two versions of the page.
Previous revisionNext revision | |||
— | tutorials:t12 [2020/07/27 12:41] – pwarczok | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== T12: Using the MatCalc console ===== | ||
+ | //This tutorial was tested on\\ | ||
+ | MatCalc version 6.00 rel 0.100\\ | ||
+ | license: free\\ | ||
+ | database: mc_fe.tdb// | ||
+ | |||
+ | ==== Complimentary files ==== | ||
+ | |||
+ | Click {{: | ||
+ | |||
+ | |||
+ | ==== Contents: ==== | ||
+ | |||
+ | * Getting help in the MatCalc console | ||
+ | * Obtaining lists of available commands for different modules | ||
+ | * Command syntax and abbreviations | ||
+ | * Example: calculating an equilibrium using the command-line | ||
+ | * Evaluating numerical expressions and variables | ||
+ | * Defining, using and plotting functions | ||
+ | |||
+ | |||
+ | ==== General remark to 6.00.0100 version ==== | ||
+ | |||
+ | Due to some development activities, the commands are to be typed into the ' | ||
+ | |||
+ | ===== Basics ===== | ||
+ | |||
+ | ==== Getting help and listing available commands ==== | ||
+ | |||
+ | Typing **'?' | ||
+ | |||
+ | < | ||
+ | MCORE: ? | ||
+ | |||
+ | ------------------------------------------------------------------------- | ||
+ | available commands in workspace module: | ||
+ | ------------------------------------------------------------------------- | ||
+ | ? HELP_WORKSPACE | ||
+ | ECHO | ||
+ | USE_MODULE | ||
+ | READ_WORKSPACE | ||
+ | SET_WORKSPACE_PROPERTY | ||
+ | RUN_SCRIPT_FILE | ||
+ | STOP_RUN_SCRIPT | ||
+ | MOVE_GUI_WINDOW | ||
+ | LIST_GUI_WINDOW_PROPS | ||
+ | SET_PROGRESS_INDICATOR | ||
+ | LIST_PLOT_OPTIONS | ||
+ | COPY_PLOT_TO_CLIPBOARD | ||
+ | EXPORT_FRAME_TO_FILE | ||
+ | SET_WORKING_DIRECTORY | ||
+ | SHOW_EXPRESSION | ||
+ | SET_VARIABLE_VALUE | ||
+ | LIST_ALL_VARIABLES | ||
+ | INPUT_VARIABLE_STRING | ||
+ | LIST_ALL_STRING_VARIABLES | ||
+ | SEND_DIALOG_STRING | ||
+ | REMOVE_FUNCTION | ||
+ | LIST_SYMBOLS | ||
+ | ------------------------------------------------------------------------- | ||
+ | use HELP_MODULE for module specific commands | ||
+ | ------------------------------------------------------------------------- | ||
+ | </ | ||
+ | |||
+ | The commands listed above are part of the **' | ||
+ | |||
+ | < | ||
+ | MCORE: help_module | ||
+ | |||
+ | ------------------------------------------------------------------------- | ||
+ | available commands in mc_core module: | ||
+ | ------------------------------------------------------------------------- | ||
+ | |||
+ | RESTART | ||
+ | LIST_DATABASE_CONTENTS | ||
+ | SET_REFERENCE_ELEMENT | ||
+ | SET_TEMPERATURE_KELVIN | ||
+ | APPLY_TANGENT_CONSTRUCTION | ||
+ | STEP_EQUILIBRIUM | ||
+ | SET_STEP_OPTION | ||
+ | LIST_PHASE_STATUS | ||
+ | CALC_PARTITION_RATIO | ||
+ | << | ||
+ | << | ||
+ | << | ||
+ | </ | ||
+ | |||
+ | |||
+ | The **' | ||
+ | |||
+ | < | ||
+ | MCORE: help-module io | ||
+ | |||
+ | ------------------------------------------------------------------------- | ||
+ | available commands in mc_core module: IO | ||
+ | ------------------------------------------------------------------------- | ||
+ | OPEN_THERMODYN_DATABASE | ||
+ | READ_MOBILITY_DATABASE | ||
+ | TEST_EXIST_PH_DATABASE | ||
+ | READ_BINARY_FILE | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Notes on syntax ==== | ||
+ | |||
+ | - Although the commands listed above contain underscores **' | ||
+ | - Commands are case-insensitive. | ||
+ | - Any unambiguous abbreviations of the commands are allowed. For example, **' | ||
+ | |||
+ | < | ||
+ | MCORE: read | ||
+ | |||
+ | READ_WORKSPACE | ||
+ | READ_THERMODYN_DATABASE | ||
+ | READ_MOBILITY_DATABASE | ||
+ | READ_PHYSICAL_DATABASE | ||
+ | READ_BINARY_FILE | ||
+ | *** error *** ambiguous command | ||
+ | _mcore: | ||
+ | </ | ||
+ | |||
+ | ===== Example: calculating an equilibrium using the command-line ===== | ||
+ | |||
+ | The use of command-lines will be illustrated with a simple example: setting up a workspace and calculating an equilibrium at a single temperature. This is the same calculation as in [[tutorials: | ||
+ | Start with a new workspace. (Warning! Using the **' | ||
+ | |||
+ | < | ||
+ | MCORE: new_workspace | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | |||
+ | </ | ||
+ | |||
+ | Open the thermodynamic database. This is equivalent to clicking **' | ||
+ | |||
+ | < | ||
+ | MCORE: open_thermodyn_database | ||
+ | name for thermodynamic database (' | ||
+ | </ | ||
+ | |||
+ | The console prompts the user for the name of a database. The default option is given between slashes **'/ | ||
+ | |||
+ | < | ||
+ | MCORE: open_thermodyn_database | ||
+ | name for thermodynamic database (' | ||
+ | |||
+ | opening database ' | ||
+ | </ | ||
+ | |||
+ | Find out which elements and phases are in the database using **' | ||
+ | |||
+ | < | ||
+ | MCORE: list_database_contents | ||
+ | (e)quilib/ | ||
+ | </ | ||
+ | |||
+ | Type in **' | ||
+ | |||
+ | < | ||
+ | MCORE: list_database_contents | ||
+ | (e)quilib/ | ||
+ | |||
+ | equilibrium database file: mc_fe.tdb | ||
+ | |||
+ | # of elements in database: 25 | ||
+ | VA, AL, B, C, CO, CR, CU, FE, H, HF, LA, MN, MO, N, NB, NI, O, P, PD, S, SI, TI, V, W, Y | ||
+ | |||
+ | # of phases in database: 122 | ||
+ | LIQUID | ||
+ | H_BCC | ||
+ | ALPHA_MN | ||
+ | DIAMOND_A4 | ||
+ | CHI_A12 | ||
+ | COV3 CR3MN5 | ||
+ | LAVES_PHASE | ||
+ | MNNI_T3 | ||
+ | ETA | ||
+ | R_PHASE | ||
+ | NI5Y PDFE_L12 | ||
+ | PDMN_P | ||
+ | PD3MN | ||
+ | CEMENTITE | ||
+ | KSI_CARBIDE | ||
+ | M7C3 M12C M23C6 | ||
+ | MOC_ETA | ||
+ | EPS_CARB | ||
+ | KSI_FE5C2 | ||
+ | BN_HP4 | ||
+ | MN6N4 | ||
+ | SI3N4 | ||
+ | CR2B CR5B3 | ||
+ | FENBB | ||
+ | MNB2 MNB4 O_MN2B | ||
+ | MN3B4 | ||
+ | MO2M1B2 | ||
+ | M5B6 TIB | ||
+ | TI3B4 | ||
+ | B_CHALC | ||
+ | DIGENITE | ||
+ | FC_MONO | ||
+ | MNS_Q | ||
+ | TI4C2S2 | ||
+ | HF1O2_M | ||
+ | LA2O3_A | ||
+ | SIO2 SPINEL | ||
+ | TI2O3 | ||
+ | Y2O3_H | ||
+ | Y2TIO5 | ||
+ | M2P | ||
+ | </ | ||
+ | |||
+ | Select the required elements using **' | ||
+ | |||
+ | < | ||
+ | MCORE: select_elements c fe | ||
+ | |||
+ | element ' | ||
+ | element ' | ||
+ | </ | ||
+ | |||
+ | Next select the phases. Any unambiguous abbreviation is acceptable for the phase names. Messages appear to confirm that these phases have been selected. | ||
+ | |||
+ | < | ||
+ | MCORE: select_phases liq bcc_a2 fcc cem | ||
+ | |||
+ | phase ' | ||
+ | phase ' | ||
+ | phase ' | ||
+ | phase ' | ||
+ | </ | ||
+ | |||
+ | Read in the thermodynamic data. This is equivalent to clicking **' | ||
+ | |||
+ | < | ||
+ | |||
+ | reading thermodynamic data ' | ||
+ | |||
+ | collecting symbols ' | ||
+ | |||
+ | elements: VA C FEhases: LIQUID FCC_A1 BCC_A2 CEMENTITE | ||
+ | |||
+ | Gibbs: 4 Phases / 0 Composition-Set(s) created | ||
+ | Gibbs: 30 functions linked ... | ||
+ | Gibbs: T = 1273.160000 K, P = 101325.000000 Pa, moles = 1 | ||
+ | </ | ||
+ | |||
+ | Enter the composition. There are three available unit qualifiers: x (mole fraction), u (u-fraction) and w (weight fraction). In addition, appending **' | ||
+ | |||
+ | < | ||
+ | MCORE: enter_composition | ||
+ | unit qualifier (X/U/W + P) /x/: wp | ||
+ | enter amount (e.g. Mn=0.32 C=0.01): c=0.4 | ||
+ | </ | ||
+ | |||
+ | Open **' | ||
+ | Set the temperature to 700°C. Note that there are two commands for temperature, | ||
+ | |||
+ | < | ||
+ | |||
+ | Impose automatic start-values and calculate an equilibrium. | ||
+ | |||
+ | < | ||
+ | MCORE: set_automatic_startvalues | ||
+ | MCORE: calculate_equilibrium | ||
+ | |||
+ | iter: 13, time used: 0,02 s | ||
+ | T: 700 C (973,16 K), GibbsEnergy: | ||
+ | - OK - | ||
+ | </ | ||
+ | |||
+ | Note the results in **' | ||
+ | |||
+ | ===== Evaluating expressions ===== | ||
+ | |||
+ | As well as entering commands, the console can be used to evaluate numerical expressions, | ||
+ | |||
+ | ==== Numerical expressions ==== | ||
+ | |||
+ | Any numerical expression can be evaluated using the command **' | ||
+ | |||
+ | < | ||
+ | MCORE: show 4/5 | ||
+ | |||
+ | 4/5 = | ||
+ | 0.8 | ||
+ | |||
+ | MCORE: show pi | ||
+ | pi = | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Note the priority rules and the use of parentheses to override these, e.g.: | ||
+ | |||
+ | < | ||
+ | MCORE: show 4/5*3 | ||
+ | |||
+ | 4/5*3 = | ||
+ | 2.4 | ||
+ | |||
+ | MCORE: show 4/(5*3) | ||
+ | |||
+ | 4/(5*3) = | ||
+ | | ||
+ | |||
+ | MCORE: show 4+4*2 | ||
+ | |||
+ | 4+4*2 = | ||
+ | 12 | ||
+ | |||
+ | MCORE: show (4+4)*2 | ||
+ | |||
+ | (4+4)*2 = | ||
+ | 16 | ||
+ | </ | ||
+ | |||
+ | ==== Expressions in x ==== | ||
+ | |||
+ | Expressions in terms of the current value of the stepped variable, x, can be evaluated using **' | ||
+ | |||
+ | < | ||
+ | MCORE: show 3*x | ||
+ | |||
+ | 3*x = | ||
+ | 0 | ||
+ | </ | ||
+ | |||
+ | Functions in x can be defined and then evaluated. | ||
+ | |||
+ | < | ||
+ | MCORE: set-function-expression | ||
+ | which function: function1 | ||
+ | enter expression: 3*x | ||
+ | |||
+ | MCORE: show function1 | ||
+ | |||
+ | function1 = | ||
+ | 0 | ||
+ | </ | ||
+ | |||
+ | Pressing the up-arrow recalls the latest command to be entered. Further use of this up-arrow scrolls through the command history in reverse chronological order. Commands are given with the full names and chosen options, e.g.: | ||
+ | |||
+ | < | ||
+ | |||
+ | The command-line can then be edited, e.g. replace **' | ||
+ | |||
+ | < | ||
+ | MCORE: SET_FUNCTION_EXPRESSION function2 | ||
+ | enter expression: x**2 | ||
+ | </ | ||
+ | |||
+ | This is the expression for **x< | ||
+ | |||
+ | < | ||
+ | MCORE: SET_FUNCTION_EXPRESSION | ||
+ | which function / | ||
+ | enter expression: x^2 | ||
+ | </ | ||
+ | |||
+ | The functions just defined can now be found by opening the **' | ||
+ | Firstly, create a new window and enter the window-type code. These codes can be found under **' | ||
+ | |||
+ | < | ||
+ | MCORE: new_gui_window | ||
+ | enter window-type code: p1 | ||
+ | </ | ||
+ | |||
+ | Next, add a new series using set-plot-option and choosing the following options (press Enter, if there is no sign behind the colon): | ||
+ | |||
+ | < | ||
+ | MCORE: set-plot-option | ||
+ | enter plot ID /1/: | ||
+ | (t)itle/ | ||
+ | (n)ew/ | ||
+ | deri(v)e/ | ||
+ | (b)uffer results/ | ||
+ | expression in variable ' | ||
+ | definition range /auto/: -10..10 | ||
+ | </ | ||
+ | |||
+ | Finally, add the other two series by recalling and editing the previously used command. | ||
+ | |||
+ | < | ||
+ | MCORE: SET_PLOT_OPTION 1 S N F function2 -10..10 | ||
+ | MCORE: SET_PLOT_OPTION 1 S N F function3 -10..10 | ||
+ | </ | ||
+ | |||
+ | The resulting plot should look like this:\\ | ||
+ | |||
+ | {{: | ||
+ | ==== Expressions using MatCalc variables ==== | ||
+ | |||
+ | It is also possible to define functions made up of MatCalc variables. Here, two functions similar to those discussed in [[tutorials: | ||
+ | |||
+ | < | ||
+ | MCORE: SET_FUNCTION_EXPRESSION function4 F$BCC_A2*X$BCC_A2$C | ||
+ | MCORE: SET_FUNCTION_EXPRESSION function5 F$CEMENTITE*X$CEMENTITE$C | ||
+ | </ | ||
+ | |||
+ | These new functions can then be evaluated using **' | ||
+ | |||
+ | < | ||
+ | MCORE: show function4 | ||
+ | |||
+ | function4 = | ||
+ | | ||
+ | |||
+ | MCORE: sh function5 | ||
+ | |||
+ | function5 = | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Expressions can be built up from existing functions and variables: | ||
+ | |||
+ | < | ||
+ | MCORE: show function4+function5 | ||
+ | |||
+ | function4+function5 = | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Below, it is confirmed that, at 700°C, function4 + function5 = < | ||
+ | |||
+ | < | ||
+ | MCORE: show XS$C-(function4+function5) | ||
+ | |||
+ | xs$C-(function4+function5) = | ||
+ | 0 | ||
+ | </ | ||
+ | |||
+ | The next tutorial discusses the use of command-lines in scripts to facilitate repetitive or complex tasks. | ||
+ | |||
+ | |||
+ | ==== Command history ==== | ||
+ | |||
+ | The command history window can be made to appear by selecting the console window and either clicking on the up-arrow icon or pressing **Ctrl + up-arrow**. This window gives a chronological list of all the commands entered in the Console. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | A command can be selected using the mouse pointer or arrow keys. Right-clicking on the command displays the following menu. On the right-hand side of the menus in MatCalc are keyboard shortcuts for the more commonly used commands. It can be seen from the image below that it is sufficient to press the **Enter** key to execute the selected command. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | Previously used commands can also be accessed in the Console window itself; pressing the up-arrow key displays the most recently entered command, and pressing it repeatedly scrolls through recent commands in reverse chronological order. The command displayed can be edited then executed by pressing the **Enter** key. | ||
+ | |||
+ | |||
+ | ===== Consecutive articles ===== | ||
+ | |||
+ | The tutorial is continued in article [[tutorials: | ||
+ | |||
+ | Go to [[: |