0% found this document useful (0 votes)
21 views28 pages

02 FVM For Steady State Diffusion

Uploaded by

ax0980959
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views28 pages

02 FVM For Steady State Diffusion

Uploaded by

ax0980959
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

CHE-614

Computational Fluid Dynamics

Finite Volume Method


1-D Steady State Diffusion

Dr. Muhammad Nadeem


[email protected]
Room 15, . : 3774
Finite Volume Method
The transport equation of a general variable 𝜙 in conservative form

Rate of increase Net rate of flow Rate of increase Rate of increase


of 𝜙 fluid + of 𝜙 out of = of 𝜙 due to + of 𝜙 due to
element fluid element diffusion sources

Mathematically,
𝜕 𝜌𝜙
+ div 𝜌𝜙𝐮 = div Γ grad 𝜙 + 𝑆𝜙
𝜕𝑡
Equation of steady state diffusion
div Γ grad 𝜙 + 𝑆𝜙 = 0

Γ is the diffusion coefficient and S is the source term


32
Finite Volume Method
Integrate over control volume
𝑑𝑨
න div Γ grad 𝜙 𝑑𝑉 + න 𝑆𝜙 𝑑𝑉 = 0
𝐶𝑉 𝐶𝑉
𝑑𝑨 = 𝒏𝑑𝐴
The volume integrals are rewritten as
integrals over the entire bounding
surface of the control volume by using
Gauss’s divergence theorem 𝜙

න 𝐧 ⋅ Γ grad 𝜙 𝑑𝐴 + න 𝑆𝜙 𝑑𝑉 = 0 න ∇ ⋅ 𝜙 𝑑𝑉 = න 𝜙 ⋅ 𝒏 𝑑𝐴
𝑉 𝑆
𝐴 𝐶𝑉
ҧ
෍ 𝑛𝑖 ⋅ Γ grad 𝜙 𝑖 𝛢𝑖 + 𝑆∆𝑉 =0

The order of integration and differentiation has been changed to


illustrate its physical meaning
33
Finite Volume Method:
1-D Steady State Diffusion
Control volume boundaries
div Γ grad 𝜙 + 𝑆𝜙 = 0

ϕB = constant
ϕA = constant
P E
A B
W w e
𝑑 𝑑𝜙
Γ +𝑆 =0
𝑑𝑥 𝑑𝑥
Control volume Nodal Points

Step 1: Grid generation


δxWP δxPE
δxwP δxPe

W w e E
P

Δx = δxwe
34
Finite Volume Method:
1-D Steady State Diffusion
Step 2: Integrate over Control Volume
𝑑 𝑑𝜙
Γ +𝑆 =0
𝑑𝑥 𝑑𝑥

𝑑 𝑑𝜙
න Γ 𝑑𝑉 + න 𝑆 𝑑𝑉 = 0
𝑑𝑥 𝑑𝑥
∆𝑉 ∆𝑉

𝑑𝜙
න 𝒏⋅ Γ 𝑑𝐴 + න 𝑆𝑑𝑉 = 0
∆𝐴 𝑑𝑥 Δ𝑉 𝑒
𝑑 𝑑𝜙
න Γ𝛢 𝑑𝑥 + න 𝑆𝑑𝑉 = 0
𝑑𝜙 𝑤 𝑑𝑥 𝑑𝑥 Δ𝑉
෍ 𝑛𝑖 ⋅ Γ ҧ
𝛢𝑖 + 𝑆∆𝑉 =0
𝑑𝑥 𝑖

