Ch5 the Advection Diffusion Equation

19
Chapter 5 The Advection-Diffusion Equation Now that we have a strong foundation in understanding and solving the diffusion equation (Chapter 4), let’s consider the effects of advection on both analytical and numerical solutions. 5.1 Analytical Solutions of the ADE We can find some analytical solutions for the advection-diffusion equation (ADE) if we have incompressible flow, Fickian diffusion, and uniform diffusivities. Under these con- ditions, the ADE simplifies to ∂C ∂t + u ∂C ∂x + v ∂C ∂y + w ∂C ∂z = D x 2 C ∂x 2 + D y 2 C ∂y 2 + D z 2 C ∂z 2 (5.1) Eqn. 5.1 is equivalent to Eqn. 2.30 without a source term – see Chapter 2 for its derivation. 5.1.1 Instantaneous Point Source Moving Coordinates Let’s consider the 1D case first. If the coordinate system is chosen such that cross-stream and vertical velocities are zero (v = w = 0), and if mixing in the y and z directions is fast compared to longitudinal advection and diffusion, then Eqn. 5.1 simplifies to ∂C ∂t + u ∂C ∂x = D x 2 C ∂x 2 (5.2) If we release scalar mass per unit area M/A at location x = x 0 and time t = t 0 , it spreads due to diffusion. The only effect of advection is to carry the cloud downstream 113

Transcript of Ch5 the Advection Diffusion Equation

Page 1: Ch5 the Advection Diffusion Equation

Chapter 5

The Advection-Diffusion Equation

Now that we have a strong foundation in understanding and solving the diffusion equation(Chapter 4), let’s consider the effects of advection on both analytical and numericalsolutions.

5.1 Analytical Solutions of the ADE

We can find some analytical solutions for the advection-diffusion equation (ADE) if wehave incompressible flow, Fickian diffusion, and uniform diffusivities. Under these con-ditions, the ADE simplifies to

∂C

∂t+ u

∂C

∂x+ v

∂C

∂y+ w

∂C

∂z= Dx

∂2C

∂x2+Dy

∂2C

∂y2+Dz

∂2C

∂z2(5.1)

Eqn. 5.1 is equivalent to Eqn. 2.30 without a source term – see Chapter 2 for its derivation.

5.1.1 Instantaneous Point Source

Moving Coordinates

Let’s consider the 1D case first. If the coordinate system is chosen such that cross-streamand vertical velocities are zero (v = w = 0), and if mixing in the y and z directions isfast compared to longitudinal advection and diffusion, then Eqn. 5.1 simplifies to

∂C

∂t+ u

∂C

∂x= Dx

∂2C

∂x2(5.2)

If we release scalar mass per unit area M/A at location x = x0 and time t = t0, itspreads due to diffusion. The only effect of advection is to carry the cloud downstream

113

Page 2: Ch5 the Advection Diffusion Equation

114

as it diffuses. In fact, if we float along in a boat moving at velocity u (the same velocityas the fluid), the cloud will appear to evolve just like it would have without any advectionat all because the center of mass will not move relative to us. To describe the evolutionof the cloud from this perspective, let’s define the moving coordinate, ξ, to be in thesame direction as x but with its origin in the moving boat as illustrated below:

If the boat starts at time t = 0 and location x = 0, its location is given by x = ut, andthe moving coordinate ξ must be related to the stationary coordinate x by the equation

ξ = x− ut (5.3)

to ensure that ξ = 0 in the boat at all times. From the perspective of the boat, theconcentration distribution simply follows the diffusion equation (with zero advection),for which the solution is

C(ξ, t) =M/A√

4πDx(t− t0)exp

[− (ξ − ξ0)2

4Dx(t− t0)

](5.4)

where ξ0 = x0 − ut0 is the location of the point source from the perspective of the boat.Eqn. 5.4 is equivalent to Eqn. 4.11, but with ξ taking the place of x.

