Академический Документы
Профессиональный Документы
Культура Документы
Table of Content
Introduction Why CFD History
C p e xx Chapter
The Finite Volume Method
By Melik Sahraoui
Transport equation Other numerical methods 1D conduction FVM 2D conduction FVM B Boundary d C Conditions diti Solving the discretized equations Checking for accuracy Convergence FVM in polar coordinates (Example) Convection FVM Solving the flow equation (Staggered grid)
M. Sahraoui FVM
M. Sahraoui FVM
Why CFD
CFD (computational fluid dynamics) software is a very important tool to engineers. Shortened product development cycle requires the use of CFD tools to optimize the design early in the design phase.
History
Generally known as Patankars method. Lots of other researchers have p g the method for contributed to improving all kinds of flow problem. These include Spalding, Raithby, etc.
M. Sahraoui FVM
M. Sahraoui FVM
Transport Equations
Transport equations describe the behavior of the different independent transport variables based the conservation principles: Conservation of Mass Momentum equation Balance of Thermal Energy (Conservation of total mechanical energy) Conservation of chemical species Balance of the kinetic energy Two equation turbulence model
Transport Equations
Conservation of species
Cont.
mk ( mk ) + ( ui mk ) = (k ) + Rk t xi xi xi
The conservation of energy equation
(1)
k h ( h) + ( u i h ) = ( ) + Sh t xi xi c xi
u p ( u j ) + ( ui u j ) = ( j ) + Bj +Vj t xi xi x j xi
M. Sahraoui FVM
M. Sahraoui FVM
Turbulence model
The k-e k e turbulence model is given by:
t k ( k ) + ( ui k ) = ( ) + G xi t xi xi
( ) + ( ui ) = ( t ) + (c1G c2 ) t xi xi xi k
( ) + ( u ) = ( ) + S t
Where is kinetic energy, is the rate of dissipation, G is the rate of generation Turbulence, t is the turbulent viscosity, and k, , ,and are empirical constants in the model. 2 1
Where is the diffusion coefficient, S in the source term and is the dependent variable ( (i.e., , mi,ui,T,,)
Source term
A highly nonlinear problem, due to the interdependence of the different solution fields.
M. Sahraoui FVM
M. Sahraoui FVM
FVM- 1D Conduction
The one-dimensional conduction equation is given by
Finite Difference: Using Taylor series expansion Variational formulation g residuals Method of weighted Control Volume Formulation
d dT k +S = 0 dx dx
Where k [W/(m.K] is the thermal conductivity, T is the temperature and S (W/m3) is the rate of heat generation
(x)w
W
(x)E
E
P x
M. Sahraoui FVM
M. Sahraoui FVM
With
dy = dz = 1
One Dimensional problem
(x)E
E
P x
d =0 dx k dx + S ) dx
W w P e E
d dT
k + Sdx = 0 d dx
W
dT
dT k E (TE TP ) k = xE dx e
E
dT dT + Sdx = 0 k k dx E dx W W
We assume that S is constant over the contro volume
M. Sahraoui FVM
and
k (T T ) dT k = W P W xW dx W
M. Sahraoui FVM
FVM- 1D Conduction
Cont.
FVM- 1D Conduction
Cont.
k (T T ) dT k = E E P xE dx E
and
k (T T ) dT k = W P W xW dx W
From the previous slide we found that the control volume temperature Tp is then given by:
a pT p = aW TW + aETE + b
The sourse term S may depend on T. Linearization is necessary, therefore, we assume
k E (TE TP ) kW (TP TW ) + S x = 0 xE xW
Where S is the averaged source term over the control volume. The control volume temperature Tp is then given by:
S = S c + S pTP
The coefficient Ap becomes
a p = aE + aW S P
and
a pT p = aW TW + a ETE + b
Where
b = S c x
aW = kW xW b = S x
aE =
kE xE
a p = aE + aW
M. Sahraoui FVM
M. Sahraoui FVM
Finite-Difference
The one-dimensional conduction equation is given by:
Generalization 1D to 3D Conduction
The 1D discretization Th di ti ti can b be generalized li d t to th the 3D case:
d dT k +S = 0 dx dx
It can be discretized as follows (Using Taylor series expansion)
a pT p = anbTnb + b
Where
dT dT k k dx E dx W +S =0 x k (TE Tp ) k (TP TE ) xw
(x)w
W
(x)E
E
anb
E
is the coefficient of the neighboring points is the temperature of the neighboring points
P x
Tnb
xe
+S =0
Note: not all scalar quantities are calculated using a linear profile between neighboring points. The source term (S), (S) ke, and kw (conductivity at the interfaces) can be calculated using piece wise function.
M. Sahraoui FVM
M. Sahraoui FVM
1-
Consistency at control volume faces: for two adjacent control volumes, the expression for the flux across the common face must be the same in the discretized equation.
If this not satisfied, the overall balance will not be satisfied. Inconsistent flux may be due to the incorrect profile of temperature in a given cell or using the conductivity of the center-point.
2-
3-
S = S c + S pT p
With
Sp < 0
If Sp is positive it implies that if the source term increases which in turn means that the temperature increases causing further increase in T ..
M. Sahraoui FVM
M. Sahraoui FVM
Griding
xW
W
Griding
xE
E
All discretization formulations tend to give the the same solution as the number of grids is added.
E
P x
Use of non-uniform grid is very beneficial to efficient ffi i t computation t ti and d use of f computing ti resources. Not true that the use of non-uniform grids leads to less accurate results than uniform grids Highest number of grids should be used in regions of highest gradients such as boundary layers and flame fronts (Combustion). Refine grids as needed after initial trials runs.
Two more requirements are necessary even for a coarse grid: Physically realistic behavior Unrealistic Overall balance
Approximate
Unrealistic
Exact
x
M. Sahraoui FVM M. Sahraoui FVM
Conductivity at an interface
k aE = E xE
Solid A
Recall that
Solid B
k A kB
qE =
k E (TE TP ) xE
What should we use as kE (interface between 2 CVs) conductivity It is required that flux conservation is satisfied
(x)e(x)E (x)e+
E
Req = Re + Re
xE
keq yz
M. Sahraoui FVM
xe
k P yz
xe+
k E yz
M. Sahraoui FVM
xe xe+ keq = k + k P E
(x)e-
(x)e+
E
xe + = xe = xE / 2
k eq = 2k p k E k p + kE
Harmonic mean
This is called the harmonic mean and developed by working out the heat flux between two consecutives nodes This approach guarantees conservation of heat across the interface.
And not
Keep in mind d that h using an arithmetic mean leads to incorrect results especially when there an abrupt change in conductivity
k eq = f e k P + (1 f e )k E
fe =
xe+ xe
M. Sahraoui FVM
M. Sahraoui FVM
Non-linearity
Non linearity may come from the fact that conductivity is temperature dependent, or from radiative effects (T4 influence),density variation due to temperature and concentration gradients. In cases where the coefficients in the discretized equations are not constant, iterations for a solution is necessary. For an iteration procedure a convergence criteria is needed to ensure that the iteration process has given the correct solution.
d dT k +S = 0 dx dx
Recall a pT p = aW TW + a ETE + b With and Where
a p = aE + aW S P b = S c x
S = S c + S pTP
Sc = 4 5Tp*3 and S p = 0
Sc = 4
and
S p = 5Tp*2
M. Sahraoui FVM
M. Sahraoui FVM
an
d p
S = 25Tp
* P
S c = 4 + 20T
W t
t + t
t + t E T T dtdx = c k dxdt t W x t x
W t
t + t
1 S 2
TP 4
T
M. Sahraoui FVM
M. Sahraoui FVM
ke (TE TP ) kw(TP TW ) dt xe xw
W t
t + t
t + t E T T dtdx = c dxdt k t W x t x
t + t
1 TP dt = [ fTP + (1 f )Tp0 ]t
W t
t + t
TP0
M. Sahraoui FVM
M. Sahraoui FVM
2-D conduction
For the fully implicit scheme (f=1)
T T T = k + k y +S t x x y
CV W y P
The temperature of the CV is given explicitly in terms of the old values. No iterations are needed. Need to keep the explicit scheme positive. Therefore, there a restriction on how big the time step is. For a uniform grid the time step restriction becomes:
c(x) 2 t < 2k
M. Sahraoui FVM
S
M. Sahraoui FVM
aE =
aN =
k E y xE
k N X y N
aW =
k y aS = S y S
a0 p =
C Xy
T
(Top)
0 b = sC xy + a 0 pT p
a P = aE + aW + a N + aS + a 0 p s P xy
xw
N
aW =
aS =
xe
CV
kW yz B (Bottom) S xW
yn
W P y E
k S yz yS
k B xy z B
aT =
aB =
ys
Y
0 b = sC xyz + a 0 pT p
a0 p =
Cxyz
T
x S
M. Sahraoui FVM
a P = aE + aW + a N + aS + aT + a B + aS a 0 p s P xyz
M. Sahraoui FVM
Boundary conditions
Three types of boundary conditions can be used Fixed temperature Fixed flux Convective heat transfer coefficient.
aE =
aN =
k E y xE
k N X y N
aW =
aS =
a0 p =
C Xy
T
T = T0
0 b = sC xy + a 0 pT p
a P = aE + aW + a N + aS + a 0 p s P xy
xw
xe
N CV
T = h(T T ) n
T k = q" n
yn
W P y E
ys
x S
M. Sahraoui FVM
M. Sahraoui FVM
aw = 0
i.e, the boundary point is not needed for the calculation Also
a pT p = a E TE + a S TS + a N TN + b
Sp = a P = aE + a N + aS + a 0 p S p V
T1, j T 2, j x
y = h(T1, j T )y xe
N
y x ( w + 1 / h) v k y 1 b= T x w v ( + 1 / h) k 1
CV
aw = 0
T1, j = T2, j
aw = 0
a pT p = a ETE + a S TS + a N TN + b b = y q"
Recall that z=1m (2D assumption)
yn
W P y E
ys
x S
q" = 0
M. Sahraoui FVM
M. Sahraoui FVM
a pTp = anbTnb + b
Where nb denotes a neighbor point (node)
Tp
a =
*
nb
* Tnb +b
ap
Where Tnb is the guessed value of the neighbor points. The grid points are visited in sequence.
Iteration direction
M. Sahraoui FVM M. Sahraoui FVM
Gauss-Seidel - Convergence
1D solution
Use (TriDiagonal-Matrix U of f TDMA A( i i l i Algorithm).
a
ap
np
1 < 1
i = 1,2,3,, M +1
In 1D problems this method allows to find a direct solution when the coefficients do not depend on the field we are solving for.
The convergence of Gauss-Seidel is very slow since information from the boundaries is transmitted at a rate of one grid point per iteration
M. Sahraoui FVM
M. Sahraoui FVM
for
i = 1,2, ,....., ,N
b1 P = 1 a1
and
d Q1 = 1 a1 di + ciQi1 ai ci P i 1
a pT p = aW TW + a E TE + a S TS + a N TN + b
Apply the TDMA technique in the x-direction, one line at a time. The above equation becomes
* a pT p = aW TW + a ETE + ( aS Ts* + a N TN + b)
P i =
for
bi ai ci Pi1
and
Qi =
i = 2,.....,N 1
Estimated values
Tn = Qn
Back substitution
i = N 1, ,......, , 1
Ti = P iTi +1 + Qi
Chosen line
M. Sahraoui FVM
M. Sahraoui FVM
More on TDMA
Information from one boundary to the other can be transferred with a single iteration on the same line. For faster solution in 2D and 3 D problems, TDMA can be applied alternatively in all directions.
Overrelaxation and Underrelaxation Overrelaxation O l ti is used to speed up the iteration process of linear
problems
Nonlinear problems These two methods use relaxations factors where the value of the node from the previous time step is used to control the value for the next iteration.
The g general discretized equation q is g given by y
a pT p = anbTnb + b
Tp =
nb nb
T +b
ap
nb nb
T +b
Tp =
nb nb
T +b
ap
+ (1 )T p*
ap
Lets introduce the node value from the previous time step T p*
anbTnb + b T p = T p* + T p* ap
T p Produced by the current time step (= 0 for a converged solution)
For a converged solution equation (27) still satisfy the original equation (26)
>1
Overrelaxation used for linear problems to speed up the convergence process. process
( a p + i )T p = anbTnb + b + iT p*
i>0
To compare the value of the nodes between two consecutive iterations may be misleading when a convergence is very slow or not converging (does nor mean diverging)
For a converged solution equation (28) still satisfy the original equation (26)
M. Sahraoui FVM
M. Sahraoui FVM
Convection
For testing the flow part compare with the simple analytical solutions first
Poiseuille flow Couette flow Periodic flow
CONVECTION
M. Sahraoui FVM
M. Sahraoui FVM
Convection-Diffusion
The flow field must satisfy, satisfy the continuity equation
1D Convection-Diffusion
The flow field must satisfy, satisfy the continuity equation
+ ( u j ) = 0 t x j
(30)
d ( u ) = 0 dx
or
u = C (33)
( ) + ( u j ) = ( )+S t x j x j x j
Where C is constant
(31)
Transport equation
( ) + u j = ( )+S t x j x j x j
d d d ( u ) = ( ) dx dx dx
(34)
(32)
(x)
w
(x)
E
P x
M. Sahraoui FVM
M. Sahraoui FVM
1D Convection-Diffusion Cont.
Integrate the differential equation (34) over the control volume
dx (u )dx = dx ( dx )dx
Which becomes
(35)
e = (E + P )
1 2
w = (W + P )
1 2
(37)
d (u ) = d ( dx )
d d ( u )e ( u ) w = dx e dx w
(x)
w
This assume that the control volume face is located in the middle between nodes E & P and W & P. The integrated equation (36) becomes
(36)
(x)
E
1 1 (38) ( u)e (E + P ) ( u) w (W + P ) = 2 2 e (E P ) w (P W ) x x e w
(x)
w
(x)
E
P x
P x
M. Sahraoui FVM
M. Sahraoui FVM
F u
a p p = aW W + a EE
With the coefficients defined
aE = De a p = De +
Fe 2 Fe F + Dw w 2 2
aW = Dw +
Fw 2
Lets look at an example. (Excel File)
a p = aE + aW + ( Fe Fw )
However the continuity equation ensures that
Fe = Fw
Then
a p = aE + aW
M. Sahraoui FVM
M. Sahraoui FVM
e = (E + P )
1 2
w = (W + P )
1 2
Fee = P Fe ,0 E Fe ,0
R1 , R2
Denotes the maximum of the two numbers With the coefficients
a p p = aW W + a EE
Upwind scheme
e = P e = E
(x)
E
if if
Fe > 0
a E = De + Fe ,0
aW = Dw + Fw ,0 a P = De + Fe ,0 + Dw + Fw ,0
Fe < 0
(x)
w
a P = a E + aW + ( Fe + Fw )
E
M. Sahraoui FVM
M. Sahraoui FVM
1D Convection-Diffusion Solution
Need to use more accurate schemes for predicting the flux across the control interface. Use the exact solution as a starting position. position
d d d ( u ) = dx dx dx
With the following boundary conditions at at
x=0 x=L
Pe x L
= 0
= L
0 e 1 = L 0 e Pe 1
Where Pe is the peclet number and is given by
Pe =
M. Sahraoui FVM
uL
1D Convection-Diffusion Solution
The profile of the exact solution is shown below
J = u
Exact Solution
d dx
dJ =0 dx
Integrating over the control volume
Je Jw = 0
Where Je is given by
Pe
) e Pe 1 J w = Fw (w wPw p ) e 1
M. Sahraoui FVM M. Sahraoui FVM
J e = Fe ( p
p e
a p p = aW W + aEE
where
Pe < 2
2 Pe 2
aE = Pe De
aE =
Fe e( Fe / De ) 1
For
Fwe Fw / Dw aw = ( Fw / Dw ) e 1
aE = Pe De aE =0 De
For
Pe > 2
Hybrid VS Exact 6 5
a p = aE + aW + ( Fe Fw )
The exponential scheme is computationally expensive
Ae/De
4 3 2 1 0 -1 -6 -4 -2 0 Pe 2 4 6 Exact Hybrid
M. Sahraoui FVM
M. Sahraoui FVM
a p p = aW W + aEE
where
a E = Max ( Fe , De Fe ,0) 2 F aW = Max( Fw , Dw + w ,0) 2
Pe < 10
aE = Pe De aE = (1 0,1Pe ) 5 Pe De aE = (1 0,1Pe ) 5 De
10 Pe < 0
0 Pe 10
Pe > 10
a p = aE + aW + ( Fe Fw )
aE =0 De
M. Sahraoui FVM
M. Sahraoui FVM
a p p = aW W + aEE
where
a E = De f ( Pe ) + Max ( Fe ,0) aW = Dw f ( Pw ) + Max ( Fw ,0)
f (P) 1 0 .5 P
Max(0,1 0.5 P )
Max(0, (1 0.1 P ) 5 ) P e 1
P
Diffusion/Convection Flux
a p = aE + aW + ( Fe Fw )
where f ( P ) is given by Scheme C t l diff Central difference Upwind Hybrid Power Law Exponential (Exact)
f (P)
1.5 1 Central Difference f(P) 0.5 0 0 -0.5 -1 P 2 4 6 8 10 Upwind Hybrid Power Law Exponential
1 0 .5 P
1
Max (0,1 0.5 P )
Max(0, (1 0.1 P ) 5 ) P
e 1
P
M. Sahraoui FVM
M. Sahraoui FVM
2D Convection-Diffusion Discretization
The conservation equation in 2D is given by:
2D Convection-Diffusion Discretization
The conservation equation in 2D is given by:
J ( ) + J x + y = S t x y
Where the fluxes J x and J y are given by J x = u u is the x-direction velocity x v is the y-direction velocity J y = v y Integrating over the two-dimensional CV xw xe
N
(
P
0 0 P )xy P
+ Je Jw + Jn Js =
( SC + S p p )xy
(39)
xw
N
xe
Jn
P CV
yn
W
yn
W P E
CV
Jw
y
Je
ys
Y
ys
x
S
Y
Js
x
S
M. Sahraoui FVM
M. Sahraoui FVM
2D Continuity equation
Along with the transport equation we have the th continuity ti it equation ti u v + + =0 t x y
P
0 P xy + Fe Fw + Fn Fs = 0 t
2D Convection-Diffusion cont.
If we use equation (39) and subtract from it equation by p ti (40) multiplied lti li d b
(40) ( )
xy + ( J e Fe p ) ( J w Fw p ) + t ( J n Fn p ) ( J s Fs p ) = ( SC + S p p )xy (42)
0 p P
0 P
Where Fe, Fw, Fs, Fn are the mass flow rates across the four faces of the control volume given by Fw = (u )w y (41a)
Where
J e Fe p = ae ( p E ) J w Fw p = aw (W p ) J n Fn p = an ( p N ) J s Fs p = as (S p )
Then equation (42) becomes
Fe = (u )e y Fn = (v )n x Fs = (v )s x
(43)
M. Sahraoui FVM
M. Sahraoui FVM
2D Convection-Diffusion cont.
The coefficients in equation (43) are given by
Artificial diffusion
aE = De f ( Pe ) + Max( Fe ,0)
aW = Dw f ( Pw ) + Max( Fw ,0)
Hot Hot Cold T Cold T
With diffusion
Excel file
Pe =
UL
L: characteristic length
: thermal diffusivity
M. Sahraoui FVM
Pe =
UL
M. Sahraoui FVM
Convection
The momentum equation is a highly non-linear equation. For three dimensional problems we have to solve for four variables: Three components of velocity Pressure field
M. Sahraoui FVM
M. Sahraoui FVM
u p u u + u + v = + t x y x 2u 2u + 2 + fx 2 y x v v v p + u + v = + t x y y 2v 2v + 2 + fy 2 y x
(45)
(46)
Need to find a way of calculating directly the primitive variables (u,v, and p)
Along with the momentum equation we have to solve the continuity equation (conservation of mass)
u v + =0 x y
(47)
M. Sahraoui FVM
M. Sahraoui FVM
x
Discretization of this term for the CV given below is
30
10
30
10
30
10
30
10
P PP + PE W +P P p Pw Pe 2 2 = x x x P PE = W 2x
The pressure value at Pp is not used ???
(x)w (x)E (x)w (x)E
M. Sahraoui FVM
M. Sahraoui FVM
uW + uP uP + uE u uwue 2 2 = x x x u uE = W 2x
This discretized equation uses the velocity at alternating grid points => oscillatory behavior
To solve the problem we use a staggered grid. The velocity components and other variables are not located on the same grid points.
(x)w
(x)E
(x)w
(x)E
M. Sahraoui FVM
M. Sahraoui FVM
Staggered Grid
Staggered Grid 2
Staggered location for u This methodology gives significant improvements over the th single i l grid id for f all ll the th variables i bl
u v P T, P, T C C, , k
Control Volume
This methodology is very convenient in writing the momentum equation, energy, species (or mass). This removes the oscillatory behavior of the velocity in the continuity equation and pressure in the momentum equation.
M. Sahraoui FVM M. Sahraoui FVM
aeue = anb unb + b + ( pP pE )Ae (48)X-momentum equation an vn = anb vnb + b + ( p P p N )An (49) Y-momentum equation
u v P T, P, T C C, , k
Control Volume
ue
PP
This methodology is very convenient in writing the momentum, energy, species (or mass) equations.
V control U Control
Volume Volume The control volume for W
M. Sahraoui FVM
This removes the oscillatory behavior of the velocity in the continuity equation and pressure in the momentum equation.
M. Sahraoui FVM
(58)
The same approach can be used for the other p of velocity y components In equation (54) the term in the summation can be neglcted and (54) becomes
L t that Lets th t th the correct t pressure field fi ld p Can be written in this form
p = p * + p' (54)
And in a similar manner the velocity components can be written in this in terms of the guessed velocity components t ( (u*, * v*, * w*) *) fi field ld and d a correction ti f for each h (u, v, and w).
u = u * +u ' (55)
v = v * +v'
(56)
(61)
w = w * + w' (57)
M. Sahraoui FVM
u v w + + + =0 t x y z
The discretized continuity equation is
0 (P P )xyz + [( u ) e ( u ) w ]yz + t [( v) n ( v) s ]xz + [( w) t ( w) b ]yx = 0
aE = e d e yz aW = w d w yz a N = n d n xz aS = s d s xz aT = t d t xz aB = b d b xy
And the source term b is given b
0 (P P )xyz + [( u*) w ( u*)e ]yz + b= t [( v*) s ( v*) n ]xz + [( w*) s ( w*)t ]yx
x
N
vn
P
CV
ue
uw
vs
S
X
M. Sahraoui FVM
M. Sahraoui FVM
M. Sahraoui FVM
M. Sahraoui FVM
T T c = k t x x
T ( k T ) = .( + k y y
c t dV = q.n dS Where q
S
q = k
T T xk y x y
k dy y+k dx = 0 c t dV + x y
S
Note that:
n dS = xdy ydx
M. Sahraoui FVM
T +k xda y i , j 1/ 2
M. Sahraoui FVM
i + 1/ 2, j
T x i +1/ 2, 2 j
n
T y i +1/ 2, 2 j
T etc x i , j +1/ 2
n
(dz = 1)
F dV = F n dS
Let
Then Th
F = Tx T
x dV = T dy
S
(65)
T dy
S
And
F = Ty
y dV = T dx
S
(66)
T dy T
S
n i +1, j
ya 'b ' + Tbn yb ' c ' + Ti ,nj yc ' d ' + Tan yd ' a '
Where Tb and Tan are determined as the averages of the four neighboring points
Expressions (65) and (66) provide a way to calculate the derivative at the control volume interface
M. Sahraoui FVM M. Sahraoui FVM