Quenching (update)

Quenching heat transfer
Schematic showing stages of Quenching

Heat transfer during quenching into liquid is complicated when the quench medium forms a gas when heated to high temperatures.

The quenching process is usually split into 3 -5 stages.

Stage 1. Vapour blanket.

Depends upon surface roughness, quenchant temperature, quenchant type, oxidation. Heat transfer by radiation through vapour layer into quenchant.

Stage 1b. Partial film boiling.

Stage 2. Nucleate boiling.

Conduction and Convection.

Stage 3. Convection.

Dominated by heat transfer in the quenchant by convection which can be natural, forced with turbulence or forced with lamellar flow.

Hala Salman-Hasan has been investigating heat transfer problems, a series of experiments have been made for quenching using an experimental rig we built at Cambridge. Here we can see a video of a 2 mm probe made from steel which has a thermocouple embedded. Data logging is from a computer with data logger. I think data logging at these speeds could also be achieved using an Oscilloscope, that would probably need an electrical engineer, and more importantly a trigger to start logging at the correct time.

Quenching into water

Typical Quenching Curve
Quenching curve for water at 42 Celcius, Heat Transfer as a function of temperature.


Installing gnuplot on Windows

[updated Sep 2012]

If you are still stuck with using windows for whatever reason, don’t despair you can still use gnuplot to plot your graphs! You can get gnuplot from the gnuplot project page on sourceforge.

Browse versions to go to directory with latest updates.

Download gp443win32.zip (or latest version) which is a self extracting zip file, click on it and follow the instructions. (you don’t need to have winzip installed). You just have to copy the files to a directory on your computer, then make a shortcut to wgnuplot.

It is also useful to install ghostview, you need gs860w32.exe and gs49w32.exe (or higher?) which allows you to view postscript graphs made with gnuplot, you can copy from ghostview to the windows clipboard to insert into your word document if you so desire.

Instructions for installing ghostview can be found here;

Fitting polynomial equations with gnuplot

I wanted an equation to summarise the following data so that it could conveniently be used for some calculations, after many attempts I found that I could fit the data using 2, 6 order polynomials. One was fitted on the data between x = 0-200 and another in the range x = 200-900.

Final polynomial equations fit.

1 polynomial equation after fitting.

Final polynomial equations fit.

Second polynomial equation after fitting.

Final ploynomial equations fit.

Final polynomial equations after fitting.

Source files

set terminal png
set output "HH.png"

#set cntrparam cubicspline
#set cntrparam order 2

#plot "HH.DAT" using 1:2:(1.0) smooth acsplines title "acsplines"
#plot "HH.DAT" using 1:2 smooth csplines title "csplines"
#plot "HH.DAT" using 1:2 smooth bezier title "bezier"
#plot "HH.DAT" using 1:2 smooth sbezier title "sbezier"
#plot "HH.DAT" using 1:2 smooth unique title "unique"
#plot "HH.DAT" using 1:2 smooth frequency title "frequency"

# Linear Regression
#f(x) = m*x+c
#fit f(x) "HH.DAT" via m,c
#plot "HH.DAT", f(x)
#f(x) = a + b*x + c*x**2 + d*x**3 + e*x**4 + f*x**5
#fit f(x) "HH.DAT" via a,b,c,d,e,f
#plot "HH.DAT" ps 0.1, f(x)

a = 100
f(x) = a + b*x + c*x**2 + d*x**3 + e*x**4 + f*x**5 + g*x**6
fit [200:900] f(x) "HH.DAT" via a,b,c,d,e,f,g
plot "HH.DAT" ps 0.1 , f(x)

#g(x) = h * exp (((x-j)*(x-j))/(2*i*i))
#g(x) = h + j*x + i*x**2
g(x) = h + i*x + j*x**2 + k*x**3 + l*x**4 + m*x**5 + n*x**6

fit [0:200] g(x) "HH.DAT" via h,i,j,k,l,m,n
set yrange [-2000:10000]
set output "HH2.png"
plot "HH.DAT" ps 0.1, g(x)

set output "HH3.png"
h(x) = (x<200 ? g(x) : f(x))
plot "HH.DAT" ps 0.1, h(x)

show variables

Mtdata example 2

:example by Mathew Peet Nov07
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

