s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley...

35
CFD 4 1 David Apsley 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 4.1 Control-volume notation 4.2 The steady-state 1-d advection-diffusion equation 4.3 Discretising diffusion 4.4 Discretising the source term 4.5 The matrix equation 4.6 Discretising advection (part 1) 4.7 Extension to 2 and 3 dimensions 4.8 General discretisation properties 4.9 Discretising advection (part 2) 4.10 Implementation of advanced advection schemes 4.11 Boundary conditions 4.12 Solution of matrix equations Summary References Appendix: Tri-diagonal matrix algorithm Examples 4.1 Control-Volume Notation This course focuses on structured meshes using cell-centred storage. Unstructured meshes are discussed briefly in Section 9 and better described in Versteeg and Malalasekera (2007). A 3-d control volume is shown right. Relative to point P at cell centre, the coordinate directions are commonly denoted west, east, south, north, bottom, top with: lower case w, e, s, n, b, t used for cell faces; upper case W, E, S, N, B, T for adjacent nodes. For a cartesian mesh these usually correspond to ±, ±, ± directions, respectively. Face areas are denoted , , etc. Volumes are denoted . In 2 dimensions one can think of a single layer of cells with unit depth. It is common to switch back and forth between local geographic and global ijk notation, so that ϕ ≡ϕ , ϕ ≡ϕ +1, , etc. Local Global E W N S P n e s w EE WW NN SS i+1,j i-1,j i,j i,j-1 i,j+1 i+2,j i-2,j i,j-2 i,j+2 E W N S B T P e w t b n s j i k

Transcript of s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley...

Page 1: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 1 David Apsley

4. THE SCALAR-TRANSPORT EQUATION SPRING 2021

4.1 Control-volume notation

4.2 The steady-state 1-d advection-diffusion equation

4.3 Discretising diffusion

4.4 Discretising the source term

4.5 The matrix equation

4.6 Discretising advection (part 1)

4.7 Extension to 2 and 3 dimensions

4.8 General discretisation properties

4.9 Discretising advection (part 2)

4.10 Implementation of advanced advection schemes

4.11 Boundary conditions

4.12 Solution of matrix equations

Summary

References

Appendix: Tri-diagonal matrix algorithm

Examples

4.1 Control-Volume Notation

This course focuses on structured meshes using cell-centred storage.

Unstructured meshes are discussed briefly in Section 9 and better described in

Versteeg and Malalasekera (2007).

A 3-d control volume is shown right. Relative to point P at cell

centre, the coordinate directions are commonly denoted west, east,

south, north, bottom, top with:

• lower case w, e, s, n, b, t used for cell faces;

• upper case W, E, S, N, B, T for adjacent nodes.

For a cartesian mesh these usually correspond to ±𝑥,±𝑦,±𝑧 directions, respectively.

Face areas are denoted 𝐴𝑤, 𝐴𝑒, etc. Volumes are denoted 𝑉. In 2

dimensions one can think of a single layer of cells with unit depth.

It is common to switch back and forth between local geographic and global ijk notation, so that

ϕ𝑃 ≡ ϕ𝑖𝑗𝑘, ϕ𝐸 ≡ ϕ𝑖+1,𝑗𝑘, etc.

Local Global

EW

N

S

P

n

e

s

w EEWW

NN

SS

i+1,ji-1,j i,j

i,j-1

i,j+1

i+2,ji-2,j

i,j-2

i,j+2

E

W N

S

B

T

P e

w

t

b

ns

j

i

k

Page 2: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 2 David Apsley

4.2 The Steady-State 1-D Advection-Diffusion Equation

The scalar-transport or advection-diffusion equation for concentration ϕ is:

d

d𝑡(mass × ϕ) + ∑ (

faces

mass flux × ϕ −Γ∂ϕ

∂𝑛𝐴 ) = 𝑆

time derivative advection diffusion source

Consider first the steady-state, 1-d advection-diffusion equation. This is worthwhile because:

• it simplifies the analysis;

• it can often be solved by hand;

• subsequent generalisation to 2 and 3 dimensions is straightforward;

• (on structured meshes) discretisation of fluxes is usually carried out coordinate-wise;

• many important theoretical problems are 1-d.

Integral (Control-Volume) Form

Conservation for one control volume gives

flux𝑒 − flux𝑤 = source (1)

where, if ϕ is the amount per unit mass and s the source per unit length, then:

flux = (ρ𝑢𝐴)ϕ⏟ advection

−Γ𝐴dϕ

d𝑥⏟ diffusion

(2)

source = 𝑠Δ𝑥 (3)

Differential Forms

Dividing (1) by Δ𝑥 and taking the limit as Δ𝑥 → 0 gives the conservative form:

d

d𝑥(ρ𝑢𝐴ϕ − Γ𝐴

d𝑥) = 𝑠 (4)

Mass conservation implies ρ𝑢𝐴 = constant. (4) can also be written in non-conservative form:

ρ𝑢𝐴dϕ

d𝑥−d

d𝑥(Γ𝐴

d𝑥) = 𝑠 (5)

Note:

• This system is quasi-1-d in the sense that the cross-sectional area 𝐴 may vary. To solve

a truly 1-d problem just set 𝐴 = 1. Then

d

d𝑥(ρ𝑢ϕ − Γ

d𝑥) = 𝑠 (6)

• For the simple cases below, ρ, 𝑢, Γ and 𝑠 are assumed to be known. In the general CFD

problem, 𝑢 is itself the subject of a transport equation and ρ, Γ, 𝑆 may be functions of

the solution.

flux efluxw

x

area A

source

V

A

u

un

Page 3: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 3 David Apsley

Classroom Example 1

A thin rod has length 1 m and cross-section 1 cm 1 cm. The left-hand end is kept at 100 ºC,

whilst the right-hand end is insulated.

The heat flux across any section of area 𝐴 is given by

−𝑘𝐴d𝑇

d𝑥

where the conductivity 𝑘 = 1000 W m−1 K−1. The rod loses heat along its length at a rate

proportional to the temperature excess over ambient (Newton’s law of cooling); i.e. the heat

source per unit length is:

𝑠 = −𝑐(𝑇 − 𝑇∞)

where the ambient temperature 𝑇∞ = 20° C and the coefficient 𝑐 = 2.5 W m−1 K−1.

(a) Write down and solve the differential equation for temperature along the rod.

(b) Divide the rod into 5 control sections, with nodes at the centre of each section, and carry

out a finite-volume analysis to find the temperature along the rod.

4.3 Discretising Diffusion

Central differencing approximation for a cell-face derivative:

−Γ𝐴dϕ

d𝑥|𝑒 → −(Γ𝐴)𝑒 (

ϕ𝐸 − ϕ𝑃Δ𝑥

) → −𝐷𝑒(ϕ𝐸 − ϕ𝑃) (7)

where

𝐷 ≡Γ𝐴

Δ𝑥 (8)

is a diffusive transfer coefficient. A similar expression is used for the west face.

Note:

• This approximation for (dϕ/d𝑥)𝑒 is second-order accurate in Δ𝑥; (see later).

• If the diffusivity Γ varies then its cell-face value must be obtained by interpolation.

x = 0 1

T=100 Co

RoddTdx

=0

T = 20 Co

s = -c (T-T )

8

8

P EW w e

x

x

P

E

x

e

Page 4: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 4 David Apsley

4.4 Discretising the Source Term

The source may depend on solution ϕ, as in the example. To form algebraic equations it must

be linearised. (For example, ϕ3 → (ϕ2)ϕ, with bracketed part evaluated at the current value.)

The following notation will be used:

source = 𝑏𝑃 + 𝑠𝑃ϕ𝑃 , 𝑠𝑃 ≤ 0 (9)

𝑏𝑃 and 𝑠𝑃 may be functions of ϕ, in which case the equations have to be solved iteratively. The

requirement for 𝑠𝑃 to be negative will be explained later.

4.5 The Matrix Equation

As seen in the example, the pure diffusion problem discretises as:

flux𝑒 − flux𝑤 = source

−𝐷𝑒(ϕ𝐸 − ϕ𝑃) + 𝐷𝑤(ϕ𝑃 − ϕ𝑊) = 𝑏𝑃 + 𝑠𝑃ϕ𝑝

Collecting multiples of ϕ𝑃, ϕ𝐸 and ϕ𝑊 (noting the minus signs):

−𝑎𝑤ϕ𝑊 + 𝑎𝑃ϕ𝑃 − 𝑎𝐸ϕ𝐸 = 𝑏𝑃 (10)

where

𝑎𝑊 = 𝐷𝑤, 𝑎𝐸 = 𝐷𝑒, 𝑎𝑃 = 𝐷𝑤 + 𝐷𝑒 − 𝑠𝑃 (11)

