Numerical diffusion and oscillatory behavior characteristics are averted applying numerical solutions of advection-diffusion equation are themselves immensely sophisticated. In this paper, two numerical methods have been used to solve the advection diffusion equation. We use an explicit finite difference scheme for the advection diffusion equation and semi-discretization on the spatial variable for advection-diffusion equation yields a system of ordinary differential equations solved by Euler’s method. Numerical assessment has been executed with specified initial and boundary conditions, for which the exact solution is known. We compare the solutions of the advection diffusion equation as well as error analysis for both schemes.

Advection Diffusion Equation Finite Difference Scheme Semi-Discretization Rate of Convergence Error Analysis
1. Introduction

We consider the following partial differential equation, which has both an adventive and diffusive terms together.

u t ( x , t ) + c ( x , t ) u x ( x , t ) = D u x x ( x , t ) (1)

with initial condition:

u ( x , t 0 ) = f ( x ) ;     a < x < b .

And boundary conditions:

u ( a , t ) = u a ( t ) ;     t 0 ≪ T

u ( b , t ) = u b ( t ) ;     t 0 < t < T

where u a , u b are concentration values and u ( x , t ) is the unknown solution being investigated which indicates concentration, c ( x , t ) is the velocity of the medium in the x direction, D ( x , t ) is the diffusion coefficient. To introduce numerical scheme for Equation (1), an advection diffusion problem whose general solution    is (Figure 1)

u ( x , t ) = 1 4 π D t e − ( x − c t ) 2 4 D t (2)

3. Numerical Methodology

In mathematics, our goal is to approximate the solution of the differential equations.

This gives a large algebraic system of equations to be solved in replace of the differential equation, which can be easily solved   on a computer by Matlab code.

3.1. Computational Grid

We consider some simple space discretization on a uniform grid. We divide the spatial interval [ 0 , L ] into M + 1 equal sub-interval such that

x 1 < x 2 < x 3 < ⋯ < L with x m = ( m − 1 ) Δ x , m = 1 , 2 , 3 , ⋯ , M + 1 and Δ x = L M .

Approximations u ( t ) ≈ u ( x m , t ) 0 are found by replacing the spatial derivatives by difference quotients. we also divide the time interval [ 0 , T ] into N + 1 equal subinterval such that t 1 < t 2 < t 3 < ⋯ < T with t n = ( n − 1 ) Δ x , n = 1 , 2 , 3 , ⋯ , N + 1 ,

and Δ t = T N . For purpose of the notation Δ x = h and Δ t = k .

This gives a finite difference discretization in space. Setting

u ( t ) = ( u 1 ( t ) , ⋯ , u m ( t ) ) T .

Therefore, we get a system of ordinary difference equations (ODEs) of (1.1)

u ′ ( t ) = F ( t , u ( t ) ) ,     t > 0 ,     u ( 0 ) = u 0 (3)

with a given initial value u ( 0 ) .

3.2. Discretization of Explicit Finite Difference Scheme (ECDS)

To approximate the solution to Equation (1) using the Explicit Centered Difference Scheme, we use the following approximations

u t ( x m , t n ) ≅ u m n + 1 − u m n Δ t (a)

u x ( x m , t n ) ≅ u m + 1 n − u m − 1 n 2 Δ x (b)

u x x ( x m , t n ) ≅ u m + 1 n + 1 − 2 u m n + u m − 1 n ( Δ x ) 2 (c)

where Δ x is the spatial step, Δ t is the time step, m and n is spatial and temporal node respectively. Substituting Equation (a), (b), (c) in Equation (1) and solving

for unknown u m n + 1 . We obtain u m n + 1 = ( α 2 + γ ) u m − 1 n + ( 1 − 2 γ ) u m n + ( γ − α 2 ) u m + 1 n where c Δ t Δ x = α and D Δ t Δ x 2 = γ . Stability condition c Δ t Δ x ≤ 1 & D Δ t Δ x 2 ≤ 1 2 .

3.3. Spatial Discretization Technique for ADE and Solved by Euler Method

