finite difference method for solving advection-diffusion problem...

24
Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Result Finite difference method for solving Advection-Diffusion Problem in 1D Author : Osei K. Tweneboah MATH 5370: Final Project

Upload: others

Post on 22-May-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Finite difference method for solvingAdvection-Diffusion Problem in 1D

Author : Osei K. Tweneboah

MATH 5370: Final Project

Page 2: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Outline

1 Advection-Diffusion ProblemStationary Advection-Diffusion Problem in 1D

2 Solution of the Stationary Advection-Diffusion Problem in 1DCentered-Difference method for the StationaryAdvection-Diffusion Problem in 1D

3 Numerical Results

4 Discussion of Results

5 Conclusions

Page 3: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Advection-Diffusion Problem

Background of the Advection-Diffusion Problem

The advection-diffusion equation describes physicalphenomena where particles, energy, or other physicalquantities are transferred inside a physical system due to twoprocesses: diffusion and advection.

Advection is a transport mechanism of a substance orconserved property by a fluid due to the fluid’s bulk motion.

Diffusion is the net movement of molecules or atoms from aregion of high concentration to a region of low concentration.

The advection-diffusion equation is a relatively simpleequation describing flows, or alternatively, describing astochastically-changing system.

Page 4: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

1D Advection-Diffusion Problem (Cont.)

General form of the 1D Advection-Diffusion Problem

The general form of the 1D advection-diffusion is given as:

dU

dt= ε

d2U

dx2− a

dU

dx+ F (1)

where,

U is the variable of interest

t is time

ε is the diffusion coefficient

a is the average velocity

F describes ”sources” or ”sinks” of the quantity U.

In Equation 1, the four terms represent the transient, diffusion,advection and source or sink term respectively.

Page 5: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Advection-Diffusion Problem (Cont.)

Stationary Advection-Diffusion Problem in 1D

The stationary advection-diffusion equation describes thesteady-state behavior of an advection-diffusive system. Insteady-state, dU

dt = 0, so Equation 1 reduces to,

− εd2U

dx2+ a

dU

dx= F (x). (2)

In Equation 2, the three terms represent the diffusion, advectionand source or sink term respectively.

Page 6: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Solution of the Stationary Advection-Diffusion Problem in1D

Computers are often used to numerically approximate the solutionof the advection-diffusion equation typically using the finitedifference method (FDM) and the finite element method (FEM).

The FDM are numerical methods for solving differentialequations by approximating them with difference equations, inwhich finite differences approximate the derivatives. FDMs arethus discretization methods.

The FEM is a numerical technique for finding approximatesolutions to boundary value problems for partial differentialequations. It uses subdivision of a whole problem domain intosimpler parts, called finite elements, and variational methodsfrom the calculus of variations to solve the problem byminimizing an associated error function.

Page 7: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Solution of the Stationary Advection-Diffusion Problem in1D (Cont.)

Stationary Advection-Diffusion Problem in 1D

− εd2U

dx2+ a(x)

dU

dx= F (x), 0 < x < 1, (3)

U(0) = α, U(1) = β, a(x) > a0 > 0. (4)

Where the data is chosen according to:

U(x) = x −exp

(− (1−x)

ε

)− exp

(−1ε

)1− exp

(−1ε

) (5)

a(x) = 1 (6)

Page 8: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Solution of the Stationary Advection-Diffusion Problem in1D (Cont.)

In order to numerically solve Equation 3, we need to determine theunknown function F (x) and unknown constants α and β. In orderto determine the unknown constants α and β, we plug 0 and 1into Equation 5. Thus we have,

U(0) = 0−exp

(− (1−0)

ε

)− exp

(−1ε

)1− exp

(−1ε

) = 0 = α (7)

and

U(1) = 1−exp

(− (1−1)

ε

)− exp

(−1ε

)1− exp

(−1ε

) = 0 = β (8)

Page 9: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Solution of the Stationary Advection-Diffusion Problem in1D (Cont.)

Similarly, in order to determine the unknown function F (x) wesubstitute Equation 5 into Equation 3 and we get,

−ε

[− exp(−1

ε ) exp( xε )

ε2(1− exp(−1ε

))

]+

[1−− exp(−1

ε ) exp( xε )

ε(1− exp(−1ε

))

]= 1 = F (x)

Therefore our problem reduces to:

Stationary Advection-Diffusion Problem in 1D

− εd2U

dx2+

dU

dx= 1, 0 < x < 1, (9)

U(0) = 0, U(1) = 0. (10)

Page 10: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Solution of the Stationary Advection-Diffusion Problem in1D (Cont.)

We now employ FDM to numerically solve the StationaryAdvection-Diffusion Problem in 1D (Equation 9). We will employFDM on an equally spaced grid with step-size h. We setxi±1 = xi ± h, h = xn+1−x0

n and x0 = 0, xn+1 = 1.

A finite difference method comprises a discretization of thedifferential equation using the grid points xi , where the unknownsUi (for i = 0, . . . , n + 1) are approximations to U(xi ).

