CFD at Chapter-3
CFD at Chapter-3
CFD at Chapter-3
Since all new value depends only on the value of previous time step, we can loop over the cells
to solve them nicely one by one.
Advantage: -
1- More robust (Resistant to crash or diverse)
2- Simple to code
Disadvantage: -
1- Slow convergence due to small time step
Implicit (Indirect) Scheme: - In implicit time discretization scheme, solution of the
discretised equation at the current time step (say (t+1)) is not only depends on the solution of
the previous time step (t) but also on the solution of the current time step (t+1) so cell variables
are solved simultaneously in each time step.
For e.g.: - f (u) = du / dt
Approximating above according to implicit formulation
u (n+1) = u(n) + h. f [u(n+1)]
Unknown Known Unknown
Advantage: -
1- Fast convergence due to large time step causes less computation time.
Disadvantage: -
1- Due to large time step (Δt), truncation error is high causes low accuracy, so this
scheme is not good for time dependent flow simulation.
2- More complicated to code
3- Usually less robust than explicit scheme i.e. it diverges easily than explicit scheme for
the same flow condition.
Convective Numerical Methods
CFD code offers many types of PDE discretisation scheme. Few are following
1- Linear (Central differencing) scheme
2- Upwind scheme
3- Linear Upwind Scheme
4- QUICK
5- Limiter linear
Boundary face and Internal face and Interpolation of variable from cell center
to face center
Suppose we know the variable value (Ф) (say P, V, ρ, T etc.) at the owner cell centroid (Ф P) and
neighbour cell centroid (ФN). We want to know the value at the face center (Ф f). For this
purpose, a lot of discretisation scheme (or we can say it as face interpolation scheme) is there
with their own merit and demerit.
Here and
Face Interpolation
• In the above figure, value between cell centroid is varying linearly, and value
interpolated on the face is donated by blue circle.
• This scheme is 2nd order accurate (First order accurate scheme will give the constant
red line in above figure)
• Problem with scheme is this scheme is unbounded means it subjected to higher non-
physical oscillation or wiggles in the solution field.
• Central differencing should be used for diffusion term but not for convection term in
RANS solver, but it can be used for convection term in LES where greater accuracy is
required.
Velocity vector at face center and linear interpolation from cell center to face
center
• In upwind differencing scheme, first we calculate the mass flux on the cell centroid
then accordingly we interpolate the values on the face center as
• As we can see in figure, there is a constant variation of variable values (Ф) from cell
centroid to face center so upwind differencing is only first order accurate because of
that it is unable to capture adverse pressure gradient, flow separation, vortex formation
etc. Upwind differencing should not be used for convection term if possible.
Use of upwind differencing scheme: -
• Reason behind using the upwind differencing scheme is because it is most stable
scheme for convection domain flow. This scheme can be used where solution is
unstable and diverging very frequently due bad mesh.
• In these cases, we can compute our initial CFD solution using upwind differencing
scheme with few hundred iterations to get the solution settle down and become
somewhat stable (that would not be accurate) and then after getting the initial solution,
we can switch this scheme to some more accurate scheme (Higher order scheme) to
get accuracy in the final solution. By this way, we can achieve the stability and accuracy
in our final solution.
Here r is the distance between cell centroid (P) to face center (f). Gradient (∇∅) is used to
improve the accuracy of the extrapolation for the projection on the cell face.
It should be noted that linear upwind differencing scheme should be used for convection term
only and not for other term like diffusion term.
Here ψ is the blending function to switch the scheme. Value of ψ varies all over the mesh
depending on the solution. ADS choose the value of ψ such that it goes for upwind differencing
in the area where physical oscillation is more and goes for central differencing in the area
where physical oscillation is less. Some examples of ADS are TDV scheme, Gamma
differencing scheme, NVA, MUSCLE, QUICK scheme etc.
-----------> 1
Note: -
• For any explicit simple linear convection problem, the Courant number must be equal
or smaller than 1, otherwise, the numerical viscosity would be negative. Numerical
viscosity is defined as the function of
𝜇𝑛𝑢𝑚 = f [(1-u.∆𝑡/∆𝑥)]
• In general, the explicit methods depend greatly on courant number for their stability.
Whereas the implicit methods are insensitive with changes in courant number.
• From a physical viewpoint, the time step indicates the smallest unit of time that we
wish to resolve in the simulation, and therefore should be selected such that all the
physics of interest are resolved in time. Any flow structure that changes faster than the
time step defined through CFL leads to divergence of the solution so we should
decrease the time-step (indirectly decrease the CFL number) to convergence the
solution. The characteristic time scale of the problem depends upon several factors that
include the geometry size, the boundary conditions, and the flow characteristics.
Fraction of the cell moved by the flow in a time step is defined as CFL
Number
Here Vp is cell volume and Af is total face area of that cell. Finally, Courant Number for 3D cell
--------> 2
From conservation of mass that total mass flux across any cell should be zero i.e.,
But if total mass flux across any cell is zero so CFL number would be zero from equation 2
which is unreasonable and incorrect.
To solve this problem, we will take the magnitude of mass flux only. This will reverse the half
of the flux so total flux will not be zero.
To calculate the CFL number, magnitude of mass flux is taken here only
Now we must add the factor of ½ as the half of the flux is reversed. For example.
This definition is adopted by OpenFOAM. Every cell in the mesh has a different courant
number so it can be plotted as a field values. CFD solver use maximum courant number to set
the time step.
Stability Criteria: - There are some recommendations for maximum courant number
depending on different applications.
1- LES (C = 0.5-1)
2- Free surface Flow (C <1)
3- Compressible Flow (Depends on speed of sound)
4- Turbomechaniery (C< 80)
5- Explicit time stepping (C<1)
Most often maximum courant number should be less than 1.
Fixed Time Stepping: - When we choose the fixed time stepping for our CFD simulation
then CFD code goes through following procedure.
• Choose a time step size Δt and CFD solver computes the flow field U
• After that, computing the courant number field Co and reporting the maximum
Courant number to the user
• Proceed to the net iteration and keep Δt same.
Adjustable Time Stepping: - In the Case of automatic/adjustable time stepping, CFD
code goes to following procedure.
• Choose the initial time step size Δt and maximum courant number Co max and CFD
solver compute the flow field U
• Compute the courant number field Co and report the maximum Courant number
(Comax) to the user
• If Co > Comax then reduce the time step Δt for the next iteration
• Time step can be updated by
• In case, simulated courant number is very higher than maximum defined courant
number then solver reduce the courant number very rapidly which creates the
oscillation in the simulation and solution may diverse. To overcome this problem,
relaxation factor or limiting factor is provided to prevent large change to Δt.
Summary: -
o Co represents the fraction of the cell moved by the fluid in one time-step.
o Co is evaluated for every cell in the mesh so this field can be plotted in post-processing.
o CFD solver reports the maximum courant number in the mesh.
o Maximum courant number can be used to update time steps to keep the solution stable.
Aspect Ratio: -
Aspect ratio is the ratio of the length of the longest and shortest sides. An aspect ratio of 1
indicates a perfect square.
ANSYS Fluent: -
In ANSYS Fluent, the distance from the cell centroid to all the face centres and nodes are
calculated individually.
The AR is then taken as the ratio of the largest of these distances (L) and the smallest (S) of
these distances.
Note: - For perfect square, this method does not compute an AR of 1. Despites this difference,
this method is completely general and can be applied to skewed cells and cells with any
number of faces, therefore the slight difference in the AR calculation is not critically important.
OpenFOAM: -
The approach used by OpenFOAM to calculate the AR is different for 2D and 3D cell.
• 2-D Face:-
• 3-D Cell: -
o To compute the AR of 3D cells, a bounding box is constructed around the cell
first. A bounding box is cuboid that fully contains the cell and can always be
constructed around the 3D cell regardless of its shape by identifying the
maximum and minimum x, y and z coordinate of the nodes that make up the
cell. These maximum and minimum coordinates then become then corners of
the bounding box.
o Once the bounding box is constructed, AR is computed with following formula.
Largest Area of bounding box face
Aspect Ratio =
Smallest Area of bounding box face
o With this approach, the aspect ratio of skewed cells and cells with any number of sides
can be calculated using the same approach. It is also relatively simple to implement in a
CFD code or mesh generator.
Bounding box can be constructed around the 3D cell regardless of its shape
It is desirable for solver stability to have aspect ratios as close to 1 as possible. This is because
cells with a high aspect ratio have faces with much larger areas than the others. These faces
have a much larger face flux contribution than the other faces. To demonstrate this point, refer
to the heat diffusion equation.
The summation occurs over all the faces of the cell. If one cell has a much larger area (Af) than
the other faces of the cell, then this face dominates the contribution from the other faces. This
can lead to instability in the system of equations if the aspect ratios are too large.
Equiangle Skewness: -
• The equiangle skewness for a face is the departure of the face shape from a perfect
(regular) polygon with the same number of sides.
• The equiangle skewness gives the quick check for cells having the poor non-
orthogonality.
• The equiangle skewness for a triangular and quadrilateral face is the departure of the
corner angles from a perfect triangle (60◦) and from a perfect quadrilateral (90◦)
respectively.
• The equiangle skewness is based on the worst angle of the face. Where θmax and θmin
are the maximum and minimum corner angles on the face. This equation is general
and can be applied to any N sided face.
• A perfect triangular or quadrilateral face will result in an equiangle skewness of 0. A
corner angle less than 0◦ or greater than 180◦ indicates that the face is inverted and
will result in an equiangle skewness greater than 1.
Note:-
• While constructing mesh, user should aim for equiangle skewness as low as possible.
• ANSYS Fluent recommends that all cells in the mesh should have an equiangle
skewness less than 0.95.
• Any cells with an equiangle skewness greater than 1 have inverted faces and will cause
CFD solver to fail so these faces must be corrected before a solution is attempted.
Non-Orthogonality: -
Consider two cells are connected by a shared face. Vector that connects the cell centroid is d
and shared face normal vector is 𝑛̂.
(For Faces)
Above expression is used by OpenFOAM. Here θ = 0 gives the perfect orthogonal face and θ<70
is usually ok for OpenFOAM. Angle more than 90 means face is collapsed, and cell is inverted.
• Once the face non-orthogonality has been calculated for all the faces in the mesh, the
cell non-orthogonality (θcell) is taken as the highest non-orthogonality angle of the faces
that make up that cell.
θcell = max (θface1, θface2, θface3, ...θfaceN)
• If cell is not aligned (non-coplanar) i.e., if they are at different plane then d, as we have
taken it earlier, might not be good vector to use because Face Non-orthogonality Angle
(θ) may look like 0° as shown in figure-1, which is not correct, so an alternative idea is
to define the vector d is the vector c from cell centroid to shared face centre as shown
in figure-2. In this case, the angle between vector c and shared face normal vector n
would be θ = 30°.
• Ansys Fluent and CFX calculate θ using both c and d for all the faces in generated mesh
cells and then takes the largest angle (In the concept of the cell based non-
orthogonality).
• This is called cell orthogonal quality by Ansys where θcell is normalised to give values
from 0 to 1 rather than 0 to 90 to calculate the non-orthogonal quality of the mesh.
Large number of cells are required to capture the near wall steep gradient
• Meshing software generates the prism layers automatically but user must define the
number of prism layers, growth ratio and height of the first layer.
But different correlation is required for different applications for eg. Internal flow,
natural convection etc.
• Good guess for deciding the growth ratio according to various post, paper and
discussions is
1. By keeping the number of layers more than 10 (N> 10) for (y+ ~ 30)
2. And by keeping the number of layers more than 25 (N> 25) for (y+ ~ 1)
This was the procedure to generate a mesh based on a good guess but for the final
verification of good guess should be done after the flow simulation whether prism layer
is enough to capture the boundary layer or not.
• There are few ways to check the suitability of our generated prism layer.
1. Generate the y+ contour plot and check the maximum y+ achieved in the mesh. If
y+ is too high than assumed earlier (suppose y+ = 1) then regenerate the mesh by
reducing the first layer height by the factor of maximum y+ achieved in the mesh.
Optimisation of Grid
2. Volume transition from final height of prism layer to tetrahedron (triangle for
2-D case) (Free stream of the flow) should be very smooth for divergence free
behaviour of solver.
Smooth volume transition is an important factor for stability and
accuracy of CFD solution
3. If volume transition is too large, then either we can increase the number of prism
layer (recommended) or we can increase growth rate of the prism layer.
4. Increasing the growth ratio is not recommended because it reduces the accuracy
of the results. Growth rate should be always in the range of 1.05 to 1.3.
5. Sudden volume transition is bad for both RANS and LES simulation. In LES, sub-
grid viscosity (νsgv) in the cell is function of cell volume so sudden change in cell
volume leads to sudden change in flow viscosity.
First layer height (yh) can be written as 𝑦 ℎ = 2 ∗ 𝑦𝑝 , we should give the input in the
software as yh not yp while setting the prism layer height. Here yp is cell centroid distance from
the wall and defined as
Here Cf is skin friction coefficient. There is a lot of formula by which we can calculate the skin
friction coefficient (Cf) but at the time of choosing the formula we need to be insured that BL
is fully turbulent. The following empirical formula is defined for fully turbulent flow on flat
plate.
Unstructured grids: - This is typically formed from simplexes such as tetrahedron and
the fact they have no repeating structure which makes it very difficult to create and compute
the necessary cell-to-cell connectivity for CFD. The random orientation of an unstructured
grid can be led to awkward interfaces within the grid, possibly reducing the final accuracy of
the solution.
The Delaunay criterion: - It is also called empty sphere property which states that any
node must not be contained within the circumsphere of any tetrahedral within the mesh. The
Delaunay criterion is not an algorithm but provides the criteria for which to connect a set of
existing points in space. A circumsphere can be defined as the sphere passing through all four
vertices of a tetrahedron.
• There are basically three grid types by their connectivity of points - Structured,
Unstructured and Hybrid Grid. Structured mesh has the regular connectivity which
means that each point has the same number of neighbours. On other hand,
unstructured mesh has the irregular connectivity where each point can have different
number of neighbours.
• Numerical algorithm written to use unstructured grid can be also used on structured
grid but vice versa is not true.
• Method of grid generation – Algebraic or Based on differential equation
(Elliptical/Parabolic/Hyperbolic)
Types of grid Topology: -
Topology refers the way by which computational region is mapped.
o 2-D Topology: - H- Type/ O – Type/ C - Type
o 3-D Topology: - These are combination of 2D topologies for example: - HH-type /OO-
type /CH-type /OH-type /CO-type
H-Type Grid
C-Type Grid
O-Type Grid
H-Type Grid: - Good for complex region but requires large number of points
O-Type Grid: - Suitable for cylinder type body but requires a smaller number of points
C-Type Grid: - Good for resolving wake flow but number of points required lies between H-
Type and O-Type.
For complex body, multiblock grid provides better control over grid quality.