We found Eqn. 5.4 from our intuitive understanding of advection as a process that simplycarries a diffusing scalar cloud downstream. The more rigorous way to show that Eqn. 5.4is the solution of Eqn. 5.2 is to transform Eqn. 5.2 to moving coordinates and show thatwe obtain the diffusion equation, whose solution is given by Eqn. 5.4. We can transformthe Eqn. 5.2 from stationary coordinates (x, t) to moving coordinates (ξ, t) using thechain rule as follows

∂C(x, t)

∂t=∂C(ξ(x, t), t)

∂ξ

∂ξ

∂t−u

+∂C(ξ(x, t), t)

∂t

∂t

∂t1

= −u∂C(ξ, t)

∂ξ+∂C(ξ, t)

∂t

∂C(x, t)

∂x=∂C(ξ(x, t), t)

∂ξ

∂ξ

∂x1

=∂C(ξ, t)

∂ξ

∂2C(x, t)

∂x2=

∂ξ

∂C(ξ(x, t), t)

∂ξ

∂ξ

∂x1

∂ξ

∂x1

=∂2C(ξ, t)

∂ξ2

Page 3: Ch5 the Advection Diffusion Equation

Advection and Diffusion 115

Substituting into Eqn. 5.2, we find

����−u∂C∂ξ

+∂C

∂t+���

u∂C

∂ξ= Dx

∂2C

∂ξ2⇒

∂C

∂t= Dx

∂2C

∂ξ2

which is, indeed, the diffusion equation, which for an instantaneous point source in anunbounded domain has the solution given by Eqn. 5.4 (recall, we found this solutionusing the similarity approach in Section 4.1.1). Note that by defining similar movingcoordinates in the y and z directions, we may tranform the 2D and 3D ADE to thediffusion equation as well.

1D Solution

Transforming back to stationary coordinates, i.e., plugging in ξ = x − ut, we find thefollowing solution to the 1D ADE for an instantaneous point source of mass M/A releasedat location x0 and time t0

C(x, t) =M/A√

4πDx(t− t0)exp

[−(x− x0 − u(t− t0))2

4Dx(t− t0)

](5.5)

2D Solution

The solution for 2D advection and diffusion of an instantaneous point source of mass perunit length M/L released at location (x0, y0) and time t0 is

C(x, y, t) =M/Lz

4π(t− t0)√DxDy

×

exp

[−(x− x0 − u(t− t0))2

4Dx(t− t0)− (y − y0 − v(t− t0))2

4Dy(t− t0)

] (5.6)

3D Solution

The solution for 3D advection and diffusion of an instantaneous point source of mass Mreleased at location (x0, y0, z0) and time t0 is

C(x, y, t) =M

[4π(t− t0)]3/2√DxDyDz

×

exp

[−(x− x0 − u(t− t0))2

4Dx(t− t0)− (y − y0 − v(t− t0))2

4Dy(t− t0)− (z − z0 − w(t− t0))2

4Dz(t− t0)

] (5.7)

Page 4: Ch5 the Advection Diffusion Equation

116

Spatial and Temporal Records for a 1D Instantaneous Point Source

In this section, we will examine spatial and temporal distributions of concentration for1D advection and diffusion of an instantaneous point source released at location x0 andtime t0. The spatial distribution of concentration is fairly intuitve by now – a Gaussianscalar cloud spreads via diffusion such that the standard deviation is given by

σx =√

2Dx(t− t0)

The cloud is carried downstream by advection such that the center of mass is given by

xc = x0 + u(t− t0)

This spatial distribution of concentration is plotted below at times t− t0 = βL2/Dx forβ = 10, 30, and 50 at Peclet numbers of 0.1 (diffusion dominating) and 10 (advectiondominating):

0 100 200 300 400 5000

0.02

0.04

0.06

0.08

(x!x0)/L

C(x)

L1

/2

34 5 0.134 5 10

Figure 5.1: Some spatial concentration distributions for 1D advection and diffusion.