Page 11: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Solution of the Stationary Advection-Diffusion Problem in1D (Cont.)

U ′(x) is approximated by the centered-difference:

(DoU)(x) =U(x + h)− U(x − h)

2h≈ Ui+1 − Ui−1

2h

U ′′(x) is approximated by the central difference approximations:

(D+D−U)(x) =U(x + h)− 2U(x) + U(x − h)

h2

≈ Ui+1 − 2Ui + Ui−1

h2

From Equation 9, we approximate the diffusion term by the secondorder central-difference operator and the advection term by thecentered-difference operator.

Page 12: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Centered-Difference method for the StationaryAdvection-Diffusion Problem in 1D

Implementation of Centered-difference method forAdvection-Diffusion Problem in 1D

− εUi+1 − 2Ui + Ui−1

h2+

Ui+1 − Ui−1

2h= 1, on [0, 1]

U0 = 0, Un+1 = 0.

Combining terms with the same indices, we get:

AUi+1 + BUi + CUi−1 = f (xi ) = 1, (11)

where, A = 12h −

εh2 , B = 2ε

h2 and C = −12h −

εh2

Page 13: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Centered Difference method for the StationaryAdvection-Diffusion Problem in 1D (Cont.)

From Equation 11, we have a tridiagonal linear system of nequations with n unknowns, which can be written in the form

AU = F (12)

where U = [U1,U2, . . . ,Un]T is the unknown vector and

A =

b c 0a b c

a b c. . .

. . .. . .

a b c0 a b

, F =

f (x1)f (x2)f (x3)

...f (xn−1)f (xn)

(13)

Page 14: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Numerical Results

A C + + module was developed to generate the approximatedsolution Uh by solving the tridiagonal system.

The tridiagonal system is solved in two steps.

The first step is using the process of Gaussian Elimination toobtain a triangular matrix.

The second step is using back substitution to solve for theunknown vectors.

Page 15: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Numerical Results (Cont.)

We will briefly present some numerical results for theadvection-diffusion problem.

We will consider three(3) different cases where the number of gridpoints are chosen as n = 50, 25 and 2.For each grid point, we will change the choice of the diffusioncoefficient ε to 1, 0.5, 0.1 and 0.01.

The exact solution and approximated solution are plotted on thesame window for different values of ε on [0, 1].

Page 16: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Numerical Results (Cont.)

Figure: n = 50, ε = 1, 0.5, 0.1 and 1

Page 17: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Numerical Results (Cont.)

Figure: n = 25, ε = 1, 0.5, 0.1 and 1

Page 18: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Numerical Results (Cont.)

Figure: n = 2, ε = 1, 0.5, 0.1 and 1

Page 19: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Discussion of Results

In order to explain the figures obtained on the previous slides, weperform some analysis on the behavior of the centered-differenceapproximation for the Advection-Diffusion Problem in 1D.We rewrite Equation 11 as a difference equation in the form

aUi+1 + bUi + cUi−1 = 1, (i ≥ 1) (14)

where, a = 12h −

εh2 , b = 2ε

h2 and c = −12h −

εh2

Page 20: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Discussion of Results (Cont.)

The analysis is performed on the homogeneous solution of ourdifference equation (Equation 14). To find the homogeneoussolution, we assume a trial solution Ui = x i . Substituting Ui = x i ,Ui+1 = x i+1 and Ui−1 = x i−1 into the homogeneous part ofEquation 14 gives

ax i+1 + bx i + cx i−1 = 0

=⇒ ax2 + bx + c = 0

which has solution,

x1,2 =−b ±

√b2 − 4ac

2a(15)

Page 21: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Discussion of Results (Cont.)

Plugging the values of a, b and c into Equation 15, gives

x1 = 1 and x2 =−2ε− h

−2ε+ h(16)

Thus the complimentary solution is

Uh = C1 + C2(−2ε− h

−2ε+ h)i , (i ≥ 1) (17)

Page 22: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Discussion of Results (Cont.)

The solution obtained suggest that, if ε > 0.01, the approximatesolution is consistent with the exact solution.

However, if ε ≤ 0.01 the approximate solution oscillates. This isbecause, for ε ≤ 0.01, x2 in Equation 16 is negative.

Page 23: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Conclusions

In this project, we discussed the centered-difference method for theAdvection-Diffusion problem in 1D.

We analyzed the approximated solution Uh and we concluded thatthis method performs well for large values of ε. However, it fails toapproximate the solution for small values of ε.

We presented some analytical behavior of the problem whichexplains the presence of oscillations in the approximated solutionfor small values of ε.

Page 24: Finite difference method for solving Advection-Diffusion Problem …utminers.utep.edu/oktweneboah/files/talk.pdf · 3 Numerical Results 4 Discussion of Results 5 Conclusions. Advection-Di

Advection-Diffusion Problem Solution of the Stationary Advection-Diffusion Problem in 1D Numerical Results Discussion of Results Conclusions

Thank You!