Ram Ramanan 8/10/2015 FD and FV 1 ME 5337/7337 Notes-2005-001
Introduction to Computational Fluid Dynamics Lecture 5:
Discretization, Finite Volume Methods
Slide 2
Ram Ramanan 8/10/2015 FD and FV 2 ME 5337/7337 Notes-2005-001
Transport Equations Mass conservation The integral form of mass
conservation equation is where is the density in domain , v the
velocity of the fluid and n the unit normal to the boundary,
S.
Slide 3
Ram Ramanan 8/10/2015 FD and FV 3 ME 5337/7337 Notes-2005-001
Transport Equations Momentum Conservation T = Stress tensor, n =
normal to the boundary b = body force (gravity, centrifugal,
Coriolis, Lorentz etc..)
Slide 4
Ram Ramanan 8/10/2015 FD and FV 4 ME 5337/7337 Notes-2005-001
Transport Equations Energy transport T = temperature, k = thermal
conductivity, c = specific heat at constant pressure, Q = heat flux
(Species transport is similar no specific heat term)
Slide 5
Ram Ramanan 8/10/2015 FD and FV 5 ME 5337/7337 Notes-2005-001
Finite Volume Methods See class slides for finite volume
methods
Slide 6
Ram Ramanan 8/10/2015 FD and FV 6 ME 5337/7337 Notes-2005-001
Discretization Courtesy: Fluent, Inc.
Slide 7
Ram Ramanan 8/10/2015 FD and FV 7 ME 5337/7337 Notes-2005-001
Overview The Task Why discretization? Discretization Methods
Dealing with Convection and Diffusion Discretization Errors
Courtesy: Fluent, Inc.
Slide 8
Ram Ramanan 8/10/2015 FD and FV 8 ME 5337/7337 Notes-2005-001 u
The Navier-Stokes equations equations governing the motion of
fluid, in this instance, around a vehicle, are highly non-linear,
second order partial differential equations (PDEs) u Exact
solutions only exist for a small class of simple flows, e.g.,
laminar flow past a flat plate A numerical solution of a PDE or
system of PDEs consists of a set of numbers from which the
distribution of the variable can be obtained from the set The
variable is determined at a finite number of locations known as
grid points or cells. This number can be large or small The Task
Courtesy: Fluent, Inc.
Slide 9
Ram Ramanan 8/10/2015 FD and FV 9 ME 5337/7337 Notes-2005-001
Discretization is the method of approximating the differential
equations by a system of algebraic equations for the variables at
some set of discrete locations in space and time The discrete
locations are grid/mesh points or cells The continuous information
from the exact solution of PDEs is replaced with discrete values
What is discretization? Pipe discretized into cells Courtesy:
Fluent, Inc.
Slide 10
Ram Ramanan 8/10/2015 FD and FV 10 ME 5337/7337 Notes-2005-001
Discretizing the domain Transforming the physical model into a form
in which the equations governing the flow physics can be solved can
be referred to as discretizing the domain Illustration of the cells
Continuous domain Discretized domain Courtesy: Fluent, Inc.
Slide 11
Ram Ramanan 8/10/2015 FD and FV 11 ME 5337/7337 Notes-2005-001
Solving the PDEs The are a number of methods for the solution of
the governing PDEs on the discretized domain The most important
discretization methods are: Finite Difference Method (FDM) Finite
Volume Method (FVM) Finite Element Method (FEM) Courtesy: Fluent,
Inc.
Slide 12
Ram Ramanan 8/10/2015 FD and FV 12 ME 5337/7337 Notes-2005-001
Finite Difference Method - Introduction Oldest method for the
numerical solution of PDEs Procedure: Start with the conservation
equation in differential form Solution domain is covered by grid
Approximate the differential equation at each grid point by
approximating the partial derivatives from the nodal values of the
function giving one algebraic equation per grid point Solve the
resulting algebraic equations for the whole grid. At each grid
point you solve for the unknown variable value and the value of its
neighboring grid points Courtesy: Fluent, Inc.
Slide 13
Ram Ramanan 8/10/2015 FD and FV 13 ME 5337/7337 Notes-2005-001
Finite Difference Method - Concept The finite difference method is
based on the Taylor series expansion about a point, x xx xx u i-1 u
i+1 uiui Subtracting the two eqns above givesAdding the two eqns
above gives Courtesy: Fluent, Inc.
Slide 14
Ram Ramanan 8/10/2015 FD and FV 14 ME 5337/7337 Notes-2005-001
Finite Difference Method - Application Consider the steady
1-dimensional convection/diffusion equation: From the Taylor series
expansion, get Courtesy: Fluent, Inc.
Slide 15
Ram Ramanan 8/10/2015 FD and FV 15 ME 5337/7337 Notes-2005-001
Finite Difference Method - Algebraic form of PDE Substitute the
discrete forms of the differentials to get: Algebraic form of PDE
Courtesy: Fluent, Inc.
Slide 16
Ram Ramanan 8/10/2015 FD and FV 16 ME 5337/7337 Notes-2005-001
Finite Difference Method - Summary Discretized the one-dimensional
convection/diffusion equation The derivatives were determined from
a Taylor series expansion Advantages of FDM: simple and effective
on structured grids Disadvantages of FDM: conservation is not
enforced unless with special treatment, restricted to simple
geometries Courtesy: Fluent, Inc.
Slide 17
Ram Ramanan 8/10/2015 FD and FV 17 ME 5337/7337 Notes-2005-001
Finite Volume Method - Introduction Using Finite Volume Method, the
solution domain is subdivided into a finite number of small control
volumes by a grid The grid defines to boundaries of the control
volumes while the computational node lies at the center of the
control volume The advantage of FVM is that the integral
conservation is satisfied exactly over the control volume Control
volume Computational node Boundary node Courtesy: Fluent, Inc.
Slide 18
Ram Ramanan 8/10/2015 FD and FV 18 ME 5337/7337 Notes-2005-001
Finite Volume Method - Typical Control Volume The net flux through
the control volume boundary is the sum of integrals over the four
control volume faces (six in 3D). The control volumes do not
overlap The value of the integrand is not available at the control
volume faces and is determined by interpolation P E W N S SW SE NE
NW j i n e s w xx yy xwxw xexe Courtesy: Fluent, Inc.
Slide 19
Ram Ramanan 8/10/2015 FD and FV 19 ME 5337/7337 Notes-2005-001
Finite Volume Method - Application Consider the one-dimensional
convection/diffusion equation The finite volume method (FVM) uses
the integral form of the conservation equations over the control
volume: Integrating the above equation in the x-direction across
faces e and w of the control volume and leaving out the source term
gives The values of at the faces e and w are needed P E W N S j i n
e s w Courtesy: Fluent, Inc.
Slide 20
Ram Ramanan 8/10/2015 FD and FV 20 ME 5337/7337 Notes-2005-001
Finite Volume Method - Interpolation Using a piecewise-linear
interpolation between control volume centers gives where } n linear
interpolation between nodes n face is midway between nodes n
equivalent to Central Difference Scheme (CDS) n Under assumption of
continuity, discrete form of PDE from FVM is identical to FDM
Courtesy: Fluent, Inc.
Slide 21
Ram Ramanan 8/10/2015 FD and FV 21 ME 5337/7337 Notes-2005-001
Finite Volume Method - Exact Solution Exact solution with boundary
conditions: = o at x = 0, = L at x = L Peclet number, Pe, is the
ratio of the strengths of convection and diffusion When the Peclet
number is high (positive or negative), the profile is highly
non-linear The Central-Difference Scheme relies on a linear
interpolation which will fail to capture the gradient changes in
the variable LL oo L -Pe >> 1 Pe = -1 Pe = 1 Pe >> 1 Pe
= 0 Courtesy: Fluent, Inc.
Slide 22
Ram Ramanan 8/10/2015 FD and FV 22 ME 5337/7337 Notes-2005-001
Finite Volume Method - Interpolation The piecewise-linear or CDS
interpolation may give rise to numerical errors (oscillatory or
checkerboard solutions). CDS was used only as an example of
discretization and is inappropriate for most convection/diffusion
flows A large number of interpolation techniques in FLUENT software
that are improvements on the CDS. Some of these, in increasing
level of accuracy, are: First-Order Upwind Scheme Power Law Scheme
Second-Order Upwind Scheme Higher Order Blended Second-Order
Upwind/Central Difference Quadratic Upwind Interpolation (QUICK)
Courtesy: Fluent, Inc.
Slide 23
Ram Ramanan 8/10/2015 FD and FV 23 ME 5337/7337 Notes-2005-001
Sources of Numerical Errors - FDM & FVM Discretization Errors
from inexact interpolation of nonlinear profile (FVM) Truncation
Errors due to exclusion of Higher Order Terms (FDM) Domain
discretization not well resolved to capture flow physics Artificial
or False Diffusion due to interpolation method and grid Courtesy:
Fluent, Inc.
Slide 24
Ram Ramanan 8/10/2015 FD and FV 24 ME 5337/7337 Notes-2005-001
False Diffusion (1) False diffusion is numerically introduced
diffusion and arises in convection dominant flows, i.e., high Pe
number flows Consider the problem below: Hot fluid Cold fluid T =
100C T = 0C u If there is no false diffusion, the temperature along
the diagonal will be 100C u False diffusion will occur due to the
oblique flow direction and non-zero gradient of temperature in the
direction normal to the flow u Grid refinement coupled with a
higher-order interpolation scheme will minimize the false diffusion
Diffusion set to zero k =0 Courtesy: Fluent, Inc.
Slide 25
Ram Ramanan 8/10/2015 FD and FV 25 ME 5337/7337 Notes-2005-001
False Diffusion (2) 8 x 8 64 x 64 First-order Upwind Second-order
Upwind Courtesy: Fluent, Inc.
Slide 26
Ram Ramanan 8/10/2015 FD and FV 26 ME 5337/7337 Notes-2005-001
Finite Volume Method - Summary The FVM uses the integral
conservation equation applied to control volumes which subdivide
the solution domain, and to the entire solution domain The variable
values at the faces of the control volume are determined by
interpolation. False diffusion can arise depending on the choice of
interpolation scheme The grid must be refined to reduce smearing of
the solution as shown in the last example Advantages of FVM:
Integral conservation is exactly satisfied, Not limited to grid
type (structured or unstructured, cartesian or body- fitted)
Courtesy: Fluent, Inc.
Slide 27
Ram Ramanan 8/10/2015 FD and FV 27 ME 5337/7337 Notes-2005-001
Finite Element Method - Introduction Using Finite Element Method,
the solution domain is subdivided into a finite number of small
elements by a grid The grid defines to boundaries of the elements
and location of nodes for higher-order elements, there can be
mid-side nodes also FEM uses multi-dimensional shape functions
which afford geometric flexibility and limit false diffusion Finite
element Computational node Mid-side node Courtesy: Fluent,
Inc.
Slide 28
Ram Ramanan 8/10/2015 FD and FV 28 ME 5337/7337 Notes-2005-001
Finite Element Method - Typical Element 9-noded quadrilateral
Within each element, the velocity and pressure fields are
approximated by: where u i, v i, p i are the nodal point unknowns
and i and i are interpolation functions Quadratic approximation for
velocity, linear approximation for pressure required to avoid
spurious pressure modes nodes with u, v, p nodes with u, v
Courtesy: Fluent, Inc.
Slide 29
Ram Ramanan 8/10/2015 FD and FV 29 ME 5337/7337 Notes-2005-001
Finite Element Method - Interpolation The solution on an element is
represented as: node ii i+1 where N are the basis functions. We
choose basis functions that are 1 at one node of the element and 0
at all other the nodes. Courtesy: Fluent, Inc.
Slide 30
Ram Ramanan 8/10/2015 FD and FV 30 ME 5337/7337 Notes-2005-001
Finite Element Method - Application Recall the one-dimensional
convection/diffusion equation Most often, the finite element method
(FEM) uses the Method of Weighted Residuals to discretize the
equation Multiply governing equation by weight function W i and
integrate over the element How do we choose the W i ? For Galerkin
FEM, replace W i by N i, the shape or basis functions Courtesy:
Fluent, Inc.
Slide 31
Ram Ramanan 8/10/2015 FD and FV 31 ME 5337/7337 Notes-2005-001
Finite Element Method - Weak form Use integration by parts to
obtain the weak formulation involves first derivatives rather than
second derivatives We can now substitute the interpolation function
for and evaluate the required integrals to produce the discrete
equation: Courtesy: Fluent, Inc.
Slide 32
Ram Ramanan 8/10/2015 FD and FV 32 ME 5337/7337 Notes-2005-001
Finite Element Method - Wiggles (1) Wiggles occur in FEM when
linear weighting functions are used Typical cures are:
Petrov-Galerkin method: where the weighting function is different
from the shape function. The weighting function is asymmetric,
being skewed in the direction of the upwind element ii+1i-1 u WiWi
NiNi Courtesy: Fluent, Inc.
Slide 33
Ram Ramanan 8/10/2015 FD and FV 33 ME 5337/7337 Notes-2005-001
Finite Element Method - Wiggles (2) Artificial tensor viscosity:
the viscosity in the streamline direction is augmented this is
equivalent to skewing the weighting of the convection terms towards
the upstream direction flow U C D shapes of Galerkin and Streamline
Upwind weighting functions for nodal point C Courtesy: Fluent,
Inc.
Slide 34
Ram Ramanan 8/10/2015 FD and FV 34 ME 5337/7337 Notes-2005-001
Finite Element Method - Summary FEM solves the weak form of the
governing equations weak form requires continuity of lower order
operators only very similar to using the divergence theorem in FVM
The technique is conservative in a weighted sense The weight
functions an easily be made multi-dimensional this limits false
diffusion Courtesy: Fluent, Inc.
Slide 35
Ram Ramanan 8/10/2015 FD and FV 35 ME 5337/7337 Notes-2005-001
Summary The concept of discretization was introduced. The three
main methods of discretization, FDM, FVM, and FEM were detailed.
The one-dimensional convection/diffusion was used to illustrate the
different methods of discretizing the partial differential
equations into algebraic equations. The process of discretization
was shown to introduce errors (though minimal in some cases)
through truncation of higher order terms (FDM), approximation of
the integrals (FVM). The correct interpolation of the convective
fluxes across the cell faces minimizes errors in both
discretization methods. Courtesy: Fluent, Inc.
Slide 36
Ram Ramanan 8/10/2015 FD and FV 36 ME 5337/7337 Notes-2005-001
Designing Grids for CFD Courtesy: Fluent, Inc.
Slide 37
Ram Ramanan 8/10/2015 FD and FV 37 ME 5337/7337 Notes-2005-001
Outline Why is a grid needed? Element types Grid types Grid design
guidelines Geometry Solution adaption Grid import Courtesy: Fluent,
Inc.
Slide 38
Ram Ramanan 8/10/2015 FD and FV 38 ME 5337/7337 Notes-2005-001
Why is a grid needed? The grid: designates the cells or elements on
which the flow is solved is a discrete representation of the
geometry of the problem has cells grouped into boundary zones where
b.c.s are applied The grid has a significant impact on: rate of
convergence (or even lack of convergence) solution accuracy CPU
time required Courtesy: Fluent, Inc.
Slide 39
Ram Ramanan 8/10/2015 FD and FV 39 ME 5337/7337 Notes-2005-001
Element Types Many different cell/element and grid types are
available choice depends on the problem and the solver capabilities
Cell or element types 2D: 3D: triangle (tri) 2D prism
(quadrilateral or quad) tetrahedron (tet) pyramid prism with
quadrilateral base (hexahedron or hex) prism with triangular base
(wedge) Courtesy: Fluent, Inc.
Slide 40
Ram Ramanan 8/10/2015 FD and FV 40 ME 5337/7337 Notes-2005-001
Grid Types (1) Single-block, structured grid i,j,k indexing to
locate neighboring cells grid lines must pass all through domain
Obviously cant be used for very complicated geometries Courtesy:
Fluent, Inc.
Slide 41
Ram Ramanan 8/10/2015 FD and FV 41 ME 5337/7337 Notes-2005-001
Grid Types (2) Multi-block, structured grid uses i,j,k indexing
with each block of mesh grid can be made up of (somewhat)
arbitrarily-connected blocks More flexible than single block, but
still limited cross-section: Courtesy: Fluent, Inc.
Slide 42
Ram Ramanan 8/10/2015 FD and FV 42 ME 5337/7337 Notes-2005-001
Grid Types (3) Unstructured grid tri or tet cells arranged in
arbitrary fashion no grid index, no constraints on cell layout
There is some memory/CPU overhead for unstructured referencing CFD
stands for Cow Fluid Dynamics! Courtesy: Fluent, Inc.
Slide 43
Ram Ramanan 8/10/2015 FD and FV 43 ME 5337/7337 Notes-2005-001
Grid Types (4) Hybrid grid use the most appropriate cell type in
any combination triangles and quadrilaterals in 2D tetrahedra,
prisms and pyramids in 3D can be non-conformal: grids lines dont
need to match at block boundaries triangular surface mesh on car
body is quick and easy to create prism layer efficiently resolves
boundary layer tetrahedral volume mesh is generated automatically
non-conformal interface Courtesy: Fluent, Inc.
Slide 44
Ram Ramanan 8/10/2015 FD and FV 44 ME 5337/7337 Notes-2005-001
Grid Design Guidelines: Quality (1) Quality: cells/elements are not
highly skewed Two methods for determining skewness: 1. Based on the
equilateral volume: Skewness = Applies only to triangles and
tetrahedra optimal (equilateral) cell actual cell circumcircle
Courtesy: Fluent, Inc.
Slide 45
Ram Ramanan 8/10/2015 FD and FV 45 ME 5337/7337 Notes-2005-001
Grid Design Guidelines: Quality (1) 2. Based on the deviation from
a normalized equilateral angle: Skewness (for a quad) = Applies to
all cell and face shapes High skewness values inaccurate solutions
& slow convergence Keep maximum skewness of volume mesh <
0.95 Possible classification based on skewness: Courtesy: Fluent,
Inc.
Slide 46
Ram Ramanan 8/10/2015 FD and FV 46 ME 5337/7337 Notes-2005-001
Grid Design Guidelines: Resolution Pertinent flow features should
be adequately resolved Cell aspect ratio (width/height) should be
near 1 where flow is multi- dimensional Quad/hex cells can be
stretched where flow is fully-developed and essentially
one-dimensional inadequate better flow OK! Courtesy: Fluent,
Inc.
Slide 47
Ram Ramanan 8/10/2015 FD and FV 47 ME 5337/7337 Notes-2005-001
Grid Design Guidelines: Smoothness Change in cell/element size
should be gradual (smooth) Ideally, the maximum change in grid
spacing should be 20%: smooth change in cell size sudden change in
cell size AVOID! xixi x i+1 Courtesy: Fluent, Inc.
Slide 48
Ram Ramanan 8/10/2015 FD and FV 48 ME 5337/7337 Notes-2005-001
Grid Design Guidelines: Total Cell Count More cells can give higher
accuracy downside is increased memory and CPU time To keep cell
count down: use a non-uniform grid to cluster cells only where
theyre needed use solution adaption to further refine only selected
areas Courtesy: Fluent, Inc.
Slide 49
Ram Ramanan 8/10/2015 FD and FV 49 ME 5337/7337 Notes-2005-001
Geometry The starting point for all problems is a geometry The
geometry describes the shape of the problem to be analyzed Can
consist of volumes, faces (surfaces), edges (curves) and vertices
(points). Geometry can be very simple... or more complex geometry
for a cube Courtesy: Fluent, Inc.
Slide 50
Ram Ramanan 8/10/2015 FD and FV 50 ME 5337/7337 Notes-2005-001
Geometry Creation A good preprocessor provides tools for creating
and modifying geometry. Geometry can also be imported from other
CAD programs. Various file types exist: IGES ACIS STL STEP DXF
various proprietary (Universal files, etc.) Courtesy: Fluent,
Inc.
Slide 51
Ram Ramanan 8/10/2015 FD and FV 51 ME 5337/7337 Notes-2005-001
Solution Adaption Q: how do you ensure adequate grid resolution,
when you dont necessarily know the flow features? A: solution-based
grid adaption! The grid can be refined or coarsened by the solver
based on the developing flow: solution values gradients along a
boundary inside a certain region Courtesy: Fluent, Inc.
Slide 52
Ram Ramanan 8/10/2015 FD and FV 52 ME 5337/7337 Notes-2005-001
Grid Import Grids can also be created by many CAD programs (I-DEAS,
Patran, ANSYS, etc.). These can be imported into the solver. Be
sure to check grid quality! A grid acceptable for stress analysis
may not be good enough for CFD. Repair/improve if necessary.
Courtesy: Fluent, Inc.
Slide 53
Ram Ramanan 8/10/2015 FD and FV 53 ME 5337/7337 Notes-2005-001
Summary Design and construction of a quality grid is crucial to the
success of the CFD analysis. Appropriate choice of grid type
depends on: geometric complexity flow field cell/element types
supported by solver Hybrid meshing offers the greatest flexibility.
Take advantage of solution adaption. Courtesy: Fluent, Inc.