Module_6-Class_pdf
Module_6-Class_pdf
Module 1: Introduction
Module2: Geometry Creation Assignment 1
Derivation of Governing Equations and their
Module 3:
classification
Module 4: Meshing in ANSYS Mesh Modeller Assignment 2
Finite Volume Method for Diffusion Problem;
Module 5:
Implementation using ANSYS Fluent
Finite Volume Method for Convection-Diffusion
Module 6: Assignment 3
Problem; Implementation using ANSYS Fluent
Module 7: Pressure-Velocity Coupling and Turbulence
Fluid Flow and Heat transfer problems using ANSYS
Module 8: Assignment 4
Fluent
Module 9: Errors in CFD
Module 10: CFD Modelling of Combustion Assignment 5 & 6
1
Evaluation
➢ Mid Sem: Weightage: 30%
➢ End Sem: Weightage: 40%
➢ Assignment Submission: Weightage: 10%
➢ Assignment Implementation: Weightage: 20%
Pre-requisite
➢ Fluid Mechanics, Thermodynamics and Heat Transfer
Textbooks
➢ Numerical Heat Transfer and Fluid Flow: Suhas V. Patankar
➢ An introduction of computation fluid dynamics: Versteeg & Malalasekera
Reference books
➢ Computational Fluid Dynamics: Jr. Anderson
➢ Computational Fluid Mechanics and Heat Transfer: Anderson, Tanehil and Pletcher
2
Convection diffusion
In the fluid flow, convection is an important factor as it is governed by bulk motion of fluid.
Also, along side convection, conduction also occurs. Therefore, considering the convection
diffusion equation of a general property 𝜙 by eliminating unsteady term from Eqn 1.
𝜕(𝜌𝛷)
𝜌 + 𝑑𝑖𝑣(𝜌𝛷𝒖) = 𝑑𝑖𝑣 𝛤 𝑔𝑟𝑎𝑑 𝛷 + 𝑆𝛷
𝜕𝑡 (1)
𝑑𝑖𝑣 𝜌𝜙𝑢 = 𝑑𝑖𝑣 𝛤𝑔𝑟𝑎𝑑 𝜙 + 𝑆𝜙
(2)
Now integrating Eqn. 2 over control volume and using the Gauss-divergence theorem:
(3)
Eqn. 3 represents the flux balance within a control volume. The left-hand side describes the
net convective flux while the right-hand side accounts for the net diffusive flux and the
generation or depletion of the scalar property 𝜙 within the control volume.
It is important to note that diffusion occurs in all the direction along its gradient. However,
convection is influenced by flow direction. Here, we are assuming that the velocity at each
face is known.
Steady 1D convection and diffusion
Considering Eqn. 1 by eliminating unsteady term and source term.
𝑑 𝑑 𝑑𝛷
(𝜌𝛷𝒖) = 𝛤
𝑑𝑥 𝑑𝑥 𝑑𝑥 (4)
𝑑
𝜌𝑢 = 0 (5)
𝑑𝑥
On discretisation of Eqn. 4 and Eqn. 5 over a control volume, we will get Eqn. 6 and Eqn.7,
respectively
𝑑𝛷 𝑑𝛷
(𝜌𝐴𝛷𝒖)𝑒 −(𝜌𝐴𝛷𝒖)𝑤 = 𝛤𝐴 − 𝛤𝐴 (6)
𝑑𝑥 𝑒
𝑑𝑥 𝑤
(9)
Let the area 𝐴 of all the faces of control volume is constant. The gradient of 𝛷 is
discretised using Central difference scheme. Therefore using Eqn. 8 and 9, Eqn. 6 and 7
can be written as: (10)
(11)
It is assumed that the velocity field is known. Therefore, calculation for 𝛷 at east and west
face can be made.
Steady 1D convection and diffusion contd.
For convective term, considering the property 𝛷 at the face is the average of two adjacent
nodes (for uniform grid) for convective term. Therefore,
𝛷𝑊 + 𝛷𝑃 (12)
𝛷𝑤 =
2
𝛷𝑃 + 𝛷𝐸 (13)
𝛷𝑒 =
2
(14)
Eqn. 14 can be rearranged:
(15)
(16)
As, 𝐹𝑒 – 𝐹𝑤 = 0 (continuity)
Steady 1D convection and diffusion contd.
In short, the Eqn. 16 can be written as:
𝑎𝑃 𝛷𝑃 = 𝑎𝑊 𝛷𝑊 + 𝑎𝐸 𝛷𝐸 (17)
𝑎𝑊 𝑎𝑬 𝐴𝑒
𝐹𝑤 𝐹𝑒
𝐷𝑤 + 𝐷𝐸 − 𝑎𝑊 + 𝑎𝑬 + (𝐹𝑒 − 𝐹𝑤 )
2 2
Problem 1
A property 𝛷 is transported by means of convection and diffusion through the one-
dimensional domain. The governing equation is given below. The boundary conditions are
𝛷0 = 1 at 𝑥 = 0 and 𝛷𝐿 = 0 at 𝑥 = 𝐿. Using five equally spaced cells and the central
differencing scheme for convection and diffusion, calculate the distribution of 𝛷 as a
function of 𝑥 for
(i) Case 1: u = 0.1 m/s, (ii) Case 2: u = 2.5 m/s, and compare the results with the analytical
solution
(18)
(iii) Case 3: recalculate the solution for u = 2.5 m/s with 20 grid nodes and compare the
results with the analytical solution. The following data apply: length 𝐿 = 1.0 m, 𝜌= 1.0 kg/m3,
𝛤 = 0.1 kg/m.s.
Solution of Problem 1
Now, dividing the domain into five equal control volume with 𝛿𝑥 = 0.2 𝑚.
𝛤
𝐹 = 𝜌𝑢, 𝐷 = 𝛿𝑥, 𝐹𝑒 = 𝐹𝑤 = 𝐹 and 𝐷𝑒 = 𝐷𝑤 = 𝐷
The discretisation scheme 𝒂𝑷 𝜱𝑷 = 𝒂𝑾 𝜱𝑾 + 𝒂𝑬 𝜱𝑬 (Eqn. 17) can be applied at internal
nodes 2,3 and 4. It can be seen that the west face of cell 1 is defined as 𝛷w = 𝛷𝐴 = 1 and
east face of cell 5 is defined as 𝛷e = 𝛷𝐵 = 0. Therefore, no approximation is taken at these
faces for convective flux. Now, after discretisation of governing equation at node 1 and
node 5, we get:
(19)
(20)
Solution of Problem 1 contd.
2𝛤
Here, 𝐷𝐴 = 𝐷𝐵 = = 2𝐷 and 𝐹𝐴 = 𝐹𝐵 = 𝐹. Now the Eqn. 19 and 20 can be given as:
𝛿𝑥
𝑎𝑃 𝛷𝑃 = 𝑎𝑊 𝛷𝑊 + 𝑎𝐸 𝛷𝐸 + 𝑆𝑢 (21)
where
𝑎𝑃 = 𝑎𝑊 + 𝑎𝐸 + 𝐹𝑒 – 𝐹𝑤 − 𝑆𝑃
𝜞 𝟎.𝟏
𝛤 = 0.1 kg/m.s, 𝛿𝑥 = 0.2 m : 𝑫 = = 𝟎.𝟐 = 𝟎. 𝟓, we will get the updated table as:
𝜹𝒙
(22)
Solution of Problem 1 contd.
The Eqn. 22 can be solved using Excel or MATLAB. Therefore, the is given as:
By putting the value of u = 0.1 m/s, 𝜌= 1.0 kg/m3 and 𝛤 = 0.1 kg/m.s in Eqn. 18, we will
get the exact solution as:
(23)
1.2
Numerical Solution
1 Exact Solution
0.8
𝛷
0.6
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1
Distance (m)
Solution of Problem 1: case 2
Case 2: Putting u = 2.5 m/s, 𝜌= 1.0 kg/m3 : 𝑭 = 𝝆𝒖 = 𝟏 ∗ 𝟐. 𝟓 = 𝟐. 𝟓
𝜞 𝟎.𝟏
𝛤 = 0.1 kg/m.s, 𝛿𝑥 = 0.2 m : 𝑫 = = 𝟎.𝟐 = 𝟎. 𝟓, we will get the updated table as:
𝜹𝒙
After solving the all the five equation, we will get 𝛷 at different nodes.
(24)
Φ 𝑥 =
3
Numerical Solution
2.5 Exact Solution
2
𝛷
1.5
0.5
0
0 0.2 0.4 0.6 0.8 1
Distance (m)
The numerical simulation oscillates around the exact solution. Such oscillations are called
as wiggles.
Observations
➢ It can be seen that solution is unstable with central difference scheme (𝐶𝐷𝑆) when flow
velocity is increased from 0.1 m/s to 2.5 m/s.
➢ The value of 𝐹/𝐷 ratio is ‘0.2’ in case 1. Whereas, this quantity reach to ‘5’ for case 2.
𝝆𝒖𝜹𝒙
➢ The term 𝐹/𝐷 is called as cell Peclet number (𝑃𝑒)= 𝜞
➢ For using Central Difference Scheme (𝐶𝐷𝑆), 𝑷𝒆 ≤ 𝟐 to get the correct solution. If not
so, the solution will wiggle as in the case 2.
➢ It is necessary to calculate the cell Peclet number for each problem if we need to use
𝐶𝐷𝑆. Therefore, we need to find the a discretization scheme which is more stable than
that of 𝐶𝐷𝑆.
➢ One of the methods is Upwind difference scheme (𝑈𝐷𝑆). This method provides more
stable solution but this scheme is only first order accurate.
Taylor Series
➢ Considering equally spaced one-dimensional grid with spacing Δ𝑥 as shown in the Fig.
given below:
➢ The Taylor series for 𝜙 𝑥 + Δ𝑥 is given as:
𝜕𝜙 𝜕2𝑥 Δ𝑥 2 𝜕3𝑥 Δ𝑥 3
𝜙 𝑥 + Δ𝑥 = 𝜙 𝑥 + Δ𝑥 + + +⋯ (1)
𝜕𝑥 𝑥
𝜕𝑥 2 𝑥
2 𝜕𝑥 3 𝑥
6
➢ In our notation we use discrete values 𝜙𝑃 and 𝜙𝐸 for 𝜙 𝑥 and 𝜙 𝑥 + Δ𝑥 respectively
so that Eqn. 1 can be written as:
𝜕𝜙 𝜕2𝑥 Δ𝑥 2 𝜕3𝑥 Δ𝑥 3
𝜙𝐸 = 𝜙𝑃 + Δ𝑥 + + +⋯ (2)
𝜕𝑥 𝑃
𝜕𝑥 2 𝑃
2 𝜕𝑥 3 𝑃
6
Forward difference scheme (FDS)
➢ The Eqn. 2 can be rearranged to give
𝜕𝜙 𝜕2𝑥 Δ𝑥 2 𝜕3𝑥 Δ𝑥 3
Δ𝑥 = 𝜙𝐸 − 𝜙𝑃 − − −⋯ (3)
𝜕𝑥 𝑃 𝜕𝑥 2 𝑃
2 𝜕𝑥 3 𝑃
6
𝜕𝜙 𝜙𝐸 − 𝜙𝑃 𝜕2𝑥 Δ𝑥 𝜕3𝑥 Δ𝑥 2
= − − −⋯ (4)
𝜕𝑥 𝑃
Δ𝑥 𝜕𝑥 2 𝑃
2 𝜕𝑥 3
𝑃
6
𝜕𝜙 𝜙𝐸 − 𝜙𝑃
= + Truncated terms (5)
𝜕𝑥 𝑃
Δ𝑥
➢ By neglecting the truncated terms which involve the multiplying factor Δ𝑥. By neglecting
these terms Eqn. 5 can be written as:
𝜕𝜙 𝜙𝐸 − 𝜙𝑃
= (6)
𝜕𝑥 𝑃 Δ𝑥
➢ The power 𝑛 of Δ𝑥 governs the rate at which the error tends to zero as the grid is
refined and is called the order of the difference approximation.
Forward difference scheme (FDS) contd.
𝜕𝜙 𝜙𝐸 − 𝜙𝑃
= + 𝑂 Δ𝑥 (7)
𝜕𝑥 𝑃
Δ𝑥
➢ The Eqn. 7 involves only finites number of terms. Therefore, there occurs some errors in
the calculated value as compared to actual value. This error, due to the truncation, is
termed as truncation error.
➢ Equ. 7 is only first order accurate as order of the difference approximation (𝑛) is 1.
Backward difference scheme (BDS)
➢ The value 𝜙 𝑥 − Δ𝑥 at node 𝑊 can also be calculated if 𝜙 𝑥 at node 𝑃. The Taylor
series expansion be given as:
𝜕𝜙 𝜕 2 𝑥 Δ𝑥 2 𝜕 3 𝑥 Δ𝑥 3
𝜙 𝑥 − Δ𝑥 = 𝜙 𝑥 − Δ𝑥 + 2
− 3
+⋯ (8)
𝜕𝑥 𝑥 𝜕𝑥 𝑥 2 𝜕𝑥 𝑥 6
𝜕𝜙 𝜕2𝑥 Δ𝑥 2 𝜕3𝑥 Δ𝑥 3
𝜙𝑊 = 𝜙𝑃 − Δ𝑥 + − +⋯ (9)
𝜕𝑥 𝑃
𝜕𝑥 2 𝑃
2 𝜕𝑥 3 𝑃
6
𝜕𝜙 𝜕2𝑥 Δ𝑥 2 𝜕3𝑥 Δ𝑥 3
Δ𝑥 = 𝜙𝑃 − 𝜙𝑊 + − −⋯
𝜕𝑥 𝑃
𝜕𝑥 2 𝑃
2 𝜕𝑥 3 𝑃
6
𝜕𝜙 𝜙𝑃 − 𝜙𝑊 𝜕2𝑥 Δ𝑥 𝜕3𝑥 Δ𝑥 2
= + − −⋯
𝜕𝑥 𝑃
Δ𝑥 𝜕𝑥 2 𝑃
2 𝜕𝑥 3
𝑃
6
𝜕𝜙 𝜙𝑃 − 𝜙𝑊
= + 𝑂 Δ𝑥 (10)
𝜕𝑥 𝑃
Δ𝑥
➢ Similar to Eqn. 7, Eqn. 10 also involve two terms and the order of the difference
approximation is 1. Therefore, Eqn. 10 is also first order accurate.
Central difference scheme (CDS)
➢ Now considering Eqn. 2 and Eqn. 9,
𝜕𝜙 𝜕2𝑥 Δ𝑥 2 𝜕3𝑥 Δ𝑥 3
𝜙𝐸 = 𝜙𝑃 + Δ𝑥 + 2
+ 3
+⋯ (2)
𝜕𝑥 𝑃
𝜕𝑥 𝑃
2 𝜕𝑥 𝑃
6
𝜕𝜙 𝜕2𝑥 Δ𝑥 2 𝜕3𝑥 Δ𝑥 3
𝜙𝑊 = 𝜙𝑃 − Δ𝑥 + − +⋯ (9)
𝜕𝑥 𝑃
𝜕𝑥 2 𝑃
2 𝜕𝑥 3 𝑃
6
𝜕𝜙 𝜕3𝑥 Δ𝑥 3
𝜙𝐸 − 𝜙𝑊 =2 Δ𝑥 + 2 +⋯ (11)
𝜕𝑥 𝑃
𝜕𝑥 3 𝑃
6
𝜕𝜙 𝜙𝐸 − 𝜙𝑊
= + 𝑂(Δ𝑥 2 ) (12)
𝜕𝑥 𝑃
2Δ𝑥
➢ The Eqn. 12 involves east and west node to evaluate the gradient at the midpoint 𝑃.
Therefore, it is called as central difference scheme.
For finite volume method, the gradient at a cell face (say ‘𝑒’) can be evaluated as:
𝜕𝜙 𝜙𝐸 − 𝜙𝑃
= (13)
𝜕𝑥 Δ𝑥
𝑒 2( 2 )
➢ Central difference scheme is one of the methods to have accuracy of second order.
However, there are other discretization schemes which are also second order accurate.
➢ Second order upwind scheme considers three terms of Taylor series. Therefore, it is
more accurate than that of first order upwind scheme as it involves only single term of
Taylor series.
Upwind differencing scheme (UDS)
The central differencing scheme fails to account for flow direction, giving equal weight to
𝜙𝑃 and 𝜙𝑊 at the west face, even in strong west-to-east convection. In contrast, the
upwind differencing scheme uses the value at the upstream node for the convected
property at the cell face, ensuring flow direction is considered
Then 𝜙𝑤 = 𝜙𝑊 and 𝜙𝑒 = 𝜙𝑃
Therefore the discretized equation
became
(27)
which can be rearranged as
(28)
(29)
UDS contd.
Then 𝜙𝑤 = 𝜙𝑃 and 𝜙𝑒 = 𝜙𝐸
Therefore the discretized equation
became
(30)
which can be rearranged as
(31)
𝑎𝑃 𝛷𝑃 = 𝑎𝑊 𝛷𝑊 + 𝑎𝐸 𝛷𝐸 (32)
where 𝑎𝑃 = 𝑎𝑊 + 𝑎𝐸 + 𝐹𝑒 – 𝐹𝑤
UDS contd.
➢ A unified notation for the neighbor coefficients in the upwind differencing method,
applicable to both flow directions, is as follows:
Problem solution using UDS
➢ Solve the problem considered in Problem 1, using the upwind differencing scheme for
(i) u = 0.1 m/s, (ii) u = 2.5 m/s with the coarse five-point grid.
At boundary node 1,
(33)
At boundary node 5,
(34)
At boundary nodes,
2𝛤
𝐷𝐴 = 𝐷𝐵 = = 2𝐷
𝛿𝑥
𝐹 = 𝐹𝐴 = 𝐹𝐵
Problem solution using UDS contd.
➢ The boundary conditions introduced source term:
𝑎𝑃 𝛷𝑃 = 𝑎𝑊 𝛷𝑊 + 𝑎𝐸 𝛷𝐸 + 𝑆𝑢 (34)
with
𝑎𝑃 = 𝑎𝑊 + 𝑎𝐸 + 𝐹𝑒 – 𝐹𝑤 − 𝑆𝑃
➢ Since the diffusion is also involved, therefore ‘Energy’ model should also be activated.
➢ For material, there is no option to fill the diffusivity in the unit ‘𝑘𝑔/𝑚 − 𝑠’.
Activation of new scalar function
➢ To fix the inlet and outlet boundary conditions, we need to define the new scalar
property.
➢ After adding new scalar, a new option is now activated in the material to fill the diffusion
for user defined scalar.
Material properties for User Defined Scalar
➢ Edit the UDS Diffusion.
➢ New Pop-up for UDS Diffusion Coefficients is opened.
➢ Fill the density as 1 and Coefficient as 0.1 (given in the question) and click ‘OK’.
Cell zone conditions and Boundary conditions
➢ Set the cell zone conditions as Fluid.
➢ For boundary conditions:
➢ To activate all the discretization schemes, we have to use ‘Console’. We have to type:
Solve > set > advanced > show-all-discretization-schemes > yes
Solution
➢ Keeping the other option as default. Initialize the solution with ‘standard initialization’
from the ‘all zones’ as previously and start the start the calculation.
1.2
First order upwind
1 Second order upwind
Scalar
Analytical
0.6
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1 1.2
Axial position (m)
UDS for case 2
Case 2:
Putting u = 2.5 m/s, 𝜌= 1.0 kg/m3 : 𝑭 = 𝟐. 𝟓,
𝛤 = 0.1 kg/m.s, 𝛿𝑥 = 0.2 m
𝜞 𝟎.𝟏
𝑫 = 𝜹𝒙 = 𝟎.𝟐 = 𝟎. 𝟓,
𝑭 𝟐. 𝟓
𝑷𝒆 = = =𝟓
𝑫 𝟎. 𝟓
➢ Remaining setup is similar to previous case. Therefore, initialize the solution and start
the calculation.
Comparison between different solutions
1.2
0.8
𝛷
0.6
0.4
Exact Solution
0.2 Numerical Solution
Fluent_first_order
0
0 0.2 0.4 0.6 0.8 1
Distance (m)
Comparison between first order and second
order upwind difference scheme
➢ For second order upwind, the discretization scheme should be changed. Keep the
remaining set up as previous cases.
1.2
0.8
𝛷
0.6
1.2
0.8
𝛷
0.6
0.4
Exact Solution
0.2 Numerical Solution
Second_order_upwind
0
0 0.2 0.4 0.6 0.8 1
Distance (m)