Implementation of TVD schemes To demonstrate the most important aspects of the implementation of a TVD

5.10.5 Implementation of TVD schemes To demonstrate the most important aspects of the implementation of a TVD

scheme we consider the now familiar one-dimensional convection–diffusion equation

ρuφ) = Γ (5.3) dx

dx H I K dx L

The diffusion term is discretised using central differencing as before, but the convective flux is now evaluated using a TVD scheme. In our usual notation the discretised form of the equation is as follows:

F e φ e −F w φ w =D e ( φ E − φ P ) −D w ( φ P − φ W )

(5.75) For flow in the positive x-direction u > 0 and the values of φ e and φ w using a

TVD scheme may be written as

φ φ E B φ φ C E E − P F C P − W F Note that r for each face flux term is the local ratio of upstream gradient to

where r =

and r

downstream gradient. The limiter functions ψ(r e ) and ψ(r w ) can be any of the functions described above. Substitution of (5.76a) and (5.76b) into equa- tion (5.75) gives

G J K −F w φ W + ψ(r w )( φ P − φ W )

2 I K L =D e ( φ E − φ P ) −D w ( φ P − φ W )

F e H φ P + ψ(r e )( φ E − φ P )

172 CHAPTER 5 FINITE VOLUME METHOD FOR C---D PROBLEMS

This can be rearranged to yield [D e +F e +D w ] φ P = [D w +F w ] φ W +D e φ E

G 1 J −F e H ψ(r e )( φ E − φ P ) K +F w H ψ(r w )( φ P − φ W ) K

I (5.77)

This can be written as

a P φ P =a W φ W +a E φ E +S u DC (5.78a)

where a W =D w +F w

(5.78b)

a E =D e (5.78c)

I (5.78e)

I 2 L It should be noted that the coefficients a W , a E and a P are those of the UD

scheme, which provides numerical stability to the TVD schemes. The contribution arising from the additional flux with the limiter function is

introduced through the source term as a deferred correction S DC u . We have come across this practice before in section 5.9.3 when we discussed Hayase’s implementation of the QUICK scheme. Deferred correction avoids the occurrence of stability problems due to negative coefficients in the discretised equation, whilst ensuring that the final converged solution has the desired TVD behaviour. As mentioned earlier, the above derivation is for the positive flow direction. To note the flow direction we use a superscript ‘ +’. Therefore

both r

e and r w are replaced with r w and r e . We rewrite the source term as

I 2 L For u < 0, i.e. flow in the negative x-direction, the discretised form of the

equation is as before:

F e φ e −F w φ w =D e ( φ E − φ P ) −D w ( φ P − φ W )

Values of φ e and φ w using a TVD scheme are now

A where r φ EE − φ E D and r − A φ E − φ P D

W F Here we use the superscript ‘ −’ to indicate that the flow direction is in the

negative x-direction. Note that r is still the local ratio of upstream gradient to downstream gradient. Substitution of (5.81a) and (5.81b) into equation (5.80) gives

5.10 TVD SCHEMES 173

F e H φ E + ψ(r e )( φ P − φ E ) K −F w H φ P + ψ(r w )( φ W − φ P ) K

I 2 L =D e ( φ E − φ P ) −D w ( φ P − φ W )

The usual rearrangement yields

w H ψ(r w )( φ P − φ W ) (5.82)

KL

This can be written as

a P φ P =a W φ W +a E φ E +S u DC (5.83a) where a W =D w

(5.83b)

a E =D e −F e (5.83c)

I (5.83e)

S u =F e H ψ(r − e )( φ E − φ P )

K − −F w H ψ(r w )( φ P − φ W ) K

I 2 L Again the expressions for the main coefficients are the same as for the UD

scheme. We note that F w and F e are negative when the flow is in the negative x -direction, so coefficients a W ,a E and a P will always be positive. Combining expressions (5.78a–e) and (5.83a–e) we obtain a set of expressions valid for both positive and negative flow directions. Thus the TVD scheme for one- dimensional convection–diffusion problems may be written as

a P φ P =a W φ W +a E φ E +S u DC (5.84) with central coefficient

a P =a W +a E + (F e −F w )

The neighbour coefficients and deferred correction source term of TVD schemes are as follows:

TVD neighbour coefficients

D w + max(F w , 0)

a E D e + max(−F e , 0)

TVD deferred correction source term

DC S 1 u F e [(1 − α e ) ψ (r − e ) − α e . ψ (r e + )]( φ E − φ P )

+ F w [ α w . ψ (r w + ) − (1 − α w ) ψ (r w − )]( φ P − φ W )

174 CHAPTER 5 FINITE VOLUME METHOD FOR C---D PROBLEMS

where α w = 1 for F w > 0 and α e = 1 for F e >0

α w = 0 for F w < 0 and α e = 0 for F e <0 Treatment at the boundaries

At inlet /outlet boundaries it is necessary to generate upstream/downstream values to evaluate the values of r. These can be obtained using the extra-

polated mirror node practice that was demonstrated for the QUICK scheme in Example 5.4 (see section 5.9.1).

Consider an inlet with given boundary value φ=φ A and convective mass flux per unit area: F =F A . The TVD discretised equation is

F e H φ P + ψ(r e )( φ E − φ P ) K −F A φ A =D e ( φ E − φ P ) −D A *( φ P − φ A )

1 (D e +F e +D A *) φ P =D e φ E + (D A * +F A ) φ A −F e ψ(r e )( φ E − φ P )

with D * A = Γ/ δx The problem is to find

for the deferred correction term. The gradient ratio contains a missing nodal value φ=φ W .

Leonard mirror node extrapolation gives

A further discussion on boundary conditions for higher-order schemes is available in Leonard (1988).

Extension to two and three dimensions Extension of the TVD expressions to two dimensions is straightforward.

The discretised equation using a TVD scheme in a two-dimensional Cartesian grid arrangement is given by

a P φ P =a W φ W +a E φ E +a S φ S +a N φ N +S u DC (5.85)

with central coefficient

a P =a W +a E +a S +a N + (F e −F w ) + (F n −F s ) The neighbour coefficients and deferred correction source term of TVD

schemes are as follows:

5.10 TVD SCHEMES 175

TVD neighbour coefficients

a W D w + max(F w , 0)

a E D e + max(−F e , 0)

a S D s + max(F s , 0) a N

D n + max(−F n , 0)

TVD deferred correction source term

We note that the deferred correction source term now also includes terms re- lated to south and north. The extension to three dimensions is straightforward.