2.29 Numerical Fluid Mechanics Spring 2015 – Lecture 16 REVIEW Lecture 15:

advertisement
2.29 Numerical Fluid Mechanics
Spring 2015 – Lecture 16
REVIEW Lecture 15:
• Finite Volume Methods
– Integral and conservative forms of the cons. laws
– Introduction
– Approximations needed and basic elements of a FV scheme
• Grid generation ⇒ Time-Marching
• FV grids: Cell centered (Nodes or CV-faces) vs. Cell vertex; Structured vs. Unstructured
• Approximation of surface integrals (leading to symbolic formulas)
• Approximation of volume integrals (leading to symbolic formulas)
• Summary: Steps to step-up a FV scheme
– One Dimensional examples
d  x  
• Generic equation:
f
j
dt
j 1/ 2
 f j 1/ 2  
x j 1/ 2
x j 1/ 2
s ( x, t ) dx
• Linear Convection (Sommerfeld eqn): convective fluxes
– 2nd order in space
2.29
Numerical Fluid Mechanics
PFJL Lecture 16,
1
TODAY (Lecture 16):
FINITE VOLUME METHODS
• Summary: Steps to step-up a FV scheme
• Examples: One Dimensional examples
– Generic equations
– Linear Convection (Sommerfeld eqn): convective fluxes
• 2nd order in space, 4th order in space, links to CDS
– Unsteady Diffusion equation: diffusive fluxes
• Two approaches for 2nd order in space, links to CDS
• Approximation of surface integrals and volume integrals revisited
• Interpolations and differentiations
– Upwind interpolation (UDS)
– Linear Interpolation (CDS)
– Quadratic Upwind interpolation (QUICK)
– Higher order (interpolation) schemes
2.29
Numerical Fluid Mechanics
PFJL Lecture 16,
2
References and Reading Assignments
• Chapter 29.4 on “The control-volume approach for elliptic
equations” of “Chapra and Canale, Numerical Methods for
Engineers, 2014/2010/2006.”
• Chapter 4 on “Finite Volume Methods” of “J. H. Ferziger and
M. Peric, Computational Methods for Fluid Dynamics.
Springer, NY, 3rd edition, 2002”
• Chapter 5 on “Finite Volume Methods” of “H. Lomax, T. H.
Pulliam, D.W. Zingg, Fundamentals of Computational Fluid
Dynamics (Scientific Computation). Springer, 2003”
• Chapter 5.6 on “Finite-Volume Methods” of T. Cebeci, J. P.
Shao, F. Kafyeke and E. Laurendeau, Computational Fluid
Dynamics for Engineers. Springer, 2005.
2.29
Numerical Fluid Mechanics
PFJL Lecture 16,
3
One-Dimensional Example I
Linear Convection (Sommerfeld) Eqn, Cont’d
• The resultant linear algebraic system is circulant tri-diagonal (for
periodic BCs)
dΦ
c

B P ( 1,0,1)Φ  0
dt
2x
• This is as the 2nd order CDS!, except that it is written in terms of
cell averaged values instead of values at FD nodes/points
– It is also 2nd order in space
– Has same properties as classic CDS for
 ( x, t )  c  ( x, t )

0
t
x
• Non-dissipative (check Fourier analysis or eigenvalues of BP which are
imaginary), but can provide oscillatory errors
• Stability (recall tables for FD schemes, linear convection eqn.) of time-marching
– If centered in time, centered in space, explicit: stable with CFL condition:
– If implicit in time: unconditionally stable for all t, x
2.29
Numerical Fluid Mechanics
c t
1
x
PFJL Lecture 16,
4
One-Dimensional Example II
Linear Convection (Sommerfeld) Eqn: 4th order approx.
• 1D exact integral equation still
d  x  j 
j-2
• Use
j-1
∆x
j+1/2
j+1
j
 f j 1/ 2  f j 1/ 2  0
dt
4th
j-1/2
L
R
L
j+2
R
x
order accurate surface/volume integrals
Image by MIT OpenCourseWare.
– Replace piecewise-constant approx. to  (x) with piece-wise quadratic
approx (ξ= x – xj ):  ( )  a 2  b  c (note  defined over more than 1 cell)
– Satisfy  P ' s (average) constraints, i.e. choose a, b, c so that:
1
x

x / 2
3x / 2
– This gives:
a
 ( ) d   j 1 ,
 j 1  2 j   j 1
2x 2
1
x
, b