𝑑𝜙 𝑑𝜙
Γ𝐴 − Γ𝐴 ҧ
+ 𝑆∆𝑉 =0
𝑑𝑥 𝑒
𝑑𝑥 𝑤
35
Finite Volume Method:
1-D Steady State Diffusion
The values of the property 𝜙 and the diffusion
coefficient are defined and evaluated at nodal points
The interface diffusion coefficient Γ and the gradient 𝜙
𝑑𝜙/𝑑𝑥 at east (e) and west (w) are required.
Step 3: Make linear profile assumption between
cell centroids for ϕ.
W w P e E
𝑑𝜙 𝜙𝐸 − 𝜙𝑃 x
Γ𝐴 = Γ𝑒 𝐴𝑒 Central
𝑑𝑥 𝑒
𝛿𝑥𝑃𝐸
Differencing
𝑑𝜙 𝜙𝑃 − 𝜙𝑊 Scheme
𝜙
Γ𝐴 = Γ𝑤 𝐴𝑤
𝑑𝑥 𝑤
𝛿𝑥𝑊𝑃
In a uniform grid linearly interpolated values of Γ
Γ𝑊 + Γ𝑃 Γ𝑃 + Γ𝐸
Γ𝑤 = Γ𝑒 = W w P e E
2 2 x 36
Finite Volume Method:
1-D Steady State Diffusion
Treatment of the source term
Often, the source term S is a function of the dependent variable 𝜙 itself.
In such cases the finite volume method approximates the source term by
means of a linear form
𝑆ҧ = 𝑆𝑢 + 𝑆𝑝 𝜙𝑃
Profile assumptions for 𝜙 and S need not be the same.
Substitution gives
𝜙𝐸 − 𝜙𝑃 𝜙𝑃 − 𝜙𝑊
Γ𝑒 𝐴𝑒 − Γ𝑤 𝐴𝑤 + 𝑆𝑢 + 𝑆𝑝 𝜙𝑃 ∆𝑉 = 0
𝛿𝑥𝑃𝐸 𝛿𝑥𝑊𝑃
Γ𝑒 Γ𝑤 Γ𝑤 Γ𝑒
𝐴𝑒 + 𝐴𝑤 − 𝑆𝑝 ∆𝑉 𝜙𝑃 = 𝐴𝑤 𝜙𝑊 + 𝐴𝑒 𝜙𝐸 + 𝑆𝑢 ∆𝑉
𝛿𝑥𝑃𝐸 𝛿𝑥𝑊𝑃 𝛿𝑥𝑊𝑃 𝛿𝑥𝑃𝐸

𝑎𝑃 𝜙𝑃 = 𝑎𝑊 𝜙𝑊 + 𝑎𝐸 𝜙𝐸 + 𝑆𝑢 ∆𝑉
where Γ𝑤 Γe
𝑎𝑊 = 𝐴 𝑎𝐸 = 𝐴 𝑎𝑃 = 𝑎𝑊 + 𝑎𝐸 − 𝑆𝑝 ∆𝑉
𝛿𝑥𝑊𝑃 𝑤 𝛿𝑥𝑃𝐸 𝑒 37
Finite Volume Method:
1-D Steady State Diffusion
Step 4: Solution of equations
𝑎𝑃 𝜙𝑃 = 𝑎𝑊 𝜙𝑊 + 𝑎𝐸 𝜙𝐸 + 𝑆𝑢 ∆𝑉

Discretised equations of the form above must be set up at each of


the nodal points in order to solve a problem.
For control volumes that are adjacent to the domain boundaries
the general discretised equation is modified to incorporate
boundary conditions.

The resulting system of linear algebraic equations is then solved


to obtain the distribution of the property 𝜙 at nodal points.
Any suitable matrix solution technique may be enlisted for this
task
38
Basic Rules
The solution should always have
(1) physically realistic behavior and
Unrealistic (2) overall balance

Approximate, but
physically realistic

𝜙
Exact

Unrealistic

x
39
Basic Rules
Rule 1: Consistency at control-volume faces
When a face is common to two adjacent control volumes, the flux
across it must be represented by the same expression in the
discretization equations for the two control volumes.

ϕ ϕ Slope from right

Slope from left

W w P e E W P E EE
x x

40
Basic Rules
Rule 2: Positive coefficients
All coefficients (aP and neighbor coefficients anb) must always be
positive.

Rule 3: Negative-slope linearization of the source term


When the source term is linearized as 𝑆ҧ = 𝑆𝑢 + 𝑆𝑝 𝜙𝑃 , the coefficient
Sp must always be less than or equal to zero.

Rule 4: Sum of the neighbor coefficients