The peak concentration over all space at a given time for a 1D point source under theinfluence of both advection and diffusion is

Cmax(t) =M/A√

4πDx(t− t0)(5.8)

This is the same maximum as for diffusion alone (see p. 75). Let us define xmax, thelocation of maximum concentration, such that Cmax(t) ≡ C(xmax, t). When there is noadvection, the maximum concentration occurs at the location of the release, xmax = x0.However, when there is advection, the maximum concentration occurs at location

xmax = x0 + u(t− t0)

Page 5: Ch5 the Advection Diffusion Equation

Advection and Diffusion 117

which moves downstream over time. Since the concentration distribution is symmetricabout xmax at any given time, the maximum concentration over all space coincides withthe center of mass of the cloud.

Using aerial photography or various laboratory visualization techniques, we can measurethe spatial distribution of concentration C(x) at a given time, and for an instantaneouspoint source, we will obtain nice Gaussian concentration distributions like the ones inFigure 5.1. However, in the field, it is more common to obtain a time history of con-centration C(t) from a stationary instrument. Therefore, we need to understand thetemporal evolution of concentration at a fixed point in space as well as the more intuitivespatial distribution of concentration at a given point in time.

The temporal record of concentration at a point in space depends on the Peclet numberin a more complicated way than the spatial record of concentraiton at a point in time, solet’s work with the dimensionless form of Eqn. 5.5. Recall from Section 3.4 that there aretwo ways to scale the 1D ADE: using the diffusive time scale T = L2/Dx (appropriatewhen diffusion is important, at low to moderate Peclet numbers) and using the advectivetime scale T = L/u (appropriate when advection is important, at moderate to high Pecletnumbers). Let’s define dimensionless variables so that the coordinate system is centeredat the point of the release as follows:

x∗ ≡ x− x0

L, t∗ ≡ t− t0

T, C∗ ≡ CLA

M

The Peclet number is defined by

Pe =uL

Dx

Using the diffusive time scale, T = L2/Dx, we find the nondimensional solution

C(x∗, t∗) =1√4πt∗

exp

[−(x∗ − Pe t∗)2

4t∗

](5.9)

and alternatively, using the advective time scale T = L/u, we find the nondimensionalsolution

C(x∗, t∗) =

√Pe

4πt∗exp

[−Pe(x∗ − t∗)2

4t∗

](5.10)

Time histories of concentration at location x = x0 + L are plotted on the next pagefor the diffusive scaling (Figure 5.2) and the advective scaling (Figure 5.3) for somedifferent Peclet numbers. To fit all of these curves on the same figure, we have normalizedconcentration by Cmax(x0 + L), the maximum concentration measured over all time atx = x0 + L.

Page 6: Ch5 the Advection Diffusion Equation

118

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

Dx(t!t0) /L2

C(x

0+L,t)

/ C m

ax(x

0+L)

Figure 5.2: Concentration time histories C(t) measured at location x = x0 + L for somedifferent Peclet numbers Pe = uL/Dx. Time is normalized by the diffusive time scale.

0 0.5 1 1.5 2 2.5 30

0.2

0.4

0.6

0.8

1

u(t!t0) /L

C(x

0+L,t)

/ C m

ax(x

0+L)

Figure 5.3: Concentration time histories C(t) measured at location x = x0 + L for somedifferent Peclet numbers Pe = uL/Dx. Time is normalized by the advective time scale.

Setting the time derivative of Eqn. 5.5 to zero, we find that Cmax(x), the maximumconcentration measured over all time at location x, occurs at time

tmax = t0 −Dx

u2+

√(Dx

u2

)2

+(xu

)2

= t0 +(x− x0)

2

Dx

(−1 +

√1 + Pe2x

Pe2x

)

= t0 +(x− x0)

u

(−1 +

√1 + Pe2x

Pex

) (5.11)

Page 7: Ch5 the Advection Diffusion Equation

Advection and Diffusion 119

