Mtdata example 2


:example by Mathew Peet Nov07
multiphase
define system 'Fe,Mn,C' source tcfe !
:using tcfe database - other options are sol, ssol, plus, pluss, sub_sgte etc
set w 100 !
:set total weight of system to 100 kg
set w(1) undefined w(2) 1 w(3) 0.1 !
:this means 1 weight percent manganese and 0.1 weight percent carbon
:iron is calculated as the balance
classify absent phase(*) !
classify normal phase(BCC_A2,FCC_A1) !
:in this calculation we want to allow only ferrite and austenite phases
step temp 973 1373 20 !
:we want to calculate the equilibrium for this system
:from around 700 to 1100 centigrade
compute print mole_fraction_table !
:we want the calculation to produce the results as a table of mole fractions

Writing the results to a file
To output the fraction of the phase to a file we can use something like;


compute print graphics_output !
ordinate mass fraction_of_phases !
units temperature celsius !
plot tabulate spreadsheet !

Mtdata will then tell us where the file “def1.gtb” is written. This file can then be opened in your spreadsheet software or plotted using gnuplot, etc.

Plotting the output with gnuplot
The file is output as a spreadsheet with comma delimiters. If we want to plot this in gnuplot, it’s useful to switch these to spaces. This can be done with the following incantation;

sed 's/,/ /g' def1.gtb > file.ssv

The following is the commands needed in gnuplot to produce a suitable graph. This can either be written in gnuplot used interactively, or placed in a file and executed as a script.

Copy the following to a text file, for example called plot_mtdata.gnu, and run the script with the command gnuplot plot_mtdata.gnu in this case we will produce a graph in postscript format, although other formats are also available in gnuplot.


#example by Mathew Peet Nov07
set term postscript enhanced eps 22
set title "Equilibrium between austenite and ferrite for Fe-1Mn-0.1C Wt. \%"
set xlabel "TEMPERATURE / ^oC"
set ylabel "CONSTITUENTS / Wt. \%"
set output "graph.eps"
plot "file.ssv" using 1:($2*100) title "BCC" w lp, \
"file.ssv" using 1:($3*100) title "FCC" w lp

This should produce a graph something like this (converted to jpg using ‘convert graph.eps graph.jpg” command in linux)

Example graph made by MTDATA/Gnuplot

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s