### n - Projects at Harvard

```Finite-Volumes I
Sauro Succi
Finite Volumes
Real-life geometries: coordinate-free
Courtesy of Prof. M. Porfiri, NYU
Gauss theorem
Given a Volume V,
enclosed in a piecewise smooth boundary (surface) S,
characterized by the normal n in each point;
The flux of a is defined as
IF S is regular and a is continuously
differentiable, we have the following:
Gauss theorem: conservation laws
Gauss theorem: conservation laws
Volume vs
Surface average
Gauss theorem: Control Volume
Conservativeness
Flux(P,Q)+ Flux(Q, P) = 0
Colocated; Control Volume
N
n
W
w
ne
e
E
s
S
1
1
Simple, but not good for surfint > geos
VP uncoupled, hourglass
Centers to Edges: Interpolate
Fe = aPE FP + (1- aPE )FE
aPE =1
aPE
N
n
w
s
xe - x P
=
x E - xP
ne
e
E
Staggered
1
1
1
Laborious, no interpolation > simple geos
No hourglass, VP coupled
Discretized Gauss: Continuity
Dt
j P (t + dt) = j P (t) +
Fk (t)
å
V k={e,n,w,s}
Discretized Fluxes: Interpolation
D
F = ò DÑj × nˆk dS =
Ak å dkQjQ
Dk
Sk
Q
D
k
Discretized Fluxes: General
AUDt
j P (t + dt) = j P (t) +
LPQjQ (t)
å
V Q
j P (t + dt) = j P (t) + CFL * å LPQjQ (t)
Q
Discretized Fluxes: Interpolation
Ak
D
LPQ = å
(akQ +
dkQ )
UD k
k={e,n,w,s} A
Finite Volumes
Sh
<1
V
J =U(j )j
(U x Sx +U y Sy +Uz Sz )h
V
J || S
<1
Topological issues
C = hS /V >>1
l x ~ l y ~ lz ~ V
S /V >>1
J << p / 2
J >> p / 2
1/3
FD<FV<FE
Cartesian
Non-Cartesian, Structured
Unstructured
Dj P +(Fe +Fn + Fw + Fs )Dt = 0
Discretized Fluxes
FkD =
ò DÑj × nˆ
k
Sk
dS
One Dimension
¶tj = -U¶xj + D¶xxj
Dx º DxP = xe - xw
W
w
P
e
DtDy
j P (t + Dt) - j P (t) =
[-Uj + D¶xj ]ew
DxDy
E
One Dimension
W
P
w
e
E
[Uj ]e = ae [Uj ]E + (1- ae )[Uj ]P
[Uj ]w = aw [Uj ]W + (1- aw )[Uj ]P
Linear Interp:
Upwind:
x E - xe
ae =
xE - xP
x P - xw
aw =
xP - xW
ae = 0 if Ue > 0
ae =1 if Ue < 0
aw =1 if Uw > 0
aw = 0 if Uw < 0
One Dimension
W
w
P
e
E
[D¶xj ]e = D[j E - j P ] /[xE - xP ]
[D¶xj ]w = D[j P - jW ] /[xP - xW ]
One Dimension
W
w
P
e
E
UDt
j P (t + Dt) = j P (t) +
LPQjQ (t)
å
Dx Q={W ,P,E}
FluxPQ + FluxQP = 0
1d: example
Give explicit expression of L_PQ
and show that it reduces to standard
FD for square finite volumes.
Again, we don’t care about non-uniformity
because the unknowns are cell averages
(more physical)
Two-dimensions
Going to 2D: same principles more labour!
Cartesian (Orthogonal)
Trapezoidal (non-orthogonal)
Unstructured (similar to FEM)
Cartesian d=2
N
{xi , y j }
W
E
P
xe - xw = DxP
yn - ys = DyP
V
j
d
S
i
d
U
Fe =UejeDyP
Fn = Vnj n DxP
D E x = x E - xP =
DxP + DxE
2
D N y = yN - yP
Fw =Uwj wDyP
Fs = Vsj s DxP
DW x = xW - xP
D S y = yS - yP
je = (1- aE )j P + aEj E
aE =
DxP
DxP + DxE
Structured cartesian: diffusive flux
Adv _ Flux = -ae aEj E + -a w aW jW - an aNj N + as aSj S +
[-a e (1- aE ) + a w (1- aW ) - an (1- aN ) + a s (1- aS )]j P
ae =UeDyP
an = VnDxP
å
APQj Q
Q={P.E,N,W ,S}
dj P
VP
=
APQjQ
å
dt Q={P.E,N,W ,S}
Structured matrix:
5 nonzero entries
Fe =UejeDyP
Fn = Vnj n DxP
D E x = x E - xP =
DxP + DxE
2
D N y = yN - yP
Fw =Uwj wDyP
Fs = Vsj s DxP
DW x = xW - xP
D S y = yS - yP
je = (1- aE )j P + aEj E
aE =
DxP
DxP + DxE
2d cartesian: diffusive fluxes
je,x = (j P - j E ) / (xP - xE )
j e,y = 0
j n,y = (j N - j P ) / (yP - yE )
j n,x = 0
Structured cartesian: cieff’s
Dif _ Flux = -de dEj E + -dw dW jW - dn d Nj N + ds dSj S +
[-de (1- dE ) + dw (1- dW ) - dn (1- d N ) + ds (1- dS )]j P
de = 2DeDyP / (DxP + DxE )
Dif _ Flux =
å
DPQj Q
Q={P.E,N,W ,S}
dj P
VP
=
DPQj Q
å
dt Q={P.E,N,W ,S}
Structured matrix:
5 nonzero entries
Structured non-cartesian
Structured Non-Cartesian
Geometrical data
Non-cartesian: structured
NW
NΕ
N
n
W
w
C
ne
Non-orthogonal
e
Ε
Fk = Jn An = J x Ax + J y Ay
Dxe ¹ 0
s
SW
S
se
SΕ
Dye ¹ Dyw ¹ DyP
Still structured
CEV = Centers/Edges/Vertices
Co/Contravariant/Cartesian
Co/Contravariant/Cartesian
Co/Contravariant/Cartesian
P = P(q , q , q )
1
2
3
¶P 1 ¶P 2 ¶P 3
dP = 1 dq + 2 dq + 3 dq
¶q
¶q
¶q
Staggered
NW
NΕ
N
n
W
w
C
s
SW
S
ne
Non-orthogonal
e
Ε
Fk = Jn An = J x Ax + J y Ay
se
SΕ
CEV = Centers/Edges/Vertices
Navier-Stokes (Compressible)
Staggered FV
Vertex-centered staggered
N
NW
Ww
SW
n
P
s
S
NΕ
e
SΕ
E
Discretized Gauss: Continuity
DrC + (Fe + Fn + Fw + Fs )Dt = 0
Discretized Convective Fluxes
F
e
= re [ueDye + veDxe ]
Dxe = xne - xse
Dye = yne - yse
Same for north,west, south …
Non-orthogonality issues (!)
NW
W
w
n
ne
C
e
s
SW
NΕ
N
S
Ε
se
SΕ
Discretized Gauss: Continuity
DrC + (Fe + Fn + Fw + Fs )Dt = 0
Discretized midpoint (2nd order 8 neigh)
F
e
Dye
= re [(une + use )
+...{vDxe }..]
2
Discretized Simpson (4th order, 8 neigh)
F
e
Dye
= re [(une + 4ue + use )
+...{vDxe }..]
6
Discretized Convective Fluxes
r(e) = ar(C)+ (1- a)r (E)
x(E) - x(e)
a=
x(E) - x(C)
u(e), v(e) = Interp[C, E]
Discretized Gauss: Momentum_x
DJ x,C + (Fx,e + Fx,n +Fx,w +Fx,s )Dt = 0
1
uC = (une + unw + use + usw )
4
rC native
Convective and Dissipative Fluxes
F = [ ru + p]e Dye +[ ruv]e Dxe
x,e
F
Dif
x,e
2
= me {ux,eDye +[¶x u +¶y v]e Dxe }
uE - uC
¶ x ue =
xE - xC
vE - vC
¶ y ve =
yE - yC
Non-Linear (outer) iteration
rP (t + Dt) = r P (t) + Dt å[APQuQ (t) + BPQ vQ (t)]rQ (t)
Q
å
rP uP (t + Dt) = rP uP (t) + Dt
[EPQuQ (t) + FPQ vQ (t)]rQ (t + Dt) + CPQ pQ (t + dt)
Q={E,N,...}
rP vP (t + Dt) = r P vP (t) + Dt
å
[GPQuQ (t + Dt) + H PQ vQ (t)]rQ (t + Dt) + DPQ pQ (t + dt)
Q={E,N,...}
Nonlinear (outer) iteration, k=0,1…
Ax (t + Dt) = B(x )x (t) º b
k+1
k
k
k
Real-life geometries
Courtesy of Prof. M. Porfiri, NYU Poly
Example:
Global: Cylindrical, Spherical,
Local: Oblique
Unstructured FV~FEM
Cell vs Vertex Centered
Vertex control elements
Tk+1
Sk = {EkCk Ek+1}
Ek+2
Ck+1
Tk
Ek+1
Ck
Ek
Finite Volumes: summary
Intuitive and physically sound
Round-off Conservative (fluxin=-fluxout)