solving the navier-stokes equations · pdf fileindustrial scale flow problems. with over 220...
TRANSCRIPT
FMIA
ISBN 978-3-319-16873-9
Fluid Mechanics and Its ApplicationsFluid Mechanics and Its ApplicationsSeries Editor: A. Thess
F. MoukalledL. ManganiM. Darwish
The Finite Volume Method in Computational Fluid DynamicsAn Advanced Introduction with OpenFOAM® and Matlab®
The Finite Volume Method in Computational Fluid Dynamics
Moukalled · Mangani · Darwish
113
F. Moukalled · L. Mangani · M. Darwish The Finite Volume Method in Computational Fluid Dynamics An Advanced Introduction with OpenFOAM® and Matlab ®
This textbook explores both the theoretical foundation of the Finite Volume Method (FVM) and its applications in Computational Fluid Dynamics (CFD). Readers will discover a thorough explanation of the FVM numerics and algorithms used in the simulation of incompressible and compressible fluid flows, along with a detailed examination of the components needed for the development of a collocated unstructured pressure-based CFD solver. Two particular CFD codes are explored. The first is uFVM, a three-dimensional unstructured pressure-based finite volume academic CFD code, implemented within Matlab®. The second is OpenFOAM®, an open source framework used in the development of a range of CFD programs for the simulation of industrial scale flow problems.
With over 220 figures, numerous examples and more than one hundred exercises on FVM numerics, programming, and applications, this textbook is suitable for use in an introductory course on the FVM, in an advanced course on CFD algorithms, and as a reference for CFD programmers and researchers.
Engineering
9 783319 168739
Solving the Navier-Stokes Equations
Chapter 15
Introduction
• For the solution of the scalar equation we have assumed that the velocity field is known
• How do we actually compute the velocity field is the subject of this lecture
!m = ρv ⋅S
Velocity Pressure Coupling
Navier-Stokes Equations∂ ρφ( )∂t
transient term!"#
+ ∇⋅ ρvφ( )convection term!"# $#
= ∇⋅ Γ∇φ( )diffusion term! "# $# + Q
source term!
Navier-Stokes equations are a special case of the general scalar equation with Φ = 1, u or v and Γ=0 or μ and appropriate Q
∂ ρv( )∂t
+∇ ⋅ ρvv( ) = ∇ ⋅τ − ∇p + B
∂ρ∂t
+∇⋅ ρv( ) = 0
τ = −µ ∇v +∇vT( )+ 23µI∇⋅v
NS equations are non-linear‣ Not by itself a problem
‣ Can do Picard iteration
Momentum Equations (x,y,z)‣ not a problem
‣ Can solve each sequentially
Source terms?‣ stress tensor sources can be computed
Main Issue is that pressure is not known‣ should find a way to compute it
‣ what PDE to use?
‣ Special case of incompressible flow
Options
• Option 1‣ Vorticity-Stream function formulation
• Option 2‣ Density Based formulation
• Option 3‣ Use the Momentum equations to compute the velocity field‣ Use the Continuity equation to form a pressure equation to
compute the Pressure field‣ This is known as the Primitive Variables Formulation
Option I• Used in 70’s-80’s‣ Derive one PDE for stream function Ψ and one PDE for the
single component vorticity in 2D‣ Eliminates pressure as variable‣ Only 2 PDE;s as opposed to 3 for primitive variable formulation
(u,v,p)
• However no stream function definition in 3D flows
• Vorticity-vector potential formulation in 3D‣ 6 components (3 for vorticity, 3 vector potential)‣ Fewer components for primitive variable formulation
• Difficult to derive bc’s
Option 2: Density Methods
• Popular in compressible flow community
• (u,v,w,ρ,E) used as unknowns
• Artificial compressibility/preconditioning schemes
• Effectively add some artificial compressibility to enable use of density-based schemes for incompressible flows
• Widely used in aeronautics industry
Option 3: Pressure Methods
• Will focus on pressure-based methods since they are the most widely used in the incompressible flow community.
• At convergence, the solution satisfies the discrete continuity and momentum equations
• Choice of pressure-based/density-based solution technique only governs‣ whether we get a solution‣ how fast/cheaply we can get it ‣ how much memory/storage we need
SIMPLE Algorithm
• Semi-Implicit Method for Pressure-Linked Equations
• Proposed by Patankar and Spalding (1972)
• Idea is to start with discrete continuity equation
• Substitute into it the discrete u and v momentum equations
• Discrete momentum equations contain pressure differences
• Hence get an equation for the discrete pressures
• SIMPLE actually solves for a related quantity called the pressure correction
Flow in PipesA portion of a water-supply system is shown in the figure below. The flow rate in a pipe is given by
!mA
!mB
!mF = 20
!mE
!mD
!mC
P1 = 275
P6 = 40
P2 = 270
P5
P4 = 0
P3
!m = C∆ PCA = 0.4
CB = CD = CF = 0.2
CC = CE = 0.1
Pressure drop over the length of the pipe
Hydraulic conductance
1 Guess values for the unknowns
2Compute the flow rates using the guessed pressure
3Construct a pressure correction equation, and solve for the pressure correction
Solution
!mk∗ + ! ′mk( )
~k∑ = 0
! ′mk
~k∑ = − !mk
∗
~k∑
1 P3 = 200 P5 = 30
!mB∗ = CB P3
∗ − P2( ) !mA∗ = CA P1 − P3
∗( ) !mC∗ = CC P4 − P3
∗( ) !mD∗ = CD P3
∗ − P5∗( ) !mE∗ = CE P6 − P5
∗( )2
!mk∗ ≠ 0
~k∑
!mk = 0
~k∑
!m∗ = C∆ P∗
! ′m = C∆ ′P( ) !m = C∆ P
3
! ′mA = CA − ′p3( )
! ′mB = CB ′p3( )
! ′mC = CC − ′p3( ) ! ′mD = CD ′p3 − ′p5( )
! ′mE = CE − ′p5( )
!mA
!mB
!mF = 20
!mE
!mD
!mC
P1 = 275
P6 = 40
P2 = 270
P5
P4 = 0
P3
! ′mA − ! ′mB + ! ′mC − ! ′mD = − !mA
∗ − !mB∗ + !mC
∗ − !mD∗( )
! ′mD + ! ′mE = − !mD∗ + !mE
∗ − !mF( )
!mk∗ + ! ′mk( )
k=nb 3( )∑ = 0
CA − ′p3( )−CB ′p3( ) +CC − ′p3( )−CD ′p3 − ′p5( ) = − !mA∗ − !mB
∗ + !mC∗ − !mD
∗( )
!mk∗ + ! ′mk( )
k=nb 5( )∑ = 0
CD ′p3 − ′p5( ) +CE − ′p5( )= − !mD
∗ + !mE∗ − !mF( )
3
! ′mA = CA − ′p3( )
! ′mB = CB ′p3( )
! ′mC = CC − ′p3( ) ! ′mD = CD ′p3 − ′p5( )
! ′mE = CE − ′p5( )
!mA
!mB
!mF = 20
!mE
!mD
!mC
P1 = 275
P6 = 40
P2 = 270
P5
P4 = 0
P3
−0.7 ′p3( ) + 0.2 ′p5( ) = 100.2 ′p3( )− 0.3 ′p5( ) = −15
⇒′p3 = 0′p5 = 50
⎧⎨⎪
⎩⎪
! ′mA = 0
! ′mB = 0
! ′mC = 0
! ′mD = −10
! ′mE = −5
!mB∗ = −14
!mA∗ = 30
!mC∗ = −20
!mD∗ = 34
!mE∗ = 1
!mF = 20P1 = 275
P6 = 40
P2 = 270
P4 = 0
p3∗ = 200
p5∗ = 30
′p3 = 0
′p5 = 50
SIMPLE Based Algorithms
The SIMPLE AlgorithmStaggered Grid
aCvvC
• + aFvvF
•
F=NB(C )∑ = −VC ∇p(n)( )C
∇.(ρvv) = −∇p +∇⋅τ +B
∴v n( ),P n( )
!m•f
f =nb(C )∑ ≠ 0
∇⋅(ρv) = 0
Predictor
∴v•,P n( )
Corrector∴ ′v , ′P
!mf
f =nb(C )∑ = 0
!m•f + ! ′mf( )
f =nb(C )∑ = 0 !m
•ff = ρv•f ⋅Sf
! ′mf = ρ ′v f ⋅Sf
aeuue
• + afuu f
•
f =NB(e)∑ = −Ve ∇p(n)( )e
C EWw e
ρv f• ⋅Sf
f =NB(C )∑ = ρue
•Ae − ρuw•Aw
ue• +
afuu f
•
aeu
f =NB(e)∑ = − Ve
aeu
∂p(n)
∂x⎛⎝⎜
⎞⎠⎟ e
ue• = He u
•( )− de ∂p(n)
∂x⎛⎝⎜
⎞⎠⎟ e
uw• = Hw u•( )− dw ∂p(n)
∂x⎛⎝⎜
⎞⎠⎟ w
ue• = He u
•( )− de ∂p(n)
∂x⎛⎝⎜
⎞⎠⎟ e
′ue = He ′u( )− de∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ e
ue = He u( )− de∂p∂x
⎛⎝⎜
⎞⎠⎟ e
! ′mf
f =nb(C )∑ = − !m•
ff =nb(C )∑
′v f = H f ′v( )− d f ∇ ′p( ) f
Pv
Pressure Equation
ρ ′v f ⋅S f
f =nb(C )∑ = − !m•
ff =nb(C )∑ ′v f = H f ′v( )− d f ∇ ′p( ) fSubstituting
H f ′v( )− d f ∇ ′p( ) f⎡⎣ ⎤⎦ ⋅S f
f =nb(C )∑ = − !m•
ff =nb(C )∑
−d f ∇ ′p( ) f ⋅S f
f =nb(C )∑ = − !m•
ff =nb(C )∑ − H f ′v( ) ⋅S f
f =nb(C )∑
− −affu ′v ff
a fu
ff =NB( f )∑
⎛
⎝⎜⎞
⎠⎟⋅S f
f =nb(C )∑
C EWw e
−d f ∇ ′p( ) f ⋅S ff =nb(C )∑ = −
d f Af
CF′pF − ′pC( )
f =nb(C )∑
= aCp ′pC + aE
p ′pE + aWp ′pW( )
− !m•
ff =nb(C )∑ = − ρue
•Ae − ρuw•Aw( )
⇒ −d f Af
CF′pF − ′pC( )
f =nb(C )∑ = − ρue
•Ae − ρuw•Aw( )
aCp ′pC + aE
p ′pE + aWp ′pW( ) = bCp ⇒ ′v f = −d f ∇ ′p( ) f ⇒ v••f = v
•f − d f ∇ ′p( ) f
SIMPLESIMPLECSIMPLERSIMPLESTSIMPLE-MPISO
The SIMPLE Algorithm
assemble and solve momentum equation for v*
assemble and solve Pressure Correction equation for P'
repeat until convergence
SIMPLE iteration assemble using Rhie-Chow interpolation
m∗
f
correct , v*, ρ(n) and P(n) to get
improved , v**, ρ* and P*
m∗
f
m∗∗
f
start with nth iteration values
, v(n), ρ(n), P(n)m
(n)f
∴v n( ),P n( )
Predictor∴v•,P n( )
Corrector
∴v••, ′P
aCp ′pC + aE
p ′pE + aWp ′pW( ) = bCp
aCvvC
• + aFvvF
•
F=NB(C )∑ = −VC ∇p(n)( )C
v••f = v•f − d f ∇ ′p( ) f
p•C = p(n)C + ′pC
Sequential Solution
• Pressure methods were also developed as sequential methods as opposed to coupled methods where all the Navier-Stokes equation are solved simultaneously
• In sequential methods each of the following equation is solved individually in sequence‣ Solve u-momentum equation for u velocity component, with all
other variables assumed known‣ Solve v-momentum equation for v velocity component‣ Modify the continuity equation to yield a pressure equation and
solve for pressure‣ Repeat process until convergence
Collocated Grids
Collocated Grids
C EW
w e
C EWw e
u P
Pu
!mf
uw ueu f
??u f
C EW
w e
C EWw e
∂ p∂x⎛⎝⎜⎜⎜⎞⎠⎟⎟⎟f
∂ p∂x⎛⎝⎜⎜⎜⎞⎠⎟⎟⎟C
ρ ′v f ⋅S f
f =nb(C )∑ = − !m•
ff =nb(C )∑
′!mf
f =nb(C )∑ = − !m•
ff =nb(C )∑
′v f = 12 ′vC + ′vF( )
′ue = He ′u( )+ De∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ e
′uw = Hw ′u( ) + Dw∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ w
′ue − ′uw = He ′u( )− Hw ′u( )+ De∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ e
− Dw∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ w
≈ D∆ x
12
′pEE − 2 ′pC + ′pWW[ ]
!m•e − !m
•w = ρA u•
E − u•W( )Similarly
≈ D 12
∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ E
+ ∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ C
− ∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ C
− ∂ ′p∂x
⎛⎝⎜
⎞⎠⎟W
⎡
⎣⎢
⎤
⎦⎥
= 12 HC ′v( )− DC
∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ C
+ HF ′v( )− DF∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ F
⎛⎝⎜
⎞⎠⎟
aCp ′pC + aEE
p ′pEE + aWWp ′pWW = − !mE
• − !mW•( )
Rhie Chow Interpolation
H f v( )= gPHP v( )+ gFHF v( )
vP = HC v( )−DC∇pC
v f = v f +∇p f( )−D f∇pf
Df =Vf
a fv
HP v( )=−aFvvFaCv
F∑
DP =VCaCv
v f = H f v( )−D f∇pf
vF = HF v( )−DF∇pF
!mf• = ρv f
• ⋅Sf
C EW
w e
C EWw e
u P
Pu uw ue
u f
C EW
w e
C EWw e
∂ p∂x⎛⎝⎜⎜⎜⎞⎠⎟⎟⎟f
∂ p∂x⎛⎝⎜⎜⎜⎞⎠⎟⎟⎟C
!mf !mf
!me !mw
= gP vP +DP∇pP( )+ gF vF +DF∇pF( )≈ v f +Df∇pf
= v f −D f ∇pf −∇p f( )
!′mf = ρ ′v f ⋅Sf
1
2
3
Pressure Correction
u P
ρ ′v f ⋅S ff =nb(C )∑ = − !m•
ff =nb(C )∑
′!mf
f =nb(C )∑ = − !m•
ff =nb(C )∑
′v f == v f − D f ∇pf −∇p f( )′ue = ′ue − De
∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ e
− ∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ e
⎛
⎝⎜⎞
⎠⎟
′ue − ′uw = ′ue − De∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ e
− ∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ e
⎛
⎝⎜⎞
⎠⎟⎡
⎣⎢⎢
⎤
⎦⎥⎥− ′uw − Dw
∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ w
− ∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ w
⎛
⎝⎜⎞
⎠⎟⎡
⎣⎢⎢
⎤
⎦⎥⎥
≈ D∆ x
12
′pE − 2 ′pC + ′pW[ ]
!m•e − !m
•w = ρ f ue
•Ae − ρwuw•Aw
Similarly
≈ D 12
∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ e
− ∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ w
⎡
⎣⎢
⎤
⎦⎥
′uw = ′uw − Dw∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ w
− ∂ ′p∂x
⎛⎝⎜
⎞⎠⎟ w
⎛
⎝⎜⎞
⎠⎟
C EW
w e
C EWw e
Pu uw ue
u f
C EW
w e
C EWw e
∂ p∂x⎛⎝⎜⎜⎜⎞⎠⎟⎟⎟f
∂ p∂x⎛⎝⎜⎜⎜⎞⎠⎟⎟⎟C
!mf
!me !mw
aCp ′pC + aE
p ′pE + aWp ′pW = − !mf
•
f =nb C( )∑
The Pressure-Correction Equation
assemble and solve momentum equation for v*
assemble and solve Pressure Correction equation for P'
repeat until convergence
SIMPLE iteration assemble using Rhie-Chow interpolation
m∗
f
correct , v*, ρ(n) and P(n) to get
improved , v**, ρ* and P*
m∗
f
m∗∗
f
start with nth iteration values
, v(n), ρ(n), P(n)m
(n)f
∴v n( ),P n( )
∴v•,P n( )
∴v••, ′PaCp ′pC + aE
p ′pE + aWp ′pW( ) = bCp
aCvvC
• + aFvvF
•
F=NB(C )∑ = −VC ∇p(n)( )C
v••f = v•f − d f ∇ ′p( ) f
p•C = p(n)C + ′pC
! ′mf = −ρ (n) D f∇ ′pf( ) ⋅S f
!mf• = ρ (n)v f
• ⋅S f = ρ (n) v f• −D f ∇ ′pf −∇ ′p f( )⎡⎣ ⎤⎦ ⋅S f
′v f = −D f∇ ′pf
Pressure-Velocity Coupling
�
− ρ f* D f ∇ ′ P ( ) f ⋅S f( )
f∑ = − ρ f
*U f*( )
f∑ − ′ ρ f ′ v f ⋅S f( )
f∑ − ρ f
* H ′ v [ ] f ⋅S f( )f∑
First Predictor
€
vP
* =H[v*]P−D
P∇P
n( )( )P
First Corrector
( ) ( ) ( )( )ρ′+ρ=ρ′+=′+=ρ′′′ n*n****,PPP,,P, vvvv
€
vP
** = H[v**
]P−D
P∇P
*( )P
= H[v* + ′ v ]
P−D
P∇ P
n( ) + ′ P ( )[ ]P
€
′ v P
= H[ ′ v ]P−D
P∇ ′ P ( )
P
′ ρ = Cρ ′ P
Condition
€
ρP
* − ρP
o( )δt
V + Δ ρ*v**.S[ ]P
= 0
€
ρP
n( ) + ′ ρ P− ρ
P
o( )δt
V + Δ ρn( ) + ′ ρ ( ) v
* + H[ ′ v ]−D ∇ ′ P ( )( ).S[ ]P
= 0
€
VCρ
δt′ P P
+ Δ CρU* ′ P [ ]
P
−Δ ρ n( )D ∇ ′ P ( ).S[ ]
P
= −ρ
P
n − ρP
o( )δt
V −Δ ρ n( )U
*[ ]P
−Δ ρn( )
H[ ′ v ].S[ ]P
−Δ ′ ρ ′ v ( ).S[ ]P
Neglect
Approximation
€
Δ ′ ρ ′ v ( ).S[ ]P
€
H[ ′ v ]
€
′ v P
= −DP∇ ′ P ( )
P
Approximation Equation
€
VCρ
δt′ P P
+ Δ CρU* ′ P [ ]
P−Δ ρ
n( )D ∇ ′ P ( ).S[ ]
P
= −ρ
P
n − ρP
o( )δt
V −Δ ρn( )U
*[ ]P
Second Predictor
€
vP
*** =H**[v
**]P−D
P
** ∇P*( )P
Second Corrector
€
′ ′ v , ′ ′ P , ′ ′ ρ ( ) v****
= v***
+ ′ ′ v ,P**
= P*
+ ′ ′ P ,ρ**= ρ*
+ ′ ′ ρ ( )
€
vP
**** =H**[v
****]
P−D
P
** ∇ P* + ′ ′ P ( )[ ]
P
€
vP
*** =H**[v
**]P−D
P
** ∇P*( )P
€
′ ′ v P
= H**
[v**** − v
**]
P−D
P
** ∇ ′ ′ P ( )P
= H**
[v*** − v
** + ′ ′ v ]P−D
P
** ∇ ′ ′ P ( )P
′ ′ ρ = Cρ ′ ′ P
€
ρP
* + ′ ′ ρ P− ρ
P
o( )δt
V + Δ ρ* + ′ ′ ρ ( ) v*** + H
**[v
*** − v** + ′ ′ v ]−D
P
** ∇ ′ ′ P ( )( ).S[ ]P
= 0
Condition
€
ρP
** − ρP
o( )δt
V + Δ ρ**v****.S[ ]P
= 0
€
VCρ
δt′ ′ P P
+ Δ CρU*** ′ ′ P [ ]
P
−Δ ρ*D
P
** ∇ ′ ′ P ( ).S[ ]P
= −ρ
P
* − ρP
o( )δt
V −Δ ρ*U
***[ ]P
−Δ ρ*H
**[v
*** − v** + ′ ′ v ].S[ ]
P−Δ ′ ′ ρ ′ ′ v ( ).S[ ]
P
Neglect
Approximation
€
H**
[v*** − v
** + ′ ′ v ]P
€
Δ ′ ′ ρ ′ ′ v ( ).S[ ]P
€
′ ′ v P
= −DP
**∇ ′ ′ P ( )
P
Approximation Equation
€
VCρ
δt′ ′ P P
+ Δ CρU*** ′ ′ P [ ]
P−Δ ρ*D
P
** ∇ ′ ′ P ( ).S[ ]P
=−ρ
P
* − ρP
o( )δt
V −Δ ρ*U***[ ]P
collocated variable arrangementRhie-Chow Interpolation
treatment leadsto variety of schemes
neglected
SIMPLESIMPLECSIMPLERSIMPLESTSIMPLE-MPISO
Problem 1- Staggered Grid
• Use the SIMPLE procedure to compute p2, uB, and uC from the following data:
• As an initial guess, set
1 2 3uB
uC