We draw vertical grid line as shown in the picture. These lines are parallel to the t-axis and cross the x-axis in x = x m , m = 1 , ⋯ , M + 1 . x m = m × Δ x ,

Δ x = 1 M + 1 .

In semi-discretization method (SDM), we assume that the PDE system with its boundary conditions has spatially discretized, and thus we focus on ODE system u ′ ( t ) = F ( t , u ( t ) ) , representing semi-discrete advection-diffusion problems.

This equation is same as Equation (2). Now Consider ADE (1) with c > 0 and D > 0 .

We introduce the function of one variable: u m ( t ) ≈ u ( t , x m ) , m = 1 , ⋯ , M + 1 .

Now approximate the first derivative and second derivative ∂ x and ∂ x x respectively as:

u x ( x m , t ) ≅ u m + 1 ( t ) − u m − 1 ( t ) 2 Δ x (d)

u x x ( x m , t ) ≅ u m + 1 ( t ) − 2 u m ( t ) + u m − 1 ( t ) ( Δ x ) 2 (e)

This gives the semi-discrete form of (1)

d u m ( t ) d t = − α ( u m + 1 − u m − 1 ) 2 Δ x + γ ( u m − 1 + 2 u m + u m + 1 ) ( Δ x ) 2 u 1 ( t ) = f 0 ( t ) u M + 1 ( t ) = f 1 ( t ) m = 2 , ⋯ , M ;   α = c 2 Δ x & γ = D ( Δ x ) 2 (4)

Setting u m ( 0 ) = f ( x m ) , m = 2 , ⋯ , M

We get, u ˙ ( t ) : = [ u 2 ( t ) , ⋯ , u m ( t ) ] T

d d t ( u 2 ⋮ u M ) = − α ( 0 1 0 − 1 0 0 0 1 0 − 1 0 1 ) ( u 2 ⋮ u M )       + γ ( − 2 1 0 1 − 2 0 − 2 1 0 1 − 2 1 ) ( u 2 ⋮ u M ) + ( − α u 1 ⋮ − α u M + 1 ) + ( γ u 1 ⋮ γ u M + 1 )

So, we obtain a linear system of ordinary differential equations (ODE’s) of the type.

u ˙ ( t ) = d u d t = A u + b ( t ) ︸ f ( t ) ,   u ( 0 ) = u 0 = [ f ( x 1 ) , ⋯ , f ( x M ) ] T ∴         u ˙ ( t ) = F ( t , u ) ,   u ( 0 ) = u 0 ,     where     u   and   F ( t , u )   ​ are   vector

Now, we get with time step Δ t for the numerical solution

u n + 1 − u n Δ t = F ( t n , u n ) u n + 1 = u n + Δ t   F ( t n , u n )

which is the semi discretization using Euler method of F ( t , u ) = A u ˙ + b ( t ) .

4. Numerical Result’s and Discussion4.1. Algorithm for the Semi Discretization of ADE Solved by Euler Method

To approximate the solution to the partial differential equation

∂ u ∂ t ( x , t ) + c ∂ u ∂ x ( x , t ) − D ∂ 2 u ∂ x 2 ( x , t ) = 0 , a < x < b and t 0 < t < T Subject to the boundary condition                         u ( a , t ) = u a ( t ) , t 0 < t < T                         u ( b , t ) = u b ( t ) , t 0 < t < T And Initial condition,                         u ( x , t 0 ) = f ( x ) ; a < x < b

Input: dt, dx, constant co-efficient C , D , t 0 , the left and right end point t f of ( 0 , T ) ; x d , the right end point of ( 0 , b ) .

Output: approximation u m m to u ( x m , t n ) for each m m = 2 , ⋯ , m , n = 1 , ⋯ , N .

Step 1: set n x = x d − x 0 d x ; n t = t f − f 0 d t ; α = − c 2 d x , λ = D d x 2

Step 2: for m = 2 , ⋯ , n x Set u m , 1 = f ( x ) ( Initial value ) u n = u m , 1 ;

Step 3: Set , u 1 , n = u a ( left boundary condition ) u n x + 1 , n = u b ; ( right boundary condition )

Step 4-Step 6: (solve a tri-diagonal linear system)

Step 4: Construct matrix A and B

