Chapter 6 Numerical Methods for Transient Problems 1 Numerical Solution of Transient Heat Conduction Problems Mathematical models of heat conduction problems must often be solved numerically. Three main approximation techniques are available: finite differences (FD), finite elements (FE) and finite volume (FV) methods. These methods are based on the idea of first discretizing the heat equation and then solving the resulting (algebraic) problem. Discretization is accomplished by regarding the medium as constituted by a collection of cells or volumes of finite size. Nodes are usually associated with each cell thus producing a mesh of points. The separation between any two nodes is the mesh spacing. Temperature at each cell is then represented by the temperature at the corresponding nodal location. A computer and a computer program are then used to solve the resulting algebraic problem. This section contains a survey of finite difference methods for the solution of one- and multidimensional transient heat conduction problems. 2 The Finite Difference Method The basic idea behind the finite difference method is to replace the various derivatives appearing in the mathematical formulation of the problem by suitable approximations on a finite difference mesh. The simplest derivation of finite difference formulae makes use of Taylor series. The Taylor series expansions of a function f(x) about a point x are: f(x + δx) = f(x) + δxf ′(x) + δx2 ′′ δx3 ′′′ f (x) + f (x) + ... 2! 3! f(x − δx) = f(x) − δxf ′(x) + δx2 ′′ δx3 ′′′ f (x) − f (x) + ... 2! 3! and where δx is the mesh spacing. 1 Solving the first equation above for f ′ (x) gives f ′ (x) = δx2 ′′′ f(x + δx) − f(x) δx ′′ − f (x) − f (x) + ... δx 2 6 and solving the second one f ′ (x) = f(x) − f(x − δx) δx ′′ δx2 ′′′ + f (x) − f (x) + ... δx 2 6 Finally, from the first two equations f ′ (x) = f(x + δx) − f(x − δx) δx2 ′′′ − f (x) + ... 2δx 6 These are called respectively the forward, backward and central approximations to the derivative of f(x). Note that the second term on the right hand side in the first two equations above is proportional to δx while the same second term in the third equation is proportional to δx2. Therefore, the first two equations are regarded as leading to first-order accurate approximations to the derivative while the last formula leads to a second-order accurate approximation. Note that the neglect of higher order terms in the above formulae for f ′ (x) produces various approximation schemes for the derivative. Second order derivative approximations can be similarly obtained. For example, expanding f(x ± δx) about x 4 f(x + 2δx) = f(x) + 2δxf ′ (x) + 2δx2f ′′(x) + δx3f ′′′ (x) + ... 3 and 4 f(x − 2δx) = f(x) − 2δxf ′(x) + 2δx2f ′′ (x) − δx3f ′′′(x) + ... 3 Eliminating f ′ (x) gives f ′′ (x) = f(x + δx) − 2f(x) + f(x − δx) 1 − δx2f ′′′′(x) + ... 2 δx 12 Neglecting the higher order terms produces the central difference approximation to f ′′ (x). Note that this leads to a second-order accurate approximation of the second derivative. Errors are always involved in performing any numerical computation. Round-off errors appear whenever computing takes place using a finite number of digits. This is the case when using modern computing machines. Truncation error is the error that exists even in the absence of round-off error and is the result of neglecting higher order terms in the finite difference approximations obtained from Taylor series expansions. Successful numerical work in conduction heat transfer requires attention to issues of accuracy and error control. 2 3 Solution of Transient Heat Conduction Problems by the Finite Difference Method Consider the problem of transient 1D heat conduction inside a slab of span L with constant properties. The governing equation is 1 ∂T ∂ 2T = 2 ∂x α ∂t This equation must be solved subject to specific boundary and initial conditions in order to determine T (x, t). The formulae given above can now be used to produce finite difference equations approximating the heat conduction problem. Consider first a mesh in space formed by points separated by constant spacing ∆x. The mesh points in space are x1 , x2, ..., xi−1, xi , xi+1 , ..., xN . Note that nodes x1 and xN are boundary nodes while all other nodes are interior nodes. Consider also a mesh in time formed by instants of time separated by a constant amount of time ∆t. The mesh points in time are t1 , t2, ..., tj , tj+1 , ..., tM . Note that time level t1 represents the initial condition of the system. With the above notation, the temperature at a particular node (xi, tj ) is given by T (xi, tj ) = Ti,j . 3.1 The Explicit Scheme We can now use the finite difference formulae given above to write approximations to the derivatives in the heat conduction equations. For instance, using a forward difference in time to represent the time rate of change of temperature at nodal location (xi, tj ) yields 1 ∂T 1 T (xi, tj + ∆t) − T (xi, tj ) 1 Ti,j+1 − Ti,j ≈ = α ∂t α ∆t α ∆t A central difference approximation to the right hand side term around the same nodal location yields ∂ 2T T (xi + ∆x, tj ) − 2T (xi , tj ) + T (xi − ∆x, tj ) Ti+1,j − 2Ti,j + Ti−1,j ≈ = 2 2 ∂x ∆x ∆x2 Substituting and rearranging gives an explicit formula for the calculation of Ti,j+1 for all interior nodes i, i.e. Ti,j+1 = Ti,j + α∆t (Ti+1,j − 2Ti,j + Ti−1,j ) ∆x2 If the problem to be solved involves Dirichlet boundary conditions, for instance T (0, t) = T (x1, tj ) = T1,j = T1 3 and T (L, t) = T (xN , tj ) = TN,j = TN The above equations completely define the temperatures at all the nodal locations. Since T1,j and TN,j are given one computes only Ti,j for i = 2, 3, ..., N − 1 and for all time levels j + 1. An important limitation of the explicit scheme is that it is conditionally stable. It can be shown that the calculation of Ti,j with the above method produces stable and physically meaningful results only as long as the Courant-Friedrichs-Lewy (CFL) condition is fulfilled, i.e. as long as 1 α∆t ≤ 2 ∆x 2 3.2 The Implicit Scheme An alternative scheme is obtained by using instead a central difference approximation to the right hand side term around the nodal location (xi , tj+1 ). This gives T (xi + ∆x, tj+1 ) − 2T (xi , tj+1 ) + T (xi − ∆x, tj+1) ∂ 2T ≈ = 2 ∂x ∆x2 Ti+1,j+1 − 2Ti,j+1 + Ti−1,j+1 = ∆x2 Substituting and rearranging gives an implicit formula for the calculation of Ti,j+1 for all spatial nodes i, i.e. − α∆t α∆t α∆t Ti−1,j+1 + (2 2 + 1)Ti,j+1 − Ti+1,j+1 = Ti,j 2 ∆x ∆x ∆x2 For given temperatures at the boundaries, the above formula constitutes a system of simultaneous algebraic equations the solution of which yields the desired values of Ti,j+1 for all i = 2, 3, ..., N − 1 and for all time levels j + 1. Introducing the expressions a i = ci = bi = 2 α∆t ∆x2 α∆t +1 ∆x2 and di = Ti,j 4 the system of equations becomes −aiTi−1,j+1 + bi Ti,j+1 − ci Ti+1,j+1 = di for i = 2, 3, ..., N − 1 for each and every time level j + 1 such that j = 1, 2, ..., M. Recall that the values of Ti,1 are given for all i by the initial condition of the problem . The resulting system is tridiagonal, the associated matrix is diagonally dominant and it is easily and efficiently solved by the Thomas algorithm. The main idea in the Thomas algorithm is to first reduce the original tridiagonal system of equations to a simple upper triangular form and then back substitute to determine the values of all the unknowns. Specifically, new variables βi , Si and Di for i = 1, 2, 3, ..., N are introduced and computed as follows, first β1 = d1 b1 next, recursively for i = 2, 3, ..., N Si = ai bi−1 Di = bi − Si ci−1 βi = di − Si βi−1 Then, back substitution is performed to obtain the solution, first for i = N TN,j+1 = βN DN and finally for i = N − 1, N − 2, ..., 2, 1 as follows Ti,j+1 = (βi − ci Ti+1,j+1 ) Di An advantage of the implicit scheme is that stability is unconditionally stable. However, accuracy considerations preclude the use of large values of ∆t. 3.3 The Semi-implicit Scheme Still another possibility is to use weight averaging for the finite difference approximation of the right hand side term. Specifically, consider the following approximation T (xi + ∆x, tj+1 ) − 2T (xi , tj+1 ) + T (xi − ∆x, tj+1) ∂ 2T ≈θ + 2 ∂x ∆x2 T (xi + ∆x, tj ) − 2T (xi , tj ) + T (xi − ∆x, tj ) = +(1 − θ) ∆x2 Ti+1,j+1 − 2Ti,j+1 + Ti+1,j+1 Ti+1,j − 2Ti,j + Ti+1,j =θ + (1 − θ) ∆x2 ∆x2 5 where 0 ≤ θ ≤ 1. Substituting and rearranging gives a semi-implicit formula for the calculation of Ti,j+1 for all spatial nodes i, i.e. − α∆t θα∆t θα∆t Ti−1,j+1 + (2θ + 1)Ti,j+1 − Ti+1,j+1 = 2 2 ∆x ∆x ∆x2 α∆t = Ti,j + (1 − θ) (Ti+1,j − 2Ti,j + Ti+1,j ) ∆x2 The resulting system is also tridiagonal and it is also easily and efficiently solved by the Thomas algorithm. The scheme is also unconditionally stable. If θ = 21 one obtains the Crank-Nicolson scheme. Note that the above formula reduces to the explicit scheme when θ = 0 and to the implicit scheme when θ = 1. 3.4 More General Boundary Conditions for a Slab Consider the same problem as above except that the slab is assumed insulated at x = 0 and that exchanges heat with an environment at T∞ by means of a heat transfer coefficient h at x = L. The boundary conditions are thus k ∂T =0 ∂x at x = 0, and − ∂T = h(T − T∞ ) ∂x at x = L. Assuming a mesh consisting of nodes x1 = 0, x2, ..., xi−1, xi, xi+1 , ..., xN = L as before, approximations to the boundary conditions are readily obtained by using one-sided differences, i.e. k T2 − T1 =0 ∆x which yields T1 = T2 at x = 0, and −k TN − TN −1 = h(TN − T∞ ) ∆x These can be used with any of the time marching schemes described before by appropriate selection of the time level used to evaluate the approximations. However, these formulae are only first order accurate and very fine meshes may be required to obtain good approximations. The following approaches is recommended for higher accuracy. 6 Introduce auxiliary nodes outside the slab (symmetrically located with respect to x1 and xN , respectively. Therefore, the auxiliary node to the left of node 1 will be labeled node -2 and the one to the right of node N will be node N + 1. These nodes are fictitious (sometimes they are called ghost nodes), they are only a device to obtain higher accuracy and do not appear in the final formulae. Second order accurate central difference formulae are derived by performing differential energy balances to approximate the corresponding boundary condition and the temperature of the ghost nodes is eliminated by combining the result with the finite difference formula corresponding to the boundary node. Next, a central difference formula is used to approximate the derivatives at the boundaries and the values of temperature at the auxiliary nodes are eliminated by combining the result with the difference approximation of the heat equation. A second order accurate finite difference approximation at x = 0 is k T2,j − T−2,j =0 2∆x or T2,j = T−2,j . A similar approximation at x = L yields −k TN +1,j − TN −1,j = h(TN − T∞ ) 2∆x )∆x(TN,j − T∞ ). or TN +1,j = TN −1,j − ( 2h k Combining with the finite difference approximation according to the explicit scheme and rearranging yields T1,j+1 = T1,j + 2α ∆t (T2,j − T1,j ) ∆x2 and TN,j+1 = TN,j + 2α h h ∆t [TN −1,j − TN,j (1 + ∆x ) + T∞ (∆x )] 2 ∆x k k The above expressions provide explicit formulae for the calculation of the temperatures of the boundary nodes. While combining with the finite difference approximation according to the implicit scheme yields (1 + 2α ∆t ∆t )T1,j+1 − (2α 2 )T2,j+1 = T1,j 2 ∆x ∆x and −(2α ∆t h ∆t h ∆t )TN −1,j+1 + (1 + 2α 2 [1 + ∆x ])TN,j+1 = TN,j + T∞(2α 2 )(∆x ) 2 ∆x ∆x k ∆x k The above expressions provide the necessary additional equations for the calculation of the temperatures of the boundary nodes. 7 3.5 Transient Conduction in Cylindrical Coordinates Consider the following transient heat conduction problem in a cylinder (radius = a), ρCp 1 ∂ ∂T ∂T = (rk )+g ∂t r ∂r ∂r Introduce a mesh or nodes ri , i = 1, 2, ..., N with uniform spacing ∆r. An explicit scheme is readily obtained by using a central differences formula for the space derivative and an Eulerforward difference for the time derivative. Hence, writing T (ri, tj ) ≈ Ti,j , the FD analog is Ti,j+1 − Ti,j 1 (kr)i+ 12 ρCp = ∆t ri t Ti+1,j −Ti,j ∆r − (kr)i− 1 2 Ti,j −Ti−1,j ∆r ∆r and for constant properties, the explicit finite difference scheme is given by Ti,j+1 = Ti,j + α∆t (r 1 Ti−1,j − 2ri Ti,j + ri+ 1 Ti+1,j ) 2 ri ∆r2 i− 2 which is again a nice tri-diagonal system of algebraic equations. While handling of Dirichlet boundary conditions is straightforward, care must be used when implementing more general types of conditions. 3.6 More General Boundary Conditions in Cylindrical Coordinates Consider the problem of transient heat conduction in a long, solid cylinder (radius a), subject to axi-symmetrical heat extraction. The corresponding boundary conditions are k ∂T =0 ∂r at r = 0, and − ∂T = h(T − T∞ ) ∂r at r = a. The ghost node approach is easily implemented to obtain a finite difference formula representing the boundary condition at r = a. Using the ghost node approach and central differences at r = a readily yields −k TN +1,j − TN −1,j = h(TN,j − T∞ ) 2∆r 8 Rearranging gives the following expression for the temperature of the ghost node TN +1,j = TN −1,j − 2 hk ∆r(TN,j − T∞ ). Introduction of this result into the finite difference formula for the heat equation applied at the boundary node yields the following explicit formula TN,j+1 = TN,j + 2 ap h α∆t [TN −1,j − TN,j − ( )( )∆r(TN,j − T∞ ))] 2 ∆r a k where am = a − ∆r/2 and ap = a + ∆r/2. Since the finite difference analog of the heat equation is singular at r = 0 the ghost node approach cannot be used in this case. A convenient and also accurate alternative is to consider the plane perpendicular to the cylinder axis and switch to Cartesian coordinates at the origin. The finite difference formula for the node at the origin, i.e. T1,j+1 − T1,j Tnorth,j − 2T1,j + Tsouth,j Teast,j − 2T1,j + Twest,j = α( + ) 2 ∆t ∆r ∆r2 where north, south, east and west are nodal locations a radial distance ∆r from the origin, on the plane normal to the axis of the cylinder. Because of the assumption of axi-symmetry Tnorth,j = Tsouth,j = Teast,j = Twest,j = T2,j . Hence, rearranging T1,j+1 = T1,j + 4 α∆t (T2,j − T1,j ) ∆r2 Implicit formulae can be also readily obtained following the same procedure. 3.7 Multidimensional Systems in Cartesian Coordinates Consider the following transient heat conduction problem with internal heat generation and constant thermal properties in a three dimensional rectangular Cartesian system of coordinates (x, y, z), ρCp ∂T = k∇2T + g ∂t First we create a rectangular mesh of points xi , i = 1, 2, 3..., Nx , yj , j = 1, 2, 3, ..., Ny and zk , k = 1, 2, 3, ..., Nz . The temperature at a specific nodal location (xi , yj , zk ) and time t t, will be denoted by T (xi, yj , zk , t) = Ti,j,k . An explicit finite difference scheme is readily obtained by approximating the space derivatives by second order accurate central differences and the time derivative by a first order accurate Euler-forward difference, i.e. t+∆t t t t t Ti,j,k − Ti,j,k Ti−1,j,k − 2Ti,j,k + Ti+1,j,k ρCp =k + ∆t ∆x2 t t t t t t Ti,j,k−1 − 2Ti,j,k + Ti,j,k+1 Ti,j−1,k − 2Ti,j,k + Ti,j+1,k + k + g(xi , yj , zk , t) k ∆y 2 ∆z 2 9 Note that all quantities on the right hand side are evaluated at time level t and this allows t+∆t direct computation of the value of Ti,j,k for each point (xi, yj , zk ). Once all nodes have been computed this way, the process advanced to the next time level in the same manner. This scheme is easily implemented but it is conditionally stable. The CFL condition is this case, requires that 1 α∆t ≤ 2 δ 2 where ∆x2∆y 2∆z 2 2 δ = ∆x2 ∆y 2 + ∆y 2∆z 2 + ∆z 2∆x2 An unconditionally stable implicit scheme is obtained by approximating the time derivative by a backward difference formula, i.e. t+∆t t+∆t t+∆t t+∆t t Ti−1,j,k − 2Ti,j,k + Ti+1,j,k Ti,j,k − Ti,j,k =k + ρCp ∆t ∆x2 t+∆t t+∆t t+∆t t+∆t t+∆t t+∆t Ti,j−1,k − 2Ti,j,k + Ti,j+1,k Ti,j,k−1 − 2Ti,j,k + Ti,j,k+1 k + k + g(xi , yj , zk , t + ∆t) ∆y 2 ∆z 2 This however requires solving a system of algebraic equations at each time step. Such system can be solved in various different ways but an efficient method consists of a combination of SOR iteration and the tri-diagonal matrix algorithm. This is obtained by visiting lines of nodes in sequence and solving for the temperatures of the nodes on the line, using the most recent values stored in memory for nodes in neighboring lines and over-relaxation. 4 Solution of Transient Heat Conduction Problems by the Finite Volume Method An alternative discretization method is based on the idea of regarding the computation domain as subdivided into a collection of finite volumes. In this view, each finite volume is represented by a line in 1D, an area in 2D and a volume in 3D. Nodes, located inside each finite volume, become the locus of computational values. In rectangular Cartesian coordinates in 2D the simplest finite volumes are rectangles. For each node, the rectangle faces are formed by drawing perpendiculars through the midpoints between contiguous nodes. Discretization equations are obtained by integrating the original partial differential equation over the span of each finite volume. The method is easily extended to nonlinear problems. 4.1 Transient Conduction in a Slab Now we apply the finite volume method to the discretization of a transient problem. Consider the problem of determining T (x, t) for the slab x ∈ [0, L] and t > 0 such that ∂T ∂ ∂T ρCp = (k ) ∂t ∂x ∂x 10 subject to T (x, 0) = T0(x) and T (0, t) = T (L, t) = 0 The above is an approximate representation of the problem of quenching a slab. Subdivide the slab into a collection of N adjacent segments of thickness (finite volumes) and introduce a set of N + 1 nodes (one inside each volume and one on each boundary). The positions of nodes are then labeled from left to right in the form of a sequence x1, x2 , x3, ..., xi, ...xN +1. To discretize time simply select time intervals of duration ∆t at which the calculations will be performed. Uniform time intervals will be assumed here. As before, we focus on the derivation of the discretized heat equation for all the interior volumes. Consider now an arbitrary finite volume of size ∆x. Its representative node is locate at xP and its boundaries are located at xw and xe . . The two contiguous nodes to the left and right of node P are W and E and their locations are xW and xE . Introduce again the various mesh spacings as in the steady case δxe , δxe+ , δxe− , δxw , δxw+ , δxw− and ∆x Integrate now the heat equation over the span of the finite volume (i.e. from x to x + ∆x) and also over the time interval from t to t + ∆t , i.e. Z t t+∆t Z ∂T dxdt = ρCp ∂t xe xw Z t+∆t t Z xe xw ∂ ∂T (k )dxdt = ∂x ∂x Z t+∆t t Z xe xw ∂(k ∂T )dt ∂x The double integration on the left hand side is straightforward and yields Z t+∆t t Z xe xw ρCp ∂T dxdt = ρCp ∆x(TP − TPo ) ∂t where TP is the value of T at P at time t + ∆t and TPo is the value of T at P at time t. On the right hand side, the space integration is performed first and the resulting derivatives are approximated from a piecewise linear profile to yield Z t t+∆t Z xe xw ∂(k ∂T )dt = ∂x ∂T ∂T )|e − (k )|w ]dt = ∂x ∂x t Z t+∆t TP − TW TE − TP − kw ]dt [ke = δxe δxw t Z t+∆t [(k To complete the process an important decision must be made when carrying out the time integration. A very general proposition is to assume that the integrals are given by timeweighed averages as follows Z t t+∆t TP dt = [θTP + (1 − θ)TPo ]∆t 11 Z t+∆t t TE dt = [θTE + (1 − θ)TEo ]∆t and Z t t+∆t o TW dt = [θTW + (1 − θ)TW ]∆t where the weighing factor θ is a pure number with 0 ≤ θ ≤ 1. Introducing the above, the integrated heat equation then finally becomes ∆x ke (TE − TP ) kw (TP − TW ) (TP − TPo ) = θ[ − ]+ ∆t δxe δxw o ke (TEo − TPo ) kw (TPo − TW ) +(1 − θ)[ − ] δxe δxw Rearrangement gives o aP TP = aE [θTE + (1 − θ)TEo ] + aW [θTW + (1 − θ)TW ]+ o +[aP − (1 − θ)aE − (1 − θ)aW ]TPo where aE = ke δxe aW = kw δxw aoP = ρCp ∆x ∆t and aP = θaE + θaW + aoP Note that if finite volumes of uniform size are used with nodes at their midpoints, transport properties are assumed constant and θ = 0 is assumed, the above reduces, after some rearrangement to o TP − TPo k TW − 2TPo + TEo = ∆t ρCp ∆x2 which is identical to the result obtained earlier using the finite difference method with forward differencing in time. 12 4.2 More General Boundary Conditions for a Slab Dirichlet conditions are easy to implement as the value of the temperature at a boundary is specified. For more general boundary conditions, such as specified flux (Newmann) and relationships between the flux and the boundary temperature the following approach is used. While for interior finite volumes, their representative nodes are located in the interior of the volume, the boundary nodes are envisioned as located on the outer edge of the boundary where A is the (unit) area volume. Hence the volume of the resulting finite volume is A ∆x 2 normal to the direction of heat flow (x). Next, one performs differential energy balances on the boundary volumes. Specifically, with the above boundary conditions, for x = 0 Ein = Eout + Eacc where Ein , Eout and Eacc are, respectively, energy into the volume (at x = 0), energy out (at x = ∆x ) and energy accumulated inside the element. Introducing the expressions for these 2 energies in terms of the temperature yields the following explicit formula 0 = −k ∆x T2,j − T1,j A∆t + ρCp (T1,j+1 − T1,j )A ∆x 2 Rearrangement gives T1,j+1 = T1,j + 2α ∆t (T2,j − T1,j ) ∆x2 Now for x = L Ein = Eout + Eacc ), energy where Ein , Eout and Eacc are, respectively, energy into the volume (at x = L − ∆x 2 out (at x = L) and energy accumulated inside the element. Introducing the expressions for these energies in terms of the temperature yields the following explicit formula −k ∆x TN,j − TN −1,j A∆t = h(TN,j − T∞ )A∆tρCp(T1,j+1 − T1,j )A ∆x 2 Rearrangement gives TN,j+1 = TN,j + 2α ∆t h h [TN −1,j − TN,j (1 + ∆x ) + T∞ (∆x )] 2 ∆x k k These formulae are identical to that obtained using the ghost node approach. Corresponding expressions for an implicit scheme are also readily obtained. 13 4.3 More General Boundary Conditions for the Cylinder In the FVM, the condition −k ∂T =0 ∂r at the center of a solid cylinder is represented by the energy balance Ein = Eout + Eacc = 0 = −k T2,j − T1,j ∆A∆t + ρCp (T1,j+1 − T1,j )∆V ∆r where ∆A = π∆r and ∆V = π∆r2/4. Rearranging yields T1,j+1 = T1,j + 4 α∆t (T2,j − T1,j ) ∆r2 which is identical to the expression obtained in the FDM using the ghost node approach. Now, the boundary condition at the surface of the cylinder r = a −k ∂T = h(T − T∞ ) ∂r is represented by the energy balance Ein = Eout + Eacc as follows −k TN,j − TN −1,j 2πam ∆t = h(Tn,j − T∞ )2πa∆t + ρCp (TN,j+1 − TN,j )π(a2 − a2m) ∆r where am = a − ∆r/2. Rearranging yields TN,j+1 = TN,j + 2 α∆t am h [( )TN −1,j − TN,j − ( )∆r(TN,j − T∞ )] 2 ∆r a k which is almost identical to the formula obtained in the FDM using the ghost node approach. 4.4 Transient Conduction in Multidimensional Systems Consider the problem of estimating the temperature T (x, y, z, t) in a three-dimensional brick x ∈ [0, X], y ∈ [0, Y ], z ∈ [0, Z] undergoing transient heat conduction with constant internal heat generation. The heat equation for this case is ρCp ∂ ∂T ∂ ∂T ∂ ∂T ∂T = (k ) + (k )+ (k ) + g ∂t ∂x ∂x ∂y ∂y ∂z ∂z subject to specified conditions at the boundaries of the domain. The finite volume formulation regards the brick as composed of a set of adjoining volumes each containing a node. The dimensions of the typical volume are ∆x × ∆y × ∆z and the 14 typical node P has six neighbors E, W, N, S, T and B. Proceeding exactly as above, the finite volume method produces the following result (with θ = 1) aP TP = aE TE + aW TW + aN TN + aS TS + aT TT + aB TB + b where aE = ke ∆y∆z δxe aW = kw ∆y∆z δxw aN = kn ∆z∆x δyn aS = kw ∆z∆x δys aT = kt ∆x∆y δzt aB = kb ∆x∆y δzb aoP = ρCp ∆x∆y∆z ∆t b = g∆x∆y∆z + aoP TPo and aP = aE + aW + aN + aS + aT + aB + aoP Note that all the above expressions can all be generically written as ap TP = X anb Tnb + b where the summation contains just TE and TW in the case of uni-dimensional systems, contains TE , TW , TN and TS in the case of 2D systems and all TE , TW , TN , TS , TT and TB in the case of three dimensional systems. 15 The discrete equation derived using the FV method can be rearranged for θ = 1 to produce a very appealing and physically meaningful expression. Consider two dimensional systems. The generic discrete form of the conservation equation is λP (φP − φoP ) ∆V = Jw Aw − Je Ae + Js As − Jn An + g∆V ∆t where the dependent variable φi is the temperature T , for heat transfer and the concentration c, for mass transfer. Further, the Ji ’s are the fluxes of the transported quantity and the Ai ’s are the cross-sectional areas of the finite volume faces through which the transported quantity enters/leaves the finite volume. Therefore the products Ji Ai are the rates of transport of energy or mass through the various control volume faces. Moreover, λ = ρCp for heat transfer and = 1 for mass transfer. The transport rates are given as Je Ae = [( Jw Aw = [( δxe− δxe+ −1 )+( )] (φP − φE )Ae ΓP ΓE δxw+ −1 δxw− )+( )] (φW − φP )Aw ΓW ΓP Jn An = [( δyn+ −1 δyn− )+( )] (φP − φN )An ΓP ΓN Js As = [( δys− δys+ −1 )+( )] (φS − φP ) ΓS ΓP where Γi = ki for heat transfer and = D for mass transfer. Many special forms can be obtained by simplification of the above. For instance, for a rectangle with constant thermal properties, without internal heat generation at steady state and using ∆x = ∆y one obtains 1 TP = [TE + TW + TN + TS ] 4 which is identical to the expression obtained before using the method of finite differences. 5 Solution of Transient Heat Conduction Problems by the Finite Element Method To describe the finite element methodology fro transient problems it is convenient to review the steady state problem first. 16 5.1 Steady State Conduction Recall the case of one-dimensional steady heat conduction with internal heat generation inside a slab, i.e. d dT (1) − (k ) = g dx dx in 0 ≤ x ≤ 1 and subject to the boundary conditions T (0) = T (1) = 0. The Galerkin finite element method requires consideration of the variational statement of the problem. This is obtained by taking scalar product of the (approximated) energy equation with a smooth function v(x), i.e. Z 1 0 − d dT (k )vdx = dx dx Z 1 k 0 dT dv dx = dx dx Z 1 0 gvdx = (2) where the term on the left hand side has been integrated by parts. In the Galerkin formulation of the finite element method, the domain 0 ≤ x ≤ 1 is first subdivided into a set of N intervals (finite elements) of size ∆x connected at their ends (nodes). For each node i, introduce the following global shape function of position φi (x) = 0 x−xi−1 ∆x xi+1 −x ∆x 0 0 ≤ x ≤ xi−1 xi−1 ≤ x ≤ xi xi ≤ x ≤ xi+1 xi+1 ≤ x ≤ 1 (3) Since the global functions constitute an orthogonal set, they serve as a basis from which one can express the desired approximation as T (x) ≈ N +1 X Tj φj (x) (4) j=1 where the coefficients Tj are the simply the values of T at the nodes j = 2, ..., N. Note that the equations for nodes 1 and N + 1 are not needed since the values at those locations are specified. Furthermore the function v is selected to be a simple linear combination of the shape functions, i.e. v(x) = N +1 X φj (x) (5) j=1 Introducing the above into the variational statement of the problem finally yields k (−Ti−1 + 2Ti − Ti+1 ) = g (∆x)2 (6) which is simply a tridiagonal system of linear algebraic equations for i = 2, 3, ..., N. Note in this case, this is exactly the same result obtained using the finite difference or the finite volume methods. 17 Using matrix notation, the above result is written as KT = f (7) where K is the global conductance matrix (analogous to the global stiffness matrix in structural mechanics finite element analysis) given as 1 K11 K1 21 K= 0 0 0 0 0 0 . 1 2 2 (K22 + K11) K12 0 . 2 2 3 3 K21 (K22 + K11 ) K12 0 3 3 4 4 0 K21 (K22 + K11 ) K12 . . . . . . . 0 . (8) i i i i The entries K11 , K12 , K21 , and K22 are the components of the element conductance matrix for the i-th element, i.e. Ki = i K11 i K21 i K12 i K22 = k (∆x)2 1 −1 −1 1 (9) Further, T is the vector of nodal temperatures, T= T2, T2, .., TN T (10) and f is the forcing vector. f= 5.2 g, g, ..., g T (11) Transient Conduction in a Slab Now, let us consider how to modify the above formulation in order to be able to apply the finite element method to the solution of transient problems. As a specific illustration consider the problem of one-dimensional, transient heat conduction without internal heat generation through a plane wall of thickness L = 1 with constant thermal properties and internal heat generation. The heat equation is ρCp ∂T ∂ 2T =k 2 +g ∂t ∂x (12) The problem is to be solved subject to the boundary conditions T (0, t) = T (1, t) = 0 (13) T (x, 0) = T0 (14) and the initial condition 18 As before, the Galerkin finite element method subdivides the domain 0 ≤ x ≤ 1 into a set of N intervals (finite elements) of representative size h = ∆x connected at their ends (nodes). For each node i, the global shape function is φi (x) = 0 x−xi−1 ∆x xi+1 −x ∆x 0 0 ≤ x ≤ xi−1 xi−1 ≤ x ≤ xi xi ≤ x ≤ xi+1 xi+1 ≤ x ≤ 1 (15) The set of φi ’s is used to construct the approximation to Th (x, t) as before Th (x, t) = n X Tj (t)φj (x) (16) j=1 where the coefficients Tj are the (approximate) values of T at the nodes j = 2, ..., N. Note that the Galerkin formulation separates the dependency of the problem on t from that of x through the use of the shape functions. Note also that the equations for nodes 1 and N + 1 are also not needed here as the values of temperature at those locations are given. Moreover, v(x) = N +1 X φj (x) (17) j=1 The Galerkin method is based in the weighed minimization of the residual R = ρCp Tt − kTxx − g by constructing the scalar product (R, φi ) of the (approximated) energy equation with the shape functions, i.e. (R, φi ) = Z 1 Z 0 0 t [ρCp ∂ 2T ∂T − k 2 − g]φi (x)dxdt = 0 ∂t ∂x (18) Note that the scalar product now involves integration over time as well as over space. The same value of the integral is obtained if one first integrates over the interval [xi−1, xi+1 ], for all i and then collects all the resulting integrals, i.e. n Z X i=1 xi+1 xi−1 Z 0 t [ρCp ∂T ∂ 2T − k 2 − g]φi (x)dxdt = 0 ∂t ∂x (19) Using the selected expressions for Th and v, this reduces to n Z X i=1 xi+1 xi−1 Z 0 t [ρCp d2 φj (x) dTj (t) φj (x)φi (x) − Tj (t)k )φi (x) − gφi (x)]dxdt = 0 dt dx2 (20) Performing the indicated integrals this can finally be written using matrix notation as a set of differential-algebraic equations for the unknown Ti ’s, i.e. C dT + KT = f dt 19 (21) where C is the global capacitance matrix given by C = Cij = Z 1 ρCpφj φi dx 0 (22) Moreover, K, T and f are, respectively, the global conductance matrix, the vector of nodal temperatures and the forcing vector and they all have the same form obtained for the steady state case. In order to solve the resulting system of differential-algebraic equations, consider the following generic implicit approximation with parameter θ such that 0 ≤ θ ≤ 1, C( Tt+∆t − Tt ) + K(θTt+∆t + (1 − θ)Tt) = f ∆t (23) For any value of θ a system of algebraic equations has to be solved. Note that θ = 0 corresponds to an explicit method, θ = 1 to a fully implicit method and θ = 0.5 corresponds to a semi-implicit (Crank-Nicolson-type) method. As in the steady case, introduction of the boundary conditions requires modification of the finite element equations for the boundary nodes. 5.3 Multidimensional Systems Again, it is useful to reconsider the steady state case first. 5.4 Steady State Conduction Consider a three dimensional body occupying the volume Ω, inside which heat is generated at a rate g and whose outer surface Γ is subjected to homogeneous Dirichlet conditions at its boundary. The heat equation is −∇ · (k∇T ) = g on Ω and the boundary condition is T = 0 on Γ. The variational statement of the above problem involves the multiplication of the governing equation by the smooth function of the spatial coordinates v(x), then integrating over the domain, i.e. Z Ω (−k∇2T )vdΩ = Z Ω gvdΩ = Z Ω k∇T ∇vdΩ = Z Ω gvdΩ In the Galerkin formulation of the finite element method the domain Ω is first subdivided into a number of regions with simple polygonal shape (representative element size h) and the desired approximation to the temperature Th (x) is expressed as a linear combination of the nodal values Ti ; i = 1, 2, ..., N, by means of global finite element basis functions, i.e. Th (x) = N X φi (x)Ti = φT i=1 20 where N is the number of nodes in the finite element mesh and where φ and and T are, respectively, the global basis function matrix and the vector of nodal temperatures. Furthermore, the function v is selected to be equal the linear combination of the global basis functions, i.e. v(x) = N X φ(x) i=1 Substituting the above into the variational formulation yields the finite element equation KT = f where the stiffness matrix is given by K= Z Ω BT DBdΩ where ∂φ1 ∂x ∂φ1 ∂y ∂φ1 ∂z B= ∂φ2 ∂x ∂φ2 ∂y ∂φ2 ∂z ... ... ... ∂φN ∂x ∂φN ∂y ∂φN ∂z and k 0 0 D= 0 k 0 0 0 k and the force vector is f= Z Ω gφT dΩ In order to assure convergence of the finite element model as the element size decreases the basis functions must satisfy the standard requirements of compatibility and completeness, i.e. the basis functions selected must provide for continuity of the temperature at the interface between any two elements as well as for the continuity of temperature and heat flux inside each element. Standard polynomials of order n satisfy the requirement. 5.5 Transient Conduction Consider now instead the transient problem in Ω, consisting of determining the function T (x, t) that satisfies ρCp ∂T − ∇(k∇T ) = g ∂t 21 subject to homogeneous Dirichlet conditions at the boundary (i.e. T = 0 on Γ. Proceeding as in the steady state case, multiply the above by a suitably smooth function v(x) and integrate over Ω to obtain ∂T vdΩ − (k∇2T )vdΩ = gvdΩ = ∂t Ω Ω Ω Z Z Z ∂T vdΩ + k∇T ∇vdΩ = gvdΩ = ρCp ∂t Ω Ω Ω Z ρCp Z Z By introducing the representations Th (x) = N X φi (x)Ti = φT i=1 and v(x) = N X φ(x) i=1 One obtains the differential-algebraic system C dT + KT = f dt (24) where C is the global capacitance matrix given by C = Cij = Z Ω ρCpφj φidΩ (25) and K, T and f are, respectively, the global conductance matrix, the vector of nodal temperatures and the forcing vector and they all have the same form obtained for the steady state case. As in the one dimensional setting, a generic implicit solution scheme for the resulting system of differential-algebraic equations involves the parameter θ such that 0 ≤ θ ≤ 1, Tt+∆t − Tt ) + K(θTt+∆t + (1 − θ)Tt) = f C( ∆t 22 (26)
© Copyright 2025 Paperzz