6.5 Operator Discretisation
In the following section we will look at the discrete representation of various operators. Operators which do not interact can be looked at in isolation and will be considered in the increased order of complexity.
6.5.1 Temporal Derivative
Time derivative captures the rate-of-change of φ. We only need to handle the volume integral.
• Using the prescribed temporal variation in a point, defining time-step size
∆t
• tnew = told+ ∆t, defining time levels φn and φo
φo = φ(t = told) (6.10)
φn= φ(t = tnew) (6.11)
• Temporal derivative, first and second order approximation
∂φ
∂t = φn− φo
∆t
∂φ
∂t =
3
2φn− φo+12φoo
∆t
• Thus, with volume integral:
Z
V
∂φ
∂t dV = φn− φo
∆t VP (6.12)
• Calculus: given φn, φo and ∆t create a field of the time derivative of φ
• Method: matrix representation. Since ∂φ∂t in cell P depends on φP, the matrix will only have a diagonal contribution and a source
– Diagonal value: aP = V∆tP
– Source contribution: rP = VP∆t,φo
6.5.2 Second Derivative in Time
Second derivative in time
• This term will appear when we try to do stress analysis
• Very similar to the above: second temporal derivative is calculated using two old-time levels of φ
∂2φ
∂t2 = φn− 2φo+ φoo
∆t2 , (6.13)
where φn = φ(t + ∆t), φo = φ(t) and φoo = φ(t − ∆t).
• One can also construct a second-order accurate form of ∂∂t2φ2 using three
“old-time” levels (φooo = φ(t − 2 ∆t)):
∂2φ
∂t2 = 2φn− 5φo+ 4φoo− φooo
∆t2 . (6.14)
• Exercise: what needs to be done if the time step is not constant between the two old time levels?
6.5.3 Evaluation of the Gradient
Gauss’ Theorem
• Evaluation of the gradient is a direct application of the Gauss’ Theorem Z
VP
∇φ dV = I
∂VP
ds φ (6.15)
• Discretised form splits into a sum of face integrals I
S
nφ dS =X
f
sfφf (6.16)
• It still remains to evaluate the face value of φ. Consistently with second-order discretisation, we shall assume linear variation between P and N
φf = fxφP + (1 − fx)φN (6.17)
• Gradient evaluation almost exclusively used as a calculus operation
6.5 Operator Discretisation 87 Least Squares Fit
• On highly distorted meshes, accuracy of Gauss gradients is compromised
• Lest squares fit uses a set of neighbouring points without reference to cell geometry to assemble the gradient
• Assuming a linear variation of a general variable φ, the error at N is:
eN = φN − (φP + dN•(∇φ)P) (6.18)
Minimising the least square error:
e2P =X
leads to the following expression:
(∇φ)P =X
• This produces a second-order accurate gradient irrespective of the arrange-ment of the neighbouring points
6.5.4 Convection Term
Convection term captures the transport by the convective velocity. In general terms, convection can be seen as a “coordinate transformation”: information (variable) is carried by the flow field from one region to another. A concept of upwind or downwind direction is needed to understand the convective process.
Convection Operator and Face Flux
• Convection operator splits into a sum of face integrals
• Two different ways of writing the same term: integral and differential form I
• Integration follows the same path as before
• In general, face flux is a face field giving the measure of the flow through the face. In some algorithms, it may come from different expressions, depending on the overall algorithm
• Primary unknowns are the cell centre values, not face values
• In order to close the system, we need a way of evaluating φf from the cell values φP and φN: face interpolation
Face Interpolation Schemes
• Simplest face interpolation: central differencing. Second-order accurate, but causes oscillations
φf = fxφP + (1 − fx)φN (6.26)
where fx= f N/P N
• Upwind differencing: taking into account the transportive property of the term: information comes from upstream. No oscillations, but smears the solution
φf = max(F, 0) ∗ φP + min(F, 0) ∗ φN (6.27)
• There exists a large number of schemes, trying to achieve good accuracy without causing oscillations: e.g. TVD, and NVD families: φf = f (φP, φN, F, . . .)
• We shall re-visit the schemes with examples
6.5 Operator Discretisation 89 Matrix Coefficients
• In the convection term, φf depends on the values of φ in two computational points: P and N.
• Therefore, the solution in P will depend on the solution in N and vice versa, which means we’ve got an off-diagonal coefficient in the matrix.
In the case of central differencing on a uniform mesh, a contribution for a face f is
– Diagonal value: aP = 12F – Off-diagonal value: aN = 12F
– Source contribution: in our case, nothing. However, some other schemes may have additional (gradient-based) correction terms
– Note that, in general the P -to-N coefficient will be different from the N-to-P coefficient: the matrix is asymmetric
6.5.5 Diffusion Term
Diffusion term captures the gradient transport
Diffusion Operator
• Integration same as before I
S
γ(n•∇φ)dS =X
f
Z
Sf
γ(n•∇φ) dS
=X
f
γfsf•(∇φ)f
• γf evaluated from cell values using central differencing
• Evaluation of the face-normal gradient. If s and df = P N are aligned, use difference across the face
sf•(∇φ)f = |sf|φN − φP
|df| (6.28)
• This is the component of the gradient in the direction of the df vector
• For non-orthogonal meshes, a correction term may be necessary
Matrix Coefficients
• For an orthogonal mesh, a contribution for a face f is – Diagonal value: aP = −γf |sf|
|df|
– Off-diagonal value: aN = γf
|sf|
|df|
– Source contribution: for orthogonal meshes, nothing. Non-orthogonal correction will produce a source
– The P -to-N and N-to-P coefficients are identical: symmetric matrix Non-Orthogonal Correction
• We wish to keep the part with coefficient creation as above even for non-orthogonal meshes . . . but this would not be correct
• Solution: add a correction
– Decompose the s vector into a component parallel with d and the rest.
– For the parallel component, same as above
– Correction = k•(∇φ)f. The missing gradient will be calculated at cell centres and interpolated, just as γf above
P d N
f
s k
∆
6.5.6 Source and Sink Terms
Source and sink terms are integrated over the volume Z
V
qvdV = qvVP (6.29)
• In general, qv may be a function of space and time, the solution itself, other variables and can be quite complex. In complex physics cases, the source term can carry the main interaction in the system. Example: complex chemistry mechanisms. We shall for the moment consider only a simple case.