Open access peer-reviewed chapter

Introduction to Numerical Approaches for Forward and Inverse Heat Transfer Problems

Written By

Sergey Voronin

Submitted: 23 September 2019 Reviewed: 08 September 2020 Published: 27 October 2020

DOI: 10.5772/intechopen.93928

From the Edited Volume

Inverse Heat Conduction and Heat Exchangers

Edited by Suvanjan Bhattacharya, Mohammad Moghimi Ardekani, Ranjib Biswas and R. C. Mehta

Chapter metrics overview

683 Chapter Downloads

View Full Metrics

Abstract

We describe the formulation of forward and inverse problems in heat transfer and illustrate several techniques applicable to their solution.

Keywords

  • heat transfer
  • finite differences
  • regularization
  • Fourier transforms
  • interpolation

1. Introduction

Heat flow is described by the heat (or diffusion) partial differential equation, which takes the form u t = k 2 u x 2 with u = u x t representing the temperature at time t and at spatial location x (which may have one or more components). The constant k is the ratio of the thermal conductivity in the material over the specific heat times the density of the material. Applying the conservation law principle to the heat flow across the rod yields the parabolic partial differential equation. If a heat source is present or the material is exothermic, a non-homogeneous version of the problem: u t k 2 u x 2 = f x t with f x t 0 applies. The initial boundary value problem comes from assigning relevant initial and boundary conditions. For example, for a perfectly insulated rod as in Figure 1, the conditions could be u 0 t = u L t = 0 . Given some initial profile of the temperature at time t = 0 , u x 0 = h x , the analytical solution in 1D or 2D with a regular geometrical domain is given by separation of variables. Assuming u x t = F x G t , one obtains a system of two ODEs and from that, the series solution u x t = n = 1 u n x t = n = 1 A n exp λ n 2 t sin L x with the coefficients A n satisfying the initial condition u x 0 = n = 1 A n sin L x = f x and the eigenvalues λ n = nkπ L . The coefficients are evaluated via the sin series integration: A n = 2 L 0 L f x sin kπx L dx . For non-intregrable cases or more complicated geometries, numerical techniques for approximation are used [1].

Figure 1.

Perfectly insulated rod used a model of heat transfer, an exothermic slab, and sample modeled heat profile in 2D.

1.1 Derivation of homogeneous and non-homogeneous equations

We now discuss two simple scenarios which can be used to derive homogeneous and non-homogeneous forms of the heat Equation [2]. Heat is the flow of energy from a warmer to a cooler location. There are several types of heat transfer including conduction (flow of heat through stationary material), convection (flow of heat through fluids), and radiation (flow of heat through electromagnetic waves) [2]. In this chapter we are concerned mainly with heat conduction for which the differential heat model applies. We take Q to represent the heat transfer rate in units of Watts. It is the rate at which heat is flowing through one of the slabs in Figure 2. When heat flows into and out of a mass, the temperature of the mass changes in accordance with the model: Q in Q out = mc dT dt , where T represents the temperature, m the mass, and c is the specific heat value of the material. It should be noted that in heat problems, T and u are ofter used interchangeably. We define q = Q / A (heat over area) as the heat flux, which by Fourier’s law is proportional to the temperature gradient: q = k ¯ dT dx , where k ¯ is the thermal conductivity of the material [2]. Using Q in = Q x and Q out = Q x + δx along with heat flux q = Q / A , we have Aq x Aq x + δx = mc T / t . Applying Fourier’s law yields:

Figure 2.

Heat conducting slabs without and with internal heat generation.

k ¯ A T x x + T x x + δx = mc T / t

Next, using Taylor’s approximation T x x + δx T x x + 2 T x 2 x δx and expressing m = ρAδx in terms of slab density, area, and width, we obtain:

k ¯ A 2 T x 2 = ρc T t k 2 T x 2 = T t

For the exothermic slab case exhibited in Figure 2 on the right, we obtain an inhomogeneous equation. We assume the slab is filled with a material which emits heat at a rate q ̇ with units W / m 3 (energy per unit volume). In this case, the in and out energy balance gives Q x + q ̇ V Q x + δx = mc T / t , which with q = Q / A , V = Aδx , Fourier’s law and Taylor’s expansion, gives k ¯ A 2 T x 2 δx + q ̇ Aδx = mc T t k ¯ 2 T x 2 + q ̇ = ρc T t k 2 T x 2 + q ̇ ρc = T t . In the case of steady state, T / t = 0 and a second order differential equation model results.