where we have defined a new Peclet number based on L = x− x0

Pex ≡u(x− x0)

Dx

We may find the following two limiting solutions using Taylor series expansion aboutPex = 0 and 1/Pex = 0, respectively:

tmax = t0 +

x2

2Dx

for Pex . 0.1

x

ufor Pex & 1000

(5.12)

These limiting solutions are clearly visible in Figures 5.2 and 5.3 with L = x− x0.

Plugging tmax into the solution of the 1D ADE for an instantaneous point source (Eqn. 5.5),we find Cmax(x), the maximum concentration measured over all time at location x. Theresult is a rather ugly function of Pex. Since this function ugly, we will not write it out,but it is plotted below vs. Pex and also vs.

√Pex.

5 10 15

0.2

0.4

0.6

0.8

1

Pex

C max

(x) L

A/M

1 2 3 4

0.2

0.4

0.6

0.8

1

Pex1/2

general solutionlimiting solution for small Pexlimiting solution for large Pex

Figure 5.4: Maximum concentration over all time at a given point in space, as a functionof Peclet number and its square root. Limiting cases for small and large Peclet numberare also plotted.

Also included in this plot are the limiting solutions for small and large values of Pex.These are given by

Cmax(x) ≈

M

AL

√1

2πe≈ 0.242

M

ALfor Pex . 0.1

M

AL

√Pex

4π≈ 0.282

M

AL

√Pex for Pex & 1000

(5.13)

Page 8: Ch5 the Advection Diffusion Equation

120

5.1.2 Advection and Diffusion of a Concentration Front in 1D

Now consider 1D advection and diffusion of an initially sharp concentration front. Forexample, consider fluid with concentration C0 displacing fluid with zero concentration ina pipe where the velocity is u. The governing equation is

∂C

∂t+ u

∂C

∂x= Dx

∂2C

∂x2

At time t = 0, there is a sharp front so that

C(x, 0) =