Set, T 1 = ( α ∗ A ) + ( β ∗ B )

b ( 1 ) = u ( 1 , 1 ) b ( n x − 1 ) = u ( n , 1 ) } Boundary

u n e w = u n + d t ( T 1 ∗ u n ) + b (Unknown solution for first time step)

Step 5: For n = 1 , ⋯ , n t + 1

Set u m m , n = u n e w ; u n = u n e w ;

u n e w = u n + d t ( T 1 ∗ u n ) + b ;

Output ( x , u m , n ) ,

Step 6: Stop (the procedure complete)

4.2. Case Study

Numerical implementation of Euler method  : our solving equation (1): u t + c u x = D u x x initial condition: u m 0 = f ( x m ) = u ( x , t = 0 )

Boundary condition: u ( x = 0 , t ) = u 0 n = f 1 ( t n ) u ( x = b , t ) = u b n = f b ( t n )

We will solve numerically for the concentration u using matrix system of equation.

Suppose we use 4 grid points x 1 , x 2 , x 3 , x 4 = x m + 1 i.e. m = 3 in this example.

We let, u → n = ( u 2 n u 3 n ) , Solution for concentration vector u → n at time t n .

The boundary condition gives

u 1 n = u ( x = 0 , t n ) and u m + 1 n = u 4 n = u ( x = b , t b ) .

We can rewrite general nth term in Equation (4) to required Euler method of advection diffusion equation.

u → n + 1 = ( u 2 n u 3 n ) − α ( 0 1 − 1 0 ) ︸ A ( u 2 n u 3 n ) + λ ( − 2 1 1 − 2 ) ︸ B ( u 2 n u 3 n ) − α ( u 1 n u 4 n ) + λ ( u 1 n u 4 n )

u → n + 1 = ( u 2 n u 3 n ) + Δ t { − α A ( u 2 n u 3 n ) + λ B ( u 2 n u 3 n ) − α ( u 1 n u 4 n ) + λ ( u 1 n u 4 n ) ︸ P } u → n + 1 = ( u 2 n u 3 n ) + Δ t   P → ;   ​ ​     α = c 2 Δ x ;     &     λ = D ( Δ x ) 2

4.3. Semi Discretization Scheme for ADE Solved Using Euler Method

For this case the time step is increased to Δ t = 0.008 , Δ x = 0.1 , and the parameter c = 0.2 and D = 0.02 , c Δ t Δ x = α known as advection equation number and D Δ t ( Δ x ) 2 = γ known as diffusion term. Regarding this application, (Figure 2)

α = 0.2 × 0.008 0.1 = 0.0160 ≤ 1 ,

γ = 0.02 × 0.008 0.1 2 = 0.0160 ≤ 0.5

Summary of elapsed time for different temporal grid point present below:

5. Error Analysis and Convergence5.1. Error Analysis

The comparison of relative error for two finite difference schemes as a function of time is shown in Figure 3. Two different curves show relative error for Explicit (red) and Euler (blue). We found the relative error for ECDS remains below 0.0009 and the relative error for Euler remains below 0.0011.

5.2. Convergence

Figure 4 illustrates the convergence of relative error by the scheme FTCS techniques. In this figure, numerical computation of ADE is presented by using explicit finite difference methods by FTCS and compared with an exact solution of

the ADE. A good agreement between the numerical solutions and the analytical solutions is obtained and the error becomes clear when using large size step for the time.

Figure 5 presents the convergence of semi discretization by Euler for ADE with respect to time. It can be seen that, the relative error rate of the convergence curves for the Euler scheme with respect to time. This figure shows a very good rate of convergence.

5.3. Problem Discussion

Figure 6 describes the concentration distribution profile as a function of distance. Different curves represent concentration distribution profiles at different times starting from t = 10   sec to t = 50   sec . The plot marked by “red curved”

represents the concentration is high for 10 seconds and the green curve shows that concentration is decreased for 20 seconds. The curve marked by “blue” represents concentration is high for 30 seconds and. The plot marked by “yellow” represents concentration is high for 50 seconds we can see that when time is increased concentration profile is decreasing. As can be seen in Figure 6, five curves show concentration distribution profiles for different times, advection, and diffusion parameter as a function of distance.