1.2 Numerical schemes

Discretization of the derivative operators yields the finite difference formulation. A number of different schemes are possible based on the difference schemes used to replace the derivatives in the equation resulting in either an explicit method (where the update for u at the next time step is given by a direct calculation from the previous one) or an implicit method (where the update for u is accomplished via a linear solve). For 2D heat transfer, the model becomes α 2 2 u x 2 + 2 u y 2 = u t and again, the finite difference method can be used for discretization. The initial value problems are either forward or inverse, in the sense that they either predict the temperature profile at later time from the knowledge of the initial temperature distribution at time t = 0 or in the inverse case, predict the temperature distribution at time t = 0 from knowledge of the temperature at a future time. Sometimes, the initial boundary value problem may be prescribed extra conditions, such as Neumann or other derivate condition type and the inverse problem could instead seek the initial values for such expressions from future data [3]. In general, the inverse problem is more challening than the forward problem due to being ill-posed. The discretized operator matrix which can be assembled from the difference formulation is not well conditioned and as a result the problem is overly sensitive to slight changes in input values. Regularization techniques need to be used for the solution [4].

Advertisement

2. Forward problem

The forward problem is concerned by the prediction of heat profile in future time from the initial condition. We first consider the heat equation initial boundary value problem in 1D:

u t = ku xx , 0 < x < 1 , E1
u x 0 = f x , 0 < x < 1 , E2
u 0 t = u 1 t = 0 , t > 0 E3

with constant k . Via a transformation, this problem can be extended to nonzero boundary conditions. For (3), separation of variables gives the solution as the superposition of solutions of the form:

u ˜ x t = e π 2 kt sin πx

A quick calculation shows that t k 2 x 2 u ˜ x t = 0 . In order to form the well-known explicit scheme, we use the forward in time and central in space difference operators:

u t fd x i t j = u x i t j + 1 u x i t j l E4
2 u x 2 fd x i t j = u x i + 1 t j 2 u x i t j + u x i 1 t j h 2 E5

which results in the explicit finite difference scheme:

u i , j + 1 = u i , j + kl h 2 u i + 1 , j 2 u i , j + u i 1 , j E6

This can be re-written as u i , j + 1 = 1 2 α u i , j + α u i + 1 , j + u i 1 , j with α = kl h 2 , with l the time step ( Δ t ) and h the spatial step size ( Δ x ). Von Neumann stability analysis yields the condition l h 2 2 k . For non-homogeneous cases the general model is u t = k 2 u x 2 + f x t and the finite difference analysis proceeds in a similar way, with an explicit scheme of the form: u i , j + 1 = u i , j + kl / h 2 u i + 1 , j 2 u i , j + u i 1 , j + lf x i t j .

If we use the backward time finite difference approximation for u t , we get: u i , j + 1 u i , j k = u i + 1 , j + 1 2 u i , j + 1 + u i 1 , j + 1 h 2 , yielding the implicit scheme: α u i 1 , j + 1 + 1 + 2 α u i , j + 1 α u i + 1 , j + 1 = u i , j which can be solved for time j + 1 from the information at time j using a linear system with a tridiagonal matrix with elements α 1 + 2 α α . The implicit scheme is numerically stable for any α but is costlier than the explicit scheme. Another example, is the so called Crank–Nicolson scheme based on the time derivative approximation at the midpoint of the time stamp. It takes the form:

u i , j + 1 u i , j l = k u i + 1 , j + 1 2 u i , j + 1 + u i 1 , j + 1 + u i + 1 , j 2 u i , j + u i 1 , j 2 h 2

Again using α = kl h 2 , we arrive at the scheme:

α u i + 1 , j + 1 + 2 1 + α u i , j + 1 α u i 1 , j + 1 = α u i + 1 , j + 2 1 α u i , j + α u i 1 , j

Note that this takes the form of the linear system Au = b , where A is a tridiagonal matrix of terms α 2 1 + α α , as before, u containing the heat distribution at time j + 1 and b containing the heat distribution information at time j . A linear system solves then yields the new time information from previous data.

In 2D, the standard explicit scheme arises from the discretization:

T i , j n + 1 T i , j n Δ t = k T i , j + 1 n 2 T i , j n + T i , j 1 n Δ x 2 + T i + 1 , j n 2 T i , j n + T i 1 , j n Δ y 2