𝑎𝑃 = Σ𝑎𝑛𝑏
for situations where the differential equation continues to remain
satisfied after a constant is added to the dependent variable.
41
Example: 1-D Steady State Diffusion
Consider the problem of source-free heat conduction in an insulated rod
whose ends are maintained at constant temperatures of 100°C and
500°C respectively. Calculate the steady state temperature distribution
in the rod. Thermal conductivity k equals 1000 W/m.K, cross-sectional
area A is 10 ×10−3 m2.

Solution:
𝑑 𝑑𝑇
𝑘 =0
𝑑𝑥 𝑑𝑥

𝑘 𝑘 𝑘 𝑘
𝐴 + 𝐴 𝑇𝑃 = 𝐴 𝑇𝑊 + 𝐴 𝑇𝐸
𝛿𝑥 𝛿𝑥 𝛿𝑥 𝛿𝑥
𝑘 𝑘
Discretized equation for nodal points 2, 3 and 4 is 𝑎𝑊 = 𝐴, 𝑎𝐸 = 𝐴
𝛿𝑥 𝛿𝑥
𝑎𝑃 𝑇𝑃 = 𝑎𝑊 𝑇𝑊 + 𝑎𝐸 𝑇𝐸 𝑎𝑃 = 𝑎𝑊 + 𝑎 𝐸
45
Example: 1-D Steady State Diffusion
For control volume surrounding point 1 TA 1 2
𝑇𝐸 − 𝑇𝑃 𝑇𝑃 − 𝑇𝐴
𝑘𝐴 − 𝑘𝐴 =0 δx/2 δx
𝛿𝑥 𝛿𝑥Τ2
𝑘 2𝑘 𝑘 2𝑘
𝐴+ 𝐴 𝑇𝑃 = 0. 𝑇𝑊 + 𝐴 𝑇𝐸 + 𝐴 𝑇𝐴
𝛿𝑥 𝛿𝑥 𝛿𝑥 𝛿𝑥
The fixed temperature boundary condition enters the calculation as a source
term 𝑆ҧ = 𝑆𝑢 + 𝑆𝑃 𝑇𝑃 with 𝑆𝑢 ∆𝑉 = 2𝑘𝐴Τ𝛿𝑥 𝑇𝐴 and 𝑆𝑝 ∆𝑉 = − 2𝑘𝐴Τ𝛿𝑥
𝑎𝑃 𝑇𝑃 = 𝑎𝑊 𝑇𝑊 + 𝑎𝐸 𝑇𝐸 + 𝑆𝑢 ∆𝑉
𝑘
𝑎𝑊 = 0, 𝑎𝐸 = 𝐴 𝑎𝑃 = 𝑎𝑊 + 𝑎𝐸 − 𝑆𝑝 ∆𝑉
𝛿𝑥 4 TB
5
Similarly, for boundary node 5
δx δx/2
𝑎𝑃 𝑇𝑃 = 𝑎𝑊 𝑇𝑊 + 𝑎𝐸 𝑇𝐸 + 𝑆𝑢 ∆𝑉
𝑘
𝑎𝑊 = 𝐴, 𝑎𝐸 = 0, 𝑎𝑃 = 𝑎𝑊 + 𝑎𝐸 − 𝑆𝑝 ∆𝑉
𝛿𝑥 46
Example: 1-D Steady State Diffusion
The resulting set of algebraic
equations is

This set of equations can be rearranged as

47
Example: 1-D Steady State Diffusion
• MATLAB / Python Code of Example 4-1

48
Finite Difference & Finite Volume Method
𝑑2 𝜙
Consider 1D diffusion equation: Γ 2 +𝑆 =0
𝑑𝑥
𝜙𝐴 1 2 3 4 𝜙𝐵 𝜙𝐴 1 2 3 4 5 𝜙𝐵
𝑖−1 𝑖 𝑖+1 Δx W w P e E Δx
From Taylor series Integrating over control volume P
𝑒
𝑑2 𝜙 𝜙𝑖−1 − 2𝜙𝑖 + 𝜙𝑖+1 𝑑 𝑑𝜙
= න Γ𝛢 𝑑𝑥 + න 𝑆𝑑𝑉 = 0
𝑑𝑥 2 𝑖
∆𝑥 2 𝑤 𝑑𝑥 𝑑𝑥 Δ𝑉

