Lecture # 02 Goverening Equations and Its Discritization
Lecture # 02 Goverening Equations and Its Discritization
Lecture # 02 Goverening Equations and Its Discritization
∂ ∂ ∂
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
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
JetWings 2
Lecture # 02 Goverening Equations and its Discritization
b3
∂u ∂u ∂u
Example. v · ∇u = vx + vy + vz convective derivative
∂x ∂y ∂z
a3 a3 b1 a3 b2 a3 b3
JetWings 3
Lecture # 02 Goverening Equations and its Discritization
JetWings 4
Lecture # 02 Goverening Equations and its Discritization
JetWings 5
Lecture # 02 Goverening Equations and its Discritization
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
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
Eulerian Lagrangian
S S
integral
V V
differential
dS dS
dV dV
JetWings 8
Lecture # 02 Goverening Equations and its Discritization
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
JetWings 9
Lecture # 02 Goverening Equations and its Discritization
JetWings 10
Lecture # 02 Goverening Equations and its Discritization
Lagrangian representation
dρ
∇ · (ρv) = v · ∇ρ + ρ∇ · v ⇒ + ρ∇ · v = 0
dt
dρ
Incompressible flows: dt =∇·v =0 (constant density)
JetWings 11
Lecture # 02 Goverening Equations and its Discritization
Conservation of momentum
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
∂(ρ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)
w = f · v = ρg · v dV + v · (σ · n) dS, σ = −pI + τ
JetWings 14
Lecture # 02 Goverening Equations and its Discritization
JetWings 15
Lecture # 02 Goverening Equations and its Discritization
∂(ρ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
JetWings 17
Lecture # 02 Goverening Equations and its Discritization
∂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
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
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
v0 L0 convection µ
Peclet number Pe = κ diffusion Prandtl number Pr = ρκ
JetWings 21
Lecture # 02 Goverening Equations and its Discritization
Model simplifications
ρ = const µ=0
JetWings 22
Lecture # 02 Goverening Equations and its Discritization
JetWings 23
Lecture # 02 Goverening Equations and its Discritization
∂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
JetWings 24
Lecture # 02 Goverening Equations and its Discritization
Computational meshes
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
JetWings 27
Lecture # 02 Goverening Equations and its Discritization
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
Geometric interpretation
u forward ba
kward
entral ∂u
ui+1 −ui
∂x i ≈ ∆x forward difference
∂u
ui −ui−1
∂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
JetWings 30
Lecture # 02 Goverening Equations and its Discritization
≈ =
∂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
JetWings 32
Lecture # 02 Goverening Equations and its Discritization
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
α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
α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
JetWings 36
Lecture # 02 Goverening Equations and its Discritization
Grid transformations
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
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
JetWings 38
Lecture # 02 Goverening Equations and its Discritization
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
• 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
JetWings 40
Lecture # 02 Goverening Equations and its Discritization
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
JetWings 41
Lecture # 02 Goverening Equations and its Discritization
JetWings 42
Lecture # 02 Goverening Equations and its Discritization
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
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
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
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
JetWings 45
Lecture # 02 Goverening Equations and its Discritization
xi 1 xi xi+1
ui+1 − ui−1
Ic ≈ v central difference
xi 1=2 xi+1=2
2∆x
JetWings 46
Lecture # 02 Goverening Equations and its Discritization
JetWings 47
Lecture # 02 Goverening Equations and its Discritization
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
JetWings 49
Lecture # 02 Goverening Equations and its Discritization
JetWings 50
Lecture # 02 Goverening Equations and its Discritization
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
ϕ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
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
JetWings 53
Lecture # 02 Goverening Equations and its Discritization
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
JetWings 54
Lecture # 02 Goverening Equations and its Discritization
N
X N
X
FEM approximations: uh = u j ϕj ∈ V h , vh = vj ψj ∈ Vh′
j=1 j=1
JetWings 55