© AUG 2019 | IRE Journals | Volume 3 Issue 2 | ISSN: 2456-8880
Finite Difference Methods for Two Dimensional Heat Equation KHAING KHAING SOE WAI1, SAN SAN TINT2 1, 2 Department of Engineering Mathematics, Technological University (Myitkyina), Myitkyina, Myanmar Abstract- In this paper, we first consider the initial boundary value problem for the heat equation. And, the finite difference methods for the heat equation in one space dimension, its consistency and stability are studied. Then, the two dimensional heat equation is solved by using finite difference methods.
u (t, x) = 0,
(t, x) (0, T) , T
Where any inhomogeneous boundary conditions have been eliminated. If we look for classical solutions of the IBVP, whose derivatives are continuous on QT , the following compatibility condition must also be satisfied
Indexed Terms- Consistency, stability, difference methods and heat Equation. I.
finite
INTRODUCTION
We consider the heat equation
u t div (a(x) u) 0, t R , x , Where u denotes the temperature and a defines the heat conductivity. The generic domain for the heat equation is the space-time cylinder QT (0,T) . In order to obtain a well-posed problem, we must prescribe spatial boundary condition
u(t, x) g(t, x) x , t (0, T) and an initial condition
u(0, x) u 0 (x), x .
II.
FINITE DIFFERENCE METHODS IN ONE SPACE DIMENSION
First, we consider the initial boundary value problem in one space dimension u t – u xx f , (t, x) (0, T) × (0, 1) u(0, x) u 0 (x) , x (0, 1) (2) u(t, 0) u1 (t) , t (0, T) u(t, 1) u 2 (t), t (0, T). We discretise the equation equidistantly with respect to space and time xi = ih, i = 0, …, N tk = k, k = 0, …, M. k
We use u i to denote the approximation for u(t k , xi)
The equation combined with the initial datum forms an initial boundary value problem. Note that, the operator Lu = – div (a(x) u) is elliptic, and that in general, the equation with an elliptic differential operator L u t Lu 0 Defines a parabolic equation. We consider the initial boundary value problem (IBVP) (1) u t Lu = f (t, x), (t, x)QT u (0, x) = u0(x), x
IRE 1701491
u 0 (x) 0 x .
and write
fik f (t k , xi ).
We require approximations to the first order time derivative and the second order spatial derivative. We use the second difference operator for the spatial variables 1 D D u ik 2 (u ik1 2u ik u ik1 ). h If we choose a 2-point discretisation for the time derivative, we obtain a 6-point scheme, which in general has the form
u ik 1 u ik D D (u ik 1 (1 )u ik ) fik With the additional conditions
ICONIC RESEARCH AND ENGINEERING JOURNALS
134
© AUG 2019 | IRE Journals | Volume 3 Issue 2 | ISSN: 2456-8880 u i0 = u 0 (x i ), i 0,..., N
+ut(t, 3 4 u tt (t, x) u ttt (t, x) u tttt (t, x) 2! 3! 4!
u 0k = u1 (t k ), k 0,..., M u kN
k
= u 2 (t ).
The parameter [0, 1] can be chosen freely. By defining
, h2
We obtain the following special cases: 1. Explicit method ( = 0)
uik 1 (1 2)uik (uik1 uik1 ) fik 2.
x)
2
Implicit method ( = 1)
(1 2)uik 1 (uik11 uik11 ) uik fik 1
3. Crank-Nicolson method ( = ) 2
( 1) u ik 1 (u ik11 u ik11 ) 2 (1 ) u ik (u ik1 u ik1 ) f (t k , x i ). 2 2 For the first method we can proceed iteratively, whereas the last two methods require the solution of a linear system. The coefficient matrices of the systems are always positive definite. Since the matrices are tridiagonal and we can solve such systems with complexity O (N), the complexity is not much greater than that of explicit methods. Later, we will see that the heat equation is stiff, and that therefore implicit methods are advantageous. The methods differ especially in their stability and consistency properties. 2.1 Theorem The consistency error satisfies 1. O (h2 + ) for arbitrary and
fik = f(tk, xi)
where u C4,2 (QT ). 2. O (h2 + 2) for =
1 k and fi = f (t k , x i ) 2 2
= ut + O() u(t, x h) u(t, x) hu x (t, x)
h2 u xx (t, x) 2!
h3 h4 u xxx (t, x) u xxxx (t, x), 3! 4!
u(t,
–
x
u(t, x) hu x (t, x)
2
h)
3
h h u xx (t, x) u xxx (t, x) 2! 3!
h4 u xxxx (t, x), 4! u(t, x h) 2u(t, x) u(t, x h) h2
2h 2 u xxxx (t, x), 4! u(t, x h) 2u(t, x) u(t, x h) = h2
u xx (t, x)
Moreover, we have
u xx (t, x) O(h 2 ) .
fik f (t k , x i ).
Therefore, consistency error satisfies e =
(u t u xx f ) O() O(h 2 ), e = O() O(h 2 ) O( h 2 ). For the second part, we use the Taylor expansions u(t , x) u(t, x) u t (t, x) 2! u tt (t, x) 2 3 u ttt (t, x) u tttt (t, x), 3! 4!
u(t , x) u(t, x) u t u tt O( 2 ) 2 and u(t, x h) 2u(t, x) u(t, x h) h2
where u C4,3 (Q T ).
Proof For the first part, we use the Taylor expansions u(t + , x) = u(t, x)
IRE 1701491
1 u(t , x) u(t, x) u t (t, x) 2 u tt (t, x) 2 3 u ttt (t, x) u tttt (t, x) 3! 4!
u xx (t, x)
2h 2 u xxxx (t, x), 4!
ICONIC RESEARCH AND ENGINEERING JOURNALS
135
© AUG 2019 | IRE Journals | Volume 3 Issue 2 | ISSN: 2456-8880 u(t , x h) 2u(t , x) u(t , x h) h2 u xx (t, x)
w k 1 w k D D vi const . k 1 k (w (1 )w ) vi
2h 2 u xxxx (t, x) 4!
Thus the
2 u xxt (t, x) u xxtt (t, x), 2!
v i solves the discrete eigenvalue problem D D vi vi 0
v0 v N 0 and moreover, we have
1 u(t , x h) 2u(t , x) u(t , x h) u(t, x h) 2u(t, x) u(t, x h) w k 1 w k = k (w k 1 (1 )w k ) 2 h2 h2
w k 1 k w k 1
1 h2 2 2u xx (t, x) u xxt (t, x) u xxxx (t, x) u xxtt (t, x) , 2 6 2!
w k 1 = 1 1 k w k
1 u(t , x h) 2u(t , x) u(t , x h) u(t, x h) 2u(t, x) u(t, x h) 2 h2 h2
1 2u xx (t, x) u xxt (t, x) O( 2 h 2 ) . 2 Moreover, we have f t , x f (t, x) f t (t, x) O( 2 ). 2 2 Therefore, consistency error satisfies 1 e (u t u xx f ) (u tt u xxt f t ) O( 2 h 2 ) 2 2 2 e O(h ).
w k k (1 )w k
=
1 k
w k 1 = qkwk, where qk= 1 (1 ) k . 1 k
We now consider the discretization in L2-norm of uk= w k v ,
i
i
2
then we have u k = h (w k )2 v2 i i
≤ hq (w k 1 )2 v2 i k 1 i
≤ hq q (w k 2 )2 v2 i k 1 k 2 i
Definition 2.2. Let f = 0. The method is called stable
. , if
with respect to the norm
i
=qk–1 ... q0 u 0 2 .
u(t k ) C u(0) .
Now define
. .
L2
the L2-norm. We
want to investigate stability in this norm using Von Neumann's approach, which is based on Fourier analysis. The discrimination of the homogeneous differential equation with homogeneous boundary conditions is then given by u ik 1 u ik
u i0 = u 0 (x i ),
≤ q ...q h (w 0 )2 v2 k 1 0 i
= D D (u ik 1 (1 )u ik )
For the right-hand side to be bounded as k ∞, we require that q k 1 For all eigenvalues
Then, we have stability in the discrete L -norm. In particular, we have Explicit Method ( = 0): qk = 1 – k, Implicit Method ( = 0) : qk = Crank-Nicolson Method
i 0,..., N
u 0k = u kN 0, k 0,..., M. Analogously to the continuous case, a solution can be found by using a separation of variables method as u ik vi w k . Substituting in the equation, we have
w k 1 w k vi D D vi (w k 1 (1 )w k ) Respectively,
IRE 1701491
k .
2
1 , 1 k
1 1 k 1 ( ) :q k 2 . 1 2 1 k 2
2.3 THE METHOD OF VERTICAL LINES In the following, let
n
and we consider the
initial boundary value problem, ut + Lu = f(t, x), (t, x) QT u(0, x) = u0 (x),
x
ICONIC RESEARCH AND ENGINEERING JOURNALS
136
© AUG 2019 | IRE Journals | Volume 3 Issue 2 | ISSN: 2456-8880 u(t, x) = 0, (t, x) (0, T) T
Where the differential operator L is uniformly elliptic and f L2 (Q T ). The idea of the method of lines is to consider the spatial and the time discretisation subsequently, i.e., one after another. In the method of vertical lines the spatial coordinates are discretised first. In a system of ordinary differential equations, we can discretise using known methods. 2. 4 Example We consider the initial boundary value problem for one dimensional heat equation,
u t u xx 0,
k 1 k I h u ij I h u ij . 2 2
u(t, 0) u(t,1) 0
u(0, x) u 0 (x). Then,
d u i = u i1 2u i u i 1 i 1,..., N 1 dt h2 u i (0) = u 0 (x i ), respectively 2 1 0 1 2 1 1 h2 0 O O M 1 0 L 0
u1 d M = dt u N 1
If we now apply the trapezium rule for the time discretisation, we obtain the two-dimensional version of the Crank-Nicolson method u ijk 1 u ijk ( h u ijk h u ijk 1 ). 2 Since this method is implicit, we must again solve a linear system of equations, the structure of which is exactly the same as in the stationary case. Due to the fact that the system has a sparse, very highdimensional matrix, we should solve using an iterative method. This is all the more relevant, since we must solve such a system on every time level, i.e., we must be prepared to solve the system several hundred times. Now we write the above formula as
0 M u 1 M , O 0 u N 1 2 1 1 2 L
ui (0) = u 0 (x i ). In order to apply this approach as easily as possible to multi-dimensional problems.
Although the matrix has the same structure with respect to the zero elements, we must still take care when scaling. We define A I h , 2 And calculates its eigenvalues p1 ,p2 1 2 ((cos(p1h) 1) (cos(p 2 h) 1)), h Where p1, p2 denote the eigenvalues of
h . the
largest eigenvalue has the order of magnitude 1 O( ), whereas the smallest has 1+ O (). That h2
means, the condition number of the matrix is 1 + as a comparison: the discrete Laplace operator O( ). h2
has the condition O( 1 ) . Therefore we can expect 2 h
III.
FINITE DIFFERENCE METHODS IN TWO SPACE DIMENSIONS
Now we consider the heat equation in two spatial dimensions
u t u xx u yy With initial condition u(x, y, 0) = u0(x, y) and boundary conditions on. We can discretise the right hand side of this equation by using the five-point difference stencil on the Laplace operator,
h u(x i , yi )
u i 1, j u i, j1 4u i, j u i 1, j u i, j1
IRE 1701491
h2
.
iterative methods to converge much quicker by the smaller condition number. And apart from that, we have good initial value for the iteration, i.e., the solution from the previous time level. In order to obtain better starting approximations, we can naturally extrapolate forwards and use, 0
k 1
For example, u ij 2u ij u ij . k
Or, we can perform an Euler step
0 uij I h u ijk . 2 An alternative to solving a fully coupled linear system is to replace the time step by a sequence of
ICONIC RESEARCH AND ENGINEERING JOURNALS
137
© AUG 2019 | IRE Journals | Volume 3 Issue 2 | ISSN: 2456-8880 time steps, calculating only one spatial dimension in each one. Then, we only have to solve a tridiagonal system. The Locally One-Dimensional (LOD) method can be expressed as u *ij = u ijk (D 2x u ijk D 2x u *ij ) 2 u ijk 1 = u *ij (D 2y u *ij D 2y u ijk 1 ) 2 or, in matrix form 2 * 2 k = I Dx u I Dx u 2 2 2 k 1 = 2 * . I Dy u I Dy u 2 2 Here we initially solve with the CrankNicolson method in the x direction and obtain u*, which enables us to solve with this result in the y direction. First, we only consider the diffusion in one coordinate direction and then in the other. If the time step is very small, we can expect (and sometimes even prove), that the solution shows the same behaviour. A modification of the LOD method results from a further splitting method, for which we must also only solve a tridiagonal system, since in every step, we only have to solve in one direction. However, if we exchange the directions, using the so called Alternative Direction Implicit (ADI) method, we have
we study two dimensional heat equation by finite difference methods. REFERENCES [1] Adams, R.A., "Sobolev Spaces", Academic Press, New York, 1975. [2] Evans, L.C., "Partial Differential Equations", American Mathematical Society, Providence, New York, 1998. [3] Griffits, D.F., "An Introduction to Matlab Version 2.2", University of Dundee, Ireland, 1996. [4] Mathews, J.H., "Numerical Methods for Mathematics", Science and Engineering, PrenticeHall International Education, 1992.. [5] Smith, G.D., "Numerical Solution of Partial Differential Equations, Finite Difference Methods", 3rd Ed., Clarendon Press, Oxford, 1985. [6] Süli, E., "Finite Element Methods for Partial Differential Equations", 2002. [7] Thomas, J.W., "Numerical Partial Differential Equations, Conservation Laws and Elliptic Equations", Springer-Verlag, New York, 1998.
u *ij = u ijk (D 2y u ijk D 2x u *ij ) 2
(D 2x u *ij D 2y u ijk 1 ) 2 or in matrix form 2 * = 2 k I Dx u I Dy u 2 2 2 k 1 = 2 * . I D u I D u
u
k 1 * ij = u ij
2
y
2
x
In both steps we have the diffusion in both directions where one component is dealt with explicitly and the other implicitly. IV.
CONCLUSION
This paper has presented the heat equation in one space dimension and two space dimensions. Next, its consistency is calculated by using Taylor's expansions. Then, we investigate their stability properties for one dimensional heat equation. Next,
IRE 1701491
ICONIC RESEARCH AND ENGINEERING JOURNALS
138