Professional Documents
Culture Documents
Domain
Inlet boundary Outlet boundary
Wall boundary
x
Lagrangian coordinates
The particle path is given by the history of the position vector
y Like Dynamics
r (x, y, t)
Particle path
x
Eulerian viewpoint
Tracks a property of the particles from one fixed position
y
x
Eulerian coordinates
The coordinates correspond exactly to the positions
y
Fixed boundary
x
Boundary Conditions
Neumann boundary condition
Simulation domain
u
𝜕𝑢
=0
𝜕𝑦
u (x, y, t)=0
Conservation of Mass
(properties of interest: density, velocities)
Conservation of Momentum
(properties of interest: density, pressure, velocities)
Conservation of Energy
(properties: density, pressure, temperature, velocities)
Conservation laws & CFD
• CFD is modeled with conservation laws.
• The conservation laws as applied over the
Eulerian space, leads to partial differential
equations or the governing equations.
• Governing equations are used to calculate the
properties (velocities, density, pressure,
temperature, etc.) in the CFD domain.
Basic conservation structure
no space/geometry information
=
First Law of Thermodynamics
The equation below cannot describe the physics in the chamber
𝛿𝑈 = 𝛿𝑄 − 𝛿𝑊
Dynamic conservation structure
with space/geometry information
x
x
CFD Mesh with boundary conditions
Wall
In mathematics form:
This equation makes sure that fluid
is not created out of thin air
𝜕𝜌 𝜕
Continuity equation: + 𝜌𝑢 = 0
𝜕𝑡 𝜕𝑥
𝜕𝜌𝑢 𝜕𝜌𝑢2 𝜕𝑝 𝜕 𝜕𝑢
Momentum equation: + =− + 𝜇 + 𝜌𝑓𝑥
𝜕𝑡 𝜕𝑥 𝜕𝑥 𝜕𝑥 𝜕𝑥
Normal vectors
න 𝛻 ∙ 𝜌𝑢 𝑑𝑉 = න 𝜌 𝑢 ∙ 𝑛 𝑑𝑆
𝑉 𝑆
Divergence theorem
𝜕
Source 𝛻∙𝑢 >0 න 𝜌 𝑑𝑉 + න 𝛻 ∙ 𝜌𝑢 𝑑𝑉 = 0
𝜕𝑡 𝑉 𝑉
𝜕𝜌
Sink 𝛻∙𝑢 <0 + 𝛻 ∙ 𝜌𝑢 = 0
𝜕𝑡
Divergence in Cartesian coordinates
𝜕𝑢 𝜕𝑣 𝜕𝑤
𝛻∙𝑢 = + +
𝜕𝑥 𝜕𝑦 𝜕𝑧
Adding Removing
𝑢1 + 𝑢2 𝑢1 + 𝑢2 𝑢1 - 𝑢2 𝑢1 - 𝑢2
𝑥1 𝑥2 𝑥1 𝑥2 𝑥1 𝑥2 𝑥1 𝑥2
𝜕𝑢 𝜕𝑢 𝜕𝑢 𝜕𝑢
<0 <0 >0 >0
𝜕𝑥 𝜕𝑥 𝜕𝑥 𝜕𝑥
𝜕𝑢 𝑢2 − 𝑢1
Consider the x direction: = lim
𝜕𝑥 Δ𝑥→0 𝑥2 − 𝑥1
Different forms of continuity equation
𝜕𝜌
+ 𝛻 ∙ 𝜌𝑢 = 0
𝜕𝑡
Rectangular coordinates 𝑥, 𝑦, 𝑧 :
𝜕𝜌 𝜕𝜌𝑢 𝜕𝜌𝑣 𝜕𝜌𝑤
+ + + =0
𝜕𝑡 𝜕𝑥 𝜕𝑦 𝜕𝑧
Cylindrical coordinates 𝑟, 𝜃, 𝑧 :
𝜕𝜌 1 𝜕𝜌𝑟𝑢 1 𝜕𝜌𝑣 𝜕𝜌𝑤
+ + + =0
𝜕𝑡 𝑟 𝜕𝑟 𝑟 𝜕𝜃 𝜕𝑧
Spherical coordinates 𝑟, 𝜃, 𝜑 :
𝜕𝜌 1 𝜕𝜌𝑟 2 𝑢 1 𝜕𝜌𝑣 sin 𝜃 1 𝜕𝜌𝑤
+ + + =0
𝜕𝑡 𝑟 2 𝜕𝑟 𝑟 sin 𝜃 𝜕𝜃 𝑟 sin 𝜃 𝜕𝜑
Derivation of the momentum equation
[Rate of momentum accumulation] = [Momentum flow into the volume]
+ [Surface forces] + [Volume forces]
𝑑
න 𝜌𝑢 𝑑𝑉 = − න 𝜌𝑢 𝑢 ∙ 𝑛 𝑑𝑆 + න 𝜎Ԧ ∙ 𝑛 𝑑𝑆 + න 𝜌𝑓Ԧ 𝑑𝑉
𝑑𝑡 𝑉 𝑆 𝑆 𝑉
𝑑
න 𝜌𝑢 𝑑𝑉 = − න 𝛻 ∙ 𝜌𝑢𝑢 𝑑𝑉 + න 𝛻 ∙ 𝜎Ԧ 𝑑𝑉 + න 𝜌𝑓Ԧ 𝑑𝑉
𝑑𝑡 𝑉 𝑉 𝑉 𝑉
Constant viscosity
Newton’s law of viscosity
for momentum transport
𝑇
−𝜏റ = 𝜇 𝛻𝑢 + 𝛻𝑢
−𝑞റ = 𝑘𝛻𝑇
−റ𝑗 = D𝛻φ
Grid
1D Function Approximation
Quadratic solutions
Properties
Grid
1D Finite Volume Method
Partial differential equation:
𝜕 𝜕 𝜕𝑝 𝜕 𝜕𝑈
𝜌𝑈 + 𝜌𝑈 2 = − + (𝜇 )
𝜕𝑡 𝜕𝑥 𝜕𝑥 𝜕𝑥 𝜕𝑥
Integrate
𝜕 𝜕 𝜕𝑝 𝜕 𝜕𝑈
න 𝜌𝑈 𝑑𝑥 + න 𝜌𝑈 2 𝑑𝑥 = − න 𝑑𝑥 + න (𝜇 )𝑑𝑥
𝜕𝑡 𝜕𝑥 𝜕𝑥 𝜕𝑥 𝜕𝑥
Discretization
Algebraic equation:
𝑎𝑃 𝑈𝑃 = 𝑎𝐸 𝑈𝐸 + 𝑎𝑊 𝑈𝑊 + 𝑠𝑢,𝑃
fw w e fe
FW W P E FE
Δx
Convection term
w e
W P E
𝜕
න 𝜌𝑈 2 𝑑𝑥 = 𝜌𝑈 𝑒 𝑈𝑒 − 𝜌𝑈 𝑤 𝑈𝑤
𝜕𝑥
𝜌𝑈 𝑒 𝜌𝑈 𝑤 𝜌𝑈 𝑒 𝜌𝑈 𝑤
= − 𝑈𝑃 + 𝑈𝐸 + − 𝑈𝑊
2 2 2 2
Diffusion term
w e
W P E
𝜕 𝜕𝑈 𝜕𝑈 𝜕𝑈
−න 𝜇 𝑑𝑥 = − 𝜇 + 𝜇
𝜕𝑥 𝜕𝑥 𝜕𝑥 e
𝜕𝑥 𝑤
Δ𝑈 Δ𝑈
=− 𝜇 + 𝜇
Δ𝑥 e
Δ𝑥 w
𝜇
=− 𝑈𝐸 − 𝑈𝑃 − 𝑈𝑃 − 𝑈𝑊
Δ𝑥
2𝜇 𝜇 𝜇
= 𝑈 + − 𝑈 + − 𝑈
Δ𝑥 𝑃 Δ𝑥 𝐸 Δ𝑥 𝑊
Unsteady term
w0 e0 Time 0
W0 P0 E0
Time step
w e Time 1
W P E
𝜕 𝜌𝑃
න 𝜌𝑈 𝑑𝑥 = 𝑈𝑃 − 𝑈𝑃0 Δ𝑥
𝜕𝑡 Δ𝑡
𝜌𝑃 Δ𝑥 𝜌𝑃 Δ𝑥 0
= 𝑈𝑃 + − 𝑈
Δt Δt 𝑃
Source term – Pressure gradient
w e
W P E
𝜕𝑝
−න 𝑑𝑥 = −𝑝𝑒 + 𝑝𝑤
𝜕𝑥
𝑝𝐸 𝑝𝑊
= − +
2 2
Handling boundary conditions
• Dirichlet boundary condition
Boundary wall
𝑈=𝑎
b e Domain
𝑈𝐵 + 𝑈𝑃 B P E
=𝑎
2
Δx
• Neumann boundary condition
𝜕𝑈
=𝑎
𝜕𝑥
Δ𝑈 = 𝑈𝑃 − 𝑈𝐵 = 𝑎Δ𝑥
Dirichlet boundary conditions
• Wall (not moving)
Boundary wall
𝑈 𝑏 =0
b e Domain
𝑈𝐵 + 𝑈𝑃 B P E
=0
2
Δx
• Moving wall at 2m/s
𝑈 𝑏 =2
𝑈𝐵 + 𝑈𝑃
=2
2
Neumann boundary conditions
• Symmetry (zero gradient)
Boundary wall
𝜕𝑈
=0
𝜕𝑥 b e Domain
B P E
Δ𝑈 = 𝑈𝑃 − 𝑈𝐵 = 0
Δx
• Flux (gradient=3)
𝜕𝑈
=3
𝜕𝑥
Δ𝑈 = 𝑈𝑃 − 𝑈𝐵 = 3Δ𝑥
Apply the algebraic equation to the
grid
𝑎𝑃 𝑈𝑃 = 𝑎𝐸 𝑈𝐸 + 𝑎𝑊 𝑈𝑊 + 𝑠𝑈,𝑃
Boundary wall
𝑎1 𝑈1 = 𝑎2 𝑈2 + 𝑎𝑏 𝑈𝑏 + 𝑠𝑈,1
𝑎2 𝑈2 = 𝑎3 𝑈3 + 𝑎1 𝑈1 + 𝑠𝑈,2
So on..
b 1 2 𝑎3 𝑈3 = 𝑎4 𝑈4 + 𝑎2 𝑈2 + 𝑠𝑈,3
𝑎4 𝑈4 = 𝑎5 𝑈5 + 𝑎3 𝑈3 + 𝑠𝑈,4
Δx ⋮
⋮
From the algebraic equations to the
global matrix
𝑎𝑃 𝑈𝑃 = 𝑎𝐸 𝑈𝐸 + 𝑎𝑊 𝑈𝑊 + 𝑠𝑈,𝑃
𝑎1,1 −𝑎1,2
−𝑎2,1 𝑎2,2 −𝑎2,3 𝑈1 𝑆𝑈,1 + 𝑎𝑏 𝑈𝑏
−𝑎3,2 𝑎3,3 −𝑎3,4 𝑈2 𝑆𝑈,2
⋮ ⋮
𝑈𝑖−1 𝑆𝑈,𝑖−1
⋱
𝑈𝑖 = 𝑆𝑈,𝑖
−𝑎𝑛−2, 𝑈𝑖+1 𝑆𝑈,𝑖+1
𝑎𝑛−2, −𝑎𝑛−2,
𝑛−3 𝑛−2 𝑛−1 ⋮ ⋮
−𝑎𝑛−1, 𝑎𝑛−1, −𝑎𝑛−1, 𝑈𝑛−1 𝑆𝑈,𝑛−1
𝑛−2 𝑛−1 𝑛
𝑈𝑛 𝑆𝑈,𝑛 + 𝑎𝑐 𝑈𝑐
−𝑎 𝑛, 𝑎𝑛,𝑛
𝑛−1
Iterative methods: Explicit method
𝑎𝑃 𝑈𝑃 = 𝑎𝐸 𝑈𝐸 + 𝑎𝑊 𝑈𝑊 + 𝑠𝑈,𝑃
𝑎𝐸 𝑈𝐸′ + 𝑎𝑊 𝑈𝑊
′
+ 𝑠𝑈,𝑃 Grid and coordinates
𝑈𝑃 =
𝑎𝑃
xb x1 x2 x3 x4 x5 x6 x7 x8 …
Ub’ U1’ U2’ U3’ U4’ U5’ U6’ U7’ U8’ … Previous iteration
Ub U1 U2 U3 U4 U5 U6 U7 U8 … Current iteration
Next iteration
Convergence / divergence
Explicit method is simple to implement but not 100% stable.
Iterative methods: Implicit method
𝑎𝑃 𝑈𝑃 = 𝑎𝐸 𝑈𝐸 + 𝑎𝑊 𝑈𝑊 + 𝑠𝑈,𝑃 b1 c1 0 0 0 U1 S1 – a1Ub
a2 b2 c2 0 0 U2 S2
𝑎𝑈𝑊 + 𝑏𝑈𝑃 + 𝑐𝑈𝐸 = 𝑠𝑈,𝑃
0 a3 b3 c3 0 U3 = S3
𝑠𝑈,𝑃 = 𝑑
0 0 a4 b4 c4 U4 S4
0 0 0 a5 b5 U5 S5 – c5Uc
Tri-Diagonal Matrix Algorithm*
function x = TDMAsolver(a,b,c,d) %a, b, c are the columns, d is the right vector
n = length(d); % n is the number of rows
c(1) = c(1) / b(1); d(1) = d(1) / b(1); % Modify the first-row coefficients
for i = 2:n-1
temp = b(i) - a(i) * c(i-1); c(i) = c(i) / temp; d(i) = (d(i) - a(i) * d(i-1))/temp;
end
d(n) = (d(n) - a(n) * d(n-1))/( b(n) - a(n) * c(n-1)); % Now back substitute.
x(n) = d(n);
for i = n-1:-1:1
x(i) = d(i) - c(i) * x(i + 1);
end
Implicit method is more complicated to implement but 100% stable.
*Matlab TDMA solver, http://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm, accessed 4/10/2014.
Example 2
Given a partial differential equations and its initial and boundary conditions:
𝜕𝑢 𝜕𝑢2
+ =0
𝜕𝑡 𝜕𝑥
𝑢 0, 𝑡 = 1
𝑑𝑢(1,𝑡)
=0
𝑑𝑥
𝑢 𝑥, 0 = 0
Conservation of momentum:
′ ′
𝜕𝑢ഥ𝑖 𝜕𝑢ഥ𝑖 𝜕𝑢𝑖 𝑢𝑗 1 𝜕𝑝ҧ
+ 𝑢ഥ𝑗 + = 𝑓ഥ𝑖 − + 2𝜈𝑆𝑖𝑗
𝜕𝑡 𝜕𝑥𝑗 𝜕𝑥𝑗 𝜌 𝜕𝑥𝑖
CFD model
Turbulence model
Boussinesq hypothesis:
2
−𝑢𝑖′ 𝑢𝑗′ = 2𝜈𝑡 𝑆𝑖𝑗 − 𝑘𝛿𝑖𝑗
3
Where:
𝜈𝑡 Eddy viscosity
𝑘 Turbulent kinetic energy
CFD model - standard k-epsilon model
There are other more complex, more computationally expensive models
𝜕𝑘 𝜕 𝑘𝑢𝑖 𝜕 𝜈𝑡 𝜕𝑘
+ = 𝜈+ + 2𝜈𝑡 𝑆 2 − 𝜖
𝜕𝑡 𝜕𝑥𝑖 𝜕𝑥𝑗 𝜎𝑘 𝜕𝑥𝑗
𝜕𝜖 𝜕 𝜖𝑢𝑖 𝜕 𝜈𝑡 𝜕𝜖 𝜖 𝜖 2
+ = 𝜈+ + 𝐶1𝜖 2𝜈𝑡 𝑆 2 − 𝐶2𝜖
𝜕𝑡 𝜕𝑥𝑖 𝜕𝑥𝑗 𝜎𝜖 𝜕𝑥𝑗 𝑘 𝑘
Where
𝐶𝜈 𝑘 2
𝜈𝑡 =
𝜖
𝐶𝜈 = 0.09 𝜎𝑘 = 1.0 𝜎𝜖 = 1.3
𝐶1𝜖 = 1.44 𝐶2𝜖 = 1.92