x / 2
x / 2
 ( ) d   j ,
 j 1   j 1
2x
, c
1
x

3x / 2
x / 2
 ( ) d   j 1
 j 1  26 j   j 1
24
– Next, we need to evaluate the values of  (x) at the boundaries so as to
L
R
L
R
compute the advective fluxes at these boundaries: f j 1/ 2 , f j 1/ 2 , f j 1/ 2 , f j 1/ 2
2.29
Numerical Fluid Mechanics
PFJL Lecture 16,
5
One-Dimensional Example II
Linear Convection (Sommerfeld) Eqn: 4th order approx.
• Since f = c  compute  at edges:
 jL1/ 2 
 jR1/ 2 
2 j  5 j 1   j 2
,  jL1/ 2 
6
 j 1  5 j  2 j 1
6
2 j 1  5 j   j 1
,  jR1/ 2 
j-1/2
,
j-2
j-1
6
 j 2  5 j 1  2 j
∆x
j+1/2
j+1
j
L
R
L
j+2
R
x
Image by MIT OpenCourseWare.
6
• Resolve flux discontinuity  again, use average values
fˆ j 1/ 2 
f jL1/ 2  f jR1/ 2
 fˆ j 1/ 2  c

c jL1/ 2  c jR1/ 2
2
2
 j 1  7 j  7 j 1   j 2
fˆ j 1/ 2 
f jL1/ 2  f jR1/ 2
 fˆ j 1/ 2  c
12
c jL1/ 2  c jR1/ 2

2
2
 j 2  7 j 1  7 j   j 1
12
• Done with “integrals”  we can substitute in 1D conv. eqn:
d  x  j 
dt
 f j 1/ 2  f j 1/ 2 
d  x  j 
dt
• For periodic domains:
2.29
 fˆ j 1/ 2  fˆ j 1/ 2
 x
d j
dt
c
 j 2  8 j 1  8 j 1   j 2
12
0
dΦ
c

B P ( 1, 8,0,8,1) Φ  0
dt 12x
Numerical Fluid Mechanics
PFJL Lecture 16,
6
(from Lecture 10)
Centered
Differences
2.29
Numerical Fluid Mechanics
PFJL Lecture 16,
7
One-Dimensional Example III
2nd order approx. of diffusion equation:
 ( x, t )
 2 ( x, t )

t
x 2
• 1D exact integral equation same form!
d  x  j 
dt
but with:
j-1/2
 f j 1/ 2  f j 1/ 2  0
j-2

f     
x
j-1
∆x
j+1/2
j+1
j
L
R
L
j+2
R
x
Image by MIT OpenCourseWare.
• Approximation of surface (flux) integral: Approach 1
– Direct: we know that to second-order (from CDS and from  j   j  O(x 2 ) )
f j 1/ 2  

x
 
 j 1   j
x
j 1/ 2
 O(x 2 )

  j
fˆ j 1/ 2   j 1
x
   j 1
and fˆ j 1/ 2   j
x
– Substitute into integral equation:
d  x  j 
dt
d j
  2 j   j 1
 fˆ j 1/ 2  fˆ j 1/ 2  x
  j 1
0
dt
x
– In the matrix form, with Dirichlet BCs:
• Semi-discrete FV scheme is as CDS in space,
but in terms of cell-averaged data
2.29
Numerical Fluid Mechanics
dΦ

 2 B(1, 2,1) Φ  (bc)
dt
x
PFJL Lecture 16,
8
One-Dimensional Example III
2nd order approx. of diffusion equation:
 ( x, t )
 2 ( x, t )

t
x 2
• Approximation of surface (flux) integral: Approach 2
– Use a piece-wise quadratic approx.:  ( )  a 2  b  c 
 

 2a  b
x 
• Note that a, b, c remain as before, they are set by the volume average constraints
• Since a, b are “symmetric”:
f jR1/ 2  f jL1/ 2  

x
f jR1/ 2  f jL1/ 2  

x
 
j 1/ 2
 
j 1/ 2
 j 1   j
x
 j   j 1
x
 O ( x 2 )
 O ( x 2 )
• There are no flux discontinuities in this case
– Substitute into integral equation:
d  x  j 
dt
d j
  2 j   j 1
 fˆ j 1/ 2  fˆ j 1/ 2  x
  j 1
