Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

1484 Curso CFD de Standford Me469a Numerical Methods For Fluids Mechancis Capitulo 4 Finite Volume Discretization

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

1/22/09

ME469A
Numerical Methods for
Fluid Mechanics

Handout #4

Gianluca Iaccarino

Finite Volume Methods


Starting point are the conservation law
in integral form
Ω
S
! ! ! !
d
ρφdV + ρφ#v · n̂dS = Γ∇φ · n̂dS + Qφ dV
dt Ω S S Ω

Need to define a discretization of the domain of


interest and then transform the continuous equations
in a discrete (algebraic) set of equations

1
1/22/09

FV Domain Discretization
Divide Ω in subdomains and apply
the same governing equation Sf
Ωi

! "! "! !
d
ρφdV + ρφ#v · nˆf dS = Γ∇φ · nˆf dS + Qφ dV
dt Ωi Sf Sf Ωi
f f

In a FD the grid defines the location of the unknowns, in a


FV it defines the boundary of the control volumes

FV Time Term

The rate of change

! Sf
d "! Ω "! !
ρφdV + ρφ#v · nˆi dS =
f Γ∇φ · nˆf dS + Qφ dV
dt Ωi Sf Sf Ωi
f f

Naturally refers to the evolution of a spatial average of ρφ


within each elementary volume

Once we define the (discrete) volume integration rules, the


original equation becomes an ODE

2
1/22/09

FV Domain Discretization
The unknowns are connected to volumes

NodesVolumesCenters CentersVolumesNodes

Primal Grid Dual Grid

FV Domain Discretization
The difference between the two constructions is more
clear if we consider irregular (unstructured) grids

Primal Grid
Solid line (triangles)

Dual Grid
Dotted line (polygons)

3
1/22/09

FV Surface Integrals
The computation of the fluxes requires the
determination of surface integrals, for example the
convective fluxes are:

! "! "! !
d
ρφdV + ρφ#v · nˆf dS = Γ∇φ · nˆf dS + Qφ dV
dt Ωi Sf Sf Ωi
f f

Need to use two levels of approximation:


1. the integral is approximated in terms of values
defined at one or more points on the cell faces
2. the face values are approximated in terms of the
cell center values

Nomenclature
Refer to a 2D Cartesian (structured, equally spaced)
grid.

It is common to refer
to the cells as (i,j)
y
or (P) ne
j
The neighbors are e E
P
(i+1,j)-(i-1,j), etc or
(E), (W), etc. se

Faces and nodes are


lower case (e), (w), etc.
x,i

4
1/22/09

Surface integrals
Refer to the “east” face of cell P

Step 1: Computing the integral


ne
Midpoint Rule:
!
Fe = f dS ≈ fe Se
Se P e E

Trapezoidal
! Rule: se
Se
Fe = f dS ≈ (fne + fse )
Se 2

Both second order if the integrand


is evaluated with second order accuracy

Interpolation Practices
Step 2: compute the function values at the face

Simplest and most intuitive: linear interpolation


interpolated
φ(x) value
φe = φE λe + φP (1 − λe )
φP

φe
φE
where e
P E
xe − xP
λe =
xE − xP

Second order accurate – CDS (central)

5
1/22/09

Interpolation Practices
An alternative widely used approach is to consider the
direction of propagation of the information:
interpolated
φ(x)
The convective flux is associated to value

transport by a “background” velocity φP φe


field
φE

