Lecture # 02 Goverening Equations and Its Discritization

Download as pdf or txt
Download as pdf or txt
You are on page 1of 55

Lecture # 02 Goverening Equations and its Discritization

Getting started: CFD notation


 
∂u ∂u ∂u ∂2u ∂pu
PDE of p-th order f u, x, t, ∂x1 , . . . , , ,
∂xn ∂t ∂x1 ∂x2 , . . . , ∂tp =0

scalar unknowns u = u(x, t), x ∈ Rn , t ∈ R, n = 1, 2, 3


vector unknowns v = v(x, t), v ∈ Rm , m = 1, 2, . . .

∂ ∂ ∂
Nabla operator ∇ = i ∂x + j ∂y + k ∂z x = (x, y, z), v = (vx , vy , vz )

h iT
∇u = i ∂u
∂x + j ∂u
∂y + k ∂u
∂z = ∂u ∂u ∂u
∂x , ∂y , ∂z gradient
z
∂vx ∂vy ∂vz v
∇·v = ∂x + ∂y + ∂z divergence
   ∂vy

∂vz
i j k ∂y − ∂z k
    y
∇ × v = det  ∂ ∂ ∂ = ∂vx ∂vz  curl i j

 ∂x ∂y ∂z   ∂z − ∂x 
∂vy ∂vx
vx vy vz ∂x − ∂y x
∂2u ∂2u ∂2u
∆u = ∇ · (∇u) = ∇2 u = ∂x2 + ∂y 2 + ∂z 2 Laplacian

JetWings 1
Lecture # 02 Goverening Equations and its Discritization

Tensorial quantities in fluid dynamics

Velocity gradient
  1111111111111111
0000000000000000
0000000000000000
1111111111111111
∂vx ∂vy ∂vz
∂x ∂x ∂x
 ∂vy

∇v = [∇vx , ∇vy , ∇vz ] =  ∂vx ∂vz 
 ∂y ∂y ∂y 
∂vx ∂vy ∂vz v
∂z ∂z ∂z 1111111111111111
0000000000000000
0000000000000000
1111111111111111

Remark. The trace (sum of diagonal elements) of ∇v equals ∇ · v.

Deformation rate tensor (symmetric part of ∇v)


    
∂vx 1 ∂vy ∂vx 1 ∂vz ∂vx
 ∂x 2 ∂x + ∂y 2 ∂x + ∂z 
1 T  1

∂vx ∂vy

∂vy 1

∂vz ∂vy


D(v) = (∇v + ∇v ) =  ∂y + ∂x + 
2  2
  ∂y  2 ∂y ∂z 
1 ∂vx ∂vz 1 ∂vy ∂vz ∂vz
2 ∂z + ∂x 2 ∂z + ∂y ∂z

Spin tensor S(v) = ∇v − D(v) (skew-symmetric part of ∇v)

JetWings 2
Lecture # 02 Goverening Equations and its Discritization

Vector multiplication rules

Scalar product of two vectors


 
b1
 
a, b ∈ R3 , a · b = aT b = [a1 a2 a3 ] 
 b2  = a1 b1 + a2 b2 + a3 b3 ∈ R

b3

∂u ∂u ∂u
Example. v · ∇u = vx + vy + vz convective derivative
∂x ∂y ∂z

Dyadic product of two vectors


   
a1 a1 b1 a1 b2 a1 b3
   
3
a, b ∈ R , a ⊗ b = abT = 
 a2  [b1 b2 b3 ] =  a2 b1
  a2 b2 ∈R
a2 b3 
3×3

a3 a3 b1 a3 b2 a3 b3

JetWings 3
Lecture # 02 Goverening Equations and its Discritization

Elementary tensor calculus


1. αT = {αtij }, T = {tij } ∈ R3×3 , α ∈ R

2. T 1 + T 2 = {t1ij + t2ij }, T 1 , T 2 ∈ R3×3 , a ∈ R3


 
t t t
 11 12 13  P 3
3. a · T = [a1 , a2 , a3 ]  t21 t22 t23  = ai [ti1 , ti2 , ti3 ]
i=1 | {z }
t31 t32 t33 i-th row
    
t t t a t
 11 12 13   1  P 3
 1j 
4. T · a =  t21 t22 t23   a2  =  t2j  aj (j-th column)
j=1
t31 t32 t33 a3 t3j
  
1 1 1 2 2 2
t11 t12 t13 t11 t12 t13  3
P

  
5. T 1 · T 2 =  t121 t122 t123   t221 t222 t223  = t1ik t2kj
k=1
t131 t132 t133 t231 t232 t233
3 P
P 3
1 2 1 2 T
6. T : T = tr (T · (T ) ) = t1ik t2ik
i=1 k=1

JetWings 4
Lecture # 02 Goverening Equations and its Discritization

Divergence theorem of Gauß

Let Ω ∈ R3 and n be the outward unit normal to the boundary Γ = Ω̄\Ω.


Z Z
Then ∇ · f dx = f · n ds for any differentiable function f (x)
Ω Γ

Example. A sphere: Ω = {x ∈ R3 : ||x|| < 1}, Γ = {x ∈ R3 : ||x|| = 1}


√ p
where ||x|| = x·x= x2 + y 2 + z 2 is the Euclidean norm of x

Consider f (x) = x so that ∇ · f ≡ 3 in Ω and n = x


||x|| on Γ
Z Z  
4 3
volume integral: ∇ · f dx = 3 dx = 3|Ω| = 3 π1 = 4π
Ω Ω 3
Z Z Z Z
x·x
surface integral: f · n ds = ds = ||x|| ds = ds = 4π
Γ Γ ||x|| Γ Γ

JetWings 5
Lecture # 02 Goverening Equations and its Discritization

Governing equations of fluid dynamics

Physical principles Mathematical equations


1. Mass is conserved • continuity equation
2. Newton’s second law • momentum equations
3. Energy is conserved • energy equation

It is important to understand the meaning and significance of each equation


in order to develop a good numerical method and properly interpret the results