0
dt
x
– In the matrix form, with Dirichlet BCs:
• Semi-discrete FV scheme is as CDS in space,
but in terms of cell-averaged data
2.29
Numerical Fluid Mechanics
dΦ

 2 B(1, 2,1) Φ  (bc)
dt
x
PFJL Lecture 16,
9
Expressing fluxes at the surface based on cell-averaged (nodal)
values: Summary of Two Approaches and Boundary Conditions
•
Set-up of surface/volume integrals: 2 approaches (do things in opposite order)
1. (i) Evaluate integrals using classic rules (symbolic evaluation); (ii) Then, to obtain
the unknown symbolic values, interpolate based on cell-averaged (nodal) values
(
i ) Fe

Se

(ii ) e
(e ) 

  Fe (P ' s)
Similar for other integrals:
1

(P ' s)

( S  s

dV , 
 dV , etc)

f dA 
Fe
(P ' s) 
V
V
V
2. (i) Select shape of solution within CV (piecewise approximation); (ii) impose
volume constraints to express coefficients in terms of nodal values; and (iii) then
integrate. (this approach was used in the examples).
(i ) ai ( x ) 
( x) 






(
x
)

(
x
)

a

i
P
(ii )  ai ( x )  P


  Fe (P ' s )
VP



(iii ) Fe   f dA
Se
P

•
ai
Similar for higher dimensions:
 ( x, y ) 
ai
( x, y ); etc
a ( xP , yP )  P ; etc
i
Boundary conditions:
– Directly imposed for convective fluxes
–
2.29
One-sided differences for diffusive fluxes
Numerical Fluid Mechanics
PFJL Lecture 16,
10
Approach 1: Evaluate integrals symbolically, then
interpolate based on neighboring cell-averages
•
Surface/Volume integrals: Approach 1
(i) Evaluate integrals based on classic rules (symbolic evaluation)
(ii) Then, to obtain the unknown symbolic values, interpolate based on
neighboring cell-averaged (nodal) values
•
If we utilize this approach 1
– Symbolic evaluation:
• To evaluate total surface fluxes (convective + diffusive),

 F  .n dA
S

S
 (v .n )dA   q .n dA
S
values of  and its gradient normal to the cell face at one or more locations on
that face are needed. They have to be expressed as a function of nodal values 
• Similar for volume integrals
– Next is interpolation:
• Express the ’s as a function of nodal values. Numerous possibilities. We
already saw some of the most common, provided again next.
2.29
Numerical Fluid Mechanics
PFJL Lecture 16,
11
Approx. of Surface/Volume Integrals:
Classic symbolic formulas
(summary from Lecture 15)
yj+1
NW
yj
WW
• Surface Integrals
yj-1
Fe   f dA
j
sw
s se
EE
E
∆y
SE
S
xi-1
i
xi
xi+1
x
Notation used for a Cartesian 2D and 3D grid.
Image by MIT OpenCourseWare.
2
e e
• Midpoint rule (2nd order):
Fe   f dA  f e Se  f e Se  O( y )  f S
• Trapezoid rule (2nd order):
Fe   f dA  Se
• Simpson’s rule (4th order):
Fe  
Se
n ne
P e ne
∆x
– 2D problems (1D surface integrals)
Se
nw
w
SW
y
Se
Se
W
NE
N
( f ne  f se )
 O( y 2 )
2
( f  4 f e  f se )
f dA  Se ne
 O( y 4 )
6
– 3D problems (2D surface integrals)
• Midpoint rule (2nd order):
Fe   f dA  Se f e
Se
 O( y 2 , z 2 )
• Higher order more complicated to implement in 3D
• Volume Integrals:
S   s dV ,  
V
1
dV
V V
– 2D/3D problems, Midpoint rule (2nd order):
– 2D, bi-quadratic
2.29
(4th
order, Cartesian):
SP 
SP   s dV  sP V  sP V
V
x y
16sP  4ss  4sn  4sw  4se  sse  ssw  sne  snw 
36
Numerical Fluid Mechanics
PFJL Lecture 16,
12
Interpolations and Differentiations
(to obtain fluxes “Fe” as a function of cell-average values)
• Upwind Interpolation (UDS) for convective fluxes
– Approximates e by its value at the node upstream of
“e”. This is equivalent to using backward or forwarddifference approx for a first derivative (depends on
direction of flow) => Upwind Differencing Scheme,
which is also called Donor-cell.

P if
e  

E if
yj+1
NW
yj
WW
W
yj-1
nw
w
n ne
P e ne
sw
s se
SW
y
∆x
j
 v . n e  0
 v . n e  0
xi-1
i
NE
N
EE
E
∆y
SE
S
xi
xi+1
x
Notation used for a Cartesian 2D and 3D grid.
Image by MIT OpenCourseWare.
– This approximation never yields oscillatory solutions (boundedness criterion), but it
is numerically diffusive:

( xe  xP )2  2

 R2
• Taylor expansion about xP: e P  ( xe  xP )
2
x P
• UDS retains only first term: 1st order scheme in space
2
x
P

 ...
x P
• Leading truncation error is “diffusive”, it has the form of a diffusive flux

f e  e  v . n
e  fˆe P  v . n e
  
  v . n  e x
x
• The numerical diffusion is   v . n e x (has 2 components when flow is oblique to the grid)
2.29
Numerical Fluid Mechanics
PFJL Lecture 16,
13
Interpolations and Differentiations
(to obtain fluxes “Fe” as a function of cell-average values)
• Linear Interpolation (CDS) for convective fluxes
yj+1
– Approximates e (value at face center) by its linear
interpolation between two nearest nodes:
e  E e  P (1  e )
x  xP
where e  e
xE  xP
NW
yj
WW
W
yj-1
nw
w
n ne
P e ne
sw
s se
SW
y
∆x
j
EE
E
∆y
SE
S
xi-1
i
NE
N
xi
xi+1
x
• e is the interpolation factor
Notation used for a Cartesian 2D and 3D grid.
Image by MIT OpenCourseWare.
– This approx. is 2nd order accurate (for convective fluxes):
• Use Taylor exp. of  E about xP to eliminate 1st derivative in Taylor exp. of e (previous slide)
( xE  xP ) 2  2
R2


E  P ( xE  xP )  2
E  P  ( xE  xP )

 R2 



2
2
x
P
2
x
P
x
P
xE  xP
2
x
P
xE  xP

( xe  xP )2  2
( xe  xP )( xE  xe )  2
 e  P  ( xe  xP )

 R2  E e  P (1  e ) 
 R '2
x P
2
x 2 P
2
x 2 P
• Truncation error is proportional to square of grid spacing, on uniform/non-uniform grids.
• As all approximations of order higher than one, this scheme can provide oscillatory
solutions
• Corresponds to central differences, hence its CDS name (gives avg. if uniform grid spacing)
2.29
Numerical Fluid Mechanics
PFJL Lecture 16,
14
Interpolations and Differentiations
(to obtain fluxes “Fe” as a function of cell-average values)
• Linear Interpolation (CDS) for diffusive fluxes
– Linear profile between two nearest nodes leads to simplest approx. of
gradient (diffusive fluxes)
yj+1
  E   P (1   ) 


 
 E P
x e xE  xP
x  xP
xE  xP
yj
WW
W
yj-1
nw
w
n ne
P e ne
sw
s se
∆x
– Taylor expansions of  ’s around xe, one obtains:
2
2
3
EE
E
∆y
SE
S
xi
xi+1
x
( xe  xP )  ( xE  xe )  
( x  xP )  ( xE  xe )  
 e
 R3
2
2 ( xE  xP )
x e
6 ( xE  xP )
x 3 e
2
xi-1
i
NE
N
SW
y
j
 x 
NW
3
3
Notation used for a Cartesian 2D and 3D grid.
Image by MIT OpenCourseWare.
– Approximation is 2nd order accurate if e is midway between P and E (e.g. uniform
grid)
– When the grid is non-uniform, the formal accuracy is 1st order, but error reduction
when grid is refined is asymptotically 2nd order
2.29
Numerical Fluid Mechanics
PFJL Lecture 16,
15
Interpolations and Differentiations
(to obtain fluxes “Fe” as a function of cell-average values)
• Quadratic Upwind Interpolation (QUICK), convective fluxes
yj+1
– Approx. by quadratic profile between two nearest nodes.
NW
yj
WW
– In accord with convection, third point chosen on upstream side:
This gives:
W
yj-1
• i.e. chose W if flow is from P to E, or EE if flow from E to P.
nw
w
n ne
P e ne
sw
s se
SW
y
∆x
j
e  U  g1 (D  U )  g2 (U  UU )
xi-1
i
NE
N
EE
E
∆y
SE
S
xi
xi+1
x
Notation used for a Cartesian 2D and 3D grid.
Image by MIT OpenCourseWare.
where D, U and UU denote the downstream, first upstream and second
upstream, respectively
– Coefficients in terms of nodal coordinates: g1 
( xe  xU ) ( xe  xUU )
( xD  xU ) ( xD  xUU )
; g2 
( xe  xU ) ( xD  xe )
( xU  xUU ) ( xD  xUU )
– Uniform grids: coefficients of  ’s are 3/8 for node D, 6/8 for node U and -1/8 for node UU
– Somewhat more complex scheme than CDS (larger computational molecules by one node in
each direction)
– Approximation is 3nd order accurate on both uniform and non-uniform grids. For uniform grids:
6
3
1
3x 3  3
e  U  D  UU 
 R3
3
8
8
8
48 x
U
• But, when this interpolation scheme is used with midpoint rule for surface integral, becomes 2nd order
2.29
Numerical Fluid Mechanics
PFJL Lecture 16,
16
Interpolations and Differentiations
(to obtain fluxes “Fe= f (e)” as a function of cell-average values)
• Higher Order Schemes (for convective/diffusive fluxes)
yj+1
– Interpolations of order higher than 3 make sense if integrals are
also approximated with higher order formulas
– In 1D problems, if Simpson’s rule (4th order error) is used for
the integral, a polynomial interpolation of order 3 can be used:
 ( x)  a0  a1 x  a2 x  a3 x
2
3
( Note: higher-order,
approach 1 →≈ approach 2 ! )
=> 4 unknowns, hence 4 nodal values (W, P, E and EE) needed
NW
yj
WW
W
yj-1
nw
w
n ne
P e ne
sw
s se
SW
y
∆x
j
xi-1
i
NE
N
EE
E
∆y
SE
S
xi
xi+1
x
Notation used for a Cartesian 2D and 3D grid.
Image by MIT OpenCourseWare.
= Symmetric formula for e: no need for “upwind” as with 0th or 2nd order polynomials (donor-cell & QUICK)
– With  (x), one can insert e= (xe) in symbolic integral formula. For a uniform Cartesian grid:
• Convective Fluxes:   27P  27E  3W  3EE
(similar formulas used for ϕ values at corners)
e
48
• For Diffusive Fluxes (1st derivative):

 a1  2a2 x  3a3 x 2
x e
 for a uniform Cartesian grid:

27E  27P  W  EE

x e
24 x
– This FV approximation often called a 4th-order CDS (linear poly. interpol. was 2nd-order CDS)
– Polynomials of higher-degree or of multi-dimensions can be used, as well as cubic splines (to
ensure continuity of first two derivatives at the boundaries). This increases the cost.
2.29
Numerical Fluid Mechanics
PFJL Lecture 16,
17
Interpolations and Differentiations
(to obtain fluxes “Fe= f (e)” as a function of cell-average values)
• Compact Higher Order Schemes
– Polynomial of higher order lead too large computational
molecules => use deferred-correction schemes and/or
compact (Pade’) schemes
yj+1
NW
yj
WW
2
3
– Ex. 1: obtain the coefficients of  ( x)  a0  a1 x  a2 x  a3 x by
fitting two values and two 1st derivatives at the two nodes on
either side of the cell face. With evaluation at xe:
P  E x  
 


 O( x 4 )
• 4th order scheme: e 


2
8  x P x E 
• If we use CDS to approximate derivatives, result retains 4th order:
e 
W
yj-1
nw
w
n ne
P e ne
sw
s se
SW
y
∆x
j
xi-1
i
NE
N
EE
E
∆y
SE
S
xi
xi+1
x
Notation used for a Cartesian 2D and 3D grid.
Image by MIT OpenCourseWare.
P  E

P  E  W  EE
 O ( x 4 )
2
16
– Ex. 2: use a parabola, fit the values on either side of the cell face and the derivative on the
upstream side (equivalent to the QUICK scheme, 3rd order)
3
1
x 
e  U  D +
4
4
4 x U
– Similar schemes are obtained for derivatives (diffusive fluxes), see Ferziger and Peric (2002)
• Other Schemes: more complex and difficult to program
– Large number of approximations used for “convective” fluxes: Linear Upwind Scheme,
Skewed Upwind schemes, Hybrid. Blending schemes to eliminate oscillations at higher order.
2.29
Numerical Fluid Mechanics
PFJL Lecture 16,
18
MIT OpenCourseWare
http://ocw.mit.edu
2.29 Numerical Fluid Mechanics
Spring 2015
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Download