Similarly, we observe the above figure with the concentration distribution profile for different distances is decreased in a position with respect to time in Figure 7.

Figure 8 represents the concentration profile for different velocities and different diffusion coefficients regarding distances. Different curves show concentration profiles for different applied velocities and diffusion rates. If we vary

both velocity and diffusion coefficient at t = 20 secs, the solutions appeared which can be seen in Figure 8.

Similarly, concentration profile by solving numerically at a different diffusion rate can be seen in Figure 9 where the maximum concentration profile is shown at time t = 20   sec .

6. Conclusion

We present numerical solutions with exact solutions for the advection-diffusion equation with an initial condition and two boundary conditions by using ECDS and semi discretize method. A numerical study of the ADE has been presented graphically for two different schemes. The numerical solution of ADE by semi-discretization scheme shows a good agreement with the exact solution as well as for ECDS. Though, ECDS seems a more efficient scheme in terms of elapse timing; we compute the relative errors for two different schemes, both schemes show a very good rate of convergence. In comparison to Euler’s method, ECDS shows less error, which is obvious. Semi discretize methods have to deal with a large number of systems of ordinary differential equations in comparison with ECDS. In our next work, we would like to upgrade this work with higher-order accuracy.

Conflicts of Interest

The authors declare no conflicts of interest regarding the publication of this paper.

Cite this paper

Ara, K.N.I., Rahaman, Md.M. and Alam, Md.S. (2021) Numerical Solution of Advection Diffusion Equation Using Semi-Discretization Scheme. Applied Mathematics, 12, 1236-1247. https://doi.org/10.4236/am.2021.1212079

ReferencesMojtabi, M.D.A. (2015) One-Dimensional Linear Advection–Diffusion Equation: Analytical and Finite Element Solutions. Computers and Fluids, Elsevier, 189-195.Ahmed S. ,et al. (2012)A Numerical Algorithm for Solving Advection-Diffusion Equation with Constant and Variable Coefficients The Open Numerical Methods Journal 4, 1-7.Dehghan, M. (2005) On the Numerical Solution of the One Dimensional Convection-Diffusion Equation. Hindawi Publishing Corporation, 61-74.Appadu, A.R. (2013) Numerical Solution of the 1D Advection-Diffusion Equation Using Standard and Nonstandard Finite Difference Schemes. Hindawi Publishing Corporation Journal of Applied Mathematics, 2013, Article ID: 734374.Bahar, E. and Gurarslan, G. (2017) Numerical Solution of Advection-Diffusion Equation Using Operator Splitting Method. International Journal of Engineering & Applied Sciences, 9, 76-88.Azad, T.M.A.K. and Andallah, L.S. (2016) Stability Analysis of Finite Difference Schemes for an Advection Diffusion Equation. Bangladesh Journal of Scientific Research, 29, 143-151.Chen-Charpentier, B.M. and Kojouharov, H.V. (2013) Unconditionally Positivity Presentation Scheme for Advection Diffussion Reaction Equation. Mathematical and Computer Modelling, 57, 1277-1285.Willem, H. and Amsterdam, C.W.I. (2000) Numerical Solution of Advection-Diffusion-Reaction Equations. Lecture Notes, Thomas Stieltjes Institute, 2000.Olsen-Kettle, D.L. (2011) In Numerical Solution of Partial Differential Equations. https://www.researchgate.net/publication/296672444_Numerical_solution_of_partial_differential_equations_and_codeSocolofsky, S.A. and Jirka, G.H. (2002) Environmental Fluid Mechanics Part I: Mass Transfer and Diffusion, Germany: Universit at Karlsruhe, 76128-Karlsruhe, Institut fur Hydromechanik. 2nd Edition, Germany, 2002.Mathews, J.H. and Kurtis, K. (2004) Fink, Book: Numerical Methods Using Matlab. 4th Edition, Prentice Hall, Hoboken.Burden, R.L. and Faires, J.D. (2010) Numerical Analysis. 9th Edition, 20 Channel Center Street Boston, 2010.