For node 2 𝑑𝜙 𝑑𝜙
Γ𝐴 − Γ𝐴 ҧ
+ 𝑆∆𝑉 =0
𝑑𝑥 𝑑𝑥
𝑑2 𝜙 𝜙1 − 2𝜙2 + 𝜙3 𝑒 𝑤
Γ =Γ 𝜙𝐸 − 𝜙𝑃 𝜙𝑃 − 𝜙𝑊
𝑑𝑥 2 ∆𝑥 2
2 Γ𝑒 𝐴𝑒 − Γ𝑤 𝐴𝑤
𝛿𝑥 𝛿𝑥
𝑆2 = 𝑆 𝜙2
+ ഥ𝑆∆𝑉 = 0
2Γ Γ Γ 2Γ Γ Γ
𝜙 = 𝜙 + 𝜙3 + 𝑆2 𝜙2 = 𝜙1 + 𝜙3 + ഥ𝑆∆𝑥 2
∆𝑥 2 2 ∆𝑥 2 1 ∆𝑥 2
∆𝑥 ∆𝑥 ∆𝑥
49
Finite Difference & Finite Volume Method
Let 𝜙 be temperature and Γ is thermal conductivity k, with no source
Data: 𝑘 = 250 𝑊/𝑚. 𝐾 and ∆𝑥 = 0.1𝑚 𝑇𝐴 = 100℃ 𝑇𝐵 = 25℃ 𝑆 = 0
2𝑇1 = 𝑇2 + 𝑇𝐴 3𝑇1 = 𝑇2 + 2𝑇𝐴
2𝑇2 = 𝑇1 + 𝑇3 2𝑇2 = 𝑇1 + 𝑇3
2𝑇3 = 𝑇2 + 𝑇4
2𝑇3 = 𝑇2 + 𝑇4
2𝑇4 = 𝑇3 + 𝑇5
2𝑇4 = 𝑇3 + 𝑇𝐵 3𝑇5 = 𝑇4 + 2𝑇𝐵

3 −1 0 0 0 𝑇1 200
2 −1 0 0 𝑇1 100 −1 2 −1 0 0 𝑇2 0
−1 2 −1 0 𝑇2 0 0 −1 2 −1 0 𝑇3 = 0
=
0 −1 2 −1 𝑇3 0 0 0 −1 2 −1 𝑇4 0
0 0 −1 2 𝑇4 25 0 0 0 −1 3 𝑇5 50

50
Example 2:
1-D Steady State Diffusion with Sources
Figure 4.6 shows a large plate of thickness L = 2 cm
with constant thermal conductivity k = 0.5 W/m.K and
uniform heat generation q = 1000 kW/m3.
The faces A and B are at temperatures of 100°C and
200°C respectively.
𝑑 𝑑𝑇
𝑘 +𝑞 =0
𝑑𝑥 𝑑𝑥

Assuming that the dimensions in the y- and z-


directions are so large that temperature gradients
are significant in the x-direction only, calculate
Figure 4.6
the steady state temperature distribution.
Compare the numerical result with the analytical solution.
𝑇𝐵 − 𝑇𝐴 𝑞
𝑇= + 𝐿 − 𝑥 𝑥 + 𝑇𝐴
𝐿 2𝑘
52
Example 2:
1-D Steady State Diffusion with Sources

𝑑 𝑑𝑇
න 𝑘 𝑑𝑉 + න 𝑞 𝑑𝑉 = 0
𝑑𝑥 𝑑𝑥
∆𝑉 ∆𝑉
𝑒
𝑑 𝑑𝜙
න 𝑘𝛢 𝑑𝑥 + න 𝑞𝑑𝑉 = 0
𝑤 𝑑𝑥 𝑑𝑥 Δ𝑉

𝑑𝑇 𝑑𝑇
Γ𝐴 − Γ𝐴 + 𝑞∆𝑉 = 0 ҧ
𝑆∆𝑉 = 𝑞∆𝑉
𝑑𝑥 𝑒
𝑑𝑥 𝑤