Description of fluid motion z


v

Eulerian monitor the flow characteristics (x 1 ; y1 ; z1 )

in a fixed control volume k (x 0 ; y0 ; z0 )

i j y
Lagrangian track individual fluid particles as
they move through the flow field x

JetWings 6
Lecture # 02 Goverening Equations and its Discritization

Description of fluid motion


Trajectory of a fluid particle
z
x = x(x0 , t) dx
v = vx (x, y, z, t), x|t0 = x0
(x 1 ; y1 ; z1 )
dt
x = x(x0 , y0 , z0 , t) dy
(x 0 ; y0 ; z0 )
= vy (x, y, z, t), y|t0 = y0
k
y y = y(x0 , y0 , z0 , t) dt
i j
dz
z = z(x0 , y0 , z0 , t) = vz (x, y, z, t), z|t0 = z0
dt
x

Definition. A streamline is a curve which is tangent to the velocity vector


v = (vx , vy , vz ) at every point. It is given by the relation
y

dx dy dz v dy
=
vy
= = y(x) dx vx
vx vy vz
x

Streamlines can be visualized by injecting tracer particles into the flow field.

JetWings 7
Lecture # 02 Goverening Equations and its Discritization

Flow models and reference frames

Eulerian Lagrangian

S S

integral
V V

fixed CV of a finite size moving CV of a finite size

differential
dS dS
dV dV

fixed infinitesimal CV moving infinitesimal CV

Good news: all flow models lead to the same equations

JetWings 8
Lecture # 02 Goverening Equations and its Discritization

Eulerian vs. Lagrangian viewpoint

d
Definition. Substantial time derivative dt is the rate of change for a moving

fluid particle. Local time derivative ∂t is the rate of change at a fixed point.

Let u = u(x, t), where x = x(x0 , t). The chain rule yields
du ∂u ∂u dx ∂u dy ∂u dz ∂u
= + + + = + v · ∇u
dt ∂t ∂x dt ∂y dt ∂z dt ∂t
substantial derivative = local derivative + convective derivative

Reynolds transport theorem


Z Z Z
d ∂u(x, t)
u(x, t) dV = dV + u(x, t)v · n dS
dt Vt V ≡Vt ∂t S≡St

rate of change in rate of change in convective transfer


= +
a moving volume a fixed volume through the surface

JetWings 9
Lecture # 02 Goverening Equations and its Discritization

Derivation of the governing equations

Modeling philosophy Generic conservation law


Z Z Z
1. Choose a physical principle ∂
u dV + f · n dS = q dV
∂t V S V
• conservation of mass
S n
f = vu − d∇u
• conservation of momentum V
dS f
flux function
• conservation of energy
Divergence theorem yields
2. Apply it to a suitable flow model Z Z Z
∂u
• Eulerian/Lagrangian approach dV + ∇ · f dV = q dV
V ∂t V V
• for a finite/infinitesimal CV
Partial differential equation
3. Extract integral relations or PDEs ∂u
+∇·f =q in V
which embody the physical principle ∂t

JetWings 10
Lecture # 02 Goverening Equations and its Discritization

Derivation of the continuity equation

Physical principle: conservation of mass


Z Z Z
dm d ∂ρ
= ρ dV = dV + ρv · n dS = 0
dt dt Vt V ≡Vt ∂t S≡St

accumulation of mass inside CV = net influx through the surface

Divergence theorem yields Continuity equation


Z  
∂ρ ∂ρ
+ ∇ · (ρv) dV = 0 ⇒ + ∇ · (ρv) = 0
V ∂t ∂t

Lagrangian representation

∇ · (ρv) = v · ∇ρ + ρ∇ · v ⇒ + ρ∇ · v = 0
dt

Incompressible flows: dt =∇·v =0 (constant density)

JetWings 11
Lecture # 02 Goverening Equations and its Discritization

Conservation of momentum

Physical principle: f = ma (Newton’s second law)

total force f = ρg dV + h dS, where h=σ·n


dS
dV n body forces g gravitational, electromagnetic,. . .
h surface forces h pressure + viscous stress
g
Stress tensor σ = −pI + τ momentum flux

For a newtonian fluid viscous stress is proportional to velocity gradients:


1 2
τ = (λ∇ · v)I + 2µD(v), where D(v) = (∇v + ∇vT ), λ≈− µ
2 3

Normal stress: stretching Shear stress: deformation


“ ”
∂vy ∂vx
τxx = λ∇ · v + 2µ ∂v
∂x
x y
τxy = τyx = µ ∂x
+ ∂y
y

