• ## Bainite

It's not pearlite or martensite. A blog written by Mathew Peet.

## MTDATA script – driving force

Here is a quick example script to calculate driving force for formation of ferrite from austenite.

``` mu define system 'Fe,Cr,Ni,Mo,N,C,Mn' source tcfe ! % fe Cr Ni Mo N set w(1) undef w(2) 23.00 w(3) 9.0 w(4) 3.0 w(5) 0.15 ! % C Mn set w(6) 0.02 w(7) 0.8 ! set w 100 ! classify absent p(*) ! step temp 973 1273 10 ! % % calculating for FCC % classify normal p(FCC_A1) ! compute print brief print mol ! compute print graphics_output ! units temperature celsius ! ordinate gibbs system ! plot tabulate spreadsheet ! % % calculating for BCC % classify normal p(BCC_A2) ! compute print brief print mol ! compute print graphics_output ! units temperature celsius ! ordinate gibbs system ! plot tabulate spreadsheet ! ```

This gives the answer in Joules / 100 kg.

## Mtdata Script example 3

Calculates equilibrium between ferrite austenite cementite and liquid phases and outputs a brief results and results in mole fractions and then a graph to screen.

``` :Script By Sourabh Chatterjee May 2006 mu def sys 'Fe,C,Mn,Si,Al,P,Mo,Cu' source plus sub_sgte ! class abs p(*) ! class nor p(bcc_a2,fcc_a1,cementite,liquid) ! set w 100 ! set w(2) 0.36 w(3) 1.96 w(4) 0.5 w(5) 2.0 w(6) 0.022 w(7) 0 w(8) 0.52 ! step temp 1573 1873 10 ! com pri ea_st_re !```

``` compute print brief print mole ! ```

```compute print graphic ! plot go ! ```

## 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)

## Mtdata Script example 1

Here is an example macro for use with thermodynamics software mtdata. This script sets up a stepped calculation of equilibrium for a steel composition, it then output a text file of the mass fraction of each phase. Reading the script is made difficult by the use of contracted version of the commands. The first command selects the multiphase modules could have been written ‘mu’ rather than ‘multiphase’. The next command starts ‘def sys…’ is the same as ‘define system’. Note most commands end with an exclamation mark, this is the way to tell mtdata you really mean what you typed.

``` :Macro file to calculate equilibrium phase fractions :Mathew Peet and Hala Salman Hasan 20th June 2007 multiphase def sys "Fe,C,Si,Mn,Cr,Mo,Co,Al" source plus sub_sgte ! :this is a comment :uncomment following line to use tcfe database instead :def sys "Fe,C,Si,Mn,Cr,Mo,Co,Al" source tcfe ! classify absent phase(*) ! classify normal phase(FCC_A1,BCC_A2,M23C6,M6C,cementite,m7c3) ! classify misc(FCC_A1) 1 ! set w 100 ! set w(2) 0.78 w(3) 1.6 w(4) 2.02 w(5) 1.01 w(6) 0.24 w(7) 3.87 w(8) 1.37 ! step temp 773 1373 5 ! :this line is a comment :following 3 lines output a spreadsheet of phase fractions with temperature com pri gra ! ord mass phase ! plot tabu spread ! :uncomment line/ type following to see compositions of phases :compute print brief print mol ! ```

Example output of the above calculation was archived.