𝑇𝐸 − 𝑇𝑃 𝑇𝑃 − 𝑇𝑊
𝑘𝑒 𝐴 − 𝑘𝑤 𝐴 + 𝑞𝐴𝛿𝑥 = 0
𝛿𝑥 𝛿𝑥
53
Example 2:
1-D Steady State Diffusion with Sources
Node 2, 3 and 4
𝑘 𝑒 𝐴 𝑘𝑤 𝐴 𝑘𝑤 𝐴 𝑘𝑒 𝐴
+ 𝑇𝑃 = 𝑇𝑊 + 𝑇𝐸 + 𝑞𝐴𝛿𝑥
𝛿𝑥 𝛿𝑥 𝛿𝑥 𝛿𝑥
Node 1
𝑇𝐸 − 𝑇𝑃 𝑇𝑃 − 𝑇𝐴
𝑘𝑒 𝐴 − 𝑘𝐴 𝐴 + 𝑞𝐴𝛿𝑥 = 0 𝑎𝑃 𝑇𝑃 = 𝑎𝑊 𝑇𝑊 + 𝑎𝐸 𝑇𝐸 + 𝑆𝑢 ∆𝑉
𝛿𝑥 𝛿𝑥/2
Node 5
𝑇𝐵 − 𝑇𝑃 𝑇𝑃 − 𝑇𝑊
𝑘𝐵 𝐴 − 𝑘𝑤 𝐴 + 𝑞𝐴𝛿𝑥 = 0
𝛿𝑥/2 𝛿𝑥

Node aW aE aP SPΔV SuΔV


𝑘𝐴 𝑘𝐴
2, 3, 4 𝑎𝑊 + 𝑎𝐸 − 𝑆𝑃 ∆𝑉 0 𝑞𝐴𝛿𝑥
𝛿𝑥 𝛿𝑥
𝑘𝐴 2𝑘𝐴 𝑘𝐴
1 0 𝑎𝑊 + 𝑎𝐸 − 𝑆𝑃 ∆𝑉 − 𝑞𝐴𝛿𝑥 + 𝑇
𝛿𝑥 𝛿𝑥 𝛿𝑥 𝐴
𝑘𝐴 2𝑘𝐴 𝑘𝐴
5 0 𝑎𝑊 + 𝑎𝐸 − 𝑆𝑃 ∆𝑉 − 𝑞𝐴𝛿𝑥 + 𝑇
𝛿𝑥 𝛿𝑥 𝛿𝑥 𝐵
54
Example 2:
1-D Steady State Diffusion with Sources
In matrix form

55
Example 2:
1-D Steady State Diffusion with Sources

• MATLAB / Python Code of Example 4-2

56
Example 3:
1-D Steady State Diffusion with Sources
Shown in Figure 4.9 is a cylindrical fin with uniform cross sectional area
A. The base is at a temperature of 100°C (TB) and the end is insulated.
The fin is exposed to an ambient temperature of 20°C.
One dimensional heat transfer in this
situation is governed by
d d𝑇
𝑘𝐴 − ℎ𝑃 𝑇 − 𝑇∞ = 0
d𝑥 d𝑥

where h is the convective heat transfer coefficient, P the perimeter, k the


thermal conductivity of the material and T∞ the ambient temperature.
Calculate the temperature distribution along the fin and compare the results
with the analytical solution given by 𝑇 − 𝑇∞ cosh 𝑛 𝐿 − 𝑥
=
𝑇𝐵 − 𝑇∞ cosh 𝑛𝐿
where n2 = hP/(kA), L is the length of the fin and x the distance along the fin.
Data: L = 1 m, hP/(kA) = 25/m2 (note that kA is constant). 57
Example 3:
1-D Steady State Diffusion with Sources

d d𝑇
− 𝑛2 𝑇 − 𝑇∞ = 0 where 𝑛2 = ℎ𝑃Τ 𝑘𝐴
d𝑥 d𝑥
d d𝑇
න d𝑉 − න 𝑛2 𝑇 − 𝑇∞ 𝑑𝑉 = 0
∆𝑉 d𝑥 d𝑥 Δ𝑉

d𝑇 d𝑇
𝐴 − 𝐴 − 𝑛2 𝑇𝑃 − 𝑇∞ 𝐴𝛿𝑥 = 0
d𝑥 𝑒
d𝑥 𝑤