Like in the 1D scheme, suitable finite difference approximations yield the implicit method.

A practically useful direction to consider is the use of non-standard finite difference (nsfd) schemes [5]. Based on (5), we define the discretized operators:

d ¯ t f x t = f x t + l f x t E7
d ¯ x 2 f x t = f x + h t 2 f x t + f x h t E8

and proceed to evaluate d ¯ t kl d ¯ 2 x h 2 u ˜ x t for u ˜ x t = e π 2 kt sin πx . The standard fd scheme does not set this expression to zero, and hence this analytically valid solution does not satisfy the original partial differential equation. However, based on the calculations below, we can make a replacement for kl h 2 , which would force the equation to zero.

d ¯ t u ˜ x t = sin πx e π 2 k t + l e π 2 kt = sin πx e π 2 kt e π 2 kl 1 = u ˜ x t e π 2 kl 1 E9
d ¯ x 2 u ˜ x t = e π 2 kt sin π x + h 2 sin πx + sin π x h E10
= e π 2 kt 1 2 i e x + h e x + h 2 sin πx + 1 2 i e x h e x h E11
= e π 2 kt 1 2 i e iπx e iπh e iπx e iπh 4 i sin πx + e iπx e iπh e iπx e iπh E12
= e π 2 kt 1 2 i e iπx e iπh + e iπh e iπx e iπh + e iπh 4 i sin πx E13
= e π 2 kt 1 2 i 2 cos πh e iπx e iπx 4 i sin πx E14
= e π 2 kt 1 2 i 4 i cos πh sin πx 4 i sin πx E15
= 2 e π 2 kt sin πx cos πh 1 = 2 u ˜ x t cos πh 1 E16

Setting d ¯ t kl h 2 d ¯ 2 x u ˜ x t = 0 , we obtain:

u ˜ x t e π 2 kl 1 2 kl h 2 u ˜ x t cos πh 1 = 0 e π 2 kl 1 = 2 kl h 2 cos πh 1

Hence, the nsfd scheme follows if we make the following replacement in (6):

kl h 2 = 1 2 e π 2 kl 1 cos πh 1

When h , l 1 , the nsfd substitution coincides with the standard finite difference scheme. We use the small q Taylor series approximations e q 1 + q and sin q q to obtain:

1 2 e π 2 kl 1 cos πh 1 = e π 2 kl 1 2 sin 2 πh 2 1 2 1 π 2 kl 1 π 2 h 2 2 = kl h 2

By this it follows that for small h , l , the stability constraint kl h 2 1 is satisfied in the nsfd scheme when l h 2 2 just like in the original scheme. This also holds for large h , as long as h is chosen so that cos πh 1 is not very small.

2.1 Numerical experiments

Below, we present some sample results for the case of constant k in (3), where we found that the described nsfd scheme often outperforms the fd scheme at the same time step. In Figure 3, we illustrate the solutions with fd and nsfd methods with the initial condition, u x 0 = sin πx + x for problem 1, with boundary conditions u 0 t = 0 and u 1 t = 1 and with the initial condition u x 0 = 12 sin 9 πx 7 sin 4 πx and zero homogeneous boundary conditions for problem 2. For the second example, errors vs. step size are also compared. In general, we observe more accurate results with the use of the nsfd scheme.

Figure 3.

Comparison of fd and nsfd scheme solutions for the 1-D heat equation for problems 1 and 2 above.

An interesting case is that of heat transfer with an exothermic material, which can be modeled with a heat source distributed throughout [3]. Considering an infinitesimal segment as in Figure 1 yields the energy balance equation: q ̇ + αdx q ¯ + d q ̇ dx dx = 0 d q ̇ dx = α . It follows that the heat model takes the form 1 α u t = 2 u x 2 + q ̇ k . The steady state behavior does not depend on time so that u t = 0 and an ordinary differential equation model d 2 u dx 2 + α k = 0 results. Upon a double integration, the general solution is u x = α 2 k x 2 + Ax + B , which with the boundary conditions T 0 = T L = T w becomes u x = α 2 k x 2 + Lx + T w , a parabola. We can simulate this steady state example with a finite difference scheme for the time derivative, yielding the temperature profile shown in Figure 4.

Figure 4.

Temperature distribution inside a thin slab with an exothermic material with homogeneous boundary conditions as simulated by an fd scheme.

