$$************************************************************************************************** ************************************** GENERAL INFORMATION ***************************************** **************************************************************************************************** Script for MatCalc built-in variables and graphical output according to Tutorial 5. The following contents will be covered: - Adding further plots to a plot window - Using the built-in variables - Defining a default x-axis - Modifying the series - Adding a new series to a plot - Removing a series from a plot - Duplicating and locking series - Editing series data - Converting series to tables Database: mc_fe.tdb Author: P. Warczok Creation date: 20.03.2008 This is a script for MatCalc version 6.00 (rel 0.200) Last update: 06.02.2017 (M. Lueckl, Update for version 6.00) **************************************************************************************************** ************************************** SETUP INFORMATION ******************************************* **************************************************************************************************$$ use-module core $ Use "core" module (MatCalc uses "core" module by default anyway) new-workspace $$************************************************************************************************** **************************************** SYSTEM SETUP ********************************************** **************************************************************************************************$$ $ verify correct MatCalc version (is accessible as internal variable) if (matcalc_version<5440008) send-dialog-string "MatCalc version must be 5.44.0008 or higher to run this script. Stopping." stop_run_script $ stop script endif $$************************************************************************************************** DATABASES, CHEMICAL COMPOSITION, SELECTED PHASES **************************************************************************************************$$ if (matcalc_version<6000000) open-thermodyn-database mc_sample_fe2.tdb $ Opens thermodynamic database mc_sample_fe.tdb else test-exist-td-database mc_fe.tdb if(test_result==1) open-thermodyn-database mc_fe.tdb $ Opens thermodynamic database mc_fe.tdb else send-dialog-string ""mc_fe.tdb"-database not found. Please, download it from MatCalc Website" endif endif select-elements FE C VA $ Graphite is not selected as a phase present in the system select-phases LIQUID FCC_A1 BCC_A2 CEMENTITE read-thermodyn-database set-reference-element FE $ Fe is set as a reference element enter-composition WP C=0,4 $ Sets the content of C to 0.4 wt.% set-temperature-celsius 600 $ Sets the system temperature to 700C $ Sets the start values - this should prevent from any troubles in the equilibrium calculation set-automatic-startvalues calculate-equilibrium $ Performs the equilibrium calculation $$************************************************************************************************** STEPPED EQUILIBRIUM CALCULATIONS **************************************************************************************************$$ $------------------ Stepped equilibrium calculation with varying of temperature -------------------$ set-step-option Y T $ Selects the t[y]pe of calculation: "[T]emperature" $ Defines the [r]ange of the calculation: from 1600 to 400 with [l]inear step of 25 set-step-option R 1600 400 L 25 $ Sets the temperature unit to "C" - [O]ption "Temperature in [C]elsius" is set to [y]es set-step-option O C Y step-equilibrium $ Performs stepped equilibrium calculation rename-current-buffer T=400_to_1600C $ Renames the current buffer to "T=400_to_1600C" $$************************************************************************************************** PLOTTING A GRAPH **************************************************************************************************$$ new-gui-window p1 $ Creating a new window of 'p1' type (XY-diagram) $ Plot no. [1] in [s]eries section, [n]ew series with [b]uffer result for "f$*" variables is plotted set-plot-option 1 S N B f$* %s $----------------------- Changing the format of the temperature-step plot -------------------------$ set-gui-window-property . X T$C $ Setting (x)-axis variables to "C" (T$C) set-gui-window-property . Y b/w $ Changing the plot st(y)le to black and white (b/w) set-gui-window-property . Y col_no_symb $ ... and back to colour $------------------------------------- Setting title ----------------------------------------------$ $ Plot no.[1] receives [t]itle "Phase fraction versus temperature for Fe-0.4 wt.%C" set-plot-option 1 T Phase fraction versus temperature for Fe-0.4 wt.%C $-------------------------------- Options for the plot legend -------------------------------------$ $ For plot no.[1], in the [l]egend section, the box is put on the [b]ottom of the plot set-plot-option 1 L B $ In the [l]egend section, the st[y]le of the legend frames is set to [n]one set-plot-option 1 L Y N $------------------------------------ Options for the axes ----------------------------------------$ $ In the [a]xis section, the [x]-axis no.[1] becomes a [t]itle "Temperature [C]" set-plot-option 1 A X 1 T Temperature [°C] $ In the [a]xis section, the [y]-axis no.[1] becomes a [t]itle "Phase fraction" set-plot-option 1 A Y 1 T Phase fraction $ In the [a]xis section for the [y]-axis no.[1], the scale t[y]pe is set to [log]arithmic set-plot-option 1 A Y 1 Y log $ ... and change the [s]cale range will start from 0.01 set-plot-option 1 A Y 1 S 0.01.. $ To see the changes on the x-axis, the default x-axi[s] option '[u]se default for all plots' is set to '[n]o' set-gui-window-property . S U N $---------------------------------- Options for the gridlines -------------------------------------$ $ In the [g]ridlines section, the option of showing [m]ajor grids for [x]-axis is switched to [y]es set-plot-option 1 G M X Y $ In the [g]ridlines section, the option of showing [m]ajor grids for [y]-axis is switched to [y]es set-plot-option 1 G M Y Y $----------------------------------- Options for the series ---------------------------------------$ $ In the [s]eries section, the rena[m]ing of the series no.[0] to "Liquid" is done set-plot-option 1 S M 0 Liquid $ In the [s]eries section, the rena[m]ing of the series no.[1] to "Austenite" is done set-plot-option 1 S M 1 Austenite $ Series no.2 --> "Austenite" set-plot-option 1 S M 2 Ferrite $ Series no.3 --> "Cementite" set-plot-option 1 S M 3 Cementite $$************************************************************************************************** ADDING PLOTS OF DIFFERENT VARIABLES **************************************************************************************************$$ $ Creating new [x]-y plot in GUI-window no.[2] (the number can read on the window bar) create-new-plot X 2 $ For current plot [.] in [s]eries section [n]ew series, [b]uffer result variable "dfm$*" is plotted set-plot-option . S N B dfm$* %s $-------------- Examples of other plots (every plot is plotted in a separate window) --------------$ create-new-plot X . $ Creating new [x]-y plot in current GUI-window no.[.] set-plot-option . S N B gmp$* %s $ "gmp$*" -Molar Gibbs energy of various phases $ Chemical potential of carbon create-new-plot X . $ Creating new [x]-y plot in current GUI-window no.[.] set-plot-option . S N B mup$*$c %s $ "mup$*$c" - Chemical potential of carbon in various phases $ Molar heat capacity create-new-plot X . set-plot-option . S N B cpp$* %s $ "cpp$*" - Molar heat capacity of various phases $ Arranging plots in the columns with the [n]umber of columns of "2" set-gui-window-property . N 2 $------------------------------- Changing standard x-axis settings --------------------------------$ $ In default x-axi[s] section, the option of [u]sing it is switched to [y]es set-gui-window-property . S U Y $ Setting (x)-axis variable to "C" (T$C) set-gui-window-property . X T$C $ In default x-axi[s] section, the [t]itle for the default x-axis is set to "Temperature [C]" set-gui-window-property . S T Temperature [C] $$************************************************************************************************** MODIFYING THE SERIES IN PLOTS **************************************************************************************************$$ $------------------------- Carbon concentration in the different phases ---------------------------$ create-new-plot X . set-plot-option . S N B x$*$c %s $ "x$*$c" - mole fraction of C in various phases $$ -------------- The modification of carbon concentration from mole fractions --------------------- -------------- to weight percent - removing the old series and adding the new ones ---------------$$ $ For plot no. [6], in [s]eries section, [r]emoval of all[*] series is performed set-plot-option 6 S R * $ "x$*$c$wp" - weight percent of C in various phases set-plot-option . S N B x$*$c$wp %s $ In the [a]xis section, the [y]-axis no.[1] becomes a [t]itle "Carbon content of phase [wt.%]" set-plot-option . A Y 1 T Carbon content of phase [wt.%] $$************************************************************************************************** SAVING WORKSPACE **************************************************************************************************$$ save-workspace Tutorial_5 $ Saves workspace as "Tutorial_5.mcw"