P e E
φe = φP if ("v · n̂)e > 0

φe = φE if ("v · n̂)e < 0


Flow direction

First order accurate – UDS (Upwind)

Interpolation Practices
The “going-with-the-wind” idea can be extended to high
order easily…
φW
φ(x) interpolated
value
φe = φP λw + φW λe φP

φe
φe = φP if ("v · n̂)e > 0
φE

P e E
W

Etc.

Flow direction

Second order accurate – Note: it is an extrapolation!

6
1/22/09

Interpolation Practices
Another common used interpolation extends the idea of
upwinding further by considering a parabola (QUICK:
quadratic upwind interpolation for convective kinematics)

φe = g1 φE − g2 φW + (1 − g1 + g2 )φP
φW
φe = g1 φE − g2 φW + (1 − g1 + g2 )φP φ(x) interpolated
value

φe = φP if ("v · n̂)e > 0


φP

gi are the geometric factors φe φE

P e E
W

On a Cartesian uniform grid:


6 3 1
φe = φP + φE − φW Flow direction
8 8 8

Diffusive Fluxes
Diffusive fluxes are NOT associated to an underlying
velocity (no basis for upwinding) and involve gradients
(Fick’s law)

The linear interpolation scheme interpolated


φ(x)
naturally provides an approximation value

for the gradient φP


! "
∂φ φE − φP φE

∂x e xE − xP e
P E

What is the accuracy?

7
1/22/09

Diffusive Fluxes
By using Taylor series expansions around φe we can
derive
! "
(xe − xP )2 − (xE − xe )2 ∂ 2 φ
!τ =
2(xE − xP ) ∂x2 e
! "
(xe − xP )3 + (xE − xe )3 ∂3φ
+ + H.O.T.
6(xE − xP ) ∂x3 e
φ(x)
we obtain a second order approximation φP
1. If the grid is uniform
2. If the face center is at φE

xE + xP P e E
xe =
2

Volume integrals
Similar logic as the surface integrals

Second order:
!
QP = qdV ≈ qP ∆V
ΩP

Fourth order (on Cartesian uniform grids):


!
∆V
! QP = qdV ≈ (16qP + 4qs + 4qn + 4qw + 4qe + qse + qsw + qne + qnw )
∆V Ω P
16
QP = qdV ≈ (16qP + 4qs + 4qn + 4qw + 4qe + qse + qsw + qne + qnw )
ΩP 16

8
1/22/09

FV Domain Discretization

Primal Grid – Cell Based Discretization: the unknowns


are stored in the volume baricenter  good
approximation of the volume integrals

Dual Grid – Vertex/Node Bades Discretization: the


faces are mid-way between the cell centers  good
approximation of the surface integrals

A third alternative is to use a staggered arrangement, in


which the unknowns are not co-located

Discretized Equations
Recall the original equation
! "! "! !
d
ρφdV + ρφ#v · nˆf dS = Γ∇φ · nˆf dS + Qφ dV
dt Ωi Sf Sf Ωi
f f

Consider a 1D, steady problem (d/dt=0), a conservative


variable (Qφ=0) and ρ, v and Γ constant
! "! "! !
d
ρφdV + ρφ#v · nˆf dS = Γ∇φ · nˆf dS + Qφ dV
dt Ωi Sf Sf Ωi
f f

It is not of practical relevance because it is not likely that


diffusion and convection in 1D problems, but it is
interesting from the numerical point of view

9
1/22/09

Discretized Equations

1D grid
W w e E
P

Diffusive terms: linear interpolation

! "
∂φ φE − φP
Γ∇φ · n̂e = Γ ≈Γ
∂x e xE − xP
! "
∂φ φP − φW
Γ∇φ · n̂w = Γ ≈Γ
∂x e xP − xW
w

Discretized Equations

1D grid
W w e E
P

Convective terms: linear interpolation

ρφ#v · n̂e = ρvφe ≈ φE λe + φP (1 − λe )

ρφ#v · n̂w = ρvφw ≈ φP λw + φW (1 − λw )

10
1/22/09

Discretized Equations
Integrating using the midpoint rule, the face area cancels out
(it’s 1D – no need to integrate)

W w e E
P

Assembling the various terms

AP φP + AE φE + AW φW = 0

where Γ Etc.
AE = λ e −
xE − xP

With the interesting property: AP = −(AE + AW )

Discretized Equations
Resulting discrete problem is a tridiagonal linear system

AP φP + AE φE + AW φW = 0
W w e E
P

 
· ·
 · · · · 
 
 AW AP AE 
 
 · · · 
· ·

Each row corresponds to a cell The sparsity patters


corresponds to the cell connectivity (cell-to-cell)

11
1/22/09

Discretized Equations
If the discretization was based on the QUICK scheme
(assuming v>0) we would obtain

W w e E
WW P

AW W φW W + AW φW + AP φP + AE φE = 0
 
· ·
 · · · 
 
 · · · · 
 
 AW W AW AP AE 
 
 · · · · 
· · ·

Deferred Correction
High order discretization methods naturally introduce
larger stencils (more neighbors) more complex filling
patterns and reduced sparsity

One of the consequence is that it is NOT possible to use


simple “direct” solvers, and typically iterative linear
system solver are employed (for general matrices)

This lead to the introduction of a mixed scheme to


compute the fluxes
Fe = FCL + (FeH − FeL )old
The high order term is computed using “old” values within
the iterative scheme (right hand side)

12
1/22/09

Exact Solution
This (atypical) problem has an exact solution is Dirichlet
conditions are applied to x=0 (φ0) and x=L (φL)

The Peclet number is

Power-Law Scheme
The exact solution can be used in an unusual way to
develop an interpolation scheme

interpolated
φ(x) value

φP

φE

P e E

φe − φP exp [P exe /(xE − xP )] − 1


=
φE − φP exp(Pe)-1

13

You might also like