Download Geometry and Grids - Computational Fluid Dynamics - Lecture Slides and more Slides Fluid Dynamics in PDF only on Docsity!
Geometry and GridsGeometry and Grids
Larry Caretto
Mechanical Engineering 692
Computational Fluid Dynamics
April 26, 2010
2
Outline
- Review last lecture
- Problem of treating realistic geometry
- Use of partial grid cells
- Boundary fitted coordinates
- Unstructured grids
- Grids where all variables are located at
the same point
3
Density-based Solvers
- Density-based solvers traditionally used
for compressible flows
- Not accurate for low Mach numbers
- Fluent uses a transformation to allow density based solvers for low Mach number flows
- Density-based solvers can be implicit or
explicit
- Implicit allows longer time steps while preserving stability at higher Courant numbers
4
Pressure-based Solvers
- Transient finite-volume equation
[ ( ) ( ) ]
( )
, ,
φ
a a a a a S
t
V
N N S S E E W W P P
Pt t Pt
()
φ aN φ (^) N aS φ S aE φ E aW φ W aPtransient φ P Stransient
t
V
S S
t
V
a a
Pt transient
Pt t P transient P Δ
,+ Δ () () , ,
ρ φ φ ρφ
5
What is Time Average?
- Have same choices used for conduction
equation
- Explicit – use values at old time step
- Implicit – use values at new time step
- Crank-Nicholson – use average of values at old and new time steps
- Can also use more accurate time
derivatives
- Fluent has various options
6
7
Explicit or Implicit?
- Explicit stability limits on time step (set
by the local Courant number, uΔx/α)
- The Δt required for stability is usually
much lower than the Δt for accuracy
- Implicit algorithms will generally take
less computer time
- Moving waves ( e. g. shock waves)
require small time steps so that explicit
algorithms are preferred here
- Available in Fluent only with density solver
8
Other Fluent Options
- Non-iterative time advancement –
simplifies iterations to reduce computer
time for solution
- Does not do “outer” iteration
- Frozen-flux formulation uses aK
coefficients from previous time step
- Does not update during iterations
- Another item to save computer time
9
Geometry
- CFD problems applied to a variety of
complex geometries: aircraft, engine
coolant and valve passages, gas turbine
combustors, rocket engines, etc.
- Accurate modeling of flows requires
accurate specification of geometries
- Development of geometry model and
mesh are usually the most time
consuming part of a CFD calculation
10
Approaches to Geometry
- Approaches leaving a regular gird
- Stair step approach giving an approximate boundary
- Special grid cells near boundary
- Approaches using coordinate
transformations
- Boundary fitted coordinates with transformed differential equations
- Local coordinate transformations in a finite- volume approach
11
Stair Step Approach
- Only mentioned for historical
reasons and to contrast with
next method
- Sometimes used in early CFD
calculations
- Not used in any realistic
codes
- Quick and dirty way to get
different geometry in new
codes.
Grid
Actual Geometry
Stair step boundary 12
Boundary Crosses Grid
define boundary
sions for uneven grid
δx δy
- Usually used anyway for CFD
- Programming problems when two
boundary values have to be stored at
one node as in example here
- Gradient boundary conditions must be
split into components
19
Transformed Convection Terms
= ⎟
⎟ ⎠
⎞ ⎜
⎜ ⎝
⎛ φ ∂
∂ξ
∂ξ
∂ρ
∂ξ
∂ρ φ i i
j
j j
j u x
J J
U
J
1 1
⎪⎭
⎪ ⎬
⎫ ⎥ ⎦
⎤ ⎢ ⎣
⎡ ⎟
⎟ ⎠
⎞ ⎜
⎜ ⎝
⎛
∂
∂
⎟
⎟ ⎠
⎞ ⎜
⎜ ⎝
⎛
∂
∂
⎟
⎟ ⎠
⎞ ⎜
⎜ ⎝
⎛
∂
∂
∂
∂
⎥+ ⎦
⎤ ⎢ ⎣
⎡ ⎟
⎟ ⎠
⎞ ⎜
⎜ ⎝
⎛
∂
∂ ⎟⎟+ ⎠
⎞ ⎜
⎜ ⎝
⎛
∂
∂ ⎟⎟+ ⎠
⎞ ⎜
⎜ ⎝
⎛
∂
∂
∂
∂
⎪⎩
⎪ ⎨
⎧ ⎥ ⎦
⎤ ⎢ ⎣
⎡ ⎟
⎟ ⎠
⎞ ⎜
⎜ ⎝
⎛
∂
∂ ⎟⎟+ ⎠
⎞ ⎜
⎜ ⎝
⎛
∂
∂ ⎟⎟+ ⎠
⎞ ⎜
⎜ ⎝
⎛
∂
∂
∂
∂
φ
ξ φ
ξ φ
ξ ρ ξ
φ
ξ φ
ξ φ
ξ ρ ξ
φ
ξ φ
ξ φ
ξ ρ ξ
3 3
3 2 2
3 1 1
3
3
3 3
2 2 2
2 1 1
2
2
3 3
1 2 2
1 1 1
1
1
1
u x
u x
u x
J
u x
u x
u x
J
u x
u x
u x
J J
20
- Have mixed second derivatives that will
become part of “source” term
⎭
⎬
⎫
∂ξ
∂φ Γ ∂ξ
∂
∂ξ
∂φ Γ ∂ξ
∂
∂ξ
∂φ Γ ∂ξ
∂
∂ξ
∂φ Γ ∂ξ
∂
∂ξ
∂φ Γ ∂ξ
∂
∂ξ
∂φ Γ ∂ξ
∂
⎩
⎨
⎧
∂ξ
∂φ Γ ∂ξ
∂
∂ξ
∂φ Γ ∂ξ
∂
∂ξ
∂φ Γ ∂ξ
∂
∂
∂φ Γ ∂
∂
φ φ φ
φ φ φ
φ φ φ φ
3
33
()
2 3
23
()
1 3
13
()
3
3
32
()
2 2
22
()
1 2
12
()
2
3
31
()
2 1
21
()
1 1
11
()
1
( )^1
B B B
B B B
B B B x (^) i xi J
Transformed Diffusion Terms
∂ξ
∂
∂ξ
∂
∂ξ
∂
∂ξ
∂
∂ξ
∂
∂ξ
x 1 x 1 x 2 x 2 x 3 x 3
B J
k j k j k j kj
21
From BFC to Finite Volumes
- Originally for finite-difference
approaches in complex geometries
- Alternative of finite elements has natural
system for complex geometries
- Finite-volume approach uses grid
management systems of finite elements
with gradients from finite differences
- Fluent gets gradients from vector
calculus approaches
22
Unstructured Grids
- Grids that do not follow i, j, k
relationship among neighboring nodes
- Require more bookkeeping for set of
algebraic equations to be solved
- Equations have more complex structure
- Also requires correct determination of
average values and gradients
- Generally favored for flexibility in
applications to complex geometries
23
Choice of Control Volumes
- Control volumes can be an
individual cell with nodes at
the center of the control
volume
centered, is to construct
control volumes around the
nodes, which are located on
the vertices of the grid
24
Finite-Volume Equations
- Finite-volume equations for unstructured
grids derived in same way as for
structured grids
- Have to consider geometries that are not
at right angles
- See text for details of convection and
diffusion terms
- Operations similar to those for boundary-
fitted coordinates, but in a discrete sense
25
Fluent Finite-volume Cells
Fluent Users Manual, September 29, 2006, Chapter 6
cells can have
different shapes
those available in
Fluent
- Similar to types available in general
CFD or other analysis codes
26
Structured Airfoil Grid
girds have
fixed
relationship
between ξi , ηj,
and ζk
generalized
coordinates to
fit problem
geometry
Fluent Users Manual, September 29, 2006, Chapter 6
27
Unstructured Airfoil Grid
grids have no
relationship
between ξi ,
ηj , and ζk
coordinates
coding more
complex
Fluent Users Manual, September 29, 2006, Chapter 6 28
Multiblock Structured Grid
- Overall problem geometry has main grid
with subdivisions
grid and
subdivisions
have ξi, ηj,
and ζk
coordinates
Fluent Users Manual, September 29, 2006, Chapter 6
29
Unstructured Airfoil Grid
elements in
this grid
appear to be
triangular
elements
flexible form for a 2D grid
Fluent Users Manual, September 29, 2006, Chapter 6 30
Unstructured Tetrahedral
surface with four
sides) is three-
dimensional analog of
triangle for gridding
complex three- dimensional geometries
Fluent Users Manual, September 29, 2006, Chapter 6
37
Convection Terms II
- With midpoint rule result we
have to interpolate values
to cell face from
surrounding nodes
- Use interpolation for velocity ( v·n )
- Choose differencing scheme (central,
upwind, QUICK, etc.)for φ a
- Consider higher order interpolation if face
midpoint is not on line with cell centers
( ) S
dS
ρϕ center δ
v n
vn
∫ ⋅ ≈ Σ
38
Diffusion Terms
- Use midpoint rule for integral
dS grad φ dS ( grad φ ) center δ S
φ φ − (^) ∫ d ϕ (^) ⋅ n =∫Γ ⋅ n ≈Γ ⋅ n Σ Σ
() ( )
- Use Cartesian coordinates for gradient
( ) (^) x ny y
n x
grad ∂
φ φ φ
φ n
()
- Interpolate both φ and coordinates to
get Cartesian derivatives
- Variety of possible approaches
39
Other Computations
- Can get more accurate expressions by
considering vector analysis to get
gradients
- Requires cross diffusion terms, similar
to terms in boundary-fitted coordinates,
but done in finite difference form
- Have to analyze geometry of adjacent
cells to compute gradients and
convective fluxes
40
Non-Staggered (Colocated) Grids
- Staggered grids are convenient way to
handle pressure in simple finite-
difference grids
- These become difficult in boundary-
fitted coordinates and unstructured grids
- Alternative approach uses colocated
variables (all variables at same point)
- Need interpolation method to avoid
problems with pressure
41
Staggered Grid
P
N
W
S
E
s
n
w e
nw ne
sw (^) se
P, φ locations
location of u
location of v SE
NW
( W P ) w w
nb
Pww nbnb
P E e e nb
Pee nbnb
a u a u p p A b
a u au p p A b
= + − +
= + − +
∑
∑
42
Colocated Grid Problem
50 100 50 100 50 ●------- | -------●------- | -------●------- | -------●-------- | -------● WW ww W w P e E ee EE
- Oscillating pressures seen if equation
for uP has pressure gradient (pE – pP)/δx
- Staggered grid solves problem by
placing u velocities at “e” and “w” node
- Real importance is for continuity-
momentum combination used to solve
for pressure
43
Colocated Grid
- All variables (u, v, p) stored at nodes
WW, W, P, E, EE
●------- | -------●------- | -------●------- | -------●-------- | -------● WW ww W w P e E ee EE
( w e ) P P
nb
a (^) PP uP = (^) ∑ anbunb + p − p A + b
- Find pe and p (^) w by interpolation
2 2 2
W P P E W E w e
p p p p p p p p
−
−
− =
P P
W E
nb
P P nbnb A b
p p a (^) P u a u +
− = (^) ∑ + 2 44
Colocated Grid II
- Have similar equation for uE
P
W E P
P nb
nbnb
P
W E P P
P nb
nbnb P d
p p a
au b
a
p p A a
au b u P^2 P P^2
−
=
−
=
E
EE P P
E nb
nbnb
P
EE P E P
E nb
nbnb E d
p p a
au b
a
p p A a
au b u E^2 E E^2
−
=
−
=
- Continuity equation needs ue
- Need interpolation for relation of this
velocity to pressure
45
Rhie and Chow Interpolation
- Can show that added terms amount to a
third-order error in pressure
- Examine constant d for simplicity
e P E E P^ (^ P E )^ P (^ W E )^ E (^ pP pEE )
d p p
d p p
u u d d u − − − − −
= 2 2 4 4
( P E ) ( W E ) ( P EE ) ( EE E P W )
P E W E P EE
T dp p dp p dp p dp p p p
p p
d p p
d p p
T d d
= − − − − − = − + −
− − − − −
=
4 3 3
4 2 4 4
- Third derivative as first derivative of
second derivative in finite-difference
form
2
2
2
2 2
2
2
2 3
3
x
x
p x
p
x
p x x
p (^) E P
e e Δ
∂
∂ − ∂
∂
⎟⎟= ⎠
⎞ ⎜⎜ ⎝
⎛ ∂
∂ ∂
∂
∂
∂ 46
Rhie and Chow Interpolation II
- Compare to previous equation
( ) ( ) ( )^3
2 2 2
2 2
2
3
(^3 )
2 2
2
2 x
p p p p x
x
p p p x
p p p
x
x
p x
p
x
p (^) P EE E W
P EE E W E P E P e Δ
= + − − Δ
Δ
Δ =
∂
−∂ ∂
∂
= ∂
∂
3 3
3
2 4
3 3 2 4
2 2 4 4
x x
u u d p p p p p
u u d
p p
d p p
d p p
u u d d u
e
P E P EE E W
P E
P EE
E W E
P P E
P E E P e
Δ ∂
∂
=
− − − − −
=
- Added pressure terms are equivalent to
adding a third-order error in pressure
- Higher order than usual first or second
order error in finite-volume approaches
47
Grid Quality
- Non-structured meshes have equations
that are exact for orthogonal cells, but
have errors as cells depart from
orthogonal
- Triangular cells are best when they are
equilateral triangles
- Use code indicators of mesh quality to
ensure that meshes are not badly
structured in your grid
48
Summary
- CFD codes must be able to handle
complex geometries
- Flow-3D uses FAVORTM^ method in
which boundaries cross grid lines
- Most other codes use boundary fitted
coordinates or fractional volume
methods
- Finite-element codes, not considered
here, have own approaches
55
Derivative Relationships IV
- Formula for matrix inversion,
B = A -
- bij = (-1) i+j^ Mji / det( A )
- M (^) ij is minor determinant
found by eliminating row i
and column j
- Determinant, called Jacobian
J, is the ratio of volume
elements in the two
coordinate systems
3
3
2
3
1
3
3
2
2
2
1
2
3
1
2
1
1
1
ξ ξ ξ
ξ ξ ξ
ξ ξ ξ
∂
∂
∂
∂
∂
∂
∂
∂
∂
∂
∂
∂
∂
∂
∂
∂
∂
∂
=
x x x
x x x
x x x
J
56
Derivative Relationships V
- Example of matrix inverse component 1
3
3
2
3
1
3
3
2
2
2
1
2
3
1
2
1
1
1
3
3
2
3
1
3
3
2
2
2
1
2
3
1
2
1
1
1
−
ξ ξ ξ
ξ ξ ξ
ξ ξ ξ
ξ ξ ξ
ξ ξ ξ
ξ ξ ξ
x x x
x x x
x x x
x x x
x x x
x x x
- To compute ∂ξ 2 /∂x 3 , we need M 32
( ) ⎥ ⎦
1
2
3
1
3
2
1
32 1
23
3
ξ x x x x
J J
M
x
57
Derivative Relationships VI
- Have nine relationships like the one at
the bottom of the previous slide
- See coordinate transformation notes,
page four
- Note alternative notations
J
x y x y xy xy
z J
x x x x
x J
ξ ζ ζ ξ
ξ ζ ζ ξ
η
ξ ξ ξ ξ
ξ
1
2
3
1
3
2
1
1
3
2
58
Transform Transport Equation
- We need to transform the convection
and diffusion terms in the general
transport equation
S
x x x
u
t (^) i i i
i (^) + ∂
- Look at general first derivative term
(with implied summation) ∂Fi /∂xi
- For convection terms Fi = ρuiφ
59
Transform Transport Equation II
- Required transformation equation
i x x
or x x x x i j
j
i i i i i^ ξ
ξ
ζ
ζ
η
η
ξ
ξ
j
i
i
j
i
i F
x x
F
- Two repeated indices (i and j) give two
implied summations
- Next step is not obvious – multiply by J
60
Transform Transport Equation III
- Apply product rule for derivatives
AdF d AF FdA
x
F F J
x
J
F
x
J
x
F
J
i
j
j
i i i
j
j j
i
i
j
i
i
ξ
ξ
ξ
ξ ξ
ξ
- Can show that last term vanishes
- See pages 6 and 7 in notes
- Show that this term is zero for i = 1
- Requires substitution of matrix inversion
relationships for ∂ξi /∂xj in terms of ∂xi /∂ξj
61
Transform Transport Equation IV
i i
j
i j
i i i
j
i j
i
F
x
J
x J
F
F
x
J
x
F
J
ξ
ξ
ξ
ξ
- For convection terms Fi = ρuiφ
- Define Uj = Jui∂ξi /∂xj (implied
summation) to give following result for
convection
j
j
i
i
U
x J
u
62
Transform Transport Equation V
- Handle diffusion terms next
- Have analog to convection terms
i
i i
i
i i x
with F x
F
x x ∂
- We can use result just found for ∂Fi /∂xi in
analysis of convection terms
- Basic transformation equation for ∂φ/∂x (^) i
i x xi j
j
i^ ξ
φ ξ φ
63
Transform Transport Equation V
- Combine results from previous chart
i j
j
i
i i
i
i i x x
with F x
F
x x ξ
- With convection terms analysis result
i i
k
i k
i
F
x
J
x J
F ξ
i j
j
i
k
i i k x x
J
x x J ξ
(φ ) φ^1 (φ)
64
Transform Transport Equation VI
- Define coefficients B (^) kj to simplify
diffusion terms
i j
j
i
k
i i k x x
J
x x J ξ
(φ ) φ^1 (φ)
x 1 x 1 x 2 x 2 x 3 x 3
J
x x
B J
k j k j k j
i
j
i
k kj
ξ ξ ξ ξ ξ ξ ξ ξ
j
kj i i k
B
x x J ξ
(φ ) φ^1 (φ)
65
- Transformed diffusion terms now have
mixed second derivatives
- Full set of diffusion terms shown below
⎭
⎬
⎫
∂
∂ Γ ∂
∂
∂
∂ Γ ∂
∂
∂
∂ Γ ∂
∂
∂
∂ Γ ∂
∂
∂
∂ Γ ∂
∂
∂
∂ Γ ∂
∂
⎩
⎨
⎧
∂
∂ Γ ∂
∂
∂
∂ Γ ∂
∂
∂
∂ Γ ∂
∂
∂
∂ Γ ∂
∂
3
33
()
2 3
23
()
1 3
13
()
3
3
32
()
2 2
22
()
1 2
12
()
2
3
31
()
2 1
21
()
1 1
11
()
1
( )^1
ξ
φ
ξ ξ
φ
ξ ξ
φ
ξ
ξ
φ
ξ ξ
φ
ξ ξ
φ
ξ
ξ
φ
ξ ξ
φ
ξ ξ
φ
ξ
φ
φ φ φ
φ φ φ
φ φ φ φ
B B B
B B B
B B B x (^) i xi J
Transform Transport Equation VII
66
Final Transformed Equation
- Substitute transformed convection and
diffusion terms into general transport
equation
S
x x x
u
t (^) i i i
i (^) + ∂
(^11) (φ) ( φ )
B S
J
U
t J j
kj j k
j
⎟
i
j
i
k kj
x x
B J
ξ ξ i i
j
j u
x
U J