This is just a special case of the single-cell equation that applies in 2 and 3 dimensions, and

where there is advection as well as diffusion:

𝑎𝑃ϕ𝑃 − ∑ 𝑎𝐹ϕ𝐹 = 𝑏𝑃

adjacent nodes

(12)

There will be such an equation for each variable and each control volume. For one variable, ϕ,

if the nodal values are assembled into a vector then the set of equations has the form

Aϕ = b (13)

For a 1-d system this is tri-diagonal:

(

⋱ ⋱ 0⋱ ⋱ ⋱

−𝑎𝑊 𝑎𝑃 −𝑎𝐸⋱ ⋱ ⋱

0 ⋱ ⋱ )

(

⋮⋮ϕ𝑃⋮⋮ )

=

(

⋮⋮𝑏𝑃⋮⋮ )

or

If the coefficients are constant then it can be solved directly by Gaussian elimination, or, very

efficiently on a computer, by the tri-diagonal matrix algorithm. If the elements of the matrix

are not constant but depend on the unknown solution ϕ (and/or other variables) then it must be

solved iteratively.

= b

Page 5: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 5 David Apsley

Classroom Example 2

A 2-d finite-volume calculation is to be undertaken for fully-developed, laminar flow between

stationary, plane, parallel walls. A streamwise pressure gradient d𝑝/d𝑥 = −𝐺 is imposed and

the fluid viscosity is μ. The depth of the channel, 𝐻, is divided into 𝑁 equally-sized cells of

dimension Δ𝑥 × Δ𝑦 × 1 as shown, with the velocity 𝑢 stored at cell centres.

(a) What are the boundary conditions on velocity?

(b) What is the net pressure force on a single cell?

(c) Using a finite-difference approximation for velocity gradient, find expressions for the

viscous forces on upper and lower faces of the 𝑗th cell in terms of the nodal velocities

{𝑢𝑗}. (Deal separately with interior cells and the boundary cells 𝑗 = 1 and 𝑗 = 𝑁.)

(d) By balancing pressure and viscous forces set up the finite-volume equations for

velocity.

(e) Solve for the nodal velocities in the case 𝑁 = 6, leaving your answers as multiples of

𝑈0 = 𝐺𝐻2/μ. (Note the symmetry of the problem.)

(f) Using your numerical solution, find the volume flow rate (per unit span), 𝑞, in terms of

𝑈0 and 𝐻.

(g) Find the wall shear stress τ𝑤.

(h) Compare your answers to (e), (f), (g) with the exact solution for plane Poiseuille flow.

u1

j-1u

ju

j+1u

Nu

y

x

H

Page 6: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 6 David Apsley

4.6 Discretising Advection (Part 1)

In most engineering flows, advective fluxes far exceed diffusive fluxes.

The 1-d steady-state advection-diffusion equation is

flux𝑒 − flux𝑤 = source

where, with mass flux 𝐶 (= ρ𝑢𝐴):

flux = 𝐶ϕ − Γ𝐴dϕ

d𝑥

Discretising diffusion and source terms as before, but leaving advection in terms of unspecified

face values ϕ𝑒 and ϕ𝑤 for the moment, the equation becomes

[𝐶𝑒ϕ𝑒 − 𝐶𝑤ϕ𝑤] + [−𝐷𝑒(ϕ𝐸 − ϕ𝑃) + 𝐷𝑤(ϕ𝑃 − ϕ𝑊)] = 𝑏𝑃 + 𝑠𝑃ϕ𝑃advection diffusion source

(14)

The problem is to approximate face values ϕ𝑒 and ϕ𝑤 in terms of the values at the nodes. A

method of specifying these face values in order to calculate advective fluxes is called an

advection scheme or advection-differencing scheme.

Classroom Example 3.

A pipe of cross-section 𝐴 = 0.01 m2 and length 𝐿 = 1 m carries water (density ρ =1000 kg m−3) at velocity 𝑢 = 0.1 m s−1.

A faulty valve introduces a reactive chemical into the pipe half-way along its length at a rate

of 0.01 kg s–1. The diffusivity of the chemical in water is Γ = 0.1 kg m−1 s−1. The chemical

is subsequently broken down at a rate proportional to its concentration ϕ (mass of chemical

per unit mass of water), this rate amounting to −γϕ per metre, where γ = 0.5 kg s−1 m−1.

Approximating the downstream boundary condition by dϕ/d𝑥 = 0, set up a finite-volume

calculation with 7 cells to estimate the concentration along the pipe using:

(a) central

(b) upwind

differencing schemes for advection.

(*** Optional ***)

(c)Write down and solve the exact concentration equation.

x = 0 L

pointsource

u= 0

= 0d

dx

P EW w e

u

Page 7: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 7 David Apsley

4.6.1 Central Differencing

In central differencing, take the average of adjacent nodes:

ϕ𝑒 =1

2(ϕ𝑃 + ϕ𝐸)

This is second-order accurate in Δ𝑥 (see later).

Substituting into (14), with a similar expression for ϕ𝑤, gives

[𝐶𝑒 ×1

2(ϕ𝑃 + ϕ𝐸) − 𝐷𝑒(ϕ𝐸 − ϕ𝑃)]⏟

flux𝑒

− [𝐶𝑤 ×1

2(ϕ𝑊 + ϕ𝑃) − 𝐷𝑤(ϕ𝑃 − ϕ𝑊)]⏟

flux𝑤

= 𝑏𝑃 + 𝑠𝑃ϕ𝑃⏟ source

Collecting terms:

−𝑎𝑊ϕ𝑊 + 𝑎𝑃ϕ𝑃 − 𝑎𝐸ϕ𝐸 = 𝑏𝑃

where:

𝑎𝑊 =

1

2𝐶𝑤 + 𝐷𝑤, 𝑎𝐸 = −

1

2𝐶𝑒 + 𝐷𝑒

𝑎𝑃 = 𝑎𝐸 + 𝑎𝑊 − 𝑠𝑃 + (𝐶𝑒 − 𝐶𝑤) (15)

(By mass conservation, 𝐶𝑒 − 𝐶𝑤 = 0, so the expression for 𝑎𝑃 can be simplified.)

The graphs below show the solution of an advection-diffusion problem with no sources,

constant diffusivity and ϕ fixed as 1 and 0 at upstream and downstream ends for cases

Pe = 1/2 (advection « diffusion) (equation: −5

4ϕ𝑊 + 2ϕ𝑃 −

3

4ϕ𝐸 = 0)

Pe = 4 (advection » diffusion) (equation: −3ϕ𝑊 + 2ϕ𝑃+ϕ𝐸 = 0)

where the Peclet number Pe is defined by

Pe =𝐶

𝐷 (i. e.

advection

diffusion) =

ρ𝑢Δ𝑥

Γ (16)

Pe = 1/2 Pe = 4

In the second case, there are considerable “wiggles” in the solution.

Mathematically, when the cell Peclet number Pe is bigger than 2, the 𝑎𝐸 coefficient becomes

negative, meaning that, for example, an increase in ϕ𝐸 would lead to a decrease in ϕ𝑃. This is

impossible for a quantity that is simply advected and diffused.

P Ee

P

E

e

Page 8: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 8 David Apsley

Physically, the advection process is directional; it transports

quantities only in the direction of the flow. However, the

central-differencing formula assigns equal weights to

upwind and downwind nodes.

4.6.2 Upwind Differencing

In upwind differencing take ϕ𝑓𝑎𝑐𝑒 as the value at whichever is the upwind node:

