You are on page 1of 5

Lecture 14: The Art of Discretization

KXGM 6104 Computational Mathematics
14.1 Explicit and Implicit schemes
i)

Explicit and implicit methods are approaches used in numerical analysis for obtaining numerical
solutions of time-dependent ordinary and partial differential equations, as is required in computer
simulations of physical processes.

ii)

Explicit methods calculate the state of a system at a later time from the state of the system at the
current time, while implicit methods find a solution by solving an equation involving both the current
state of the system and the later one.

iii)

It is clear that implicit methods require an extra computation, and they can be much harder to
implement. Implicit methods are used because many problems arising in practice are stiff, for which
the use of an explicit method requires impractically small time steps Δt to keep the error in the result
bounded (see numerical stability).

iv)

For such problems, to achieve given accuracy, it takes much less computational time to use an implicit
method with larger time steps. That said, whether one should use an explicit or implicit method
depends upon the problem to be solved.

v)

Equation of motion in fluid mechanics is frequently reduced to parabolic formulation. Boundary layer
equations and Parabolised Navier-Stoke (PNS) equations are examples of such formulations. In
addition, the unsteady heat conduction equation is also parabolic.

14.2 Explicit Finite Difference
Unsteady heat conduction equation,
T
 2T
 2
t
x
Descretize by using First Order Forward for time and Second Order Difference for space,
T Ti n 1  Ti n

t
t
n
2
 T Ti 1  2Ti n  Ti n1

x 2
(x)2
The equation can be approximated as follows,
Ti n1  Ti n
Ti n1  2Ti n  Ti n1

t
(x)2
In this equation, only uin1 is unknown and therefore it can be computed from the following,

The computed values at n+1 depend on the past history. (x) 2 . an initial condition and two boundary conditions must be specified.Ti n1  Ti n   (t ) (x) 2 (Ti n1  2Ti n  Ti n1 ) This method of solving is called explicit method. 2 . To start the solution. It can be proven that the solution is stable for ii) The Richardson method (CTCS) uin1  uin1   (uin1  2uin  uin1 ) 2t (x) 2 t (x) 2  1 .3 Discretization of Explicit Finite Difference i) The Forward Time Central Space (FTCS) method uin1  uin   (uin1  2uin  uin1 ) 2 t (x) t n u in1  u in  (ui 1  2uin  u in1 ) 2 (x)   It is of the order (t ). Note that the value of the dependent variable at time level n is known from the previous solution or given as initial data. Other example of heat transfer equations (one dimensional): i) ii) iii) iv) Pure steady conduction:  2T 0 2 x Unsteady conduction: T  2T  2 t x Unsteady conduction/convection: T  2T   2  h '(T  T ) t x Unsteady conduction/convection/radiation : T  2T   2  h '(T  T )   '(T4  T 4 ) t x 14.

.4 Courant-Friedrichs and Lewy (CFL) One restriction in solving the PDE using explicit method is the condition that the time step has to be smaller than the time it takes information to propagate across one step in space.5 Implicit Finite Difference In the explicit formulation. It turns out that the scheme is unconditionally unstable and therefore has no practical value. (x) 2 . Therefore. a) The accuracy of the whole solution is affected by the accuracy of the starter solution. Of course.uin 1  uin 1   2t n (ui 1  2uin  uin1 ) 2 (x)  It is of the order (t ) 2 . uin1  uin1  2t n (ui 1  uin1  uin1  uin1 ) (x) 2 Rearranging. only one set of data is required to generate the solution of at n . 14. Use a forward difference approximation for the time derivative and a second order central difference approximation for the spatial derivative. computer storage requirements will increase. 2 disadvantages of the method.  2t  n1  2t  n1 2t n n 1  (x) 2 ui  1  (x) 2 ui  (x) 2 (ui 1  ui 1 )       This method is of the order of (t ) 2 . This condition is called CFL. iii) The DuFort-Frankel method uin1  uin1 uin1  uin1  n  ( u  2  uin1 ) i 1 2t 2 (x) 2 For which. a one-step method can be used as a starter. the boundary condition lags behind computation by one step. The values of ui at time levels n and n  1 are required to start the computation. 14. Interestingly enough. Applying to the diffusion problem in one-dimension. (x) 2 . or from a practical point of view. 2t 1 (x) 2 The time to propagate through a distance x is proportional to (x)2 . it is unconditionally stable. Any explicit FD scheme that violates the CFL condition is necessarily unstable. With the values of ui at time levels n and n  1 specified. b) Since the solution at the unknown station requires data from 2 previous stations. either 2 sets of data must be specified. for one-step method starter solution. DuFort Frankel method can thus be used. but satisfying the CFL condition does not necessarily guarantee stability.

the coefficient matrix is diagonal. Rearranging the equation again. When these equations are put in a matrix form. 1 2 3 4 5  u1n1  1  2 u2n1  u3n1  u2n  u2n1  1  2 u3n1  u4n1  u3n  u3n1  1  2 u4n1  u5n1  u4n The system is a set of linear system of equations which can be solved simultaneously. there are 3 unknowns against 1 known value. The computation of the unknowns would require a set of coupled finite difference equations. resulting in a set of algebraic equations. t n1  t  n1 t n1 u  1  2 u  u  uin 2 i 1 2  i 1 2 i 1 (x) (x)  (x)  Let   t and rearranging.  0 u2  u2n  u1n1   1  2        u3    u3n    1  2  n n 1   0       1  2 u4  u4  u5   . which are found by writing FDE for all the grid points.uin1  uin u n1  2uin1  uin11   i1 t (x) 2 In the above equation. 1  2 u2n1  u3n1  u2n  u1n1  u2n1  1  2 u3n1  u4n1  u3n  u3n1  1  2 u4n1  u4nu5n1 Forming a matrix. (x) 2  uin11  1  2 uin11  uin11  uin Say there are 5 nodes on the rod where node 1 and 5 are the boundaries and abiding the prescribed boundary condition. This finite difference equation is written for all grid points at the advanced time level. expanding equation (3) at each of the internal nodes. u1 and u5 are known values at the boundaries.

It can be widely found in the internet.The matrix can be solved by using many methods that solve for simultaneous equations. Using the explicit method. The best option is to adopt tridag subroutine that can be found in Numerical Recipes. 2 u uin1  uin  t  t  2   2  It is of the order (t ) 2 . ui 2 n 1 uin1  ui 2 u n1  2uin1  uin11   i1 t (x) 2 2 Addition of the 2 equations will result in equation (5) above.6 Discretization of Implicit Finite Difference i) The Laasonen method The simple formulation of implicit as derived before is known as the Laasonen method. uin1  uin u n1  2uin1  uin11   i 1 t (x) 2 ii) The Crank-Nicolson method This formulation averages the diffusion term using central differencing at time levels n and n  1 .   . In terms of the grid points. The method can be thought of as the addition of the two time step computations. while at the right hand side. is the average of the diffusion term t at the same point. The uin1  uin 1  u n1  2uin1uin11 uin1  2uin  uin1     i1   t 2 (x) 2 (x) 2  Note that on the left side of the equation is a central difference of step t . This method is unconditionally stable and is of order of (t ) 2 . n 1  uin u n  2uin  uin1   i1 t (x) 2 2 While using the implicit method. the left side can be interpreted as the central difference u representation of at the point considered. 14. second order scheme. discretized equation is as follows. Applying the formulation to all grid points as in Section 2 would lead to a set of linear algebraic equations. (x) 2 .