𝑇𝐸 − 𝑇𝑃 𝑇𝑃 − 𝑇𝑊
− − 𝑛2 𝑇𝑃 − 𝑇∞ 𝛿𝑥 = 0
𝛿𝑥 𝛿𝑥
1 1 1 1
+ 𝑇𝑃 = 𝑇𝑊 + 𝑇𝐸 + 𝑛2 𝛿𝑥𝑇∞ − 𝑛2 𝛿𝑥𝑇𝑃
𝛿𝑥 𝛿𝑥 𝛿𝑥 𝛿𝑥
58
Example 3:
1-D Steady State Diffusion with Sources
For nodal points 2, 3 and 4 is

1 1 1 1
+ 𝑇𝑃 = 𝑇𝑊 + 𝑇𝐸 + 𝑛2 𝛿𝑥𝑇∞ − 𝑛2 𝛿𝑥𝑇𝑃
𝛿𝑥 𝛿𝑥 𝛿𝑥 𝛿𝑥

1 1 2
1 1
+ + 𝑛 𝛿𝑥 𝑇𝑃 = 𝑇𝑊 + 𝑇𝐸 + 𝑛2 𝛿𝑥𝑇∞
𝛿𝑥 𝛿𝑥 𝛿𝑥 𝛿𝑥

𝑎𝑃 𝑇𝑃 = 𝑎𝑊 𝑇𝑊 + 𝑎𝐸 𝑇𝐸 + 𝑆𝑢 ∆𝑉

𝑎𝑊 𝑎𝐸 𝑎𝑃 𝑆𝑃 ∆𝑥 𝑆𝑢 ∆𝑥
1 1
𝑎𝑊 + 𝑎𝐸 − 𝑆𝑃 ∆𝑉 −𝑛2 𝛿𝑥 𝑛2 𝛿𝑥𝑇∞
𝛿𝑥 𝛿𝑥

59
Example 3:
1-D Steady State Diffusion with Sources
For nodal point 1 𝑇𝐸 − 𝑇𝑃 𝑇𝑃 − 𝑇𝐵
− − 𝑛2 𝑇𝑃 − 𝑇∞ 𝛿𝑥 = 0
𝛿𝑥 𝛿𝑥Τ2
2 1 2 1
+ + 𝑛2 𝛿𝑥 𝑇𝑃 = 𝑇𝐵 + 𝑇𝐸 + 𝑛2 𝛿𝑥𝑇∞
𝛿𝑥 𝛿𝑥 𝛿𝑥 𝛿𝑥
𝑎𝑊 𝑎𝐸 𝑎𝑃 𝑆𝑃 ∆𝑥 𝑆𝑢 ∆𝑥
1 2 2
2
0 𝑎𝑊 + 𝑎𝐸 − 𝑆𝑃 ∆𝑉 −𝑛2 𝛿𝑥 − 𝑛 𝛿𝑥𝑇∞ + 𝑇𝐵
𝛿𝑥 𝛿𝑥 𝛿𝑥

For nodal point 5 𝑇𝑃 − 𝑇𝑊


0− − 𝑛2 𝑇𝑃 − 𝑇∞ 𝛿𝑥 = 0
𝛿𝑥
1 2
1
+ 𝑛 𝛿𝑥 𝑇𝑃 = 𝑇𝑊 + 0 + 𝑛2 𝛿𝑥𝑇∞
𝛿𝑥 𝛿𝑥
𝑎𝑊 𝑎𝐸 𝑎𝑃 𝑆𝑃 ∆𝑥 𝑆𝑢 ∆𝑥
1
0 𝑎𝑊 + 𝑎𝐸 − 𝑆𝑃 ∆𝑉 −𝑛2 𝛿𝑥 𝑛2 𝛿𝑥𝑇∞
𝛿𝑥 60
Example 3:
1-D Steady State Diffusion with Sources

61
Effect of Grid
If the rod length sub-
divided into 10 control
volumes instead of 5.

The numerical results


shows better
agreement with the
analytical solution;
now the maximum
deviation is only 2%.

The numerical solution


can be improved by
employing a finer grid
62

You might also like