yx
∂v
= µ ∂v ∂vz
` x ´
τyy = λ∇ · v + 2µ ∂yy τxz = τzx +
xx
“ ∂z ∂x ”
∂v
τzz = λ∇ · v + 2µ ∂v
∂z
z
τyz = τzy = µ ∂v
∂y
z
+ ∂zy
x x

JetWings 12
Lecture # 02 Goverening Equations and its Discritization

Derivation of the momentum equations

Newton’s law for a moving volume


Z Z Z
d ∂(ρv)
ρv dV = dV + (ρv ⊗ v) · n dS
dt Vt V ≡Vt ∂t S≡St
Z Z
= ρg dV + σ · n dS
V ≡Vt S≡St

Transformation of surface integrals


Z   Z
∂(ρv)
+ ∇ · (ρv ⊗ v) dV = [∇ · σ + ρg] dV, σ = −pI + τ
V ∂t V

∂(ρv)
Momentum equations + ∇ · (ρv ⊗ v) = −∇p + ∇ · τ + ρg
∂t
   
∂(ρv) ∂v ∂ρ dv
+ ∇ · (ρv ⊗ v) = ρ + v · ∇v + v + ∇ · (ρv) = ρ
∂t ∂t ∂t dt
| {z } | {z }
substantial derivative continuity equation

JetWings 13
Lecture # 02 Goverening Equations and its Discritization

Conservation of energy
Physical principle: δe = s + w (first law of thermodynamics)

dS δe accumulation of internal energy


dV n
s heat transmitted to the fluid particle
h
g w rate of work done by external forces

Heating: s = ρq dV − fq dS Fourier’s law of heat conduction


q internal heat sources fq = −κ∇T
fq diffusive heat transfer
the heat flux is proportional to the
T absolute temperature
local temperature gradient
κ thermal conductivity

Work done per unit time = total force × velocity

w = f · v = ρg · v dV + v · (σ · n) dS, σ = −pI + τ

JetWings 14
Lecture # 02 Goverening Equations and its Discritization

Derivation of the energy equation


|v|2
Total energy per unit mass: E =e+ 2
e specific internal energy due to random molecular motion
2
|v|
2 specific kinetic energy due to translational motion

Integral conservation law for a moving volume


Z Z Z
d ∂(ρE)
ρE dV = dV + ρE v · n dS accumulation
dt Vt V ≡Vt ∂t S≡St
Z Z
= ρq dV + κ∇T · n dS heating
V ≡Vt S≡St
Z Z
+ ρg · v dV + v · (σ · n) dS work done
V ≡Vt S≡St

Transformation of surface integrals


Z   Z
∂(ρE)
+ ∇ · (ρEv) dV = [∇ · (κ∇T ) + ρq + ∇ · (σ · v) + ρg · v] dV,
V ∂t V

where ∇ · (σ · v) = −∇ · (pv) + ∇ · (τ · v) = −∇ · (pv) + v · (∇ · τ ) + ∇v : τ

JetWings 15
Lecture # 02 Goverening Equations and its Discritization

Different forms of the energy equation

Total energy equation

∂(ρE)
+ ∇ · (ρEv) = ∇ · (κ∇T ) + ρq − ∇ · (pv) + v · (∇ · τ ) + ∇v : τ + ρg · v
∂t
   
∂(ρE) ∂E ∂ρ dE
+ ∇ · (ρEv) = ρ + v · ∇E + E + ∇ · (ρv) = ρ
∂t ∂t ∂t dt
| {z } | {z }
substantial derivative continuity equation
dv
Momentum equations ρ = −∇p + ∇ · τ + ρg (Lagrangian form)
dt
dE de dv ∂(ρe)
ρ =ρ +v·ρ = + ∇ · (ρev) + v · [−∇p + ∇ · τ + ρg]
dt dt dt ∂t
Internal energy equation

∂(ρe)
+ ∇ · (ρev) = ∇ · (κ∇T ) + ρq − p∇ · v + ∇v : τ
∂t

JetWings 16
Lecture # 02 Goverening Equations and its Discritization

Summary of the governing equations

1. Continuity equation / conservation of mass


∂ρ
+ ∇ · (ρv) = 0
∂t

2. Momentum equations / Newton’s second law


∂(ρv)
+ ∇ · (ρv ⊗ v) = −∇p + ∇ · τ + ρg
∂t

3. Energy equation / first law of thermodynamics


∂(ρE)
+ ∇ · (ρEv) = ∇ · (κ∇T ) + ρq − ∇ · (pv) + v · (∇ · τ ) + ∇v : τ + ρg · v
∂t
|v|2 ∂(ρe)
E =e+ , + ∇ · (ρev) = ∇ · (κ∇T ) + ρq − p∇ · v + ∇v : τ
2 ∂t
This PDE system is referred to as the compressible Navier-Stokes equations

JetWings 17
Lecture # 02 Goverening Equations and its Discritization

Conservation form of the governing equations


Generic conservation law for a scalar quantity
∂u
+ ∇ · f = q, where f = f (u, x, t) is the flux function
∂t

Conservative variables, fluxes and sources


     
ρ ρv 0
     
U =  ρv  , F = 
  ρv ⊗ v + pI − τ ,
 Q=
 ρg 

ρE (ρE + p)v − κ∇T − τ · v ρ(q + g · v)

Navier-Stokes equations in divergence form

∂U
+∇·F=Q U ∈ R5 , F ∈ R3×5 , Q ∈ R5
∂t

• representing all equations in the same generic form simplifies the programming
• it suffices to develop discretization techniques for the generic conservation law

JetWings 18
Lecture # 02 Goverening Equations and its Discritization

Constitutive relations

Variables: ρ, v, e, p, τ , T Equations: continuity, momentum, energy

The number of unknowns exceeds the number of equations.

1. Newtonian stress tensor


1 2
τ = (λ∇ · v)I + 2µD(v), D(v) = (∇v + ∇vT ), λ≈− µ
2 3

2. Thermodynamic relations, e.g.


p = ρRT ideal gas law R specific gas constant
e = cv T caloric equation of state cv specific heat at constant volume

Now the system is closed: it contains five PDEs for five independent variables
ρ, v, e and algebraic formulae for the computation of p, τ and T . It remains to
specify appropriate initial and boundary conditions.

JetWings 19
Lecture # 02 Goverening Equations and its Discritization

Initial and boundary conditions

Initial conditions ρ|t=0 = ρ0 (x), v|t=0 = v0 (x), e|t=0 = e0 (x) in Ω

Boundary conditions Let Γ = Γin ∪ Γw ∪ Γout


w

Inlet Γin = {x ∈ Γ : v · n < 0}


ρ = ρin , v = vin , e = ein in out

prescribed density, energy and velocity


w

Solid wall Γw = {x ∈ Γ : v · n = 0} Outlet Γout = {x ∈ Γ : v · n > 0}


v=0 no-slip condition v · n = vn or −p + n · τ · n = 0
T = Tw given temperature or v · s = vs or s·τ ·n=0
∂T
 fq
prescribed velocity vanishing stress
∂n = − κ prescribed heat flux

The problem is well-posed if the solution exists, is unique and depends continuously
on IC and BC. Insufficient or incorrect IC/BC may lead to wrong results (if any).

JetWings 20
Lecture # 02 Goverening Equations and its Discritization

Dimensionless form of equations

Motivation: sometimes equations are normalized in order to

• facilitate the scale-up of obtained results to real flow conditions


• avoid round-off due to manipulations with large/small numbers
• assess the relative importance of terms in the model equations

Dimensionless variables and numbers


t x v p T − T0
t∗ = , x∗ = , v∗ = , p∗ = , T∗ =
t0 L0 v0 ρv02 T1 − T0

ρv0 L0 inertia |v|


Reynolds number Re = µ viscosity Mach number M= c

Froude number Fr = √v0 inertia


Strouhal number St = L0
L0 g gravity v0 t0

v0 L0 convection µ
Peclet number Pe = κ diffusion Prandtl number Pr = ρκ

JetWings 21
Lecture # 02 Goverening Equations and its Discritization

Model simplifications

Objective: derive analytical solutions / reduce computational cost

Compressible Navier-Stokes equations

ρ = const µ=0

Incompressible Navier-Stokes equations Compressible Euler equations

Stokes flow boundary layer inviscid Euler equations potential flow

Derivation of a simplified model


1. determine the type of flow to be simulated
2. separate important and unimportant effects
3. leave irrelevant features out of consideration
4. omit redundant terms/equations from the model
5. prescribe suitable initial/boundary conditions

JetWings 22
Lecture # 02 Goverening Equations and its Discritization

Classification of partial differential equations

PDEs can be classified into hyperbolic, parabolic and elliptic ones


• each class of PDEs models a different kind of physical processes
• the number of initial/boundary conditions depends on the PDE type
• different solution methods are required for PDEs of different type

Hyperbolic equations Information propagates in certain directions at


finite speeds; the solution is a superposition of multiple simple waves

Parabolic equations Information travels downstream / forward in time;


the solution can be constructed using a marching / time-stepping method

Elliptic equations Information propagates in all directions at infinite speed;


describe equilibrium phenomena (unsteady problems are never elliptic)

JetWings 23
Lecture # 02 Goverening Equations and its Discritization

Classification of partial differential equations

∂u ∂u
First-order PDEs a0 + a1 ∂x1
+ . . . + aD ∂xD
=0 are always hyperbolic

D D
X ∂2u X ∂u
Second order PDEs − aij + bk + cu + d = 0
i,j=1
∂xi ∂xj ∂xk
k=1

coefficient matrix: A = {aij } ∈ RD×D , aij = aij (x1 , . . . , xD )


aij +aji
symmetry: aij = aji , otherwise set aij = aji := 2

PDE type n+ n− n0 n+ number of positive eigenvalues


n− number of negative eigenvalues
elliptic D 0 0
n0 number of zero eigenvalues
hyperbolic D−1 1 0
parabolic D−1 0 1 n+ ←→ n−

JetWings 24
Lecture # 02 Goverening Equations and its Discritization

Computational meshes

Degrees of freedom for the approximate solution are defined on a computational


mesh which represents a subdivision of the domain into cells/elements

structured block-structured unstructured

Structured (regular) meshes


• families of gridlines do not cross and only intersect with other families once
• topologically equivalent to Cartesian grid so that each gridpoint (or CV) is
uniquely defined by two indices in 2D or three indices in 3D, e.g., (i, j, k)
• can be of type H (nonperiodic), O (periodic) or C (periodic with cusp)
• limited to simple domains, local mesh refinement affects other regions

JetWings 25
Lecture # 02 Goverening Equations and its Discritization

Computational meshes
Block-structured meshes
• multilevel subdivision of the domain with structured grids within blocks
• can be non-matching, special treatment is necessary at block interfaces
• provide greater flexibility, local refinement can be performed blockwise

Unstructured meshes
• suitable for arbitrary domains and amenable to adaptive mesh refinement
• consist of triangles or quadrilaterals in 2D, tetrahedra or hexahedra in 3D
• complex data structures, irregular sparsity pattern, difficult to implement

JetWings 26
Lecture # 02 Goverening Equations and its Discritization

Discretization techniques

Finite differences / differential form


• approximation of nodal derivatives
• simple and effective, easy to derive
• limited to (block-)structured meshes

Finite volumes / integral form


• approximation of integrals
• conservative by construction
• suitable for arbitrary meshes

Finite elements / weak form


• weighted residual formulation
• remarkably flexible and general
• suitable for arbitrary meshes

JetWings 27
Lecture # 02 Goverening Equations and its Discritization

Finite difference method

Principle: derivatives in the partial differential equation are approximated


by linear combinations of function values at the grid points

1D: Ω = (0, X), ui ≈ u(xi ), i = 0, 1, . . . , N


X
grid points xi = i∆x mesh size ∆x = N

0 X
x0 x1 xi 1 xi xi+1 xN 1 xN
First-order derivatives
∂u u(x̄ + ∆x) − u(x̄) u(x̄) − u(x̄ − ∆x)
(x̄) = lim = lim
∂x ∆x→0 ∆x ∆x→0 ∆x
u(x̄ + ∆x) − u(x̄ − ∆x)
= lim (by definition)
∆x→0 2∆x

JetWings 28
Lecture # 02 Goverening Equations and its Discritization

Approximation of first-order derivatives

Geometric interpretation

u forward ba kward
entral ∂u
 ui+1 −ui
∂x i ≈ ∆x forward difference

∂u
 ui −ui−1

x x exa t ∂x i ≈ ∆x backward difference

∂u
 ui+1 −ui−1
∂x i ≈ 2∆x central difference

xi 1 xi xi+1 x ∞ 
P (x−xi )n ∂nu
Taylor series expansion u(x) = n! ∂xn i , u ∈ C ∞ ([0, X])
n=0
     
∂u (∆x)2 ∂ 2 u (∆x)3 ∂ 3 u
T1 : ui+1 = ui + ∆x + 2
+ 3
+ ...
∂x
i 2 ∂x i 6 ∂x i
     
∂u (∆x)2 ∂ 2 u (∆x)3 ∂ 3 u
T2 : ui−1 = ui − ∆x + − + ...
∂x i 2 ∂x2 i 6 ∂x3 i

JetWings 29
Lecture # 02 Goverening Equations and its Discritization

Analysis of truncation errors

Accuracy of finite difference approximations


     
∂u ui+1 − ui ∆x ∂2u (∆x)2 ∂3u
T1 ⇒ = − − + ...
∂x i ∆x 2 ∂x2 i 6 ∂x3 i

forward difference truncation error O(∆x)


     
∂u ui − ui−1 ∆x ∂2u (∆x)2 ∂3u
T2 ⇒ = + − + ...
∂x i ∆x 2 ∂x2 i 6 ∂x3 i

backward difference truncation error O(∆x)


   
∂u ui+1 − ui−1 (∆x)2 ∂3u
T1 − T2 ⇒ = − + ...
∂x i 2∆x 6 ∂x3 i
central difference truncation error O(∆x)2

Leading truncation error

ǫτ = αm (∆x)m + αm+1 (∆x)m+1 + . . . ≈ αm (∆x)m

JetWings 30
Lecture # 02 Goverening Equations and its Discritization

Approximation of second-order derivatives


Central difference scheme
 
∂2u ui+1 − 2ui + ui−1 2
T1 + T2 ⇒ = + O(∆x)
∂x2 i (∆x)2
Alternative derivation
 2     ∂u
 ∂u

∂ u ∂ ∂u ∂x i+1/2 − ∂x i−1/2
= = lim
∂x2 i ∂x ∂x i ∆x→0 ∆x
ui+1 −ui
∆x − ui −u
∆x
i−1
ui+1 − 2ui + ui−1
≈ =
∆x (∆x)2

Variable coefficients f (x) = d(x) ∂u


∂x diffusive flux
−ui
− di−1/2 ui −u
 
∂f fi+1/2 − fi−1/2 di+1/2 ui+1
∆x ∆x
i−1

≈ =
∂x i ∆x ∆x
di+1/2 ui+1 − (di+1/2 + di−1/2 )ui + di−1/2 ui−1
=
(∆x)2

JetWings 31
Lecture # 02 Goverening Equations and its Discritization

Approximation of mixed derivatives


  
∂2u ∂ ∂u ∂ ∂u y
2D: ∂x∂y = ∂x ∂y = ∂y ∂x
“ ” “ ”
∂u ∂u

∂2u
„ «
∂y ∂y
i+1,j i−1,j
= + O(∆x)2 yj +1
∂x∂y i,j 2∆x
yj
„ «
∂u ui+1,j+1 − ui+1,j−1
= + O(∆y)2 yj 1
∂y i+1,j 2∆y
„ «
∂u ui−1,j+1 − ui−1,j−1
= + O(∆y)2
∂y i−1,j 2∆y xi 1 xi xi+1 x

Second-order difference approximation


 2 
∂ u ui+1,j+1 − ui+1,j−1 − ui−1,j+1 + ui−1,j−1
= + O[(∆x)2 , (∆y)2 ]
∂x∂y i,j 4∆x∆y

JetWings 32
Lecture # 02 Goverening Equations and its Discritization

One-sided finite differences


 
∂u u1 − u0
= + O(∆x) forward difference
∂x 0 ∆x
? x0 x1 x2
backward/central difference approximations
would need u−1 which is not available
Polynomial fitting
     
∂u x2 ∂2u x3 ∂3u
u(x) = u0 + x + + + ...
∂x 0 2 ∂x2 0 6 ∂x3 0
 
∂u ∂u
u(x) ≈ a + bx + cx2 , ≈ b + 2cx, ≈b
∂x ∂x 0

approximate u by a polynomial and differentiate it to obtain the derivatives

u0 = a c∆x2 = u1 − u0 − b∆x

u1 = a + b∆x + c∆x2 −3u0 + 4u1 − u2
b=
u2 = a + 2b∆x + 4c∆x2 2∆x

JetWings 33
Lecture # 02 Goverening Equations and its Discritization

Analysis of the truncation error


 
∂u αui + βui+1 + γui+2
One-sided approximation ≈
∂x i ∆x
    
∂u (∆x)2 ∂ 2 u (∆x)3 ∂ 3 u
ui+1 = ui + ∆x + + + ...
∂x i 2 ∂x2 i 6 ∂x3 i
  2
 2  3
 3 
∂u (2∆x) ∂ u (2∆x) ∂ u
ui+2 = ui + 2∆x + + + ...
∂x i 2 ∂x2 i 6 ∂x3 i

  
αui +βui+1 +γui+2 α+β+γ ∂u ∆x ∂2u
∆x = ∆x ui + (β + 2γ) ∂x i + 2 (β + 4γ) ∂x2 + O(∆x2 )
i

Second-order accurate if α + β + γ = 0, β + 2γ = 1, β + 4γ = 0

∂u
 −3ui +4ui+1 −ui+2
α = − 23 , β = 2, γ = − 21 ⇒ ∂x i = 2∆x + O(∆x2 )

JetWings 34
Lecture # 02 Goverening Equations and its Discritization

Application to second-order derivatives


 
∂2u αui + βui+1 + γui+2
One-sided approximation ≈
∂x2 i ∆x2

    
∂u (∆x)2 ∂ 2 u (∆x)3 ∂ 3 u
ui+1 = ui + ∆x + + + ...
∂x i 2 ∂x2 i 6 ∂x3 i
  2
 2  3
 3 
∂u (2∆x) ∂ u (2∆x) ∂ u
ui+2 = ui + 2∆x + + + ...
∂x i 2 ∂x2 i 6 ∂x3 i

  
αui +βui+1 +γui+2 α+β+γ β+2γ ∂u β+4γ ∂2u
∆x2 = ∆x2 ui + ∆x ∂x i + 2 ∂x2 + O(∆x)
i

First-order accurate if α + β + γ = 0, β + 2γ = 0, β + 4γ = 2

∂u
 ui −2ui+1 +ui+2
α = 1, β = −2, γ=1 ⇒ ∂x i = ∆x2 + O(∆x)

JetWings 35
Lecture # 02 Goverening Equations and its Discritization

High-order approximations
 
∂u 2ui+1 + 3ui − 6ui−1 + ui−2
= + O(∆x)3 backward difference
∂x i 6∆x
 
∂u −ui+2 + 6ui+1 − 3ui − 2ui−1
= + O(∆x)3 forward difference
∂x i 6∆x
 
∂u −ui+2 + 8ui+1 − 8ui−1 + ui−2
= + O(∆x)4 central difference
∂x i 12∆x
 
∂2u −ui+2 + 16ui+1 − 30ui + 16ui−1 − ui−2
= + O(∆x)4 central difference
∂x2 i 12(∆x) 2

Pros and cons of high-order difference schemes


⊖ more grid points, fill-in, considerable overhead cost
⊕ high resolution, reasonable accuracy on coarse grids

Criterion: total computational cost to achieve a prescribed accuracy

JetWings 36
Lecture # 02 Goverening Equations and its Discritization

Grid transformations

Purpose: to provide a simple treatment of curvilinear boundaries

d nozzle dire t mapping d re tangle


P
P

inverse mapping

y a b  a b
physi al domain omputational domain
body- tted grid artesian grid
x 

The original PDE must be rewritten in terms of (ξ, η) instead of (x, y) and
discretized in the computational domain rather than the physical one.

∂u ∂u ∂u ∂u
Derivative transformations , ,... −→ , ,...
∂x ∂y ∂ξ ∂η
| {z } | {z }
difficult to compute easy to compute

JetWings 37
Lecture # 02 Goverening Equations and its Discritization

Finite volume method

The finite volume method is based on (I)


Integral conservation law (I)
rather than (D). The integral conservation Z Z Z
law is enforced for small control volumes ∂
u dV + f · n dS = q dV
∂t V
defined by the computational mesh: S V
S n
f = vu − d∇u
N
[ V

V̄ = V̄i , Vi ∩ Vj = ∅, ∀i 6= j
dS f
flux function
i=1 Z Z Z
Z ∂u
1 dV + ∇ · f dV = q dV
ui = u dV mean value V ∂t V V
|Vi | Vi
Partial differential equation (D)
To be specified ∂u
+∇ · f = q in V
• concrete choice of control volumes ∂t
∂u
• type of approximation inside them In steady state ∂t
= 0 so that

• numerical methods for evaluation ∇ · (uv) = ∇ · (d∇u) + q


of integrals and fluxes

JetWings 38
Lecture # 02 Goverening Equations and its Discritization

Definition of control volumes

Vertex-centered FVM Cell-centered FVM

1D ui 1D ui
ui+1 ui+1
ui 1 ui 1

Vi Vi

xi 1 xi xi+1 xi 1 x i 1=2 xi
x i 1=2 xi+1=2
2D 2D

Vi

Vi Vi
Vi

Different grids / control volumes can be used for different variables (v, p, . . .)

JetWings 39
Lecture # 02 Goverening Equations and its Discritization

Discretization of local subproblems

Integral equation for a single finite volume


Z Z Z
∂ui 1 X 1 1
+ f · nk dS = qi , ui = u dV, qi = q dV
∂t |Vi | Sk |V i | Vi |Vi | Vi
k

• the integral conservation law is satisfied for each CV and for the entire domain
• to obtain a linear system, integrals must be expressed in terms of mean values

Numerical integration pn (x )
Z n
X
f (x) dV ≈ wi f (xi )
V i=0

where wi ≥ 0 are the weights and xi are


the nodes of the quadrature rule x0 xi xn

Such formulae can be derived by exact integration of an interpolation polynomial

JetWings 40
Lecture # 02 Goverening Equations and its Discritization

Newton-Cotes quadrature rules for intervals

x1 +x2
1D x12 = 2 , V = (x1 , x2 ), |V | = x2 − x1
x1 x12 x2
Z
Midpoint rule f (x) dV ≈ |V |f12 exact for f ∈ P1 (V )
V
Z
Trapezoidal rule f1 + f2 exact for f ∈ P1 (V )
f (x) dV ≈ |V |
V 2
Z
Simpson’s rule f1 + 4f12 + f2 exact for f ∈ P3 (V )
f (x) dV ≈ |V |
V 6

Numerical integration for quadrilaterals/hexahedra


y 

1 use a mapping onto a unit square


V
V^ and apply 1D quadrature rules in
each coordinate direction
x 0 1 

JetWings 41
Lecture # 02 Goverening Equations and its Discritization

Newton-Cotes quadrature rules for triangles


2D x3
Midpoints
x1 + x2 x1 + x3 x2 + x3
x13 x123 x23 x12 =
2
, x13 =
2
, x23 =
2
x1 + x2 + x3
Center of gravity x123 =
3
x1 x12 x2
Z
f (x) dV ≈ |V |f123 exact for f ∈ P1 (V )
V
Z
f1 + f2 + f3
f (x) dV ≈ |V | exact for f ∈ P1 (V )
V 3
Z
f12 + f23 + f13
f (x) dV ≈ |V | exact for f ∈ P2 (V )
V 3
Z
3(f1 + f2 + f3 ) + 8(f12 + f23 + f13 ) + 27f123
f (x) dV ≈ |V |
V 60
exact for f ∈ P3 (V )

JetWings 42
Lecture # 02 Goverening Equations and its Discritization

Newton-Cotes quadrature rules for tetrahedra


3D x4

Center of gravity
x1234
x3 x1 + x2 + x3 + x4
x1234 =
4
x1
x2
Z
f (x) dV ≈ |V |f1234 exact for f ∈ P1 (V )
V
Z
f1 + f2 + f3 + f4 exact for f ∈ P1 (V )
f (x) dV ≈ |V |
V 4
Z
f1 + f2 + f3 + f4 + 16f1234 exact for f ∈ P2 (V )
f (x) dV ≈ |V |
V 20

JetWings 43
Lecture # 02 Goverening Equations and its Discritization

Interpolation techniques

Problem: the solution is available only at computational nodes (CV centers)


Interpolation is needed to obtain the function values at quadrature points

1
R
Volume integrals ui = |Vi | Vi
u dV ≈ u(x̄i ) midpoint rule

1
P R
Surface integrals f = vu − d∇u ⇒ |Vi | f · nk dS = Ic + Id
k Sk
Z Z
1 X 1 X
Ic = (v · nk )u dS, Id = d(nk · ∇u) dS
|Vi | Sk |Vi | Sk
k k

Approximation of convective fluxes vertex-centered FVM


ui
1 ui+1
1D: |Vi | ≡ ∆x = N, xi = i∆x ui 1

ui+1/2 − ui−1/2 Vi
Ic = v , v = const
∆x
xi 1 xi xi+1
How to define the interface values ui±1/2 ? x i 1=2 xi+1=2

JetWings 44
Lecture # 02 Goverening Equations and its Discritization

Upwind difference approximation (UDS)

Piecewise-constant solution Upwind-biased interface values

ui 1=2 ui+1=2
v>0 ui−1/2 ≈ ui−1 , ui+1/2 ≈ ui
ui+1
ui ui − ui−1
Ic ≈ v backward difference
ui 1 ∆x

x v<0 ui−1/2 ≈ ui , ui+1/2 ≈ ui+1


xi 1 xi xi+1
ui+1 − ui
xi 1=2 xi+1=2 Ic ≈ v forward difference
∆x
Taylor series expansion
   
v∆x ∂u (∆x)2 ∂2u
vui+1/2 = vui + +v + ...
2 ∂x i 8 ∂x2 i

a first-order accurate flux approximation, the leading truncation error resembles


a diffusive flux d ∂u v∆x
∂x with d = 2 being the numerical diffusion coefficient

JetWings 45
Lecture # 02 Goverening Equations and its Discritization

Central difference approximation (CDS)

Piecewise-linear solution Interpolation polynomial


ui 1=2 ui+1=2 xR − x x − xL
p1 (x) = uL + uR
ui+1 xR − xL xR − xL
ui
Averaged interface values
ui 1
ui−1 + ui ui + ui+1
ui−1/2 ≈ , ui+1/2 ≈
x 2 2

xi 1 xi xi+1
ui+1 − ui−1
Ic ≈ v central difference
xi 1=2 xi+1=2
2∆x

Taylor series expansions


  
∆x ∂u (∆x)2 ∂2u
ui+1 = ui+1/2 + 2 ∂x i+1/2 + 8 ∂x2 + ...
i+1/2
  
∆x ∂u (∆x)2 ∂2u
ui = ui+1/2 − 2 ∂x i+1/2 + 8 ∂x2 − ...
i+1/2
 
ui + ui+1 (∆x)2 ∂2u
Hence, ui+1/2 = − + ... (second-order accuracy)
2 8 ∂x2 i+1/2

JetWings 46
Lecture # 02 Goverening Equations and its Discritization

Linear upwind difference scheme (LUDS)

Piecewise-linear solution Upwind-biased extrapolation


ui 1=2 ui+1=2 3ui−1 −ui−2
ui−1/2 ≈ 2
v ui+1
v>0 3ui −ui−1
ui ui+1/2 ≈ 2

ui 1 3ui − 4ui−1 + ui−2


ui 2 Ic ≈ v
2∆x
x
3ui −ui+1
xi 2 xi 1 xi xi+1 ui−1/2 ≈ 2
v<0 3ui+1 −ui+2
xi 1=2 xi+1=2 ui+1/2 ≈ 2

LUDS is second-order accurate, equivalent 3ui − 4ui+1 + ui+2


Ic ≈ −v
to the one-sided 3-point finite difference 2∆x

The matrix is no longer tridiagonal (shifted, upper/lower triangular if Id = 0)


(m+1) (m+1) (m) (m)
Defect correction: ILU DS = IU DS + [ILU DS − IU DS ], m = 0, 1, 2, . . .

JetWings 47
Lecture # 02 Goverening Equations and its Discritization

Quadratic upwind difference scheme (QUICK)

Quadratic Upwind Interpolation for Convective Kinematics


xR −x xR −x
p2 (x) = uL xx−x
L
M
−xM xR −xL + uM xx−x
M
L
−x x
L R −xM
+ u R x
x−xL x−xM
R −xL xR −xM

ui 1=2 ui+1=2
Upwind-biased interface values
v ui+1
ui 3ui +6ui−1 −ui−2
ui−1/2 ≈ 8
ui 1 v>0
ui 2 ui+1/2 ≈ 3ui+1 +6ui −ui−1
8
x
3ui+1 + 3ui − 7ui−1 + ui−2
xi 2 xi 1 xi xi+1
Ic ≈ v
8∆x
xi 1=2 xi+1=2
3ui−1 +6ui −ui+1
ui−1/2 ≈ 8
• third-order flux approximation v<0 3ui +6ui+1 −ui+2
ui+1/2 ≈ 8
• second-order overall accuracy
3ui−1 + 3ui − 7ui+1 + ui+2
(because of the midpoint rule) Ic ≈ −v
8∆x
• marginally better than LUDS

JetWings 48
Lecture # 02 Goverening Equations and its Discritization

Evaluation of surface integrals


Approximation of convective fluxes
• any second-order finite volume scheme is a linear combination of CDS and
LU DS approximations (e.g. IQU ICK = 34 ICDS + 14 ILU DS )
• high-order schemes can be readily derived by polynomial fitting based on
pm (x), m > 2 but pay off only if the quadrature rule matches their accuracy
• a high-order scheme is guaranteed to produce better results than a low-order
one only asymptotically i.e. for sufficiently fine meshes

Approximation of diffusive fluxes


   
∂u ui − ui−1 ∂u ui+1 − ui slopes of the
≈ , ≈
∂x i−1/2 ∆x ∂x i+1/2 ∆x straight lines

Second-order accurate central difference


∂u
 ∂u

d ∂x i+1/2 − d ∂x i−1/2 ui+1 − 2ui + ui−1
Id = − ≈ −d
∆x (∆x)2

JetWings 49
Lecture # 02 Goverening Equations and its Discritization

Finite element method

Origins: structural mechanics, calculus of variations for elliptic BVPs

Boundary value problem Minimization problem








Lu = f in Ω ? Given a functional J : V → R
 u=g
0 on Γ0 ⇔ find u ∈ V such that


 n · ∇u = g1 on Γ1 J(u) ≤ J(w), ∀w ∈ V


 n · ∇u + αu = g on Γ
2 2 subject to the imposed BC

⊕ the functional contains derivatives of lower order


⊕ solutions from a broader class of functions are admissible
⊕ boundary conditions for complex domains can be handled easily
⊖ sometimes there is no functional associated with the original BVP

Modern FEM: weighted residuals formulation (weak form of the PDE)

JetWings 50
Lecture # 02 Goverening Equations and its Discritization

Fundamentals of the FEM

The Finite Element Method is a systematic approach to generating


piecewise-polynomial basis functions with favorable properties
• The computational domain Ω is subdivided into many
S
small subdomains K called elements: Ω̄ = K∈Th K.
• The triangulation Th is admissible if the intersection of
any two elements is either an empty set or a common
vertex / edge / face of the mesh.
Figure
• The finite element subspace Vh4:consists
Two nodal
of basis functions for the polygonal
piecewise-polynomial domain example
functions.
Typically, Vh = {v ∈ C m (Ω) : v|K ∈ Pk , ∀K ∈ Th }.
comprising the right hand side as well as the entries
• Any function v ∈ Vh is uniquely determined by Za finite number of degrees
a = a( ;at )certain
of freedom (function values or derivatives
i;j = rpoints
j  r dx;
i i; jnodes).
called i= 1; : : : N;
j (12)

of the
• Each basis function ϕi nite element system
accommodates exactly A. degree
matrixone This is where the advantage
of freedom and of the nodal basis
function
has a small support becomes
so that apparent: the
the resulting above integrals
matrices reduce to integrals over supp( ) in the
are sparse. i

rst case and supp( ) \ supp( ) in the second. The supports of two nodal basis functions
i j

for linear triangles consists of all those triangles of which the corresponding node is a
vertex. The supports of two basis functions in our example are shown in Figure 5.
JetWings 51
Lecture # 02 Goverening Equations and its Discritization

Finite element approximation

The finite element is a triple (K, P, Σ), where


• K is a closed subset of Ω̄
• P is the polynomial space for the shape functions
• Σ is the set of local degrees of freedom

ϕi
Basis functions possess the property

 1 if i = j
ϕj (xi ) = δij =
 0 if i 6= j
x0 x i−1 xi x i+1 xN

N
X N
X N
X
uh (x) = uj ϕj (x) ⇒ uh (xi ) = uj ϕj (xi ) = uj δij = ui
j=1 j=1 j=1

Approximate solution: the nodal values u1 , . . . , uN can be computed by the


Ritz method provided that there exists an equivalent minimization problem

JetWings 52
Lecture # 02 Goverening Equations and its Discritization

Least-squares method
Idea: minimize the residual of the PDE
R(w) = Lw − f such that R(u) = 0 ⇒ Lu = f
R
Least-squares functional J(w) = Ω
(Lw − f )2 dx always exists

Necessary condition of an extremum


Z 
d d
J(u + λv) = (L(u + λv) − f )2 dx =0
dλ λ=0 dλ Ω λ=0
R R R
Integration by parts: Ω
(Lu − f )Lv dx = Ω
L∗ (Lu − f )v dx − Γ
[. . .] ds = 0

Euler-Lagrange equation L∗ Lu = L∗ f where L∗ is the adjoint operator

• corresponds to a derivative of the original PDE


• requires additional boundary conditions and extra smoothness
• it makes sense to rewrite a high-order PDE as a first-order system

Advantage: the matrices for a least-squares discretization are symmetric

JetWings 53
Lecture # 02 Goverening Equations and its Discritization

Weighted residuals formulation

Idea: render the residual orthogonal to a space of test functions




P  Lu = f in Ω
Let u = αj ϕj ∈ V0 be the solution of
j=1  u=0 on Γ

Residual is zero if its projection onto each basis function equals zero
R
Lu − f = 0 ⇔ Ω
(Lu − f )ϕi dx = 0 ∀i = 1, 2, . . .


P R
Test functions v= βj ϕj ⇒ Ω
(Lu − f )v dx = 0, ∀v ∈ V0
j=1

Weak formulation: find u ∈ V0 such that a(u, v) = l(v) ∀v ∈ V0


R R
where a(u, v) = Ω
Lu v dx is a bilinear form and l(v) = Ω
f v dx
R
Integration by parts: Lu = ∇ · g(u) ⇒ a(u, v) = − Ω
g(u) · ∇v dx

JetWings 54
Lecture # 02 Goverening Equations and its Discritization

Finite element discretization


Continuous problem Discrete problem

Find u ∈ V0 such that Find uh ∈ Vh ⊂ V0 such that


a(u, v) = l(v), ∀v ∈ V0 a(uh , vh ) = l(vh ), ∀vh ∈ Vh′

N
X N
X
FEM approximations: uh = u j ϕj ∈ V h , vh = vj ψj ∈ Vh′
j=1 j=1

where Vh = span{ϕ1 , . . . , ϕN } and Vh′ = span{ψ1 , . . . , ψN } may differ

(Bubnov-)Galerkin method Vh′ = Vh → a(u, ϕi ) = l(ϕi ), ψi = ϕi


Petrov-Galerkin method Vh′ 6= Vh → a(u, ψi ) = l(ψi ), ψi 6= ϕi
N
X
Linear algebraic system a(ϕj , ψi )uj = l(ψi ), ∀i = 1, . . . , N
j=1

Matrix form Au = F with coefficients aij = a(ϕj , ψi ), Fi = l(ψi )

JetWings 55

You might also like