Simple Math: Quadratic Equation

quadratic equations

Gnuplot script

Using gnuplot for programming

Here’s an example script to calculate stuff in gnuplot. gnuplot is capable of many functions of the c programming language such as sin(x) erf(x). This is easy to extend since it is possible to define functions and perform logic.

Save this into a file calc.gnu and run with with command > gnuplot calc.gnu

# gnuplot script by Mathew Peet
# 18 February 2007
# Example script to calculate something
A = 1
B = 2
Answer = A + B
print "The answer: ", Answer

This could be used in conjunction with regression of data to do all sort of useful stuff.

List of supported functions

In general, any mathematical expression accepted by C, FORTRAN, Pascal, or BASIC may be plotted. The precedence of operators is determined by the specifications of the C programming language.

The supported functions include:
abs(x), acos(x), asin(x), atan(x), cos(x), cosh(x), erf(x), exp(x), inverf(x), invnorm(x), log(x), log10(x), norm(x), rand(x), sgn(x), sin(x), sinh(x), sqrt(x), tan(x), tanh(x).


MUCG73 is a program available from map, which is written in FORTRAN. The program was originally written by HKDH (Harry) Bhadeshia and using the methods described in the 1982 paper, “Thermodynamic analysis of Isothermal transformation diagrams”. PDF available here: Thermodynamics analysis of isothermal transformation diagrams from phase transformations group.

I’ve been making some changes to the program since I at first wanted to increase the range of the calculation to lower temperatures, and also wanted to decrease the temperature step size from 20 degrees to 1 degree. This was to allow me to calculate the kinetics below 200 degrees Celcius which is the temperature range I am interested in for the ‘low temperature’ bainite. Calculating with a temperature step of 1 degree allows me to more easily calculate a CCT diagram using Scheil’s Additive law, otherwise it is necessary to interpolate between each 20 degrees step.

The most useful change I made so far was to replace the regression routine used for calculating the intersection of the free energy and the stored energy for bainite and for martensite. This was necessary after changing either the range or the step size used in the calculation because the regression previously was calculated by using the energy calculated for each temperature except the last 10 points. This corresponds to the range, range 200-480, which you can see in the figure graph of T vs FTO below contains a change in gradient. Finding the intersection can be made more robust/general by replacing this with a comparison of the free energy at each temperature, when the energy reaches the level for bainite or martensite I then interpolate to find the critical temperature. Since the energy in the program varies almost linearly with temperature this means the solution no longer depends upon the temperature step, it should always work find the same answer as long as the lines intersect within the temperature range calculated.

Criterion for calculation of martensite and bainite start temperatures.
[Download gnuplot script to reproduce this graph here: gnuplot gallery.

Professor Bhadeshia recommended replacing the ENERGY subroutine with the original routine from MUCG46 for the time being, since the constants determined in the rest of the program where calculated using the original version of this function, therefore any fitting was to these values. The ENERGY2 routine written by Suresh Babu should be more correct, but to use it various parameters need to be recalculated to reproduce the TTT diagram. The next step in this project is to compare these two functions, and also I also to take a look at the calculation of the Widmanstatten start temperature, which does also change slightly with the step size. I think the functions should be extended to work below 0 degrees Celcius if possible to allow calculation of the martensite start temperature in steels with higher alloy contents.

hmmm… also I have to work out a way to avoid getting NaN for a result at low temperatures.

Here are some snipets of FORTRAN code.

The changes in the main part of the program (it’s also necessary to declare the existance of subroutines).

C MS=(-1120.0D+00-10568.0D+00*X1+94.1D+00-CONST)/SLOPE

The subroutine for calculating the martensite start temperature.

C WRITE(*,*) "MCOND, X1"
C MAT_MS = 0.5*(T(IMS)+T(IMS-1))
MAT_MS = T(IMS-1)+(T(IMS)-T(IMS-1))*
& ((G(IMS-1)-MCOND)/(G(IMS-1)-G(IMS)))

It would be nice to get hold of the data used to train the models. A similar problem exists in calculating TTT diagrams with the MAP program MTTTDATA, which uses MTDATA, which as far as I understand is also incomplete for calculating TTT diagrams.

Of course most of this wont be necessary when we can solve the Shrodinger Equation.