fdm-fvm
TRANSCRIPT
-
8/6/2019 FDM-FVM
1/48
1
Indian
InstituteofTechnologyMadras
Chenn
ai
36
Introduction to Finite Difference and Finite VolumeMethods for CFD
By
Prof. B.V.S.S.S Prasad
Thermal Turbo Machines Lab,Department of Mechanical Engineering,
IIT Madras, Chennai.
-
8/6/2019 FDM-FVM
2/48
2
Indian
InstituteofTechno
logyMadras
Chenn
ai
36
Pre-Processor Definition ofgeometry/computational domain
Grid generation Selection of
phenomena to be
modeled andselectinggoverningequations
Definition of fluidproperties
Specification ofinitial/boundaryconditions
Solver Numerical solution of
governing equations Approximation of
the unknownvariables bysimple functions
Discretization bysubstitution oftheapproximationsinto thegoverningequations
Solution ofalgebraicequations
Post-Processor
Presentation ofresults in terms of
Vector plots
Contour plots
Particle tracking View
manipulations
Printouts
-
8/6/2019 FDM-FVM
3/48
3
Indian
InstituteofTechno
logyMadras
Chenn
ai
36
SolverApproximation ofthe unknownvariables by simplefunctions
Discretization by
substitution of theapproximations intothe governingequations
Solution of
algebraic equations
Finite Difference Method
Finite Element Method
Spectral Method
Finite Volume Method
Others!
-
8/6/2019 FDM-FVM
4/48
4
Indian
InstituteofTechno
logyMadras
Chenn
ai
36
Finite Differences
-
8/6/2019 FDM-FVM
5/485
Indian
InstituteofTechno
logyMadras
Chenn
ai
36
-
8/6/2019 FDM-FVM
6/48
6
Indian
InstituteofTechno
logyMadras
Chenn
ai
36
-
8/6/2019 FDM-FVM
7/48
7
Indian
InstituteofTechno
logyMadras
Chenn
ai
36
A Typical Finite Difference Grid
-
8/6/2019 FDM-FVM
8/48
8
Indian
InstituteofTechno
logyMadras
Chenn
ai
36
-
8/6/2019 FDM-FVM
9/48
9
Indian
InstituteofTechno
logyMadras
Chenn
ai
36
-
8/6/2019 FDM-FVM
10/48
10
Indian
InstituteofTechno
logyMadras
Chenn
ai
36
-
8/6/2019 FDM-FVM
11/48
11
Indian
InstituteofTechno
logyMadras
Chenn
ai
36
-
8/6/2019 FDM-FVM
12/48
12
Indian
InstituteofTechno
logyMadras
Chennai
36
-
8/6/2019 FDM-FVM
13/48
13
Indian
InstituteofTechno
logyMadras
Chennai
36
-
8/6/2019 FDM-FVM
14/48
14
IndianInstituteofTechno
logyMadras
Chennai
36
-
8/6/2019 FDM-FVM
15/48
15
IndianInstituteofTechnologyMadras
Chennai
36
-
8/6/2019 FDM-FVM
16/48
16
IndianInstituteofTechnologyMadras
Chennai
36
-
8/6/2019 FDM-FVM
17/48
17
IndianInstituteofTechnologyMadras
Chennai
36
-
8/6/2019 FDM-FVM
18/48
18
IndianInstituteofTechnologyMadras
Chennai
36
-
8/6/2019 FDM-FVM
19/48
19
IndianInstituteofTechnologyMadras
Chennai
36
-
8/6/2019 FDM-FVM
20/48
20
IndianInstituteofTechnologyMadras
Chennai
36
-
8/6/2019 FDM-FVM
21/48
21
IndianInstituteofTechnologyMadras
Chennai
36
Fundamental of Finite-Difference Methods
-
8/6/2019 FDM-FVM
22/48
22
IndianInstituteofTechnologyMadras
Chen
nai
36
Difference Representation of Partial Differential Equations
-
8/6/2019 FDM-FVM
23/48
23
IndianInstituteofTechnologyMadras
Chen
nai
36
-
8/6/2019 FDM-FVM
24/48
24
IndianInstituteofTechnologyMadras
Chen
nai
36
Simple Theoretical Basis
Consider an ODE L()=0 Assume the solution as
Substituting in the above ODE
The residue is (R)=L( )
Ideally, we would like to have this residue to be zero
Based on the principles of calculus of variations, wepropose to minimize the residue such that:
where W is a weighing function and the integrationsperformed over the domain of interest.
2 n0 1 2 n=a +a x+a x +....+a x
W.Rdx 0
-
8/6/2019 FDM-FVM
25/48
25
India
nInstituteofTechn
ologyMadras
Chen
nai
36
In the approximate (numerical) solution, the number ofweighing functions is equal to the number of unknowncoefficients.
Choices for weighing functions
The residue is forced to be zero at selected points, i.e.,R(x1)=0, R(x2)=0 . R (xn+1)=0.
(n+1) equations for the (n+1) unknownsCollocation method
The residue itself is used as weighing function i.e., W=R
R2 dx=0 Least Squares Method
The function used for approximating the solution is taken asthe weighing function
Galerkin MethodR dx 0
-
8/6/2019 FDM-FVM
26/48
26
India
nInstituteofTechn
ologyMadras
Chen
nai
36
Numerical Algorithm of FVM
Formal Integration of the governing equations of fluidflow over all the control volumes of the solutiondomain.
Discretisation i.e. conversion of integral equationsinto a system of algebraic equations.
Solution of algebraic equations by an iterative
method.
Si l Th i l B i
-
8/6/2019 FDM-FVM
27/48
27
India
nInstituteofTechn
ologyMadras
Chen
nai
36
Simple Theoretical Basis
Consider an ODE L()=0 Assume the solution as
Substituting in the above ODE
The residue is (R)=L( )
Ideally, we would like to have this residue to be zero Based on the principles of calculus of variations, we
propose to minimize the residue such that:
where W is a weighing function and the integrationsperformed over the domain of interest.
2 n0 1 2 n=a +a x+a x +....+a x
W.Rdx 0
-
8/6/2019 FDM-FVM
28/48
28
India
nInstituteofTechn
ologyMadras
Chen
nai
36
In the approximate (numerical) solution, the number ofweighing functions is equal to the number of unknowncoefficients.
Choices for weighing functions
The residue is forced to be zero at selected points, i.e.,R(x1)=0, R(x2)=0 . R (xn+1)=0.
(n+1) equations for the (n+1) unknownsCollocation method
The residue itself is used as weighing function i.e., W=R
R2 dx=0 Least Squares Method
The function used for approximating the solution is taken asthe weighing function
Galerkin MethodR dx 0
-
8/6/2019 FDM-FVM
29/48
29
India
nInstituteofTechn
ologyMadras
Chen
nai
36
Weighing function W=1 is chosen. The number of
weighted residual equations are obtained by dividing the
computational domain into several sub domains and
setting the weighing function to be unity over onechosen sub-domain and zero everywhere else.
Finite Volume Method
One-Dimensional Steady State Diffusion Equation
-
8/6/2019 FDM-FVM
30/48
30
India
nInstituteofTechn
ologyMadras
Chen
nai
36
One Dimensional Steady State Diffusion Equation
The diffusion process is governed by
Step 1: Discretisation of domain (Grid generation)
Propertyd d
S 0dx dx
Control Volume, vol A x
vol vol
d ddvol S dvol 0
dx dx
dvol A dx
-
8/6/2019 FDM-FVM
31/48
31
India
nInstituteofTechn
ologyMadras
Chen
nai
36
Step 2: Discretization:
(i) Integration of given equation over a control volume
(ii) Obtain discretized equation at the nodal point
Taking W=1 from w to e and zero elsewhere
Equation for one sub-domain (w-e)
d
-
8/6/2019 FDM-FVM
32/48
32
India
nInstituteofTechn
ologyMadras
Chen
nai
36
Considering as the flux
J J S xe w 0
J kd
dx
The principal task is to evaluate the fluxes crossing the control
surface
Evaluation of fluxes is done using any finite difference scheme,
Presently using central difference
andd
dx xw
P W
w
d
dx xe
E P
e
Physically, Je diffusion flux of leaving east face
Jw diffusion flux of entering west face
-
8/6/2019 FDM-FVM
33/48
33
India
nInstituteofTechn
ologyMadras
Chen
nai
36
Kx
Kx
S xeE P
e
w
P W
w
0
K
x
K
x
K
x
K
xS x
e
e
w
w
P
e
e
E
w
w
W
a a a b p P E E W W
a a b p P nb nb
Fi it Diff F l ti
-
8/6/2019 FDM-FVM
34/48
34
India
nInstituteofTechn
ologyMadras
Chen
nai
36
Finite Difference Formulation
2
2
E P W
2
P P E E W W
P P nb nb
d s 0dx
2s 0
xa a a b
a a b
-
8/6/2019 FDM-FVM
35/48
35
IndianInstituteofTechn
ologyMadras
Chennai
36
In general, the source term S may be non-linear
function of the dependant variable
Linearise the source term,
such thatSp is negative
( )a S a S x p p P nb nb c
The discretisation equation becomes
u pS S S
Example Problem
-
8/6/2019 FDM-FVM
36/48
36
IndianInstituteofTechn
ologyMadras
Chennai
36
Example Problem
A fin has a base temperature of 100C (TB) and the end
insulated. It is exposed to an ambient temperature of 20 C.One dimensional heat transfer in this situation is governed by
where h is the convective heat transfer coefficient, P is theperimeter, k the thermal conductivity of the material and the
ambient temperature. Calculate the temperature distributionalong the fin and compare the results with the analyticalsolution given by
where n2=hP/(kA), L is the length of the fin and x the distancealong the fin. Data L=1m, hP/(kA)=25m-2
( ) 0d dT
kA hP T T dx dx
T
cosh[ ( )]cosh( )
T T n L xnLT T
B
-
8/6/2019 FDM-FVM
37/48
37
IndianInstituteofTechn
ologyMadras
Chennai
36
Solution:The governing equation in the example contains a sink term, th
convective heat loss, which is a function of the local temperature T. Thefirst step in solving the problem by the finite volume method is to set up
grid. We assume a uniform grid and divide the length into five controlvolumes so that x=0.2m.
( )hP T T
When kA=constant, the governing equation can be written as
-
8/6/2019 FDM-FVM
38/48
38
IndianInstituteofTechnologyMadras
Chennai
36
, g g q
where n2 =hp/(kA)
Integration of the above equation over a control volume gives
The second integral due to the source term in the equation is evaluatedby assuming that the integral is locally constant within each controlvolume.
First we develop a formula valid for nodal points 2,3 and 4 byintroducing the usual linear approximations for the temperaturegradient. Subsequent division by cross sectional area A gives
This can be rearranged as
2( ) 0d dT
n T Tdx dx
2( ) 0
V V
d dTdV n T T dV
dx dx
2[ ( ) ] 0Pe w
dT dT A A n T T A x
dx dx
2[ ( ) ] 0P wE P
P
T TT Tn T T x
x x
2 21 1 1 1P w E P
T T T n xT n xT x x x x
For interior nodal points 2,3 and 4 we write
-
8/6/2019 FDM-FVM
39/48
39
IndianInstituteofTechnologyMadras
Chennai
36
For interior nodal points 2,3 and 4 we write
with
Next we apply the boundary conditions at node points 1 and 5. At node 1 thewest control volume boundary is kept at a specified temperature.
The coefficients of the discretised equation at boundary node 1 are
At node 5 the flux across the east boundary is zero since the east side of thecontrol volume is an insulated boundary.
P P W W E E ua T a T a T S
aW aE aP Sp Su1/(x) 1/(x) aW+aE-Sp -n
2x n
2xT
2[ ( ) ] 0/ 2
E P P BP
T T T T n T T x
x x
aW aE aP Sp Su0 1/(x) aW+aE-Sp -n2x-2/x n2xT+2/xTB
20 0P W PT T
n T T xx
Hence the east coefficient is set to zero. There are no additional
-
8/6/2019 FDM-FVM
40/48
40
IndianInstituteofTechnologyMadras
Chennai
36
source terms associated with the zero flux boundary conditions. Thecoefficients at the boundary node 5 are given by
Substituting numerical values gives the coefficients
aW aE aP Sp Su
1/(x) 0 aW+aE-Sp -n2x n2xT
Node aW
aE
Su SP
aP=aW
+aE-Sp
1 0 5 100+10TB
-15 20
2 5 5 100 -5 15
3 5 5 100 -5 15
4 5 5 100 -5 15
5 5 0 100 -5 10
Th t i f f th ti t i
-
8/6/2019 FDM-FVM
41/48
41
IndianInstituteofTechnologyMadras
Chennai
36
The matrix form of the equations set is
The solution to the above system is
Comparison with the analytical solution:
The maximum percentage error ((analytical solution-finite volumesolution)/analytical solution) is around 6%. Given the coarseness of the grid
used in the calculation the numerical solution is reasonably close to theexact solution
-
8/6/2019 FDM-FVM
42/48
42
IndianInstituteofTechnologyMadras
Chennai
36
The numerical solution can be improved by employing a finer grid. Letus consider the same problem with the rod length subdivided into 10control volumes. The derivation of the discretized equations is the
same as before, but the numerical values of the coefficients and sourceterms are different owing to the smaller grid spacing of x=0.1m. Thecomparison of results of the second calculation with the analyticalsolution is given. The second numerical results show better agreementwith the analytical solution with maximum deviation of 2% only.
-
8/6/2019 FDM-FVM
43/48
43
IndianInstituteofTechnologyMadras
Chennai
36
Finite Volume Method for
-
8/6/2019 FDM-FVM
44/48
44
IndianInstituteofTechnologyMadras
Chennai
36
Two-dimensional diffusion problems
S 0x x y y
Two-dimensional steady state diffusion equation
Step 1 : Discretization using 2 D grid
vol vol vol
dx dy dx dy S dvol 0x x y y
Integrating over a control volume and then obtaining the
-
8/6/2019 FDM-FVM
45/48
45
Indi
anInstituteofTechnologyMadras
Che
nnai
36
g g g
discretized equation
Ae=Aw= y and An=As= x
[Je-Jw]+[Jn-Js]+ Where
Generalized discretized equation form for interior nodes
aPP = aPP+ aPP+ aPP+ aPP+Su
aW+aE+aS+aN-Sp
aPaNaSaEaW
w w
WP
A
x
e e
PE
A
x
s s
SP
A
y
n n
PN
A
y
S V 0
W W P Ww
WP
AJ
x
E E W P
e PE
A
J x
N N P Nn
NP
AJ
x
S S S Ps SP
A
J x
Finite Volume Method for
-
8/6/2019 FDM-FVM
46/48
46
Indi
anInstituteofTechnologyMadras
Che
nnai
36
Three-dimensional steady state diffusion equation
Three-dimensional diffusion problems
Typical ControlVolume is
S 0x x y y z z
-
8/6/2019 FDM-FVM
47/48
47
Indi
anInstituteofTechnologyMadras
Che
nnai
36
aNaSaEaW
w w
WP
A
x
e e
PE
A
x
s s
SP
A
y
n n
PN
A
y
aB aT aP
aW+aE+aS+aN+aB+
aT-SP
b b
BP
A
z
t t
Pt
A
z
aPP = aPP+ aPP+ aPP+ aPP+Su
The discretized equation for interior nodes is
where
SUMMARY
-
8/6/2019 FDM-FVM
48/48
48
IndianInstituteofTechnologyMadras
Che
nnai
36
SUMMARY
1. CFD overview
2. Basics of important CFD solvers FDM,FVM and FEM
3. Finite Volume Method for 1D diffusion problems
importance of fluxes4. Example problem of heat conduction in a fin importance
of grid size
5. Extensions to 2D and 3D diffusion problems