UNIT NO 1: Finite Difference Schemes
UNIT NO 1: Finite Difference Schemes
Topic No.5: MacCormack scheme and its application to Euler and N-S equations.
CFD
Computational fluid dynamics (CFD) is the use of applied mathematics, physics and
computational software to visualize how a gas or liquid flows -- as well as how the gas or
liquid affects objects as it flows past. Computational fluid dynamics is based on the Navier-
Stokes equations.
The Navier-Stokes equations govern the motion of fluids and can be seen as Newton's
second law of motion for fluids. In the case of a compressible Newtonian fluid, this yields
where u is the fluid velocity, p is the fluid pressure, ρ is the fluid density, and μ is the fluid
dynamic viscosity. The different terms correspond to the inertial forces (1), pressure forces
(2), viscous forces (3), and the external forces applied to the fluid (4). The Navier-Stokes
equations were derived by Navier, Poisson, Saint-Venant, and Stokes between 1827 and
1845.
These equations are always solved together with the continuity equation:
The Navier-Stokes equations represent the conservation of momentum, while the continuity
equation represents the conservation of mass.
These equations are at the heart of fluid flow modeling. Solving them, for a particular set of
boundary conditions (such as inlets, outlets, and walls), predicts the fluid velocity and its
pressure in a given geometry. Because of their complexity, these equations only admit a
limited number of analytical solutions. It is relatively easy, for instance, to solve these
equations for a flow between two parallel plates or for the flow in a circular pipe. For more
complex geometries, however, the equations need to be solved.
Truncation error
In numerical analysis and scientific computing, truncation error is the error made
by truncating an infinite sum and approximating it by a finite sum. For instance, if we
approximate the sine function by the first two non-zero term of its Taylor series, as in for
small , the resulting error is a truncation error.
projection error
A projection error is the unconscious assumption that others think, feel, judge, or perceive
more or less what we do. For instance, those who drink (abstain from) alcohol tend to
overestimate (underestimate) the drinking habits of others.
Fast marching method. The fast marching method is a numerical method created by James
Sethian for solving boundary value problems of the Eikonal equation: Typically, such a
problem describes the evolution of a closed surface as a function of time with speed in the
normal direction at a point on the propagating surface.
After discretizing the spatial derivatives in the governing PDE's (such as the
Navier-Stokes equations), we obtain a coupled system of nonlinear ODE's in
the form
du -
dt = F(u,t)
F(u)=O.
Stability
A CFD method is stable if it does not magnify numerical errors. For an explicit CFD scheme
to be stable, the Courant number
If this is not achieved then numerical errors (unavoidable in the scheme) will increase until
they destroy the solution. Implicit solution methods are more stable and able to
tolerate NC > 1, but large values of NC are best avoided.
Consistency
An important question regarding the solution of the NSE (and any other modelled equations
we might be interested in) is how closely our discretised solution will approach the true
solution of the original equations. If the original equations can be recovered mathematically
from the discretised equations by reducing the mesh spacing ( x 0), then the discretised
equations are said to be consistent. If the scheme is consistent and stable, then the numerical
solution should converge to the true solution as x 0. CFD calculations should, if
possible, be run on sucessively finer meshes until the solution does not change, a condition
known as mesh independence.
The NSE express the conservation of mass and momentum (and energy), fundamental
physical principles which we would want our numerical method to match. In addition,
physically meaningful quantities are often bounded. For instance, negative energies make no
physical sense, and neither does a phase fraction < 1. Mathematical models of the flow
may not be able to fully model complex flows, but they should produce physically realistic
results - they should be realisable. Their numerical implementation as a set of difference
equations, and their solution, should also satisfy these requirements.
mesh or grid
The subdomains are often called elements or cells, and the collection of all elements or cells
is called amesh or grid. The origin of the term mesh (or grid) goes back to early days
of CFD when most analyses were 2D in nature. For 2D analyses, a domain split into elements
resembles a wire mesh, hence the name.Jan 3, 2012
accuracy
That statement is counter to what we all know to be true in practice, that a good mesh helps
the computational fluid dynamics (CFD) solver converge to the correct answer while
minimizing the computer resources expended. Stated differently, most every decent solver
will yield an accurate answer with a good mesh, but it takes the most robust of solvers to get
an answer on a bad mesh.
The crux of the issue is what precisely is meant by “a good mesh.” Syracuse University’s
Prof. John Dannenhoffer points out that we are much better at identifying a bad mesh than we
are at judging a good one. Distinguishing good from bad is clouded by the fact that badness is
a black-white determination of whether the mesh will run or not. (Badness often only means
whether there are any negative volume cells.) On the other hand, goodness is all shades of
gray – there are good meshes and there are better meshes.
Numerical solution schemes are often referred to as being explicit or implicit. When a
direct computation of the dependent variables can be made in terms of known quantities,
the computation is said to be explicit. When the dependent variables are defined by coupled
sets of equations, and either a matrix or iterative technique is needed to obtain the solution,
the numerical method is said to be implicit.
Method
In shock-capturing methods, the governing equations of inviscid flows (i.e. Euler equations)
are cast in conservation form and any shock waves or discontinuities are computed as part of
the solution. Here, no special treatment is employed to take care of the shocks themselves,
which is in contrast to the shock-fitting method, where shock waves are explicitly introduced
in the solution using appropriate shock relations (Rankine–Hugoniot relations). The shock
waves predicted by shock-capturing methods are generally not sharp and may be smeared
over several grid elements. Also, classical shock-capturing methods have the disadvantage
that unphysical oscillations (Gibbs phenomenon) may develop near strong shock
Euler equations
The Euler equations are the governing equations for inviscid flow. To implement shock-
capturing methods, the conservation form of the Euler equations are used. For a flow without
external heat transfer and work transfer (isoenergetic flow), the conservation form of the
Euler equation in Cartesian coordinate system can be written as
where is the total energy (internal energy + kinetic energy + potential energy) per
unit mass. That is
The Euler equations may be integrated with any of the shock-capturing methods
available to obtain the solution.
If we assume the solution is steady, and so, time is not a variable, then the
R(Q,r)=0
Iterative Methods. These methods assume the equation is mathematically elliptic and
start with an initial solution and iterate to converge to a solution.
Direct Methods. These methods also assume the equation is elliptic, but solve the
system of equations in a single process.
Time Discretization
where n is the index for time. The indicates a finite step (not differential).
A couple of concepts:
1. The marching of the equation over a time step can occur over one or more stages and
one or more iterations.
The marching can be done explicitly or implicitly. An explicit method uses known
information to march the solution. An implicit method uses known and unknown information
and requires solving a local system of equations
in shock-capturing methods, the governing equations of inviscid flows (i.e. Euler equations)
are cast in conservation form and any shock waves or discontinuities are computed as part of
the solution. Here, no special treatment is employed to take care of the shocks themselves,
which is in contrast to the shock-fitting method, where shock waves are explicitly introduced
in the solution using appropriate shock relations (Rankine–Hugoniot relations). The shock
waves predicted by shock-capturing methods are generally not sharp and may be smeared
over several grid elements. Also, classical shock-capturing methods have the disadvantage
that unphysical oscillations (Gibbs phenomenon) may develop near strong shocks in flow
variables such as pressure, temperature, density, and velocity across the shock