Advertisement

3. Inverse problem

The inverse problem consists of predicting the initial condition from the observation of the heat profile at some later time t . In general, the problem is ill-posed and regularization is necessary for its solution [4]. Let us look at a simple example in 1-D. Starting from the initial boundary value problem on x 0 L :

u t = k 2 u x 2 E17
u x 0 = f x , u 0 t = 0 = u L t E18

In this case, separation of variables can be used and after a well-known sequence of steps, the following series solution can be derived [3]:

u x t = n = 1 A n sin nπx L exp k L 2 t

It follows that u x 0 = n = 1 A n sin nπx L which is a sin series; that is, A n = F u x 0 = 2 L 0 L u x 0 sin nπx L . It follows that the sin coefficients of the solution at t = T are given by the sin coefficients at t = 0 multiplied by exp k L 2 T . The values of u at t = T can then be computed via the inverse sin transform applied to the product. In a similar way, it follows that from the transform of the solution at t = T , F u x T , we can in principle go backwards, to obtain u x 0 = F 1 F u x T . exp k L 2 T with the . representing component-wise operation [3]. However, with the negative sign inside the exponential gone, there is potential for blow up of any large magnitude terms. The issue can be addressed by performing filtering on the large coefficients, setting the largest magnitude portion to zero or some maximum value. The magnitude cut off value can be selected based on quartile statistics of the nonzero absolute values.

A more general approach for inversion is to utilize the inverse problem formulations of the matrix heat propagation formulation. For example, for the standard implicit or Crank-Nicholson scheme, we have the system Au = b , where A is a tridiagonal matrix of terms α 2 1 + α α . This means that u 1 = A 1 b u 0 , u 2 = A 1 b u 1 = A 2 b u 0 b u 0 = A 2 u 2 . This then implies that the initial condition at time t = 0 , u 0 can be recovered from the application of the inverse matrix raised to a power n t corresponding to the time point. As another example, if we discretize u t = ku xx as:

u t t k h 2 u i + 1 j + 1 t 2 u i j + 1 t + u i 1 j + 1 t = 0 = u i j + 1 u i j Δ t Mu j + 1 t ,

with M = k h 2 tridiag 1 2 1 , for j = 0 , 1 , , n t 1 . Using u x 0 = U 0 , we obtain the relations:

u 0 = U 0 ; u j + 1 = I + Δ tM 1 u j = I + Δ tM j + 1 U 0 L ¯ j + 1 U 0 = u j + 1

This means that U 0 can in theory be obtained right from I + Δ tM n t u n t . The matrix needs not be formed explicitly, as the finite differencing scheme can be repeatedly applied to u n t = u T . However, as shown in Figure 5, raising the typical differencing matrix to a power results in non-linear singular value decay. Hence, the application of the inverse of matrix I + Δ tM n t to the approximant for b = u T , the heat profile at time T , would result in the blow-up of any numerical errors due to the ill-conditioning. We must instead consider the inverse formulation LU 0 = b with L = L ¯ n t and utilize a regularization scheme.

Figure 5.

Tridiagonal structure of differencing operator matrix and singular value decay of operator raised to a power.

This can be accomplished by replacing the naive solution L 1 b by the regularized formulation min u Lu b 2 2 + λ u 2 2 , which for large enough λ > 0 , alleviates the problem due to the fast decay of singular values. This well-known Tikhonov regularization formulation essentially acts to remove the influence of small singular values on the solution, which would otherwise blow up in value upon inversion. The regularization parameter λ should be chosen with care to provide regularization but not to move too far away from the naive inverse operator. For this reason, λ is usually selected based on an L-curve criterion [6], whereby the parameter is initially set at some fraction of L T b and then iteratively lowered to a lower fraction (with the values either linearly or logarithmically spaced). At each λ value, the solution to L T L + λI u λ = L t b is obtained (e.g. with a Conjugate Gradient scheme) using the solution at the previously used λ as the initial guess. Typically, the progression to lower λ stops once the value of Lu λ b 2 / N reaches a plateau. It is possible to employ a predictor-corrector scheme to iteratively improve the solution. In this approach, the approximation to U 0 can be obtained as above, then the forward operator can be applied to propagate this approximated initial heat profile at t = 0 to time t = T and compare with observations [4]. We can compare the residual at time T and attempt some corrections to U 0 based on this residual such that the propagated solution at t = T best matches observations. In the case of only a finite subset of observations, interpolation techniques can be utilized to complete the profile at t = T across all values of x [7] prior to regularization to obtain an approximate smooth and continuous u T heat profile.