ϕ𝑒 = {ϕ𝑃 (if 𝑢 > 0)

ϕ𝐸 (if 𝑢 < 0)

If subscript U denotes the upwind node for that face, then this may be summarised as

ϕface = ϕ𝑈 (17)

This is only first-order accurate in Δ𝑥 (see later), but accounts for the directional nature of

advection.

Substituting into (14) gives

−𝑎𝑊ϕ𝑊 + 𝑎𝑃ϕ𝑃 − 𝑎𝐸ϕ𝐸 = 𝑏𝑃

Where, considering either flow direction:

𝑎𝐸 = max(−𝐶𝑒 , 0) + 𝐷𝑒 , 𝑎𝑊 = max(𝐶𝑤, 0) + 𝐷𝑤 𝑎𝑃 = 𝑎𝐸 + 𝑎𝑊 − 𝑠𝑃

(18)

When applied to the advection-diffusion problem of the

previous page:

• for Pe = 1/2, upwind differencing is not as

accurate as central differencing, as expected from

its lower order of accuracy;

• for Pe = 4 (see right) the upwind-differencing

solution is not particularly accurate, but the

“wiggles” disappear.

In all cases, 𝑎𝑊 and 𝑎𝐸 are unconditionally positive.

So there is a pay-off: accuracy versus boundedness (no wiggles). After a brief digression to 2

and 3 dimensions, we define general discretisation properties and examine more advanced

advection schemes.

u

diffusion only

advection +diffusion

P E

e

P

E

e

Page 9: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 9 David Apsley

fluxefluxw source

fluxn

sflux

4.7 Extension to 2 and 3 Dimensions

In multiple dimensions, the net flux involves more faces; e.g.

(flux𝑒 − flux𝑤) + (flux𝑛 − flux𝑠) + (flux𝑡 − flux𝑏) = source (19)

(Flux here refers to a “forward” flux; i.e. in the direction of the relevant coordinate).

The discretised equations are still of the same form:

𝑎𝑃ϕ𝑃 −∑𝑎𝐹ϕ𝐹𝐹

= 𝑏𝑃 (20)

but the sum includes nodes in the other directions. Combining the

individual equations from all control volumes gives a matrix equation

of the same form as in one dimension, but more non-zero bands. Whilst

the matrix equation is almost as easy to write down in 2 or 3 dimensions,

it is now much harder to solve (see Section 4.12).

4.8 General Discretisation Properties

(i) Consistency

A numerical approximation is consistent if it tends to the correct continuum equation as the

grid size tends to zero. For example, from the definition of a derivative:

ϕ𝐸 − ϕ𝑃Δ𝑥

is a consistent approximation for ∂ϕ

∂𝑥

(ii) Conservativeness

A scheme is conservative if fluxes are associated with faces, not cells,

so that what goes out of one cell goes into the adjacent cell.

This is automatically built into the finite-volume method. Computationally, fluxes are first

calculated at faces and then distributed to the relevant cells on either side.

(iii) Transportiveness

An advection scheme is transportive if it is upstream-biased. In practice, this means more

upstream nodes and/or higher weighting to nodes on the upstream side of a face.

(iv) Boundedness

A flux-differencing scheme is bounded (i.e. creates no local peaks) if, in an advection-diffusion

problem without sources:

• ϕ at a node always lies between maximum and minimum values at surrounding nodes;

• ϕ = 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡 is a possible solution.

= b

flux

Page 10: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 10 David Apsley

This imposes conditions on the matrix coefficients. If there are no sources then

𝑎𝑃ϕ𝑃 −∑𝑎𝐹ϕ𝐹 = 0 (21)

Suppose that ϕ is only non-zero at one adjacent node, F. Then

𝑎𝑃ϕ𝑃 − 𝑎𝐹ϕ𝐹 = 0 or ϕ𝑃 =𝑎𝐹𝑎𝑃ϕ𝐹

Since ϕ𝑃 must lie between 0 and ϕ𝐹, this requires that

0 ≤𝑎𝐹𝑎𝑃≤ 1

Hence, 𝑎𝐹 and 𝑎𝑃 must have the same sign (invariably positive in practice). Thus, we require:

𝑎𝐹 ≥ 0 for all 𝐹 (“positive coefficients”) (22)

(Contravening of the positivity condition leads central differencing to produce “wiggles”.)

If equation (21) is also to admit the solution ϕ = 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡 then (in the absence of sources):

𝑎𝑃 =∑𝑎𝐹 (“sum of neighbouring coefficients”) (23)

(v) Stability

A solution method (not an advection scheme) is stable if small errors do not grow in the course

of the calculation. This determines whether it is possible to obtain a converged solution: it says

nothing about its accuracy or whether it is bounded. Stability is strongly influenced by how the

source term is discretised.

If the source term is linearised as 𝑏𝑃 + 𝑠𝑃ϕ𝑃 then the complete equation for one cell is

𝑎𝑃ϕ𝑃 − ∑𝑎𝐹ϕ𝐹 = 𝑏𝑃 + 𝑠𝑃ϕ𝑃

If the solution-dependent part of the source, 𝑠𝑃ϕ𝑃, is transferred to the LHS then the diagonal

coefficient becomes

𝑎𝑃 =∑𝑎𝐹 − 𝑠𝑃 (24)

Numerical stability requires negative feedback; otherwise, an increase in ϕ would lead to an

increase in the source, which would lead to a further increase in ϕ and so on. Thus:

𝑠𝑃 ≤ 0 (“negative-slope linearisation of the source term”) (25)

If this condition and the positivity of the 𝑎𝐹 is maintained then

𝑎𝑃 ≥∑|𝑎𝐹| (“diagonal dominance”) (26)

The last condition is also a requirement of many iterative matrix solution algorithms.

To summarise, boundedness and stability place the following constraints on the discretisation

of flux and source terms:

Page 11: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 11 David Apsley

positive coefficients: 𝑎𝐹 ≥ 0 for all 𝐹

negative-slope linearisation of the source term: source = 𝑏𝑃 + 𝑠𝑃ϕ𝑃, 𝑠𝑃 ≤ 0

sum of neighbouring coefficients: 𝑎𝑃 = ∑ 𝑎𝐹 − 𝑠𝑃𝐹

(vi) Order

Order is a measure of accuracy. It defines how fast the error in a numerical approximation

diminishes as the grid spacing gets smaller.

Definition

If, on a uniform grid of spacing Δ𝑥, the truncation error is proportional to Δ𝑥𝑛 as Δ𝑥 → 0 then

that scheme is said to be of order 𝑛.

Order can be established formally by a Taylor-series expansion about a

cell face. e.g. for the nodes either side of the east face:

ϕ𝐸 = ϕ𝑒 + (dϕ

d𝑥)𝑒(Δ𝑥

2) +

1

2!(d2ϕ

d𝑥2)𝑒

(Δ𝑥

2)2 +

1

3!(d3ϕ

d𝑥3)𝑒

(Δ𝑥

2)3 + ⋯ (27)(a)

ϕ𝑃 = ϕ𝑒 − (dϕ

d𝑥)𝑒(Δ𝑥

2) +

1

2!(d2ϕ

d𝑥2)𝑒

(Δ𝑥

2)2 −

1

3!(d3ϕ

d𝑥3)𝑒

(Δ𝑥

2)3 + ⋯ (27)(b)

Subtracting (27)(a) – (b) gives:

ϕ𝐸 − ϕ𝑃 = 0 + (dϕ

d𝑥)𝑒Δ𝑥 + 0 +

1

3(d3ϕ

d𝑥3)𝑒

(Δ𝑥

2)3 + ⋯

whence,

ϕ𝐸 − ϕ𝑃Δ𝑥

= (dϕ

d𝑥)𝑒+ O(Δ𝑥2) (28)

O(Δ𝑥2) actually has a very precise mathematical meaning (look up “big-O notation”), but you

can read it here as “of the order of Δ𝑥2”. As the error term is O(Δ𝑥2),

ϕ𝐸 − ϕ𝑃Δ𝑥

is a second-order approximation for (dϕ

d𝑥)𝑒

Alternatively, adding (27)(a) + (b) gives:

ϕ𝑃 + ϕ𝐸 = 2ϕ𝑒 + 0 + (d2ϕ

d𝑥2)𝑒

(Δ𝑥

2)2 + ⋯

whence:

1

2(ϕ𝑃 + ϕ𝐸) = ϕ𝑒 + O(Δ𝑥

2) (29)

P Ee

x

Page 12: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 12 David Apsley

As the error term is O(Δ𝑥2), the central-differencing formula 1

2(ϕ𝑃 + ϕ𝐸) is a second-order

approximation for ϕ𝑒.

By contrast, the upwind-differencing approximations ϕ𝑃 or ϕ𝐸 (depending on the direction of

the flow) are first-order accurate approximations for ϕ𝑒.

Higher accuracy requires use of more nodes.

Schemes of low-order accuracy, e.g. upwind, lead to substantial numerical diffusion in 2-d and

3-d calculations when the velocity vector is not aligned with the grid lines.

Note:

• Order is an asymptotic concept; i.e. it refers to behaviour as Δ𝑥 → 0. In this limit, only

the first non-zero truncation term in the Taylor series is important. However, the full

expansion includes terms of higher order, which may be non-negligible for finite Δ𝑥.

• Order refers to the theoretical truncation error in the approximation, not the computer’s

round-off error (the accuracy with which it can store floating-point numbers).

• The higher the order of a scheme then, in principle, the greater the reduction in

numerical error as the grid is made finer, or, conversely, the coarser the grid required

for a given accuracy. However, high-order schemes tend to require more computational

resources and often have boundedness or stability problems. Also, the “law of

diminishing returns” applies once the truncation error is of similar size to the

computer’s round-off error.

Page 13: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 13 David Apsley

4.9 Discretising Advection (Part 2)

4.9.1 Exponential Scheme (Patankar, 1980)

If there are no sources (𝑠 = 0) then the total flux must be constant:

flux = ρ𝑢𝐴ϕ − Γ𝐴dϕ

d𝑥 = constant

If ρ, 𝑢, 𝐴 and Γ are constant this first-order differential equation can be solved exactly, with

boundary conditions ϕ = ϕ𝑃 and ϕ = ϕ𝐸 at adjacent nodes, to give (see the Examples):

flux𝑒 = 𝐶 (ePeϕ𝑃 −ϕ𝐸ePe − 1

)

where 𝐶 = ρ𝑢𝐴 is the mass flux and

Pe =ρ𝑢Δ𝑥

Γ

is the Peclet number.

.

With a similar expression for the west face, we get

flux𝑒 − flux𝑤 = 𝑎𝑃ϕ𝑃 −∑𝑎𝐹ϕ𝐹

𝑎𝑊 =𝐶ePe

ePe − 1 , 𝑎𝐸 =

𝐶

ePe − 1 , 𝑎𝑃 = 𝑎𝐸 + 𝑎𝑊 (30)

Assessment:

• Transportive, because there is a larger weighting on the upwind node.

• Bounded: all 𝑎𝐹 are positive and 𝑎𝑃 is the sum of the neighbouring coefficients.

(To see these, consider separately the cases 𝐶 > 0 (ePe > 1) and 𝐶 < 0 (ePe < 1).

This scheme, by construction, gives the exact solution for zero sources and constant velocity

and diffusivity ... but this is something we could have found analytically anyway. The scheme

has never really found favour because:

• the scheme is not exact when 𝑢 or Γ vary, or if there are sources, or in 2-d or 3-d flow;

• exponentials are expensive to compute.

flux efluxw

x

area A

source

P Ee

Page 14: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 14 David Apsley

For the following 3-point advection schemes we use notation ϕ𝐷, ϕ𝑈

and ϕ𝑈𝑈 for the Downwind, Upwind and Upwind-Upwind nodes at any

particular face. Which nodes these are depends on the flow direction.

4.9.2 LUD (Linear Upwind Differencing, or “Second-Order Upwind”)

This scheme extrapolates from the two immediately upwind nodes. On a uniform grid:

ϕface = ϕ𝑈 +1

2(ϕ𝑈 −ϕ𝑈𝑈) (31)

or

ϕface =3

2ϕ𝑈 −

1

2ϕ𝑈𝑈

For example, if 𝑢 > 0 on the east face then:

ϕ𝑒 =3

2ϕ𝑃 −

1

2ϕ𝑊

whereas, if 𝑢 < 0:

ϕ𝑒 =3

2ϕ𝐸 −

1

2ϕ𝐸𝐸

Assessment

• 2nd-order accurate.

• Transportive (upwind bias in the choice of nodes).

• Not bounded (although solution-dependent limiters can be applied to remedy this).

Extension to unstructured grids

On a non-uniform cartesian grid, the extrapolation (31) can be generalised as

ϕface = ϕ𝑈 + (𝑥face − 𝑥𝑈) (dϕ

d𝑥)𝑈

(32)

where the last bracket is an estimate of the derivative at the upwind node.

This can be generalised even further to multiple dimensions in unstructured grids:

ϕface = ϕ𝑈 + (xface − x𝑈) • (∇ϕ)𝑈 (33)

where ϕ ≡ (𝜕ϕ/𝜕𝑥, 𝜕ϕ/𝜕𝑦, 𝜕ϕ/𝜕𝑧) is the cell-averaged gradient of ϕ (see Section 9)

evaluated in the upwind cell. This is used as a second-order upwind scheme in unstructured-

grid codes, although it is common to limit the departure from first-order upwind differencing

in order to maintain boundedness (see Section 4.9.4 below).

W P E

P E EE

e

W

P

e

E

P

e

E

EE

u > 0

u < 0

e

UU UD

face

Page 15: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 15 David Apsley

4.9.3 QUICK (QUadratic Interpolation for Convective Kinematics)

This fits a quadratic quadratic polynomial through ϕ𝐷, ϕ𝑈 and ϕ𝑈𝑈:

ϕface = −1

8ϕ𝑈𝑈 +

3

4ϕ𝑈 +

3

8ϕ𝐷 (34)

For example, if 𝑢 > 0 on the east face then:

ϕ𝑒 = −1

8ϕ𝑊 +

3

4ϕ𝑃 +

3

8ϕ𝐸

whereas, if 𝑢 < 0:

ϕ𝑒 = −1

8ϕ𝐸Ε +

3

4ϕ𝐸 +

3

8ϕ𝑃

Assessment

• 3rd-order accurate.

• Transportive (upwind bias in the selection of the third node and relative weightings).

• Not bounded; (for example, if 𝑢 > 0 then 𝑎𝐸 is negative – see the Examples).

4.9.4 Flux-Limited Schemes

For all schemes above, weights are constants (i.e. independent of solution ϕ). The only

unconditionally-bounded scheme of this type is first-order upwind differencing. Schemes such

as QUICK, which fit a polynomial through several points, are prone to generate cell-face values

lying outside the range of ϕ𝐷, ϕ𝑈 and ϕ𝑈𝑈. To prevent this, modern schemes employ solution-

dependent limiters, which enforce boundedness while trying to retain high-order accuracy.

For three-point schemes, ϕ is said to be:

monotonic increasing if ϕ𝑈𝑈 < ϕ𝑈 < ϕ𝐷,

monotonic decreasing if ϕ𝑈𝑈 > ϕ𝑈 > ϕ𝐷.

One necessary condition for boundedness is that the

schemes must fall back to first-order upwinding

(ϕ𝑓𝑎𝑐𝑒 = ϕ𝑈) if ϕ is not locally monotonic (either

increasing or decreasing). Monotonic variation in ϕ may

be gauged by whether the changes between successive

pairs of nodes have the same sign; i.e.

monotonic ⇔ (ϕ𝐷 − ϕ𝑈)(ϕ𝑈 − ϕ𝑈𝑈) ≥ 0

Such schemes can be written (in the notation of Versteeg and Malalasakera, if not in the manner

in which they are programmed!) as the sum of the upstream value and a solution-dependent

fraction of the downstream-upstream difference:

UU U D

monotonic

non-monotonic

UU U D

UU UD

face

W P E

P E EE

e

W

P

e

E

P

e

E

EE

u > 0

u < 0

e

Page 16: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 16 David Apsley

ϕface = {ϕ𝑈 +

1

2ψ(𝑟)(ϕ𝐷 − ϕ𝑈) if monotone

ϕ𝑈 otherwise

where 𝑟 is the ratio of successive differences (> 0 where monotonic):

𝑟 =ϕ𝑈 − ϕ𝑈𝑈ϕ𝐷 − ϕ𝑈

The limiter ψ(𝑟) is given below for some common schemes. In all, ψ(𝑟) = 0 when 𝑟 < 0.

Scheme ψ(𝑟) (for 𝑟 > 0)

UMIST min{2, 2𝑟,1

4(1 + 3𝑟),

1

4(3 + 𝑟)}

Upstream Monotonic Interpolation for Scalar

Transport (Lien and Leschziner, 1993). Limited

variant of QUICK; 3rd-order where monotonic.

Harmonic 2𝑟

1 + 𝑟

Van Leer (1974).

Second-order where monotonic.

Min-mod min(r,1) Roe (1985)

Van Albada

et al

𝑟 + 𝑟2

1 + 𝑟2 Van Albada et al., (1982)

All these schemes are (i) bounded; and (ii) non-linear (i.e. matrix elements are functions of the

solution ϕ). The latter means that an iterative solution is inevitable.

Page 17: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 17 David Apsley

Classroom Example 4. (Exam 2020 – part)

The figure shows a single line of cells in a structured mesh. The values of a transported scalar

ϕ at cell-centre nodes are given below the figure.

ϕ𝑊𝑊 = 1, ϕ𝑊 = 4, ϕ𝑃 = 5, ϕ𝐸 = 7, ϕ𝐸𝐸 = 3

(a) The Van Leer harmonic advection scheme is defined (for the immediate upstream and

downstream nodes, U and D respectively) by:

ϕface = ϕ𝑈 +1

2ψ(𝑟)(ϕ𝐷 − ϕ𝑈)

ψ(𝑟) = { 2𝑟

1 + 𝑟 if 𝑟 > 0

0 otherwise

𝑟 =ϕ𝑈 − ϕ𝑈𝑈ϕ𝐷 − ϕ𝑈

Calculate the values of ϕ on the cell faces marked e and w in the figure using the Van Leer

advection scheme if the velocity component 𝑢 is:

(i) positive;

(ii) negative.

(b) Repeat part (a) for the Van Albada et al. scheme, specified by

ψ(𝑟) = { 𝑟 + 𝑟2

1 + 𝑟2 if 𝑟 > 0

0 otherwise

P E EEWWW

ew

x

Page 18: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 18 David Apsley

4.10 Implementation of Advanced Advection Schemes

The general steady-state scalar-transport equation is

∑(

faces

mass flux × ϕ −Γ∂ϕ

∂𝑛𝐴 ) = 𝑆

advection diffusion source

(35)

If 𝐶𝑓 and 𝐷𝑓 are, respectively, the outward mass flux and diffusive transport

coefficient on face f, then, with standard discretisation for diffusion and

sources,

∑[𝐶𝑓ϕ𝑓 +𝐷𝑓(ϕ𝑃 − ϕ𝐹)] = 𝑏𝑃 + 𝑠𝑃ϕ𝑃 (36)

It is convenient to first subtract (Σ𝐶𝑓)ϕ𝑃 (which is 0, by mass conservation) from the LHS:

∑[𝐶𝑓(ϕ𝑓 − ϕ𝑃) + 𝐷𝑓(ϕ𝑃 − ϕ𝐹)] = 𝑏𝑃 + 𝑠𝑃ϕ𝑃 (37)

An advection scheme specifies cell-face value ϕ𝑓. Because many matrix algorithms require

positive coefficients and diagonal dominance, separate this into upwind + correction; i.e.

ϕ𝑓 = ϕ𝑈 + (ϕ𝑓 − ϕ𝑈)

Then, for the advective flux,

𝐶𝑓(ϕ𝑓 − ϕ𝑃) = 𝐶𝑓(ϕ𝑈 − ϕ𝑃)⏟ upwind

+𝐶𝑓(ϕ𝑓 − ϕ𝑈)⏟ correction

= max(−𝐶𝑓 , 0)(ϕ𝑃 − ϕ𝐹) +𝐶𝑓(ϕ𝑓 − ϕ𝑈) (38)

The first part of (38) gives the same positive matrix coefficient as upwind differencing:

𝑎𝐹 = max(−𝐶𝑓 , 0) + 𝐷𝑓 (39)

The latter part of (38) is transferred to the RHS of the equation as a deferred correction;

(“deferred” because it is treated explicitly and won’t be updated until the next iteration):

∑𝑎𝐹(ϕ𝑃 − ϕ𝐹)

𝐹

= 𝑏𝑃 + 𝑠𝑃ϕ𝑃− ∑ 𝐶𝑓(ϕ𝑓 − ϕ𝑈)

faces⏟ deferred correction

(40)

P Ff

Page 19: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 19 David Apsley

4.11 Boundary Conditions

The most common types of boundary condition are:

• value ϕ specified (Dirichlet boundary condition);

e.g. velocity at inflow, or temperature fixed at some surface;

• gradient 𝜕ϕ/𝜕𝑛 specified (Neumann boundary condition).

e.g. 𝜕ϕ/𝜕𝑛 = 0 on a symmetry plane, or at an outflow boundary.

In the finite-volume method, both types of boundary condition can be implemented by

transferring the boundary flux to the source term.

For a cell abutting a boundary:

flux + fluxboundary = so𝑢𝑟𝑐𝑒

ϕ𝑃 − ∑ notboundary

𝑎𝐹ϕ𝐹 = 𝑏𝑃 − fluxboundary

There are two modifications:

• the 𝑎𝐹 coefficient in the direction of the boundary is set to 0;

• the outward boundary flux is subtracted from the source terms.

If 𝑓𝑙𝑢𝑥(ϕ) is specified on the boundary, then this is immediate. If ϕ itself is fixed on the

boundary node B then, with Δ𝑥 the width of the cell and hence Δ𝑥/2 the distance between

boundary and internal nodes,

flux(ϕ) = −Γ𝐴∂ϕ

∂𝑥|boundary

→ −Γ𝐴 (ϕ𝐵 − ϕ𝑃12Δ𝑥

) = −2𝐷(ϕ𝐵 −ϕ𝑃)

To subtract this flux from the source term requires a simple change of coefficients:

𝑏𝑃 → 𝑏𝑃 + 2𝐷ϕ𝐵 , 𝑠𝑃 → 𝑠𝑃 − 2𝐷 (41)

(The above uses a biased, and hence first-order, approximation for the gradient of ϕ at the

boundary. A second-order approximation using so-called “ghost nodes” is possible, but the

extra complexity is not merited where diffusion is much smaller than advection.)

2 3 4 NI-1NI-2NI-3

boundary

boundary

P B

boundary

Page 20: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 20 David Apsley

4.12 Solution of Matrix Equations

The discretisation of a single scalar-transport equation over a single control volume produces

an algebraic equation of the form

𝑎𝑃ϕ𝑃 −∑𝑎𝐹ϕ𝐹 = 𝑏𝑃

where the summation is over adjacent nodes. Combining the equations for all control volumes

produces a set of simultaneous equations, i.e. a matrix equation:

AΦ = b

where Φ is the vector of nodal values. Matrix A is sparse (i.e. has only a few non-zero elements)

and, in general, a function of the solution Φ (so must be solved iteratively). Many solution

methods are available; some of the simpler ones are described below.

4.12.1 Matrix Solution Algorithms

Gaussian Elimination

This is a direct (i.e. non-iterative) method. It consists of row operations to obtain zeros below

the main diagonal (upper-triangular matrix), followed by back-substitution.

In general, it is inefficient because it tends to fill in sparse matrices (tridiagonal systems are an

important exception), whilst for fluid-flow problems the matrix elements vary with the

solution, so that an iterative solution is necessary anyway.

Gaussian elimination is OK for small matrices with constant coefficients, but not recommended

for large equation sets or non-linear systems that must be solved iteratively.

Gauss-Seidel

Rearrange the equation for each control

volume as an iterative update for each node in

terms of the surrounding nodal values. Then

repeatedly cycle through the entire set of

equations until convergence is achieved.

For example, in 2 dimensions:

𝑎𝑆ϕ𝑆 − 𝑎𝑊ϕ𝑊 + 𝑎𝑃ϕ𝑃 − 𝑎𝐸ϕ𝐸 − 𝑎𝑁ϕ𝑁 = 𝑏𝑃

gives an iterative formula

ϕ𝑃 =1

𝑎𝑃(𝑏𝑃 + 𝑎𝑆ϕ𝑆

∗ + 𝑎𝑊ϕ𝑊∗ + 𝑎𝐸ϕ𝐸

∗ + 𝑎𝑁ϕ𝑁∗ )

where an asterisk * denotes the “most recent” value.

Gauss-Seidel is simple to code and is often used for unstructured grids. However, it tends to

converge slowly for large matrices and may require substantial under-relaxation (see below).

P

N

S

W E

direction of sweep

Page 21: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 21 David Apsley

Classroom Example 5.

(a) Show how Gauss-Seidel can be used to solve the following matrix equation iteratively, and

conduct 3 Gauss-Seidel sweeps.

(

4 −1 0 0−1 4 −1 00 −1 4 −10 0 −1 4

) (

𝐴𝐵𝐶𝐷

) = (

24613

)

Write a computer program (using any programming language) to solve this iteratively.

(b) Now try to do the same for the matrix equation (which actually has the same solution):

(

1 −4 0 0−4 1 −4 00 −4 1 −40 0 −4 1

) (

𝐴𝐵𝐶𝐷

) = (

−7−14−21−8

)

Why does Gauss-Seidel not converge in this case?

Line-Iterative Procedures (“Line Gauss-Seidel”)

Along any one coordinate line, the system is tri-diagonal;

e.g. in the 𝑖-direction:

−𝑎𝑊ϕ𝑊 + 𝑎𝑃ϕ𝑃 − 𝑎𝐸ϕ𝐸 = 𝑏𝑃 − ∑ 𝑎𝐹ϕ𝐹∗

𝑛𝑜𝑡𝑊,𝐸

Thus, using the tri-diagonal matrix algorithm a whole line can be updated at one go and

information can propagate right across the domain in one iteration. A typical single iteration

would consist of applying the update for each successive 𝑖 line, then for each successive 𝑗 line,

then for each successive 𝑘 line.

This is probably the most popular method for block-structured grids, and is the basis of most

of our in-house research codes. Note, however, that it doesn’t work for unstructured grids.

PW E

S

N

direct

ion

of sw

eep

= b - *

Page 22: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 22 David Apsley

4.12.2 Convergence Criteria

For any individual cell the residual is the error (LHS minus RHS) in its discretised equation:

res = 𝑎𝑃ϕ𝑃 − ∑ 𝑎𝐹ϕ𝐹 − 𝑏𝑃𝐹

Iteration stops when the total residual error becomes less than some small, user-defined

tolerance. The total residual error is a suitably-weighted sum over the errors for all cells; e.g.

sum of absolute residuals: ∑|res|

cells

root-mean-square (rms) error: √1

𝑁∑(res)2

cells

The tolerance is a matter of judgement. To avoid dependence on units it is often set to a small

fraction (e.g. 10–4) of the error at the first iteration.

4.12.3 Under-Relaxation

If iterative algebraic methods are applied to non-linear, coupled equations, then large changes

in variables over an iteration may cause instability. To overcome this, under-relaxation applies

only a fraction of the projected change at each iteration. Since incremental changes vanish as

the solution is approached, under-relaxation makes no difference to the final result.

The discretised scalar-transport equation for one cell:

𝑎𝑃ϕ𝑃 −∑𝑎𝐹ϕ𝐹 = 𝑏𝑃 or ϕ𝑃 =∑𝑎𝐹ϕ𝐹 + 𝑏𝑃

𝑎𝑃

This can be written as the sum of the previous iterate plus the change in ϕ:

ϕ𝑃 = ϕ𝑃prev

+ (∑𝑎𝐹ϕ𝐹 + 𝑏𝑃

𝑎𝑃− ϕ𝑃

prev)

If, instead, only a fraction α of the projected change in ϕ is applied then

ϕ𝑃 = ϕ𝑃prev

+ α (∑𝑎𝐹ϕ𝐹 + 𝑏𝑃

𝑎𝑃− ϕ𝑃

prev)

α is called an under-relaxation factor.

The equation can then be rearranged back as

𝑎𝑃ϕ𝑃 −∑α𝑎𝐹ϕ𝐹 = α𝑏𝑃 + (1 − α)𝑎𝑃ϕ𝑃prev

𝑎𝑃αϕ𝑃 −∑𝑎𝐹ϕ𝐹 = 𝑏𝑃 + (1 − α)

𝑎𝑃αϕ𝑃

prev

Hence, under-relaxation is easily implemented by modifying coefficients:

Page 23: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 23 David Apsley

𝑎𝑃 → 𝑎′𝑃 =

𝑎𝑃α

𝑏𝑃 → 𝑏′𝑃 = 𝑏𝑃 + (1 − α)𝑎′𝑃ϕ𝑃prev

(42)

This makes the equations more diagonally dominant (𝑎𝑃 larger), improving stability. Note that,

whilst some under-relaxation is necessary to prevent divergence, too much under-relaxation

will slow down convergence.

Summary

• The generic scalar-transport equation for a control volume has the form

rate of change + net outward flux = source

• Flux means rate of transport through a surface and consists of:

advection: transport with the flow;

diffusion: net transport by molecular or turbulent fluctuations.

• Discretisation of the (steady) scalar-transport equation yields a linear equation:

𝑎𝑃ϕ𝑃 −∑𝑎𝐹ϕ𝐹𝐹

= 𝑏𝑃

for each control volume, where the summation is over adjacent nodes.

• The collection of these simultaneous equations on a structured mesh yields a matrix

equation with limited bandwidth (i.e. few non-zero diagonals), typically solved by

iterative methods such as Gauss-Seidel or line-Gauss-Seidel.

• Source terms are linearised as

𝑏𝑃 + 𝑠𝑃ϕ𝑃

where, for negative feedback, 𝑠𝑃 ≤ 0.

• Diffusive fluxes are usually discretised by central differencing; e.g.

Γ∂ϕ

∂𝑥|𝑒𝐴 → −

Γ𝐴

Δ𝑥(ϕ𝐸 − ϕ𝑃)

• Advection schemes are means of approximating ϕ on cell faces in order to compute

advective fluxes. They include upwind, central, exponential, LUD, QUICK, and

various flux-limited schemes.

• General desirable properties for a numerical scheme:

consistency

conservativeness

boundedness

stability

transportiveness

high order

Page 24: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 24 David Apsley

• Boundedness and stability impose certain constraints on matrix coefficients:

𝑎𝐹 ≥ 0 for all F (“positive coefficients”)

𝑠𝑃 ≤ 0 (“negative feedback”)

𝑎𝑃 = ∑ 𝑎𝐹𝐹 − 𝑠𝑃 (“sum of the neighbouring coefficients”)

• To ensure positive coefficients (and implement non-linear schemes), advective fluxes

are often decomposed into

upwind + deferred correction

The latter is transferred to the source and treated explicitly (fixed for this iteration).

• Boundary conditions are implemented by transferring boundary fluxes to the source.

• Under-relaxation is usually required to solve coupled and/or non-linear equations.

References

Leonard, B.P., 1979, A stable and accurate convective modelling procedure based on quadratic

upstream interpolation, Comput. Meth. Appl. Mech. Engng, 19, 59-98.

Lien, F.S. and Leschziner, M.A., 1993, Upstream monotonic interpolation for scalar transport

with application to complex turbulent flows, Int. J. Numer. Methods Fluids, 19, 293-

312.

Patankar, S.V., 1980, Numerical Heat Transfer and Fluid Flow, McGraw-Hill.

Roe, P.L., 1985, Some contributions to the modelling of discontinuous flows, Lectures in

Applied Mechanics, 22, Springer-Verlag, 163-193.

Spalding, D.B., 1972, A novel finite-difference formulation for different expressions involving

both first and second derivatives, Int. J. Numer. Meth. Engng, 4, 551-559.

Sweby, P.K., High resolution schemes using flux limiters for hyperbolic conservation laws,

SIAM J. Numer. Anal., 21, 995-1011.

Van Albada, G.D., Van Leer, B. and Roberts, W.W., 1982, A comparative study of

computational methods in cosmic gas dynamics, Astron. Astrophys., 108, 76-84.

Van Leer, B., 1974, Towards the ultimate conservative difference scheme II: monotonicity and

conservation combined in a second-order scheme, J. Comput. Phys., 14, 361-370.

Versteeg, H.K. and Malalasekera, W., 2007, An Introduction to Computational Fluid

Dynamics: The Finite Volume Method, 2nd Edition, Pearson.

Page 25: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 25 David Apsley

Appendix: Tri-Diagonal Matrix Algorithm

System of equations (note the signs!):

−𝑎𝑖ϕ𝑖−1 + 𝑏𝑖ϕ𝑖 − 𝑐𝑖ϕ𝑖+1 = 𝑑𝑖 , 𝑖 = 1,… ,𝑁

By assumption, 𝑎1 = 𝑐𝑁 = 0.

Forward pass:

𝑃0 = 0, 𝑄0 = ϕ0

𝑃𝑖 =𝑐𝑖

𝑏𝑖 − 𝑎𝑖𝑃𝑖−1, 𝑄𝑖 =

𝑑𝑖 + 𝑎𝑖𝑄𝑖−1𝑏𝑖 − 𝑎𝑖𝑃𝑖−1

, 𝑖 = 1,… ,𝑁

Backward pass:

ϕ𝑖 = 𝑃𝑖ϕ𝑖+1 + 𝑄𝑖, 𝑖 = 𝑁,… , 1

This is guaranteed to converge if the coefficients are non-negative and diagonally dominant:

𝑎𝑖 ≥ 0, 𝑐𝑖 ≥ 0, 𝑎𝑖 + 𝑐𝑖 ≤ 𝑏𝑖 for all 𝑖,

except in the degenerate case where zero 𝑎𝑖 or 𝑐𝑖 allow successive rows to be multiples of each

other and the matrix is consequently singular (rank < 𝑁).

Exercise: In a programming language of your choice, code your own tridiagonal solver; test it

on the classroom examples.

=

−−

N

i

N

i

NN

iii

d

d

d

ba

cba

cb

1111

00

0

00

0

00

Page 26: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 26 David Apsley

Examples

Q1.

Consider the uniform, one-dimensional arrangement of nodes shown right. Face e lies half-way

between P and E nodes.

(a) Show that the central-differencing schemes

ϕ𝑒 ≈1

2(ϕ𝑃 +ϕ𝐸)

(dϕ

d𝑥)𝑒≈ϕ𝐸 − ϕ𝑃Δ𝑥

are second-order approximations for ϕ𝑒 and (dϕ/d𝑥)𝑒 respectively.

(b) Making use of the W and EE nodes also, find symmetric fourth-order approximations

for ϕ𝑒 and (dϕ/d𝑥)𝑒.

Q2.

(a) By fitting a quadratic function (𝑥) to values ϕ𝑊 , ϕ𝑃 and ϕ𝐸 at 𝑥 = −3

2Δ𝑥, 𝑥 = −

1

2Δ𝑥

and 𝑥 =1

2Δ𝑥, and taking its value at 𝑥 = 0, deduce the formula for the QUICK

advection scheme (in the case of positive 𝑥-velocity):

ϕ𝑒 = −1

8ϕ𝑊 +

3

4ϕ𝑃 +

3

8ϕ𝐸

(b) By expanding ϕ𝑊 , ϕ𝑃 and ϕ𝐸 as Taylor series in terms of ϕ and its derivatives at cell

face e, show that requiring a constant-coefficient combination of these to be third-order

accurate leads to the same expression as in part (a).

Q3.

If the continuity (mass-conservation) equation were to be regarded as a special case of the

general scalar-transport equation, what would be the expressions for ϕ, Γ and 𝑆?

Q4. (From Patankar, 1980)

The source term for a dependent variable ϕ is given by 2 − 3|ϕ𝑃|ϕ𝑃. If this term is to be

linearised as 𝑏𝑃 + 𝑠𝑃ϕ𝑃, comment on the following practices (ϕ𝑃∗ denotes the value from the

previous iteration):

(a) 𝑏𝑃 = 2 − 3|ϕ𝑃∗ |ϕ𝑃

∗ , 𝑠𝑃 = 0

(b) 𝑏𝑃 = 2 − 3ϕ𝑃∗ 2, 𝑠𝑃 = 0

(c) 𝑏𝑃 = 2 − 4|ϕ𝑃∗ |ϕ𝑃

∗ , 𝑠𝑃 = |ϕ𝑃∗ |

(d) 𝑏𝑃 = 2 , 𝑠𝑃 = −3|ϕ𝑃∗ |

W EP EEe

x

3 x

Page 27: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 27 David Apsley

Q5. (Exam 2016)

A 2-d finite-volume calculation is to be undertaken for fully-

developed, laminar flow between plane, parallel walls. The upper

wall is moving at speed 𝑈0, whilst the lower wall is stationary. A

streamwise pressure gradient d𝑝/d𝑥 = −𝐺 is imposed.

The depth of the channel, 𝐻, is divided into 𝑁 equally-sized cells of

dimension Δ𝑥 × Δ𝑦 × 1 as shown, with the velocity 𝑢 stored at the

centre of each cell.

(a) What are the boundary conditions for velocity on the upper and lower walls?

(b) Find the net pressure force on a single cell in terms of 𝐺 and the cell dimensions.

(c) Write down a second-order approximation for the shear stress τ on the upper face of

the 𝑗th internal cell, in terms of the velocities 𝑢𝑗 and 𝑢𝑗+1.

(d) Write down approximations for τ on the upper and lower walls.

(e) By balancing pressure and viscous forces set up the finite-volume equations for

velocity. (Separate equations are required for internal and boundary cells).

(f) Solve your equations for the nodal velocities in the particular case

𝑁 = 4, 𝐺𝐻2

μ𝑈0= 2

leaving your answers in terms of 𝑈0.

Q6.

Consider the advection-diffusion equation with no sources (and unit cross-sectional area):

d

d𝑥(ρ𝑢𝐴ϕ − Γ𝐴

d𝑥) = 0

, 𝑢, 𝐴, are constants. If ϕ = ϕ𝑃 at 𝑥 = 0 and ϕ = ϕ𝐸 at 𝑥 = Δ𝑥, find the value of the flux

ρ𝑢𝐴ϕ − Γ𝐴dϕ

d𝑥

at any point between 𝑥 = 0 and Δ𝑥.

This is the basis of the exponential differencing scheme.

U0

u1

j-1u

ju

j+1u

Nu

y

x

H

Page 28: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 28 David Apsley

Q7.

The QUICK scheme fits a quadratic function to three nodal values to

estimate the value of a scalar at a cell face, according to

ϕface = −1

8ϕ𝑈𝑈 +

3

4ϕ𝑈 +

3

8ϕ𝐷

(a) For a two-dimensional problem, write down expressions for

ϕ𝑒 , ϕ𝑤, ϕ𝑛, ϕ𝑠,

in terms of the values at neighbouring nodes, assuming that velocity components 𝑢 and

𝑣 are known, constant and positive.

(b) Neglecting diffusion, and assuming a uniform source 𝑠 per unit volume, derive an

algebraic discretisation of the conservation equation

∑(outward flux) = source

in the form

𝑎𝑃ϕ𝑃 − ∑𝑎𝐹ϕ𝐹 = 𝑏𝑃

where the sum is over local nodes. (Assume the cell to be cartesian, with unit depth in

the 𝑧 direction, face areas 𝐴𝑒, 𝐴𝑤, 𝐴𝑛, 𝐴𝑠 and volume 𝑉).

(c) How do the expressions for ϕ𝑤 and ϕ𝑒 change if 𝑢 < 0.

(d) Which of the following properties does the QUICK scheme satisfy:

transportiveness;

boundedness?

(e) Split the QUICK expression for ϕface in the form

“upwind differencing” + “deferred correction”

Why is this decomposition used?

UU UD

face

Page 29: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 29 David Apsley

Q8. (Exam 2015)

In a cell-centred, cartesian, finite-volume scheme the

disposition of nodes in one direction is defined as shown.

The Central scheme estimates scalar ϕ on a cell face by averaging the nodal values either side

of a cell face, so that the value on the east (e) face of the cell P, is

ϕ𝑒 =1

2(ϕ𝑃 + ϕ𝐸)

The LUD scheme estimates ϕ on a cell face by extrapolating from the two upstream nodes, so

that, for flow in the positive 𝑥 direction, the value on the east (e) face of the cell P, is

ϕ𝑒 =3

2ϕ𝑃 −

1

2ϕ𝑊

(a) Define what is meant by the order of a numerical approximation on a discrete mesh.

(b) Show that both Central and LUD schemes are second-order accurate.

(c) By considering a suitably-weighted combination of Central and LUD schemes

construct a third-order-accurate scheme for ϕ𝑒.

(d) By considering a scheme involving W and EE nodes, construct a symmetric fourth-

order-accurate scheme for ϕ𝑒.

(e) For each of Central, LUD and your schemes in (c) and (d) state whether it is

transportive, justifying your answer.

P E EEWWW

ew

x

Page 30: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 30 David Apsley

Q9.

The QUICK advection scheme may be written

ϕface = −1

8ϕ𝑈𝑈 +

3

4ϕ𝑈 +

3

8ϕ𝐷

where downwind (D) and upwind (U, UU) nodes relative to a cell face and direction of flow

are defined right.

(a) Define the terms transportive and bounded when applied to an advection scheme and

state, without proof, whether QUICK is transportive and/or bounded.

(b) Prove that QUICK is 3rd-order accurate (on a uniform mesh).

(c) The values of ϕ at successive nodes of a cell-centred structured mesh are shown in the

figure below. The flow is everywhere from left to right. Using the QUICK scheme find

the values of ϕ on cell faces marked w and e.

ϕ𝑊𝑊 = 1, ϕ𝑊 = 2, ϕ𝑃 = 5, ϕ𝐸 = 3, ϕ𝐸𝐸 = 2

(d) The UMIST scheme is a variant of the QUICK scheme defined by

ϕface = ϕ𝑈 +1

2ψ(𝑟)(ϕ𝐷 − ϕ𝑈)

where

ψ(𝑟) = max [0,min {2, 2𝑟,

1

4(1 + 3𝑟),

1

4(3 + 𝑟)}], 𝑟 =

ϕ𝑈 − ϕ𝑈𝑈ϕ𝐷 − ϕ𝑈

Sketch a graph of ψ against 𝑟, indicating key points. Show that the UMIST scheme

reduces to the QUICK scheme when 1 ≤ 𝑟 ≤ 5.

(e) Find the values of ϕ on faces w and e using the UMIST scheme.

P E EEWWW

ew

x

UU UD

face

Page 31: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 31 David Apsley

Q10.

The general three-point scheme for the cell-face value of a transported scalar ϕ is

ϕface = ϕ𝑈 +1

2ψ(𝑟)(ϕ𝐷 − ϕ𝑈), where 𝑟 =

ϕ𝑈 − ϕ𝑈𝑈ϕ𝐷 − ϕ𝑈

where upstream (U) and downstream (D) nodes are defined by flow direction.

(a) The linear upwind differencing (LUD) and QUICK schemes are:

LUD: ϕface =3

2ϕ𝑈 −

1

2ϕ𝑈𝑈

QUICK: ϕface = −1

8ϕ𝑈𝑈 +

3

4ϕ𝑈 +

3

8ϕ𝐷

Identify the functional form of ψ(𝑟) for each of these schemes.

(b) Sweby’s conditions for total-variation-diminishing (TVD) schemes are that

ψ = 0 if 𝑟 ≤ 0ψ ≤ min(2𝑟, 2) if 𝑟 ≥ 0

Show that LUD and QUICK both contravene these conditions for some 𝑟 ≥ 0.

(c) The Van Albada scheme has

ψ(𝑟) = {

0 , if 𝑟 ≤ 0

𝑟 + 𝑟2

1 + 𝑟2 , if 𝑟 ≥ 0

Show that this satisfies Sweby’s criteria and also the symmetry property

ψ(𝑟)

𝑟= ψ(

1

𝑟) for 𝑟 > 0

UU UD

face

Page 32: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 32 David Apsley

Q11. (Exam 2018)

(a) The canonical scalar-transport equation for a physical quantity with concentration in

a fluid flow is, in conservative form with summation convention,

∂𝑡(ρϕ) +

∂𝑥𝑖(ρ𝑈𝑖ϕ −Γ

∂ϕ

∂𝑥𝑖) = 𝑆

I ΙΙ III IV

What physical processes are represented by parts I-IV?

(b) Define the following properties in the context of a flux-differencing scheme:

(i) transportive;

(ii) bounded;

(iii) total-variation-diminishing (TVD).

The general three-point scheme for the cell-face value of a transported scalar ϕ is

ϕface = ϕ𝑈 +1

2ψ(𝑟)(ϕ𝐷 − ϕ𝑈), where 𝑟 =

ϕ𝑈 − ϕ𝑈𝑈ϕ𝐷 − ϕ𝑈

Upstream (U) and downstream (D) nodes are defined by flow direction

as shown.

Conditions for an advection scheme to be TVD are:

ψ = 0 if 𝑟 ≤ 0;ψ ≤ min(2𝑟, 2) if 𝑟 ≥ 0.

A scheme is at least 2nd-order accurate if ψ(𝑟) passes through the point (1,1) and 3rd-order

accurate if it does so with slope ¼.

(c) For the following advection schemes, sketch (on a single graph) the variation of ψ with

𝑟 and use the conditions above to determine, for each scheme:

(i) whether the scheme is TVD;

(ii) the order of the scheme.

Central: ψ(𝑟) = 1

LUD: ψ(𝑟) = 𝑟

QUICK: ψ(𝑟) =1

4(𝑟 + 3)

Min-mod: ψ(𝑟) = max(0,min(𝑟, 1))

Van Albada: ψ(𝑟) = {

0 , if 𝑟 ≤ 0

𝑟 + 𝑟2

1 + 𝑟2 , if 𝑟 ≥ 0

UU UD

face

Page 33: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 33 David Apsley

Q12. (Exam 2014)

The figure shows part of a 2-d square finite-volume mesh, with values of a scalar concentration

ϕ marked next to the nodes. The accompanying table gives some velocity components on faces

of the central cell. The flow is incompressible.

(a) Use continuity to calculate the missing velocity component vs.

(b) Use the QUICK scheme (defined below) to calculate the value of ϕ on each of the

central-cell faces e, w, n, s. Hence, find the net advective outflow of the physical

quantity associated with ϕ (as a multiple of cell-face area 𝐴 and density ρ).

(c) Use the UMIST flux-limited scheme (defined below) to calculate the value of scalar ϕ

on the e and w faces.

(d) From the definitions given, show that the UMIST scheme reduces to the QUICK

scheme for a certain range of values of the parameter 𝑟.

(e) Define the terms transportive and bounded in the context of advection schemes and

state which of these properties is satisfied by each of QUICK and UMIST.

Data.

QUICK: ϕface = −1

8ϕ𝑈𝑈 +

3

4ϕ𝑈 +

3

8ϕ𝐷

UMIST: ϕface = ϕ𝑈 +1

2ψ(𝑟)(ϕ𝐷 − ϕ𝑈)

ψ(𝑟) = max [0,min {2, 2𝑟,1

4(1 + 3𝑟),

1

4(3 + 𝑟)}], 𝑟 =

ϕ𝑈 − ϕ𝑈𝑈ϕ𝐷 − ϕ𝑈

e

n

w

s

9 8 6 12 14

4

8

4

2x, u

y, v

face u v

e 6

w 2

n –3

s ?

UU UD

face

Page 34: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 34 David Apsley

Q13. (Exam 2017 – part; solution tolerance reduced)

A system of coupled equations is

(5𝐴 −𝐵 −𝐶−𝐴 4𝐵 −𝐶−𝐴 −𝐵 3𝐶

) = (1.98.9

−6.7)

Use the Gauss-Seidel method to solve these numerically, starting from an initial guess 𝐴 =𝐵 = 𝐶 = 0 and stopping iteration when all iterates differ from their predecessors by less than

0.01.

Q14.

(a) Use the Gauss-Seidel iterative method, starting from values 𝐴 = 𝐵 = 𝐶 = 1 to find a

solution to the coupled set of equations

2𝐴 −𝐵 −𝐶 = 1 − 𝐴2

−𝐴 +2𝐵 −𝐶 = 2 − 𝐵2

−𝐴 −𝐵 +2𝐶 = 3 − 𝐶2

stopping when successive trials are the same to 3 significant figures. (Note that you

should rearrange carefully to ensure a convergent solution and should not, under any

circumstances, do more than 10 Gauss-Seidel cycles.)

(b) Write a short computer program, in a language of your choice, to solve part (a), stopping

iteration when successive iterates for all variables differ by less than 10–6.

(c) Why would Gaussian elimination be an inappropriate way to solve the set of equations

in (a)?

Q15. (Exam 2019 – part)

(a) Using Gaussian elimination, or any other direct (ie non-iterative) numerical method of

your choice, solve the following simultaneous equations for 𝐴, 𝐵, 𝐶:

3𝐴 + 𝐵 − 𝐶 = 17−𝐴 + 5𝐵 + 𝐶 = 3 𝐴 + 𝐵 + 3𝐶 = −3

(b) Using the Gauss-Seidel method, and starting from your solution of part (a) (or from all

zeros if you failed to solve part (a)), solve the following modified equation set

iteratively for 𝐴, 𝐵, 𝐶:

3𝐴 + 𝐵 − 𝐶 = 17/(1 + 0.1𝐵2)

−𝐴 + 5𝐵 + 𝐶 = 3/(1 + 0.1𝐶2)

𝐴 + 𝐵 + 3𝐶 = −3/(1 + 0.1𝐴2)

Stop iterating when successive values for all variables differ by less than 0.1.

Page 35: s e 4. THE SCALAR-TRANSPORT EQUATION SPRING 2021 P n b · 2021. 5. 8. · CFD 4 – 2 David Apsley 4.2 The Steady-State 1-D Advection-Diffusion Equation The scalar-transport or advection-diffusion

CFD 4 – 35 David Apsley

Q16.

The linear system of equations

−𝑎𝑖ϕ𝑖−1 + 𝑏𝑖ϕ𝑖 − 𝑐𝑖ϕ𝑖+1 = 𝑑𝑖 , 𝑖 = 1,… ,𝑁

(where 𝑎𝑖, 𝑏𝑖, 𝑐𝑖 and 𝑑𝑖 are constants, and ϕ0 and 𝑁+1

are fixed) can be solved by the tri-

diagonal matrix algorithm as

ϕ𝑖 = 𝑃𝑖ϕ𝑖+1 + 𝑄𝑖 , 𝑖 = 𝑁,… ,1

where 𝑃𝑖 and 𝑄𝑖 are determined from an initial forward pass. Show that

𝑃𝑖 =𝑐𝑖

𝑏𝑖 − 𝑎𝑖𝑃𝑖−1 , 𝑖 = 1, … , 𝑁; 𝑃0 = 0

and derive a similar recurrence relation for the 𝑄𝑖.

(You may assume here that 𝑎𝑖 > 0, 𝑐𝑖 > 0, 𝑎𝑖 + 𝑐𝑖 ≤ 𝑏𝑖 for all 𝑖.)

Q17.

The figure below and the accompanying table show the velocity components and values of a

conserved scalar ϕ on the faces of a cell in a 2-d finite-volume simulation of steady,

incompressible, irrotational flow. The coordinates of the cell vertices are given in the figure.

(a) Calculate the volume flux (per unit span) out of each of the n, w, s faces.

(b) Use the incompressibility (no net volume outflow) and irrotationality (no net

circulation) conditions to find the velocity components 𝑢 and 𝑣 on the east (e) face.

(c) Assuming no source or diffusion of the scalar, calculate ϕ on the east face.

(1,4) (4,4)

(3,1)(2,1)

e

n

s

w

x

y

face

velocity scalar

𝑢 𝑣 ϕ

e ? ? ?

n 9 –3 0

w 4 -2 6

s 3 3 2