{C0 for x ≤ 0

0 for x > 0

The center of the front will travel at velocity u as the front is smoothed out by diffusionas illustrated below.

Again, it is useful to imagine riding the front as it moves with the water velocity. Fromthis perspective, advection is zero, and the problem looks a lot like one we solved inChapter 4. Transforming to moving coordinates, ξ = x−ut and t, the governing equationand initial conditions become

∂C

∂t= Dx

∂2C

∂ξ2

C(ξ, 0) =

{C0 for ξ ≤ 0

0 for ξ > 0

This is the mirror image of the problem we solved in Section 4.1.2, for which the solutionis given by Eqn. 4.22. Adjusting for the mirror image effect1, and plugging in the movingcoordinates, we find

C(x, t) =C0

2erfc

(x− ut√

4Dxt

)(5.14)

1To adjust for the mirror image effect, we may transform to C ′ = C − C0 to obtain a problem thatlooks exactly like the one solved by Eqn. 4.1.2. We also make use of the equality 1 + erf(u) = −erfc(u)to find the solution.

Page 9: Ch5 the Advection Diffusion Equation

Advection and Diffusion 121

5.1.3 Lateral Mixing of Two Streams

Now consider the lateral mixing of two streams with different concentrations of somechemical, as might occur when two rivers converge. This problem is illustrated below:

For now, let’s neglect the effects of boundaries in the lateral direction (you can add themlater using the method of images). Assume that concentration is fully mixed across theriver depth, so the problem is 2D. Also assume the solution has reached steady state.Consider the result far downstream of the convergence point so that the Peclet number islarge. Under all these assumptions, the governing equation may be simplified as follows:

����7

0∂C

∂t+ u

∂C

∂x=�����>

0

Dx∂2C

∂x2+Dy

∂2C

∂y2+�����>

0

Dz∂2C

∂z2

and we are left with

u∂C

∂x= Dy

∂2C

∂y2

We may convert this equation into the 1D diffusion equation

∂C

∂τ= Dy

∂2C

∂y2

using the following coordinate transformation:

τ =x

u

The “initial conditions” are given by

C(y, τ = 0) =

{C0 for y ≤ 0

0 for y > 0

Page 10: Ch5 the Advection Diffusion Equation

122

The solution is apparent from Section 5.1.2 if we recognize the equivalence of ξ and yand of t and τ

C(x, y) =C0

2erfc

(y√

4Dxx/u

)(5.15)

5.1.4 Concentration Specified at a Fixed Point in Space

For the problems we have considered thus far, it was possible to transform to somecoordinate system in which the advection-diffuison problem became simply a diffusionproblem. In the case of concentration specified at a fixed point in space, this is notpossible. Consider 1D advection and diffusion

∂C

∂t+ u

∂C

∂x= Dx

∂2C

∂x2

where the initial concentration at time t = 0 is zero everywhere, i.e.

C(x, 0) = 0

and after time t = 0, the concentration at x = 0 is set to a constant concentration C0

C(0, t) = C0

For x > 0, the solution is given by

C(x, t) =C0

2

[erfc

(x− ut√

4Dxt

)+ erfc

(x+ ut√

4Dxt

)exp

(ux

Dx

)](5.16)

This solution is important for soil column studies, as illustrated below:

Note that for small Peclet number (common in soils), the second term is small.

Page 11: Ch5 the Advection Diffusion Equation

Advection and Diffusion 123

5.1.5 Steady, Continuous Point Source

It is common for pollutants to be released steadily from a pipe into a river. Considereffluent released into a river at rate M and at location (x0, y0, z0). As you saw in Home-work 2, an effluent plume in steady state will travel through three zones. In zone 1, theplume will spread in 3D until it is fully mixed over the depth of the river. Then, in zone2, it will spread in 2D until it is mixed over the width as well. Finally, in zone 3, theplume is fully mixed over the river cross-section, and the concentration is constant in xdue to mass conservation. These three zones are illustrated below:

Page 12: Ch5 the Advection Diffusion Equation

124

Steady, Continuous Point Source in 3D

In 3D, with coordinates chosen so that advection is in the x direction, the steady-stateadvection-diffusion equation is

����7

0∂C

∂t+ u

∂C

∂x=�����>

0

Dx∂2C

∂x2+Dy

∂2C

∂y2+Dz

∂2C

∂z2

As you saw in Homework 2, the Peclet number is quite large in rivers, except very nearto the source, so the longitudinal diffusion term is small, and our governing equation canbe simplified to

u∂C

∂x= Dy

∂2C

∂y2+Dz

∂2C

∂z2

A sheet of water having width ∆x passes the continuous point source within time ∆t =∆x/u. Within this small time, it picks up mass ∆M = M∆t = M∆x/u. Since thereis very little diffusion in the x direction, mass within a sheet of water having width ∆xspreads like an instantaneous point source in 2D (in y and z) as it is carried downstream.

The mass per unit width in a given sheet is ∆M/∆x = M/u. Plugging this mass per unitwidth into the solution for a point source diffusing in 2D (Eqn. 4.16), and noting thatthe mass within a sheet located at x has been spreading for time t− t0 = (x− x0)/u, wefind the following solution for a 3D, steady, continuous point source located at (x0, y0, z0)

C(x, y, z) =M

4π(x− x0)√DyDz

exp

[− u(y − y0)

2

4Dy(x− x0)− u(z − z0)

2

4Dz(x− x0)

](5.17)

This is the solution for an unbounded domain. Once the plume has traveled far enoughdownstream that it reaches the water surface and the bed, image sources are necessaryto meet the vertical boundary conditions. Eventually, concentration becomes well-mixedacross the depth and the plume enters zone 2.

Page 13: Ch5 the Advection Diffusion Equation

Advection and Diffusion 125

Steady, Continuous Point Source in 2D

In zone 2, where the plume has become fully mixed across the depth of the river, it willcontinue to spread in the y direction as it travels downstream. Since Peclet number islarge (even bigger in zone 2 than in zone 1), the steady-state advection-diffusion equationin 2D becomes

u∂C

∂x= Dy

∂2C

∂y2

Sheets of water having width ∆x pick up mass M∆x/u as they pass the source. Thesesheets have cross-sectional area Lz∆x perpendicular to the direction of spreading (y)where Lz is the depth of the stream, so the mass per unit area within a single sheet isM/(uLz). The mass within a single sheet spreads like an instantaneous point source in1D (spreading in y), resulting in the following solution for a 2D, steady, continuous pointsource located at (x0, y0)

C(x, y) =M/Lz

u√

4πDy(x− x0)/uexp

[− u(y − y0)

2

4Dy(x− x0)

](5.18)

This is the solution for a domain unbounded in y. Image sources are required to satisfythe boundary conditions once the plume spreads to the banks of the river.

Steady, Continuous Point Source in 1D

Once the plume has mixed fully across the depth and the width of the river, concentrationbecomes uniform. Using a control volume approach, we may find the following solutionfor the steady state concentration far downstream from a continuous point source

C =M

uA=M

Q(5.19)

where A is the cross-sectional area of the river and Q = uA is the flow rate.

Page 14: Ch5 the Advection Diffusion Equation

126

5.1.6 Unsteady, Continuous Point Source in 1D

If a 1D continuous point source is turned on at time t = t0, so that

M(t)/A =

{0 for t < t0

M/A for t ≥ t0

slabs of fluid having thickness ∆x that pass the point source at times t > t0 will pick upmass M∆x/u.

These slabs have volume ∆xA, and in the 1D case, we can assume that mass instantlymixes across the slabs. Thus, the slabs pick up concentration C0 = M/(uA) as they passthe point source. Since the slabs that passed the point source before it was turned onhave zero concentration, there is a sharp front located at x = x0 + u(t− t0).

The solution for the evolution of such a sharp front under the influence of advection anddiffusion is given by Eqn. 5.14 for the special case of x0 = t0 = 0. Generalizing thissolution for x0 and t0, and plugging in C0 = M/(uA), we find the following solution fora continuous point source located at x = x0 that releases mass at rate M beginning attime t = t0

C(x, t) =M

2uAerfc

(x− x0 − u(t− t0)√

4Dx(t− t0)

)(5.20)

Page 15: Ch5 the Advection Diffusion Equation

Advection and Diffusion 127

Note that it takes some time for the source to build up the long region of constantconcentration C0 = M/(uA) behind the front, and as the source builds up the front,diffusion erodes it. If the distance over which diffusion has eroded the front is longerthan the region of constant concentration behind the front, there is no well-defined front,and our solution is not valid. The length of the region of constant concentration is aboutequal to u(t−t0), and the distance over which the front has diffused is about

√Dx(t− t0).

Thus, our solution is valid only when u(t − t0) >>√Dx(t− t0). Rearranging, we find

that Eqn. 5.20 is valid for times

t− t0 >>Dx

u2

At smaller times, the solution is more complicated. You can find it using the methodof superposition – you will obtain an integral that must be evaluated using discreteintegration.

5.1.7 Unsteady Velocity

The solutions developed in this chapter using moving coordinates ξ = x − ut may beeasily adapted for the the case of unsteady velocity by replacing u(t− t0) with the moregeneral form ∫ t

t0

u(τ)dτ

For example, this is appropriate in the case of an instantaneous point source, a concen-tration front, or an unsteady continuous point source. Moving coordinates in the y andz directions may be generalized in a similar manner using velocities v and w.

Page 16: Ch5 the Advection Diffusion Equation

128

5.2 Finite Difference Solutions of the ADE

We may discretize the most general form of the 3D advection-diffusion equation

∂C

∂t+∂ (uC)

∂x+∂ (vC)

∂y+∂ (wC)

∂z=

∂x

(Dx

∂C

∂x

)+

∂y

(Dy

∂C

∂y

)+

∂z

(Dz

∂C

∂z

)by plugging in Taylor series approximations of the derivatives, in the same way that wediscretized the diffusion equation in Section 4.3. However, in this chapter, for simplicityand the sake of illustration, we will only model the 1D advection-diffusion equation forincompressible flow and uniform diffusivity

∂C

∂t+ u

∂C

∂x= Dx

∂2C

∂x2(5.21)

5.2.1 FTCS Scheme

Discrete Equation for the FTCS Scheme

Using the FTCS (forward time, central space) discretization scheme, we obtain the fol-lowing discrete, finite difference equation:

Cn+1i =

(s+

c

2

)Cn

i−1 +

(1− 2s

)Cn

i +

(s− c

2

)Cn

i+1 (5.22)

where the dimensionless number

c ≡ u∆t

∆x(5.23)

is called the Courant number, and recall that the dimensionless number

s ≡ Dx∆t

∆x2(5.24)

is called the diffusion number.

Stability of the FTCS Scheme

Just as we did for the discrete diffusion equation in Section 4.3.6, we may perform VonNeumann stability analysis on the FTCS form of the discrete advection-diffusion equation(Eqn. 5.22). We find that the FTCS scheme is stable if

c2 ≤ 2s ≤ 1 (5.25)

Page 17: Ch5 the Advection Diffusion Equation

Advection and Diffusion 129

Note that the requirement c2 ≤ 1 can be written c ≤ 1, or plugging in the definition of cand rearranging,

∆t ≤ ∆x

uThis is known as the Courant-Friedrichs-Lewy or CFL condition. The CFL condtionrequires that the time step be shorter than the time it takes fluid to travel between gridpoints. This makes a lot of sense, physically, since we are trying to predict concentrationsat grid point i from concentrations at immediately adjacent grid points i± 1.

Accuracy of the FTCS Scheme

Remember that when we used Taylor series to approximate the derivatives in Eqn. 5.21(see Section 4.3.1), we truncated the Taylor series. We know that the truncation error isO(∆t) in time and O(∆x2) for the FTCS scheme because the terms we truncated weremultiplied by ∆t and ∆x2.

We can calculate the truncation error much more precisely by plugging the Taylor seriesinto the discrete equation (Eqn. 5.22) to find the partial differential equation that theFTCS scheme actually models. Plugging

Cn+1i = Cn

i +

(∂C

∂t

)n

i

∆t+

(∂2C

∂t2

)n

i

∆t2

2+ ...

Cni−1 = Cn

i −(∂C

∂x

)n

i

∆x+

(∂2C

∂x2

)n

i

∆x2

2−(∂3C

∂x3

)n

i

∆x3

6+ ...

Cni+1 = Cn

i +

(∂C

∂x

)n

i

∆x+

(∂2C

∂x2

)n

i

∆x2

2+

(∂3C

∂x3

)n

i

∆x3

6+ ...

into the discrete equation (Eqn. 5.22), we find

Cni +

(∂C

∂t

)n

i

∆t+

(∂2C

∂t2

)n

i

∆t2

2

=

(s+

c

2

)(Cn

i −(∂C

∂x

)n

i

∆x+

(∂2C

∂x2

)n

i

∆x2

2−(∂3C

∂x3

)n

i

∆x3

6

)+

(1− 2s

)Cn

i

+

(s− c

2

)(Cn

i +

(∂C

∂x

)n

i

∆x+

(∂2C

∂x2

)n

i

∆x2

2+

(∂3C

∂x3

)n

i

∆x3

6

)Grouping terms, canceling, plugging in the definitions of c and s, and dropping thesubscripts and superscripts to be more concise, we find the following partial differentialequation:

∂C

∂t+ u

∂C

∂x= Dx

∂2C

∂x2− ∆t

2

∂2C

∂t2− u∆x2

6

∂3C

∂x3+O(∆x3,∆t2) (5.26)

Page 18: Ch5 the Advection Diffusion Equation

130

Eqn. 5.26 is easier to interpret if we write the second time derivative in terms of spatialderivatives. We can do this by taking ∂/∂t and ∂/∂x of Eqn. 5.26, obtaining

∂2C

∂t2= −u ∂

2C

∂x∂t+ ... and (5.27)

∂2C

∂x∂t= −u∂

2C

∂x2+ ... (5.28)

respectively. Substituting Eqn. 5.28 into Eqn. 5.27, we find

∂2C

∂t2= u2∂

2C

∂x2+ ... (5.29)

Finally, plugging Eqn. 5.29 into Eqn. 5.26, we find

∂C

∂t+ u

∂C

∂x=

(Dx −

u2∆t

2

)∂2C

∂x2− u∆x2

6

∂3C

∂x3+O(∆x3,∆t2) (5.30)

Eqn. 5.30 is called the modified equation for the FTCS scheme. It is the differentialequation that the discrete FTCS equation (Eqn. 5.22) actually solves. But we intendedto solve Eqn. 5.21, not Eqn. 5.30! Obviously, there will be some error in our numericalsolution due to solving the wrong equation. This is called the truncation error becauseit arises from truncation of the Taylor series approximation of the governing equation.Note that truncation error is distinct from the rounding error that results from usingfloating point numbers on a computer. Rounding error causes instability and leads solu-tions to blow up if not kept under control (as discussed in Section 4.3.6) while truncationerror is usually more mild.

The leading order truncation error due to the forward time discretization is

−u2∆t

2

∂2C

∂x2

This error results in less diffusion than we intended. Because it modifies the effective valueof the diffusion coefficient in Eqn. 5.30, the coefficient -u2∆t/2 is called the numericaldiffusion coefficient.

The leading order truncation error due to the centered spatial discretization is

−u∆x2

6

∂3C

∆x3

If ∆x is too big, this error can result in ringing of the solution because it causes wavesof different frequencies to travel at different speeds. This phenomenon of different wavestraveling at different speeds is known as dispersion; thus, the coefficient −u∆x2/6 iscalled the numerical dispersion coefficient.

As we predicted, the leading order error terms for the FTCS scheme are O(∆x2,∆t).Because we truncated the modified equation at O(∆x3,∆t2), we do not see the higher

Page 19: Ch5 the Advection Diffusion Equation

Advection and Diffusion 131

order error terms such as multiples of ∂4C/∂x4, ∂5C/∂x5, etc. However, these terms docontribute to the truncation error. Each term with even-order x-derivatives (∂4C/∂x4,∂6C/∂x6, etc.) results in numerical diffusion, i.e., an incorrect amount of spreading of thesolution. All of the terms with odd-order x-derivatives (∂5C/∂x5, ∂7C/∂x7, etc.) resultin numerical dispersion, i.e., modification of wave speeds that can result in ringing.

As ∆t and ∆x become smaller and smaller, the error terms in the modified equation alsobecome smaller and smaller, and the modified equation converges to the equation weintended to solve. When the modified equation converges to the equation we intended tosolve in the limit of ∆t = ∆x = 0 we say that the discrete equation is consistent withthe governing equation.

5.2.2 Crank-Nicolson Scheme

Since the C-N scheme is centered in space, there is no first order numerical diffusion dueto advection, and thus the C-N scheme is more accurate for advection-diffusion problemsthan the FTCS scheme. With advection, the discrete equation for the C-N schemebecomes

−(s

2+c

4

)Cn+1

i−1 +

(1 + s

)Cn+1

i −(s

2− c

4

)Cn+1

i+1

=

(s

2+c

4

)Cn

i−1 +

(1− s

)Cn

i +

(s

2− c

4

)Cn

i+1 (5.31)

This is a matrix equation which must be solved at each time step. Boundary conditionsare applied in the same manner as illustrated in Section 4.3.5 for the diffusion equation.