3.1 Numerical experiments

As an example, consider the 1D cosine based initial heat profile with k = 1 and zero boundary conditions. The profile and subsequent integration results are shown in Figure 6. It is clear that the temperature in the rod will approach zero at all locations with increasing time. The inverse problem consists of approximately recovering the initial profile u x 0 = 0.5 cos 2 π / 65 x + 1 ) , with support on N / 4 3 N / 4 . For this, we take the sin transform of the solution at t = T and multiply by exp k L 2 T . In Octave, this can be accomplished with the code:

Figure 6.

Homogeneous 1D profile and change of temperature with time.

fuT=fft (u (:, n)); % temperature profile at time T

R=exp (k.*k ′*T);

filter (R);

init_cond_approx=real (ifft (fuT.*R));

The term R may contain large entries, which will blow up when the inverse fft is performed. For this reason, the filtering of small entries is necessary. This can be accomplished simply by replacing all large entries of R with either zero or some max value; e.g. taking the cutoff to be all values above 1 e 6 and replacing them either with 0 or 1 e 2 . The cutoff can be estimated with standard statistical outlier techniques, by taking the quartiles Q 1 , Q 2 , Q 3 of the R values, computing IQR = Q 3 Q 1 and filtering all entries of R above Q 3 + αIQR with α 2 by setting them to the Q 2 value. The process is illustrated in Figure 7, for the same example as above with filtering for absolute value of entries above 1 e 1 , 1 e 3 , 1 e 5 . It can be observed that filtering only the entries of R above 1 e 5 in absolute value leads to a good approximation of the initial condition. Tikhonov regularization can be utilized when it is possible to build up the finite difference propagation operator ( L ), either as an explicit matrix, or as a function. An example is shown to the right of Figure 7, with an initial triangular temperature profile that is approximately recovered by a simple continuation scheme. In the same Figure, we also show the profiles of u T both as observed and as propagated from the approximated initial values. The smoothing properties of the heat kernel [3] give rise to the observed transformation between t = 0 and t = T .

Figure 7.

Initial condition reconstruction with different filtering levels and illustration of inversion for initial condition using Tikhonov regularization with parameter tuned via the L-curve approach.

Advertisement

4. Conclusions

This article discusses numerical approaches for the heat equation, both for the forward and inverse problems with examples for homogeneous and non-homogeneous cases. For the forward heat propagation modeling problem, we have presented a simple non-standard finite difference formulation, which satisfies the differential model and appears to result in improved performance over the standard finite difference scheme with similar magnitude time and spatial step sizes. For the inverse problem, we have described approaches based on Fourier filtering and Tikhonov regularization.

References

  1. 1. Özişik, M. Necati, Helcio RB Orlande, Marcelo J. Colaço, and Renato M. Cotta. Finite difference methods in heat transfer. CRC press, 2017.
  2. 2. Glicksman, Leon R., and John H. Lienhard. Modeling and Approximation in Heat Transfer. Cambridge University Press, 2016.
  3. 3. Taler, Jan, and Piotr Duda. Solving direct and inverse heat conduction problems. Springer Science & Business Media, 2010.
  4. 4. Muniz, Wagner Barbosa, Haroldo F. de Campos Velho, and Fernando Manuel Ramos. “A comparison of some inverse methods for estimating the initial condition of the heat equation.” Journal of Computational and Applied Mathematics 103, no. 1 (1999): 145–163.
  5. 5. Mickens, Ronald E. “Nonstandard finite difference schemes for differential equations.” Journal of Difference Equations and Applications 8, no. 9 (2002): 823–847.
  6. 6. Hansen, Per Christian, and Dianne Prost O’Leary. “The use of the L-curve in the regularization of discrete ill-posed problems.” SIAM journal on scientific computing 14, no. 6 (1993): 1487–1503.
  7. 7. Castro, L. P., Q. Chen, and S. Saitoh. “Source inversion of heat conduction from a finite number of observation data.” Applicable Analysis 89, no. 6 (2010): 801–813.

Written By

Sergey Voronin

Submitted: 23 September 2019 Reviewed: 08 September 2020 Published: 27 October 2020