Professional Documents
Culture Documents
A Thesis Presented to
The Faculty of the
Fritz J. and Dolores H. Russ
College of Engineering and Technology
Ohio University
In Partial Fulfillment
of the Requirements for the Degree
Master of Science
BY
Rong Zhong
June, 2000
OHlO UblIVERSITY
LIBRARY
Acknowledgement
Khairul Alam, Moss Professor, for his valuable guidance, encouragement and support
throughout this research.
I would like to thank Professor Hajrudin Pasic for his support and assistance in
this research and help with numerical methods. I wish to thank Dr. Lany Snyder,
Professor, Mathematics Department, for his help and suggestions.
My parents, brother and sister have also been a source of encouragement to me
throughout the time I have studied at Ohio University. Their encouragement has kept me
going during the times I felt overwhelmed.
Finally I would like to thank June and Warren Crockett, Lori and Mark Tyler,
Grace and Eddie Liu and all my h e n d s for their encouragement and patience during this
time.
Table of Contents
1.2
1.3
Introduction ...........................................................................................................5
2.2
2.3
2.4
Theory ..................................................................................................................
10
2.5
2.6
Introduction .........................................................................................................
21
3.2
3.3
3.4
3.4.1
3.4.2
3.4.3
3.5
3.5.1
3.5.2
3.6
3.6.1
3.6.2
3.6.3
Quenching ............................................................................................................42
4.1.1
Introduction ...................................................................................................42
4.1.2
4.2
4.2.1
4.2.2
Experimental Procedures...............................................................................47
4.3
ExperimentalResults ........................................................................................... 48
Introduction ......................................................................................................... 51
5.2
5.3
5.4
5.5
6.1
Conclusion ........................................................................................................... 82
6.2
Reference .......................................................................................................................... 85
Appendix ...........................................................................................................................
89
List of Tables
Table 3.1 Dimensionless Temperature Values, T' (x' ,t' ) , for Various
Dimensionless Time and Distances for a
Plate Heated at x = L and Insulated at x = 0 ..................................................
33
Table 3.2 Dimensionless Temperature Values, T' (x' ,t ' ) , for Various
Dimensionless Time and Distances for a
Plate Heated at x = L and Insulated at x = 0 .................................................. 34
Table 3.3 Comparison of Analytical and Finite Difference Solutions............................. 35
List of Figures
47
Figure 4.3 Cooling curve for 304 stainless steel for 10-degree quench angle test .......... 49
Figure 4.4 Cooling curve for 304 stainless steel for 60-degree quench angle test .......... 50
Figure 5.1 Comparison of experimental results with analytical profile obtained by
using a 6thdegree polynomial approximation of the heat flux function
(quench angle = 10"). ...................................................................................... 52
Figure 5.2 Heat flux polynomial obtained by least-square matching of the analytical
and experimental temperature profiles (quench angle = 10"). ....................... 53
Figure 5.3 Comparison of experimental results with analytical profile obtained by
using a 6thdegree polynomial approximation of the heat flux function
(quench angle = 60 " ). .......................................... .. .. .. . . .. .. .. . .. ......... . 54
Figure 5.4 Heat flux polynomial obtained by least-square matching of the analytical
and experimental temperature profiles (quench angle = 60" )........................ 55
Figure 5.5 Comparison of analytical and experimental temperature profiles using
a 8-interval cubic spline approximation for the heat flux function
Figure 5.24 Heat flux curve for 10-degree quench angle test by cubic spline solution.... 80
Figure 5.25 Heat transfer coefficient curve for 10-degree quench angle test by cubic
spline solution ........................................ ... ... . ...... ..... .. .. ............... ......... 8 1
Chapter 1
Introduction
1.I The Inverse Problem
Most heat conduction problems are concerned with the determination of
temperature distribution inside the solid body when certain initial and boundary
conditions are given, such as temperature or heat flux, which are known as a function of
time. These problems belong to the class of "direct problems." A direct problem has a
unique solution, because the solution involves a direct integration of differential
equations with known initial and boundary conditions. In practice, however, the surface
heat flux cannot be determined experimentally; but the temperature in the solid can be
monitored by sensors. In theory, a surface heat flux history can be calculated from a set
of temperature values, and this is called the "inverse heat conduction problem (IHCP)."
However, because of the errors that inevitably exist in the experimental data, the IHCP
often has non-unique solutions, leading to instabilities and convergence problems. The
inverse heat conduction problem is particularly difficult because it is extremely sensitive
to measurement errors (Beck, et al., 1985).
Inverse heat conduction problems arise because measurements can only be made
in easily accessible locations, or perhaps a desired variable can only be measured
indirectly. For example, we may want to estimate the temperature history on the inside
of a pressure vessel, but it is difficult to measure the temperature on the inside surface.
Therefore we use temperature profiles on the outside surface to estimate the temperature
and heat flux inside the vessel. In high-speed flight, such as spacecraft re-entry, shock
wave interaction with the spacecraft can produce enormous heat fluxes, which can
damage aerospace vehicles.
hypersonic wind tunnels. However, we cannot measure the flux in these situations.
Therefore, the temperature is measured and computations are done to recover the heat
flux.
We know that effective heat treatment and thermal processing of metals and
alloys is an essential component in the production of dependable components. More
exacting metallurgical specifications call for greater precision in heat treatment and
thermal processes. This has resulted in the need for accurate prediction and simulation of
these processes through experimentation and computer aided design. A critical case in
the simulation of quenching process is the determination of the surface heat transfer
coefficient, which is required as an input parameter. The accuracy of the simulation and
prediction is dependent on the surface heat transfer values.
Quenching experiments are often carried out to determine the surface heat fluxes
from experimental measurements of the temperature history. Therefore, this is a typical
IHCP, and the solution algorithms require special consideration. The goal of IHCP
algorithms for quenching is to determine the surface heat flux history from a set of
measured temperature histories inside a heat-conducting body. This is obviously an
estimation of the true values, since errors that are always present affect the accuracy of
the heat flux calculation.
experimental solution and then evaluate the value of the heat flux q(t) , at the times t,,
t,, ... , tn. The heat flux history is the cubic spline fitted through these q(t) values.
Experimental data were obtained from experiments conducted at Ohio University by Zajc
(1998).
In chapter 3 a
mathematical description of the IHCP is displayed, the direct solution and inverse
solution of the problem are also shown. Chapter 4 explains the experimental setup,
procedure, and the experimental results obtained at Ohio University. Chapter 5 discusses
the results of application of the IHCP algorithm. Chapter 6 presents a discussion of
results, the conclusions and suggestions for future work.
The above is a brief summary of the direct and inverse problems and the
importance of the inverse heat conduction problem. The next chapter provides a review
of the literature related to the IHCP problems.
Chapter 2
Background and Relevance
2.1 Introduction
The "direct problem", in which the governing differential equation with known
initial and boundary conditions is solved by integration, generally has unique solutions.
In the "inverse problem", the surface flux history is to be calculated from a set of
temperature values, and this should be possible in an ideal experiment. But the inverse
problem is extremely sensitive to any error in the input data. Because of the errors that
invariably exist in the experimental data, the IHCP often has non-unique solutions,
leading to instabilities and convergence problems.
Therefore, the inverse heat conduction problem is much more difficult to solve,
both analytically and numerically, than the direct problem. There are two main reasons
for the additional difficulty in solving the inverse problem. In the direct problem, the
high-frequency components of the applied heat flux are damped as the heat flow diffuses
through the solid medium. In the inverse problem, the opposite occurs. The highfrequency components or noise in the measurements will be amplified in the projection to
the surface, and the resulting surface condition estimations can be easily overwhelmed by
the noise in the interior measurement.
The inverse problem is also made difficult by the factor that the physics of heat
conduction introduces a natural lag between the applied heat flux and the temperature
response away from the flux. Thus, a step change in the surface heat flux will not be
fully felt in the interior until a finite amount of time has passed. There is a choice
between relatively difficult measurements or a difficult analytical problem. An accurate
and tractable inverse problem solution would thus minimize both disadvantages
simultaneously.
Burggraf (1964)
the medium. The temperature field was represented in terms of an infinite series of both
T ( t ) and q(t) and their derivatives and the solution was found for some very simple
thermocouple data by a temporal power series and a second series of error functions
weighted by powers of time. The resultant expression for the prediction temperature is in
the form of a summation of the repeated integrals of the error function. This method can
be used to determine boundary conditions at either face of a finite slab or hollow sphere.
Tikhonov regularization method and iterative regularization method are usually presented
as whole domain methods in which all the heat flux components are simultaneously
estimated for all times. Two advantages of these methods are that they have had rigorous
mathematical investigation and can be applied very generally.
Numerical methods have been the focus of recent studies in IHCP. Tervola
(1989) developed a numerical method to determine thermal conductivity from measured
temperature profiles. He defined the problem as an optimization problem where the heat
equation appears as a constraint. This optimization problem is solved with the DavidonFletcher-Powell method, and in each iteration the heat equation is solved by finite
element techniques with the predictor-corrector method. The boundary element method
(BEM) was used by Lesnic et al. (1998) to determine the boundary conditions in a
transient conduction problem where energies are specified in two areas of a onedimensional slab. Tseng et al. (1995), Hunag et al. (1995), and Keanini (1998) describe
applications of IHCP to manufacturing process.
procedure was studied by Tseng et al. (1995) to predict the circumferential heat flux
during water-cooled hot rolling. Keanini (1998) developed a finite element solution of a
time-dependent, axially varying surface heat flux distribution during rolling.
Numerical solutions have an advantage over analytical solutions in that thermal
property variation is accounted for in the solution process. However, inverse calculations
based on numerical direct solutions tend to be computationally intensive and often have
convergence problems.
approach, which is sensitive to the initial guess for the heat flux. The attraction of an
exact analytical solution is that it can provide a fast, approximate solution that can be
used as an intermediate step (or an initial guess) in a detailed and more accurate inverse
calculation. This would improve the efficiency of iterative numerical solutions, which
are highly sensitive to the initial guess.
The instability problem associated with IHCP has been discussed in detail by
Beck (1985). The instability arises from the fact that arbitrarily small differences in the
input data can produce arbitrarily large differences in the output values. A classic
problem in ICHP is the determination of surface heat flux in a one-dimensional slab. For
the direct problem with a known constant heat flux, the temperature solution is known. If
the heat flux varies with time, Duhamel's theorem can be used to find a solution.
experimental data that is obtained by quenching a special probe, which produces a good
approximation to the boundary conditions in the analytical solution. A least square
method is then used to produce best fit to the experimental data and determine the
polynomial coefficients of heat flux function.
The main idea is to assign heat flux as a k'th degree polynomial in time t ,
q ( t ) = a,
, + . a ,
information the heat transfer equation can be solved to yield a curve of temperature
versus time. By taking the experimental temperature at n times, t, ,t , ,.
a ,
t, , we obtain
the surface is the inverse heat conduction problem, which is extremely sensitive to
measurement errors. This thesis reports on an experimental and theoretical study of
quenching that is carried out to determine the surface heat flux history during an
experimental quenching process by an inverse algorithm based on an analytical solution.
The algorithm is applied to experimental data from a quenching experiment carried out at
Ohio University.
The surface heat flux is then calculated, and the theoretical curve
obtained from the analytical solution is compared with experimental results. The inverse
calculation appears to produce fast, but approximate results. These results can be used as
the initial guess to improve the efficiency of iterative numerical solutions, which are
sensitive to the initial guess.
2.4 Theory
Consider a one-dimensional heat conduction problem through a uniform plate, as
shown in Figure 2.1. At one end, x = 0 , the surface is insulated, and at x = L it is
subjected to heat flux q(L,t) , which is an unknown function of time. The governing heat
conduction equation describing the temperature distribution in the plate is
x . The boundary conditions correspond to the insulated left-end of the plate and the heat
flux input at the other end:
where:
a - Thermal difhsivity
k - Thermal conductivity
q - Heat flux
T - Temperature
x - Space coordinate
L - Thickness of plate
[[
cosnn: 1--
;))I
(2.5)
Without loss of generality, it is assumed that the heat flux q(L, t) can be expressed
as a polynomial function of time:
are p + 1 undetermined
coefficients, which will be evaluated by minimizing the error between the experimental
and analytical solutions.
Differentiating equation (2.6) with respect to x, we get the following:
aw (x, t) = o
ax
W x , t)
= q(L, t, a m) ,therefore,
dx
aw (x, t) = o
ax
Now one needs to solve equation (2.10) subjected to the boundary conditions in
equations (2.1 1) and (2.12), and the initial condition in equation (2.13). This was done
nn
by using the separation of variables method and using eigenvalues h = - and
L
(nr)
eigenfunctions cos
where Cn are coefficients that are to be determined. It should be noted that all these
coefficients ( C , ) are functions of time.
- - q ( L y t y a m((jx
)
- 2 ~+-)1
kL2
( x 3 - L X ~ ) aq(L,t, a,)
k~'
at
>
(2.15)
a
a,tm+'
L
+q(L, t, a,) + const.
co (t) = kL
C-,=, rn + l 12k
-
Lao
Co(0) =-+To
12k
12q(L,t,am'
k~n'n
' - 6)cos(nn ) + 6)
kLn 2n '
2L aq(Ly
at
(cos(nn ) - 1))
((n 'n
' - 6)cos(nn ) + 6)
; : :( ;ldt]
- a
=za,tm
m=O
. Therefore,
where
+-2L
-- ((n 2 n 2 - 6) cos(nn ) + 6
k?1471:
+ E2, .
+'
n=l
dq(L,t, a,
-~
d2q(L,t, a ,
dt2
3
cos(y)
"
-
2L
--n=l
kn 4~
((n 'n
- 6) cos(nn )
+6
Having determined the temperature profile in terms of the heat flux, the final step
is the determination of the heat flux by using experimental data. This is the inverse
problem, and one now must find q(t), the polynomial hnction. This is now essentially
the problem of finding the unknown coefficients , a l ,a
m in the function
=0
Using the analytical solution for T(t) , it is possible to find the derivatives with
respect to the coefficients a o , a l,..., a j ,...,a,. Let the derivatives be designated as rj(t) ,
'T(0, t) = rj (t)
.j
This produces the following set of ' p ' equations from equation (2.26), with
Solving the above linear algebraic system in the coefficients by the Gauss
elimination method (or any other matrix inversion algorithm), one can find the
polynomial coefficients a,, a, ,...,a ,...,a, that are necessary for describing the heat flux
as a function of time. This is the heat flux sought that produces the given experimental
temperature profile at x = 0 .
In the present study, we assign the heat flux to be a cubic spline function in time
t . The cubic spline is fitted to the experimental data such that the least square error
between the cubic spline and the experimental data is minimized. After the heat flux is
calculated in the cubic spline form, it is possible to compare the analytical value of the
temperature with the experimental data.
Chapter 3
Mathematical Model
3.1 Introduction
In chapter 2 we described an analytical solution based on a sixth-degree
polynomial. It will be shown later that a single polynomial cannot adequately match the
heat flux in typical quenching processes. We will now develop the inverse solution on
the basis of a cubic spline match to the experimental heat flux. We will first define the
mathematical problem, and then derive the analytical solution for the direct problem with
the boundary heat flux expressed as a cubic spline. The inverse problem consists of
calculating the analytical temperature history in the quenched part by using a cubic spline
form of the boundary heat flux and then comparing the analytical and the experimental
temperature profiles. The heat flux values at the node points of cubic spline are obtained
by minimizing the difference between the analytical and experimental temperature
profiles.
model and the solution of the direct problem. The direct problem was defined in chapter
2. We briefly summarize the direct problem below
Consider a one-dimensional heat conduction problem through a plate as shown in
Figure 2.1. It is assumed that the plate consists of a single material, homogeneous and
isotropic. At one end x = 0 , the bar is insulated, and at x
=L
it is subjected to a heat
flux q(t), which is an unknown function of time. The initial temperature of the plate
T(x,O) is assumed to be a known function of x .
For constant thermal properties, the governing heat conduction equation
describing the temperature distribution in the bar is:
The boundary conditions are given by the insulated left-end of the plate and the
heat flux input at the other end (Figure 2.1).
dx
t , = q ( t ) , therefore,
QJ
( x , t ) =O
dx
nn
where hn = - are eigenvalues and cosh,x are eigenfunctions of the homogeneous
problem.
Now we assume that the solution to the nonhomogenous equation (3.6) is given
y (x,t ) =
C en(t)e"';'
cos hnx
Differentiating the above equation and combining with equation (3.6) the following
equation is obtained:
1 "
--
.=o
4(t)
1 (x3 - L X ~dq(t)
)
C, (t)e-"':' cos hnx= - --(6x - 2 ~+ )
k~~
a
k ~ ~ dt
There are two different solutions depending on whether the integer n is zero or
non-zero.
Case 1: n = 0
a
L ddt)
co( t ) = kL
q(t) + -12k dt
-
Case 2: n > 0
where A, =
12a (cos nn
kLn2n
-1)
( x ,t ) = Co( t )+
Therefore the solution of the governing heat conduction equation subject to the
boundary condition is :
(0 ( x 3
C C , (t)e"^:' cos hnx+ 4kL2
-
- LX')
,=I
z
m
d o ) (x3 - Lx2)
Cn(0) cos hnx+ n=O
k~~
Therefore,
m
z c n ( 0 ) c o s h n x= f (x) - m ( x 3 - Lx2)
n=O
kL2
We multiply both sides by cos hmx and integrate from 0 to L to find Eo and En :
After carrying out the integration and simplifying, the following expressions are
obtained for Eo and En :
l L
[ f (x) - ( x 3 - Lx2) ni
Case 2: n = 1,2,... :
Based on the above equations, the analytical temperature solution is given by:
+ [
n=l
n=l
[-
2L
[(n' n - 6)cos nn
kn4n
-
+ 61 01 dz
nn
where An = - , n
=1,2,..
Therefore:
a
-
kL
"
A, cos h,x
= -(6x
.=I
kL2
-21)
Equation (3.25) is satisfied if the left hand side is the Fourier cosine series
expansion of -(6x
kL2
-2L)
a
-
kL
as the zeroth ( n
=0
) term of the
series. This is seen to be the case from the following orthogonality conditions:
For n = O weget:
For n = 1,2,
=-
kL
, we get:
The above value of A, is the same as in equation (3.16); therefor equation (3.25) is a
valid solution.
In a similar manner, equation (3.26) is satisfied if the left hand side is the Fourier
cosine series expansion of
x3 - Lx2
L
with the first term - as the zeroth ( n = 0 ) term
k~~
12k
of the series. This is seen to be the case from the following orthogonality conditions:
For n = 0 we get:
For n
= 1,2,
, we get:
- 2Lx)
nrr
Since h, = -, therefore, sin h,x = 0 at x
= 0, x = L
ax
at x = O ; dT(x,t) = 0
ax
. Consequently:
From the above equation, we can see the first term on the right hand side is the
Fourier cosine series expansion of f (x). The term within the second parenthesis is the
4 (0) (x3 - Lx2),therefore it cancels the last term of the right
Fourier cosine expansion of kL2
side.
Consequently, at t = 0 ; T(x,O) = f (x) .
The above procedure proves that the analytical solution found is correct.
A solution of the above quenching problem for the case of q ( t ) = constant was
evaluated by Beck et al. (1985). For the coordinates of current problem this solution can
be written in non-dimensional form as follows:
T
X
Where T + = ---- , t + = -a t x + =L- . q- = - 4.
L2 '
9,L 1k
4,
In order to compare our analytical solution with the above solution we first nondimensionalize equation (3.23) to obtain the following:
-f
( ~ )+- q ( ~ ) ( ~- +
X + '2 )
12(cosnn
+i[
n=l
n2n2
- 1) " nf
1e-nzn2t
q ( t) e n z z d t
f (x' ) - i j ( ~ ) ( x-+x~* ~ )
cos n m +
e-n2n2t+
cos n m +
To compare equations (3.27) and (3.28), the above was evaluated with
q(t) = constant = q, at x'
= 1,
andx'
=0
values as a function of time are shown in Table 3.1. The solution calculated from
equation (3.27) as reported by Beck et al. (1985) is shown in Table 3.2 in the coordinates
of the current problem. Comparison of Table 3.1 and Table 3.2 shows that the two
solutions are in excellent agreement.
Given initial
temperature profile T(x,O) , and the measured temperature T(0, t) history as a function of
time at the position x = 0 , find the heat flux q(t) at x = L which produces the
experimental temperature history. The solution will also determine the temperature
distribution as a function of space and time, i.e., T(x,t) over the entire plate at any
instant.
Table 3.1: Dimensionless Temperature Values, T' (x' ,t' ) , for Various Dimensionless
Time and Distances for a Plate Heated at x = L and Insulated at x = 0 .
(Source: Beck et al., 1985)
Table 3.2: Dimensionless Temperature Values, T' (x' ,t' ) , for Various Dimensionless
Time and Distances for a Plate Heated at x = L and Insulated at x = 0 .
2.0
2.5
3.0
3.5
4.0
4.5
5'0
x =0
x = 0.25
x = 0.5L
400.0000
400.0000
400.0000
400.0109
400.0000
400.1246
400.3765
400.5320
401.9003
401.4413
403.4241
403.0617
406.4086
405.6022
410.2314
409.2720
415.3688
414.2795
422.0577
420.8332
430.4652
429.1411
400.0000
400.0000
400.0000
400.0121
400.0000
400.1446
400.4627
400.5927
401.9865
401.5632
403.6609
403.2637
406.6676
405.9020
410.6609
409.686
415.9697
414.8240
422.8306
421.5243
431.4326
429.9954
400.0000
400.0000
400.0000
400.0208
400.0027
400.2188
400.7213
400.8022
402.2650
401.9795
404.4127
403.9588
407.6538
406.9485
412.0363
41 1.1569
417.8438
416.7921
425.2805
424.0625
434.5639
433.1763
400.0000
400.0000
400.0000
400.0498
400.1196
400.3803
401.1524
401.2126
402.9855
402.7569
405.6795
405.2221
409.4989
408.8172
416.6008
413.7509
421.2423
420.23 18
429.6306
428.4681
439.9739
438.6680
= 0.75
x =L
400.0000
400.0000
400.0253
400.1 173
400.4086
400.6732
401.7902
401.8936
404.2209
403.9875
407.5948
407.1621
412.2865
411.6249
41 8.4412
417.5838
426.3033
425.2470
436.0784
434.8229
447.9499
446.5198
In order to develop the analytical solution for the heat flux by the inverse
algorithm, the heat flux profile as a function of time was assumed to be a cubic spline. In
the last few sections we developed the analytical temperature solution as a function of the
heat flux. The next step is the determination of the heat flux by using experimental data.
This is the inverse problem, and we must find theq(t), which is a piecewise cubic spline
function. To find the heat flux, the difference between analytical temperature solution
and the experimental temperature is to be minimized.
be an approximation to the heat flux profile in the form of a cubic spline. This is
described in the following sections.
3.6.1
a ,
x, ,
but we don't have an analytical expression for f (x) that lets us calculate its value at an
arbitrary point. We want to estimate f (x) for arbitrary x by drawing a "smooth curve"
through data points xi. Mathematically, it is possible to construct cubic functions S, (x)
on each interval [x,, x,,,] so that the resulting piecewise curve y = S(x) and its first and
second derivatives are all continuous on the large interval [x,, x,]. In this study we use a
natural cubic spline for which the second derivative of the interpolating curve vanishes at
the first and the last data points of the original set.
In the computer program, which is included in the appendix, there are two
subroutines (SPLINE, SPLINT), which allow the user to interpolate a value given a set of
data points yi = f (xi). These subroutines require the value yi at the point xi. During
the minimization process, the value of y, are obtained so that the cubic spline based on
yi = f ( x i ) represents the heat flux which produces minimum error between the
analytical and experimental temperatures.
3.6.2
In this study a number of routines from this library were used. One is called
"bounded -least-squares", which can solve a nonlinear least-squares problem subject to
simple bounds on the variables using a modified Levenberg-Marquardt algorithm.
The following synopsis provides directions for using this routine:
Synopsis:
#include <imsl.h>
float *imsl~f~bounded~least~squares(void
fcn(), int m, int n, int ibtype, float xlb[], float
xub[], ... , 0 )
Required Arguments:
void fcn (int m, int n, float x[], float
fl]) (InputIOutput)
This is a user-supplied hnction to evaluate the function that defines the leastsquares problem where x is a vector of length n at which point the fhnction is
evaluated, and f is a vector of length m containing the function values at point x.
int m (Input)
Number of functions (number of experimental data points).
int n (Input)
Number of variables (number of cubic spline points), where n I m.
int ibtype (Input)
Scalar indicating the type of bounds on the variables.
float xlb[] (Input, Output, or Input/Output)
Array with n components containing the lower bounds on the variables.
If there is no lower bound on a variable, then the corresponding xlb value should
be set to -lo6.
float xub[] (Input, Output, or InputIOutput)
Array with n components containing the upper bounds on the variables.
If there is no lower bound on a variable, then the corresponding xub value should
be set to lo6.
Return Value:
A pointer to the solution x of the nonlinear least-squares problem. To release this space,
use free. If no solution can be computed, then NULL is returned.
Synopsis with Optional Arguments:
#include <imsl.h>
float *imsl~f~bounded~least~squares
(void fcn(), int m yint n, int ibtype,float xlb[],
float xub [I,
IMSL-XGUESS,float xguess[],
IMSL-JACOBIAN, void jacobiano,
IMSL-SCALE,float xscale[],
. . .,
0)
x[] in this function represents the heat flux values at n data points, fi] is the
difference between the experimental temperature and the analytical temperature at every
iteration. The total number of experimental data points used in this calculation is 120
(m=120). The number of cubic spline intervals are 9, 15, 16 and 23 (n=10, 16, 17,24).
It
subdivides the interval [a, b] and uses a (2k + l)-points in each subinterval.
The following is the synopsis of this routine as given in IMSL manual:
Synopsis:
float imsl-f-int-fcn
Required Arguments:
float fcn (float x) (Input)
User-supplied function to be integrated.
float a (Input)
Lower limit of integration.
float b (Input)
Upper limit of integration.
Return Value:
b
The value of fcn(x)dx is returned. If no value can be computed, then NaN is returned.
a
float imsl-f-int-fcn
IMSL-ERR-ABS,float err-abs,
IMSL-ERR-REL, float err-rel,
. . .,
0)
3.6.3
Program Flowchart
The flowchart for IHCP solution is given in Figure 3.1. The primary inputs are
experimental temperature data points, the cubic spline intervals, and material properties.
The upper bound was made approximately 0, and no limit was set for the lower bound.
Start
Input
Experimental time
Experimental temperature
Initialize
1.Parameters of one-dimensional problem
2.Heat flux cubic spline function
3 .The calculation tolerance
4.Special parameters of routines
5 .The upper and lower bounds for solution
Calculate
The analytical temperature profile
Minimize
The difference between the experimental
Data and the analytical solution
No
Output
1.The analytical temperature
2.Heat flux solution
3 .Heat transfer coefficient
Stop
Chapter 4
Experimental Results
In this chapter the quenching process will be briefly described, along with the
experimental setup which is used to determine the temperature history during quenching.
These experiments were carried out in research studies (Zajc, 1998; Kumar, 1998) at the
Department of Mechanical Engineering at Ohio University.
4.1 Quenching
4.1.1 Introduction
Many metal alloys that are currently being manufactured are subjected to heat
treatment before being placed in service. They are heat treated in order to improve
certain properties, such as hardness, strength, toughness, ductility and corrosion
resistance, as well as to increase uniformity of the properties. Quenching is a particular
type of thermal treatment process that involves rapid cooling of metal alloys for the
purpose of hardening.
Alloys of iron are quenched to prevent the austenite from decomposing under
equilibrium conditions thereby producing microstructures that alter the mechanical
properties of the materials. The word quenching, when applied to the heat treatment of
steel, covers the process of cooling the steel from the austenitizing temperature at a rate
such that decomposition of the austenite will occur at sub-critical temperatures. The
quenching medium can be a gas, liquid, or solid. The quenching problem is one of heat
transfer. The quenching medium extracts heat from the surface of the steel which results
in steep temperature gradients being set up in the body of the steel.
4.1.2 Cooling Curve
Among the various experimental results that have been used to predict the ability
of quenching process to get the desirable properties, the cooling curve is the most
popular. Cooling curves are obtained experimentally using an apparatus that primarily
consists of an instrumented quench probe to monitor the interior temperature response
and a data acquisition system to collect and display the sampled data.
If a heat-treated steel part is continuously cooled from a solution treating
temperature in a quenching medium that rapidly extracts heat, four stages of heat transfer
will take place. These stages characterize the four different cooling mechanisms that
occur during quenching. The four cooling stages are: (i) the initial liquid contact or
wetting stage, (ii) the vapor blanket or film boiling stage, (iii) the nucleate boiling stage,
and, (iv) the convective heat transfer stage. Except the first stage, other three stages are
recognizable on cooling curve obtained by experimental procedures. The first stage lasts
for an extremely short time, and is generally not detected in the experimental cooling
curve.
(b)
Figure 4.1 Quench Probe: (a) Schematic of the box shaped probe showing the
walls and the screw holes for attaching the top, (b) Picture of the probe used in the
experiments -the cover has been removed to show the thermocouples connected to the
inside of the probe wall
increments, therefore, the probe could be potentially quenched at any 10 degree interval
between 0 and 60 degrees.
Quenchant and Quench Tank:
The quenchant used during the experiments was water. The water was held in a
100 gallon quenching tank shown in Figure 4.2 that is made of a high strength plastic. A
plastic tank is used to ensure that a reaction does not occur between the quenchant and
the tank that could potentially change the composition of the quenching medium.
Data Acquisition Hardware:
The data acquisition equipment consists of the following:
(i) D.A.S. 1701 board made by Keithley Metrabyte. This board has 16 singleended or 8 differential channels with 12-bit resolution, 166.67 x 1o3 samples/second
maximum throughput, and gains of 1, 5,50 and 250.
(ii) The software package used to collect the data for analysis during the
experiments is called TestPoint. Each of the thermocouples was sampled every 0.01
second for approximately 1 to 2 minutes. TestPoint has several capabilities which
include: controlling external measurement devices, creating user interface item,
displaying and analyzing data, creating files, and dynamically exchanging data with other
software applications. Furthermore, TsetPoint applications have the ability to support
sequential execution, repeating loops, and conditional statement.
(iii) Computer: P5-200 Gateway 200 MHz Pentium processor, 32MB SDRAM,
3.0 GB hard drive.
Figure 4.2 Picture of the quenching system showing the quench probe
suspended over a quench tank.
Chapter 5
Results
5.1 Introduction
In this chapter we present the results from the application of the IHCP algorithm
with the cubic spline approximation of the heat flux history for the quenching process.
The heat flux curves, heat transfer coefficient plots and the comparison of the analytical
and experimental temperature curves will be presented.
second.
It is seen that the temperature profiles compare reasonably well for the 10-degree
and 60-degree quenching angles, but the analytical temperature profiles have a 'wavy'
shape which is not representative of the continuous cooling of the probe.
The
temperature profile shows an increasing trend at several points in the analytical curve, for
example after 40 seconds of cooling. This could be due to the fact that a single 6thdegree
polynomial is being used. This produces the heat flux curves as shown in Figures 5.2 and
5.4.
The heat flux curves demonstrate another problem in that the heat flux curves are
very unrealistic after the first 60 seconds. In one case the heat flux shows a very high
negative value, and in the other we see a very high positive value (the positive heat flux is
obviously impossible for this process). This error is due to the fact that there is a
significant diffusion time lag between the quenching surface at x = L , and the
thermocouple position at x = 0 . This time lag has a characteristic time of L~/ a , and is
of the order of 10 seconds. Consequently, the analytical temperature prediction during
the last 10 to 30 seconds is quite insensitive to the heat flux prediction. The polynomial
that results from this error minimization algorithm is not influenced by the heat flux
curve for the final part of the quenching. These results in the mismatch observed in the
heat flux curves. Therefore, to match the data set for 120 seconds with a polynomial
form of the heat flux curve, additional data points should be included beyond the 120
seconds (either from experiment, or by simple extension of the experimental temperature
history).
It can also be seen from the figure that a continuous polynomial profile for heat
flux may not be very accurate when the temperature slope has a sudden change, such as
near the end of the vapor blanket stage.
b
0
b
0
b
0
O
0
b
0
b
0
b
0
9
?
39
(,WIM) xnld
Jew
b
0
*
0
*
0
?9 %9 ' 9 *
*
0
9
?
8
+
W
8
+
W
8
+
W
8
+
W
8
+
W
8
+
W
8+
W
8+
W
zzz?;q;
8+
W
8+
W
8+
W
;
8+
W
;
s
+
g
+
W
$
g
+
W
g
+
W
g
+
W
g
+
W
g
+
W
$
+
W
b
0
b
0
b
0
'
'
stage with high heat flux for about 10 seconds. The convective heat transfer stage sets in
after approximately 30 seconds. In these figures, it can be observed that the analytical
and experimental temperature profiles match reasonably well when sufficient number of
intervals are used. The differences due to the number of intervals show up in the heat flux
curves (and therefore in the heat transfer coefficient). As will be shown later, the results
are very similar for 60 degree quench angle.
The heat flux in the nucleate boiling stage is seen to have a maximum value of
about 70 kw/m2 for 10 degree quench angle. The heat flux is not very accurate when
only 8 intervals are used (Figure 5.5 -5.7); the temperature profile tends to be wavy and
the maximum heat flux is 58 kw/m2. This is not surprising, since the inverse problem is
very sensitive to input parameters. A similar variation is seen for the 60 degree quench
angle (Figures 5.14 to 5.22). However, the 60 degree quench angle test appears to have a
higher maximum flux (approximately 110 kw/m2).
Therefore, it is quite critical that the number of time intervals be varied in order
that the heat flux can be calculated with a good degree of confidence. Even though the
optimization was carried out with the constraint of heat flux constrained to be negative in
the IMSL code, it is seen that the code results contain positive heat fluxes which are
typically 20 kw/m2 (about 20% of the maximum value). This error in the IMSL solution
could not be resolved.
In all curves, the final stages of the cooling show the expected decay towards zero
heat flux. This is in sharp contrast to the single polynomial case discussed earlier.
approximation for the heat flux function (quench angle = 60, 2 time intervals in vapor blanket stage).
Figure 5.14 Comparison of analytical and experimental temperature profiles using a 9-interval cubic spline
Time (second)
approximation for the heat flux function (quench angle = 60, 4 time intervals in vapor blanket stage).
Figure 5.20 Comparison of analytical and experimental temperature profiles using a 14-interval cubic spline
Figure 5.22 Heat transfer coefficient profile obtained by using a 14-interval cubic spline
Time (second)
Therefore, the piecewise continuous cubic spline is not affected strongly by the diffusion
time lag as was seen with the single polynomial.
Since the vapor blanket stage ends in a sharp drop into the nucleate boiling stage,
the (Figures 5.5, 5.14), the temperature in vapor blanket stage is not matched very well.
The cubic spline tends to produce fluctuations in and near the vapor blanket stage. This
is strongly influenced by the number of intervals used in the vapor blanket stage. When
the number of intervals in the vapor blanket stage is increased (Figures 5.8 to 5.13, and
5.17 to 5.22), the temperature profiles show an improvement in the match with the
experimental curve. However, the temperature profile in vapor blanket stage now has a
sinusoidal variation, and that produces a sinusoidal variation in the vapor blanket stage of
the heat flux curves.
From the analytical solution of the IHCP algorithm, we can get the heat transfer
coefficient curves for each of the cases by using the heat flux curve ( q ) for the
numerator, and the temperature solution ( T ) values in the denominator.
The heat flux values will obviously reflect the fluctuations observed in the heat
flux curves, and this can be observed in the heat transfer coefficient curves shown in
Figures.5.7, 5.10, 5.13, 5.16, 5.19, and 5.22. The heat transfer coefficients show large
fluctuations when the heat flux curve oscillates. As the number of time intervals is
increased, the heat transfer coefficient curves attain more stable values.
Therefore,
increasing the number of time intervals reduces the fluctuations in the heat flux and heat
transfer coefficients.
It appears that the problems in the IHCP algorithm originate from the sharp
changes in the temperature and heat flux profiles. In order to examine this aspect, the
following simulation was carried out.
Chapter 6
Discussion and Conclusions
6.1 Conclusion
An inverse heat transfer algorithm was developed to find the surface heat flux in a
quenching process. The algorithm uses an analytical solution to calculate the surface heat
flux as a cubic spline containing a variable number of intervals, each of which is spanned
by a cubic polynomial. The algorithm was then tested with experimental data.
The experimental data consisted of 12,000 data points for 120 seconds of
quenching. This data was used to determine the surface heat flux history. It was shown
that a single polynomial provides reasonably accurate results for simple quenching
histories, but is not able to match temperature jumps very accurately.
This
requirement tends to produce variations in the heat flux curve that are similar to
sinusoidal curves. A curve made of piecewise continuous straight lines may produce a
more stable, although not a highly accurate solution.
It is also quite likely that the cubic polynomial estimation for the heat flux leads
to a large number of degrees of freedom in the solution, because of which the solution
curve may not converge to the shape that is physically more plausible. To improve the
solution, more constraints may be needed. A constraint that could be applied is that the
heat flux curve must have a negative or zero slopes at all times. This constraint was not
applied in the IMSL code because the results from the code did not satisfy the first
constraint that the heat flux be negative. The IMSL code did not produce satisfactory
results; but this is not surprising. It should be noted that constrained optimization is a
difficult problem, and global minimum is often not achieved.
The primary advantage of this algorithm is that it appears to produce very fast
results as compared to other solution schemes. This algorithm, if improved further, can
be used as the initial guess to the numerical solution methods used in multi-dimensional
solutions. It should be noted that multi-dimensional inverse problems sometimes do not
converge, or require hours of computational time because the solution steps are very
sensitive to the input data, which includes the initial guess. A good initial guess in a
complex multi-dimensional problem can reduce the solution time considerably.
The IMSL optimization routine used for this study did not perform
satisfactorily. A more flexible routine that will allow more constraints may perform
better for the IHCP problem.
Reference
Alam, M. K., Pasic, H., Anugarthi, K., Zhong, Rong, 1999, "Determination of Surface
Heat Flux in Quenching", to be published in ASME IMECE proceedings, Nashville,
November, 1999.
Beck, J. V., Ben Blackwell, and Charles R. St. Clair, Jr., 1985, Inverse Heat Conduction,
I11 Posed Problems, A Wiley-Interscience Publication, New York.
Beck, J., V. B. Blackwell and A. Haji-Sheikh, 1996, "Comparison of some inverse heat
condition methods using experimental data", Int. J. heat Mass transfer, Vol. 39, No. 17,
pp. 3649-3657.
David, M. Trujillo and Henry, R. Busby, Practical Inverse Analysis in Engineering, CRC
Press, Boca Raton, New York, 1997.
Huang, C. H., Ju, T. M., and Tseng, A. A., 1995, "The estimation of surface thermal
behavior of the working roll in hot rolling process", Int. J. Heat Mass Transfer, Vol. 38,
pp. 1019-1031.
Imber, M. and Khan, J., 1972, "Prediction of transient temperature distributions with
embedded thermocouples", AIAAJ, Vol. 10, pp. 784-789.
Keanini, R. G., 1998, "Inverse estimation of surface heat flux distributions during high
speed rolling using remote thermal measurements", Int. J. Heat Mass Transfer, Vol. 41,
pp. 275-285.
Kumar, 1998, "Analytical Solution for Inverse Heat Conduction Problem", M.S. Thesis,
Ohio University.
Langford, D., 1967, "New analytic solutions of the one-dimensional heat equation for
temperature and heat flow rate both prescribed at the same fixed boundary (with
applications to the phase change problem)", Q. Appl. Math, Vol. 24, pp. 315-322.
Lesnic, D., Elliott, L. and Ingharn, D. B., 1998, "The solution of an inverse heat
conduction problem subject to the specification of energies", Int. J. Heat Mass Transfer,
Vol. 41, pp. 25-32.
Burggraf, 0 . R., 1964, "An Exact Solution of the Inverse Problem in Heat Condition
Theory and Application", Journal of Heat Transfer, pp. 373-380.
Press, William H., Teukolsky, Saul A., Vetterling. William T. and Flannery, Brian P.,
1992, Numerical Recipes in C: the Art of Scientific Computing, Cambridge University
Press.
Stolz, G., Jr., 1960, "Numerical solutions to an inverse problem of heat conduction for
simple shapes", J. Heat Transfer, Vol. 82, pp. 20-26.
Tervola, P., 1989, "A method to determine the thermal conductivity from measured
temperature profiles", Int. J. Heat Mass Transfer, Vol. 32, pp. 1425-1430.
Totten, G. E., Bates, C. E. and Clinton, N. A., 1994, Handbook of Quenchants and
Quenching Technology, Materials Park, Ohio: ASM International.
Tseng, A. A., Chang, J. G., Raudensky, M. and Horsky, J., 1995, "An inverse finite
element evaluation of roll cooling in hot rolling of steels",
Journal of Material
Zajc, D., 1998, "Experimental Study of a Quench Process", M.S. Thesis, Ohio
University.
Appendix
.......................................................................
/ * This program is used to solve the inverse heat conduction
/ * problem.
/ * Written by Rong Zhong
.......................................................................
*/
*/
*/
#include cstdio.h>
#include cmath.h>
#include <stdlib.hz
#include <imsl.h>
#include "nrutil.h1I
#define MAX 500
.......................................................................
/ * Global Data.
.......................................................................
*/
/*
/*
/*
/*
/*
/*
Function Prototype.
.......................................................................
void spline ( ) ;
float splint (float xt) ;
float
float
float
float
Q(f1oat t);
DQ(f1oat t);
QEXP(f1oat t);
DQEXP ( float t ) ;
/*
/*
/*
/*
calculated ~ ( xt), * /
EO * /
En * /
Cn * /
*/
/ * IMSL routine * /
......................................................................
/ * Main Program.
......................................................................
/
*/
/
main ( )
int i t j , m;
int ibtype=O;
float *result, fxqt [2OOl , qcguess [MAXI qcguessd [MAXI
char *fmt="%12.4eU;
static float grad-tol=l.Oe-3;
float ted [MAXI , Ted [MAXI , tcd [MAXI ;
float v, d [ M A X ,I h [MAXI , qclb [MAXI , qcub[MAXI ;
t
for (i=0;i<mm;i++)
scanf (IT%f %fu, &tcd [i], &qcguessd [i])
for (i=O;i<m;i++)
scanf ("%f %f
qctemp
TIN=Ted [ 0 1 ;
printf("%f\nU), TIN);
for (i=O;i<mm;i++)
printf ("%f %f\n
Ir,
for (i=O;i<mm;
i++) {
tc [i]=tcd [il *L*L/alpha;
qcguess [il=qcguessd [il/QC;
for (i=0;i<mm;i++) {
qclb [i]=-1.e6;
qcub[i] =l. ;
for (i=O;i<m;i++) {
ten [i]=ted [i]*L*L/alpha;
Ten [i]=Ted [i]*K/ (QC*L);
result=imsl~f~bounded~1east~squares(exampl,
m, mm, ibtype, qclb, qcub,
IMSL-XGUESS, qcguess, IMSL-GRAD-TOL, grad-tol, IMSL-RETURN-USER, qc, 0
) ;
exampl (m,mm,result,fxqt) ;
for (i=0;i<mm;i++) {
printf ("%f %f\nu, tcd [i], qc [i]*QC) ;
for (i=O;i<mm;
i++) {
h [il=-qc[il *QC/ (TT(qc, tc [i], 1.) *Qc*L/K-25.)
printf ( "%f %f \nu, tcd [i], h [i]) ;
for (i=0;icm;i++) {
v=TT (qc, ten [i], 0.)
d [i]=v*QC*L/K;
1
for ( i = ~ ; i < m
i++)
; {
printf ("%f %f %f\nll,
ted [i], d [i], Ted [i]
) ;
.......................................................................
/ * This program is used to evaluate the function that defines the
/ * least-squares problem.
.......................................................................
*/
*/
) ;
*/
*/
/
/ * integration of x A 2 term * /
/ * integration of x A 3 term * /
value-e0=imsl~f~int~fcn~smooth(ECO,
O., I., IMSL-ERR-ABS, err-abs,
IMSL-ERR-REL, err-rel, O)+eOl+e02;
/ * EO term * /
cO=imsl-f-int-fcn-sing(Q, O., t, IMSL-ERR-ABS, err-abs, IMSL-ERR-REL,
err-rel, O)+(l./l2.)*Q(t)-(1./12.)*Q(O.)+value~eO;
/ * CO term * /
cn=CN(t,x);
tr=Q (t)* (pow(x,3) -x*x);
/ * Cn term * /
/ * Transformation term * /
return cO+cn+tr;
/*
......................................................................
*/
/
/ * An term * /
/ * Bn term * /
/*
.......................................................................
*/
.......................................................................
/*
.......................................................................
*/
.......................................................................
/ * This program is used to get q(t) term.
.......................................................................
*/
float Q(f1oat t)
float value;
value=splint (t);
return value;
.......................................................................
/ * This program is used to get dq(t)/dt term.
.......................................................................
float DQ(f1oat t)
*/
*/
float QEXP(f1oat t)
return Q(t)*exp(pow(nn*~
-PI,2)*(t-tim));
1
/*
.......................................................................
*/
return DQ(t)*exp(pow(nn*M-PI,2)*(t-tim));
1
.......................................................................
/ * This program is used to call spline function.
.......................................................................
*/
void spline ( )
L
int i,k;
float p,sig,Xu;
for (i=l;i<mm-l;i++)
{
yy2 [mm-11=O.O;
for (k=mm-2;
k>0;k--)
yy2 [kl=yy2 [kl*yy2 [k+l]+u [k];
/*
......................................................................
[I
) ;
*/
/
while (khi-klosl) {
k= (khi+klo)s>l;
if (tc[kl>xt)
khi=k;
else klo=k;
J
......................................................................
/*
*/
......................................................................
#ifndef -NR-UTILS-H#define -NR-UTILS-Hstatic float sqrarg;
#define SQR (a) ( (sqrarg=(a))
== 0 . 0
0.0
0.0
? 0.0
sqrarg*sqrarg)
dsqrarg*dsqrarg)
?\
?\
?\
>
(imaxarg2) ? \
<
(iminarg2)
II
defined (ANSI)
II
?\
......................................................................
/ * This routine is used by spline and splint routines.
/ * The first routine-nrerror is invoked to terminate program
/ * execution, others are used to allocate and deallocate memory
/ * for vectors and matrices.
/ * Written by "Numerical Recipes in C "
......................................................................
*/
*/
*/
*/
*/
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#define NR-END 1
#define FREE-ARG char*
void nrerror (char error-text [I)
/ * Numerical Recipes standard error handler * /
{
fprintf(stderr,"Numerical Recipes run-time error . . . \nH);
fprintf (stderr,"%s\n",error-text) ;
fprintf(stderr,"...now exiting to system . . . \n u );
exit (1);
1
float *vector(long nl, long nh)
float *v;
*sizeof (float))
v= (float * ) malloc ( (size-t) ( (nh-nl+l+N~_EN~)
if ( !v) nrerror ("allocation failure in vector 0 " ) ;
return V-nl+NR-END;
) ;
int *v;
v=(int *)malloc((size t) ((nh-nl+l+N~-END)*sizeof(int)));
failure in ivector 0 " ) ;
if ( !v) nrerror (~~allo~ation
return V-nl+NR-END;
1
unsigned char *cvector(long nl, long nh)
/ * allocate an unsigned char vector with subscript range v[nl..nh] * /
r
1
) ;
1
double *dvector(long nl, long nh)
/ * allocate a double vector with subscript range v[nl..nh] * /
t
double *v;
v= (double * ) malloc ( (size-t) ( (nh-nl+l+NR-END)*sizeof (double) )
if ( !v) nrerror (llallocation
failure in dvector ( ) " ) ;
return V-nl+NR-END;
1
float **matrix(long nrl, long nrh, long ncl, long nch)
/ * allocate a float matrix with subscript range m[nrl..nrh] [ncl..nch]*/
i
long i, nrow=nrh-nrl+l,ncol=nch-ncl+l;
float * *m;
) ;
*/
{
long i, nrow=nrh-nrl+l,ncol=nch-ncl+l;
double **m;
/ * allocate pointers to rows * /
m=(double * * ) malloc((size-t) ((nrow+~~-~~~)*sizeof(double*)
));
if (!m) nrerr~r(~~allocation
failure 1 in matrix()");
m += NR-END;
m - = nrl;
/ * allocate rows and set pointers to them * /
m[nrl]=(double * ) malloc((size t) ((nrow*ncol+NR-~~~)*sizeof(double)));
if ( !m[nrl]) nrerror ("allocation failure 2 in matrix ( ) " ) ;
m[nrl] += NR-END;
m[nrl] - = ncl;
for (i=nrl+l;ic=nrh;i++) m[i] =m[i-11+ncol;
/ * return pointer to array of pointers to rows * /
return m;
I
int **imatrix(long nrl, long nrh, long ncl, long nch)
/ * allocate a int matrix with subscript range m[nrl..nrh][ncl..nch] * /
L
long i, nrow=nrh-nrl+l,ncol=nch-ncl+l;
int **m;
) ;
I
float **submatrix(float **a, long oldrl, long oldrh, long oldcl, long
oldch, long newrl, long newcl)
/ * point a submatrix [newrl. .I [newcl. . ] to
a [oldrl. . oldrh] [oldcl. .oldch] * /
{
long i,j,nrow=oldrh-oldrl+l,ncol=oldcl-newcl;
float **m;
/ * allocate array of pointers to rows * /
m= (float * * ) malloc ( (size-t) ( (~~ow+NR-END)
*sizeof (float*)) ) ;
if ( !m) nrerror ("allocation failure in submatrix ( ) " ) ;
m += NR-END;
m - = newrl;
1
float **convert-matrix(f1oat *a, long nrl, long nrh, long ncl, long
nch)
/ * allocate a float matrix m[nrl..nrh] [ncl..nchl that points to the
matrix declared in the standard C manner as a[nrow] [ncol], where
nrow=nrh-nrl+l and ncol=nch-ncl+l. The routine should be called with
the address &a[Ol [Ol as the first argument. * /
long i,j,nrow=nrh-nrl+l,ncol=nch-ncl+l;
float * *m;
/ * allocate pointers to rows * /
m=(float * * ) malloc((size-t) ((nrow+NR-END)*sizeof(float*)));
if ( !m) nrerror ( "allocation failure in convert-matrix ( ) 11);
m += NR-END;
m - = nrl;
/ * set pointers to rows * /
m [nrl]=a-ncl;
for(i=l,j=nrl+l;icnrow;i++,
j++) m[jl=m[j-ll+ncol;
/ * return pointer to array of pointers to rows * /
return m;
1
float ***f3tensor(long nrl, long nrh, long ncl, long nch, long ndl,
long ndh)
/ * allocate a float 3tensor with range t[nrl..nrhl [ncl..nchl [ndl..ndhl
*/
long i,j,nrow=nrh-nrl+l,ncol=nch-ncl+l,ndep=ndh-ndl+l;
float ***t;
/ * allocate pointers to pointers to rows * /
t= (float * * * ) malloc ( (size-t) ( (~~ow+NR-END)
*sizeof(float**) ) ) ;
if ( ! t) nrerror ("allocation failure 1 in f3tensor ( )
;
t += NR-END;
t - = nrl;
/ * allocate pointers to rows and set pointers to them * /
t [nrl]= (float * * ) malloc ( (size-t) ( (nrow*ncol+NR-END)*sizeof(float*)
if ( ! t [nrl]) nrerror ("allocation failure 2 in f3tensor ( ) It);
t [nrl] += NR-END;
t [nrl] - = ncl;
/ * allocate rows and set pointers to them * /
t [nrl][ncll= (float * )
malloc ( (size-t) ( (nrow*ncol*ndep+~~-END)
*sizeof(float) ) ) ;
if ( ! t [nrl][ncl]) nrerror ( I1allocationfailure 3 in f3tensor ( )
;
t [nrl][ncl] += NR-END;
t [nrl][ncll - = ndl;
for(j=ncl+l;jc=nch;j++)t[nrlI [j]=t[nrl][j-l]+ndep;
for (i=nrl+l;ic=nrh;i++) {
t [il=t [i-11+ncol;
t [i][ncl]=t [i-l][ncll+ncol*ndep;
for (j=ncl+l;j<=nch;j++) t [il [jl=t [il [j-11+ndep;
1
void free-vector(f1oat *v, long nl, long nh)
/ * free a float vector allocated with vector() * /
L
) ) ;
I
void free-lvector(unsigned long *v, long nl, long nh)
/ * free an unsigned long vector allocated with lvector() * /
void free-matrix(f1oat **m, long nrl, long nrh, long ncl, long nch)
/ * free a float matrix allocated by matrix0 * /
{
free ( (FREE ARG) (m[nrll+ncl-NR-END) ) ;
free ( (FREEIARG) (m+nrl-NR-END) ) ;
1
void free-dmatrix(doub1e **m, long nrl, long nrh, long ncl, long nch)
/ * free a double matrix allocated by dmatrixo * /
iree ( (FREE ARG) (m[nrll+ncl-NR-END))
(m+nrl-NR-END)) ;
free ( (FREE-ARG)
-
void free-imatrix(int **m, long nrl, long nrh, long ncl, long nch)
/ * free an int matrix allocated by imatrix0 * /
iree ( (FREE-ARG) (m[nrll+ncl-NR-END) )
free ( (FREE-ARG) (m+nrl-NR-END)) ;
1
void free-submatrix(f1oat **b, long nrl, long nrh, long ncl, long nch)
/ * free a submatrix allocated by submatrix0 * /
void free-convert-matrix(float **b, long nrl, long nrh, long ncl, long
nch)
/ * free a matrix allocated by convert-matrix() * /
void free-f3tensor(float ***t, long nrl, long nrh, long ncl, long nch,
long ndl, long ndh)
/ * free a float f3tensor allocated by f3tensor() * /
1
*/
*/
*/
.......................................................................
/ * Global Data.
......................................................................
*/
/
int nn;
float L=0.006,
alpha=2e-5,
K=40.,
TIN=O., / * dimensional initial temperature * /
TINN,
/ * non-dimensional initial temperature * /
QC=lOOO.,
tim;
......................................................................
/*
unction Prototype.
.......................................................................
float qgaus (float (*func)(float), float a, float b) ;
/
*/
float (*p)(float);
float
float
float
float
Q(f10at t);
DQ (float t) ;
QEXP(fl0at t) ;
DQEXP (float t) ;
float
float
float
float
TT (float x, float t) ;
ECO(f1oat);
ECN (float);
CN(float, float);
/*
/*
/*
/*
calculated t * /
e0 * /
en * /
cn * /
.......................................................................
/*
Main Problem.
.......................................................................
main ( )
{
float value,tt,ttd,x,xl;
float vl,v2,v3,v4,v5;
float vdl,vd2,vd3,vd4,vd5;
printf ("Input the time (dimensional):
scanf
&ttd) ;
( I 1 %'I,
") ;
*/
tt=ttd*alpha/(L*L);
tim=tt;
TINN=TIN*K/ (QC*L);
printf ("tt=%f\nU,
tt) ;
vl=TT(tt,l.);
v2=TT(tt,0.75);
v3=TT(tt,0.5);
v4=TT (tt,0.25);
vS=TT(tt,O.);
V~S=VS*QC*L/K;
vd4=v4*QC*L/K;
vd3=v3 *QC*L/K;
v~~=v~*Qc*L/K;
v~~=v~*Qc*L/K;
printf ("ttd=%f, tt=%f\nl',ttd,tt) ;
printf("The non-dimensional values are:");
%f
%f
%f
%f\n11,vl,v2,v3,v4,v5);
printf ("\n%f
printf("\nThe dimensional values are:");
printf ("\n%f
%f
%f
%f
%f\nI1,vdl,vd2, vd3, vd4, vd5 ) ;
J
1
float CN(f1oat t, float x)
return sumt;
1
float ECO (float x)
return TINN;
1
float ECN(f1oat x)
r
1
return ~~NN*cos(nn*M-PI*x);
1
float Q(f1oat t)
return 1000.O/QC;
float DQ(f1oat t)
return 0.;
J
float QEXP(f1oat t)
return Q (t)*exp (pow(nn*M-PI,2)* (t-tim)) ;
J
return s*=xr;
.....................................................................
/ * This program is used to calculate the temperature distribution * /
/ * of one bar by using finite difference method.
*/
/ * Written by ROng Zhong
*/
.....................................................................
.....................................................................
Global Data.
*/
.....................................................................
float L=0.006, alpha=2.0e-5, K=40., TN 1251 , TO [25], T N [25]
~ , TN2 [25],
/*
TIN=400.;
/ * Function Prototype.
.....................................................................
*/
.....................................................................
/ * Main Program.
.....................................................................
main ( 1
for (i=0;i<=n;i++) {
TO [i]=TIN;
do I
TNl [0]=TO [0]+C* (2.*TO [l]-2.*TO [O]) ;
TNl [n]=TO [n]+C* (2.*TO [n-l]-2.*TO [n]+ ( Q (tim)/K)*2.*deltax);
for (i=l;i<n;i++) {
TNl [i]=TO [i]+C* (TO[i+l]-2.*TO [i]+TO [i-l])
J
*/
for (i=o;ic=n;i++) {
TO [i]=TN [i];
for (i=0;ic=n;i++) {
~rintf
("%e\tM,~N[i]
) ;
printf ("\n");
J
float Q(fl0at t)
{
return 10000.*t*t;
.......................................................................
/ * Global Data.
......................................................................
*/
*/
*/
*/
/
int n;
float L=0.006, alpha=2e-5, K=40., TIN=400.,TINN, QC=1000., tim,
FM=10000.;
.......................................................................
/ * Function Prototype.
.......................................................................
*/
Q(f1oat t);
DQ(fl0at t) ;
QEXP (float t) ;
DQEXP (float t) ;
float
float
float
float
TT (float x, float t) ;
ECO (float);
ECN (float);
CN (float, float);
/*
/*
/*
/*
calculated t * /
e0 * /
en * /
cn * /
/ * Main Program.
.......................................................................
main ( )
I
iloat value,tt,ttd,x,xl;
float vl,v2,v3,v4,v5;
float vdl,vd2,vd3,vd4,vd5;
float ttmp[61={0.01, 0.05, 0.1, 0.2, 0.3, 0.4);
int i;
printf("1nput the dimensional time: " ) ;
scanf ("%fU,&ttd) ;
tt=ttd*alpha/ (L*L);
tim=tt;
TINN=TIN*K/ (QC*L);
printf ("tt=%f\nU,
tt) ;
vl=TT(tt,1.) ;
v2=TT(tt,0.75);
v3=TT(tt,O.5);
v4=TT(tt,0.25);
v5=TT (tt,0.) ;
vd5=v5*QC*L/K;
vd4=v4*QC*~/K;
v~~=v~*Qc*L/K;
v~~=v~*Qc*L/K;
V~I=VI*QC*L/K;
printf (I1ttd=%f,tt=%f\nl',ttd,tt) ;
printf ("The non-dimensional values are : ");
printf (I1\n%f
%f
%f
%f
%f\nu,vl, v2, v3, v4, v5 ) ;
printf("\nThe dimensional values are:");
printf ("\n%f
%f
%f
%f
%f\ n u ,
vdl, vd2, vd3, vd4, vd5
) ;
1
float TT(f1oat t, float x)
float cn,tr,cO,e01,e02,value~eO;
e01=Q (0.) /3. ;
/ * integration of xA2 term * /
e02=-Q(0.)/4.; / * integration of xA3 term * /
p=ECO ;
/ * initial term * /
value-eO=qgaus(p, O . , l.)+eOl+e02;
/ * EO term * /
P=Q;
cO=qgaus(p, O., t)+(l./l2.)*Q(t) - (l./12.)*Q(O.)+value_eO; / * CO term
*/
cn=CN(t,x);
/ * Cn term * /
/ * Transformation term * /
return cO+cn+tr;
p=QEXP;
value-QEXP=qgaus(p, O.,
t);
/ * An term * /
/ * Bn term * /
enl=-~(0.)
* (6.*s/pow(n,2)+12./(pow(n,4)* -PI*M-PI) * (1-s))
/ * integration of xA2*cos term * /
en2=Q (0.) *4*s/pow (n,2) ;
/ * integration of xA3*cos term * /
p=ECN;
/ * Initial term of En * /
return TINN;
1
float ECN (float x)
{
return TINN*COS(~*M-PI*X);
1
float Q(f1oat tt)
float t=tt*l*L/alpha;
return ~ * ~ * F M / Q c ;
float t=tt*~*~/alpha;
return ~ * F M * ~ / Q C ;
J
float Q~XP(f1oatt)
1
float DQEXP (float t)
1
return DQ(t)*exp(pow(n*M-PI,2)*(t-tim));
return s*=xr;