Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
25 views285 pages

Open FOAM

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 285

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
OpenFOAM
Experimental
approach
Numerical approach
(Computational
approach)
A comparison Dr. Anand Raj Hariharan
Why computational
method is special

Types of Adi Shankara Institute of Engineering and Technology


computational
methods

Finite volume in a
domain
March 19, 2018
Governing
equations

Finite Control
Volume
conservative and
non-conservative
What are the approaches to solve the
problems????
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach The study of science can be carried out in three ways
(Analytical approach)
Experimental
approach
based on the approach. This is as follows:
Numerical approach
(Computational
approach)
1 Experimental approach
A comparison
Why computational
method is special
2 Theoretical approach (Analytical approach)
Types of 3 Numerical approach (Computational approach)
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Theoretical approach (Analytical approach)

OpenFOAM
In this approach we seek an exact solution (a closed
Dr. Anand Raj form mathematical function) which are applicable at
Hariharan
all the points within the domain.
Approach to the The solution is obtained by solving the governing
problem
Theoretical approach equation (single or system) which may a PDE or
(Analytical approach)
Experimental ODE.
approach
Numerical approach In many cases the assumptions are used to simplify
(Computational
approach) the solution procedure. However the assumptions
A comparison
Why computational should preserve the physics of the problem. Some
method is special
examples for the assumptions made are elastic
Types of
computational material, Newtonian Fluid, ideal gas and so on. In
methods
many problems the assumptions can be too simplistic
Finite volume in a forcing us to go for experimental approach.
domain
Some common examples are Bernoulli equation (This
Governing
equations is an exact solution for Navier-Stokes equations
Finite Control under some assumptions), Torsion equation, Bending
Volume
conservative and
moment equation and so on.
non-conservative
Experimental approach

OpenFOAM

Dr. Anand Raj


Hariharan
In this approach we find the results directly or
indirectly by measurements. In some cases trials are
Approach to the
problem repeated to find the correlations required.
Theoretical approach
(Analytical approach)
Experimental
Experimental approach has a capability to produce
approach
Numerical approach
(Computational
most realistic results.
approach)
A comparison The important difficulties regarding experimental
Why computational
method is special
approach includes replication of exact flow
Types of
computational conditions, accurate measuring methods without
methods

Finite volume in a
disturbing the flowfield (non- intrusive methods) and
domain cost. In general the cost is becoming higher day by
Governing
equations
day with the advancement in the measuring
Finite Control techniques and sophistication.
Volume
conservative and
non-conservative
Numerical approach (Computational
approach)
OpenFOAM

Dr. Anand Raj The philosophy here is to seek a numerical solution


Hariharan
for the given equations at specified points.
Approach to the
problem The governing equation may be continuous however
Theoretical approach
(Analytical approach)
Experimental
the solution is applicable only at discrete points.
approach
Numerical approach The accuracy as well as the cost of computation
(Computational
approach)
A comparison
goes up with the increase in the number of nodes.
Why computational
method is special The specified points should be more at the regions
Types of
computational of interest within the computational domain.
methods

Finite volume in a
The number of points can go from thousands or
domain
lahks (for academic works) to millions and crores
Governing
equations (for high quality research work done using
Finite Control supercomputers and workstations).
Volume
conservative and
non-conservative
A comparison between the three
approaches
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and Source: Tennehill and Anderson[4]
non-conservative
Why Computational approach is
special????
OpenFOAM

Dr. Anand Raj The computational approach can compliment the


Hariharan
experimental approach. The preliminary design and
Approach to the
problem
analysis can be done using computational approach
Theoretical approach
(Analytical approach)
there by the wind tunnel testing and
Experimental
approach experimentation can be saved during the final stages
Numerical approach
(Computational
approach)
of design. In this case the time taken for the design
A comparison
Why computational stage can be reduced.
method is special

Types of The computational methods can be cost effective as


computational
methods the computational cost is decreasing over the years.
Finite volume in a
domain
At the same time the computers are becoming more
Governing
powerful. However one should keep in mind that
equations
methods like LES is prohibitively expensive and
Finite Control
Volume RAM intensive.
conservative and
non-conservative
Why Computational approach is special???
(Cont 0d from previous slide)
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
Computational approach can be preferred if
problem non-intrusive methods and high quality imaging
Theoretical approach
(Analytical approach)
Experimental
methods are not available or prohibitively expensive.
approach
Numerical approach
(Computational
Computational method can be preferred when the
approach)
A comparison flowfield is extremely hostile for instrumentation.
Why computational
method is special

Types of
There are occasions where only limited number of
computational
methods
prototypes can be made for testing in the wind
Finite volume in a tunnel. The computational method can reduce the
domain
time taken for testing such products.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Trend of relative computational cost for a
given flow and algorithm
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control Source: Chapman (1979); Kutler et al., (1987); Simon


Volume
conservative and (1995).
non-conservative
Types of computational methods

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
Based on approach the computational methods can be
problem
Theoretical approach
classified into the following types:
(Analytical approach)
Experimental
approach
1 Finite Difference Method (FDM)
Numerical approach
(Computational
approach)
2 Finite Volume Method (FVM)
A comparison
Why computational
method is special
3 Finite Element Method (FEM)
Types of 4 Spectral method
computational
methods
The present discussion is confined to the first two in the
Finite volume in a
domain above list.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Finite volume in a domain

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
How CFD works ??????

OpenFOAM

Dr. Anand Raj


Hariharan The governing equations are written as transport
Approach to the
equations.
problem
Theoretical approach
The transport equations are applied to each of the
(Analytical approach)
Experimental
approach
finite volumes.
Numerical approach
(Computational
approach)
By integration over the finite volumes can be
A comparison
Why computational
evaluated as summations.
method is special

Types of Now the equations will be reduced to algebraic


computational
methods relations.
Finite volume in a
domain
The algebraic equations so formed are solved as a
Governing system of equations numerically.
equations

Finite Control Let us see the governing equations first.


Volume
conservative and
non-conservative
Governing equations

OpenFOAM

Dr. Anand Raj convection


Hariharan z }| { Z


Z Z Z

Approach to the
problem
ρφdV + ρφ V .n̂dS = Sφ dV + Γφ ∇φ.n̂dS
Theoretical approach
∂t V CS V CS
(Analytical approach) | {z } | {z } | {z }
Experimental unsteady Source diffusion
approach
Numerical approach
(Computational (1)
approach)
A comparison
Why computational
method is special
Sl.no:Equation φ
Types of 1 Continuity 1
computational
methods 2 X-momentum u
Finite volume in a
domain
3 Y-momentum v
Governing 4 Z-momentum w
equations
5 Energy h
Finite Control
Volume 6 Species Transport Yi
conservative and
non-conservative
Finite Control Volume

OpenFOAM

Dr. Anand Raj


Hariharan In CFD the domain is discretized into several small
Approach to the
volumes known as finite volumes. In this regard we can
problem
Theoretical approach
have two approaches:
(Analytical approach)
Experimental 1 Finite Control volume fixed in space and fluid
approach
Numerical approach
(Computational moving through it - conservative approach.
approach)
A comparison
Why computational
2 Finite Control volume keeps moving with space -
method is special

Types of
non-conservative approach.
computational
methods The first approach is also known as strong conservative
Finite volume in a and the second one the weak conservative. Two
domain

Governing
approaches are equally important based on CFD
equations perspective.
Finite Control
Volume
conservative and
non-conservative
Conservative and non-conservative form

OpenFOAM

Dr. Anand Raj


The numerical simulations are stable when
Hariharan
conservative form is used for the applications where
Approach to the the flux properties are either zero or very small (like
problem
Theoretical approach
(Analytical approach)
shock capturing method). In this case there can be
Experimental
approach erratic fluctuations when non-conservative form is
Numerical approach
(Computational
approach)
used.
A comparison
Why computational
method is special
A non-conservative form is handy when shock fitting
Types of method is used.
computational
methods Many modern CFD codes uses conservative forms to
Finite volume in a
domain
capture the discontinuities like shock wave,
Governing cavitation bubble and so on. Once the location is
equations
capture then we can switch to non-conservative
Finite Control
Volume form to determine the flowfield around it.
conservative and
non-conservative
Continuity Equation

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
The continuity equation in cartesian coordinate is given
Experimental
approach by,
Numerical approach
(Computational
approach)
A comparison ∂ρ ∂ ∂ ∂
Why computational
method is special
+ (ρu) + (ρv ) + (ρw ) = 0 (2)
Types of
∂t ∂x ∂y ∂z
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Momentum equation - X direction

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Momentum equation - Y direction

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Momentum equation - Z direction

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
The generic form of governing equation

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem The governing equations can be written together in
Theoretical approach
(Analytical approach)
Experimental
generic form,
approach
Numerical approach
(Computational
approach) ∂U ∂F ∂G ∂H
A comparison + + + = |{z}J (3)
Why computational
method is special
∂t ∂x ∂y ∂z
|{z} | {z } Source−term
Types of Solution−Vector Flux−term
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Solution vector , U

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the  
problem
Theoretical approach
ρ
(Analytical approach)
Experimental
 ρu 
approach  
Numerical approach
(Computational
U =
 ρv .

approach)
A comparison
 ρw 
Why computational 2
method is special
ρ(e + V2 )
Types of
computational
methods The aim of any algorithm (particularly for unsteady
Finite volume in a problem) is to find the elements of solution vector U.
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Flux term F

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem  
Theoretical approach
(Analytical approach)
ρu
2
Experimental
approach
 ρu + p − τxx 
Numerical approach
 
(Computational
approach)
F =
 ρuv − τxy .

A comparison
Why computational
 ρuw − τxz 
method is special 2
Types of ρ(e + V2 )u + pu − k ∂T
∂x
− uτxx − v τxy − w τxz
computational
methods

Finite volume in a
This term is due to the component of flow in X-direction.
domain
The terms include only spatial derivatives.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Flux term G

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem  
Theoretical approach
(Analytical approach)
ρv
Experimental
approach
 ρuv − τxy 
ρv 2 + p − τyy
Numerical approach
 
(Computational
approach) G =

.

A comparison
Why computational
 ρvw − τyz 
method is special
V2
Types of
ρ(e + 2 )v + pv − k ∂T
∂y
− uτyx − v τyy − w τxz
computational
methods

Finite volume in a This term is due to the component of flow in Y-direction.


domain
The terms include only spatial derivatives.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Flux term H

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem  
Theoretical approach
(Analytical approach)
ρw
Experimental
approach
 ρuw − τzx 
Numerical approach
 
(Computational
approach)
H =
 ρvw − τzy .

A comparison
Why computational
 ρw 2 + p − τzz 
method is special 2
Types of ρ(e + V2 )w + pw − k ∂T
∂w
− uτzx − v τzy − w τzz
computational
methods

Finite volume in a
This term is due to the component of flow in Z-direction.
domain
The terms include only spatial derivatives.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Source term, J

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
 
problem 0
Theoretical approach
(Analytical approach)
 ρfx 
Experimental  
approach
Numerical approach
J =
 ρfy .

(Computational
approach)
A comparison
 ρfz 
Why computational
method is special
ρ(ufx + vfy + wfz ) + ρq̇
Types of
computational The first element is zero in the absence of chemical
methods
reactions. The other elements are zero if body forces as
Finite volume in a
domain well as volumetric heating are negligible.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Solution procedure

OpenFOAM

Dr. Anand Raj


Hariharan The aim is to find the temporal derivative of U by time
Approach to the
marching. In this approach the flow dependant variables
problem
Theoretical approach
are solved progressively in steps of time.
(Analytical approach)
Experimental
approach
∂U ∂F ∂G ∂H
Numerical approach
(Computational = −( + + − |{z}J ) (4)
approach)
A comparison
∂t ∂x ∂y ∂z
Why computational
|{z} | {z } Source−term
method is special Solution−Vector Flux−term
Types of
computational
methods Once the vector U is numerically known then primitive
Finite volume in a
domain
variables (u, v , w , e) can be evaluated by back
Governing
substitutions. For unsteady problems we seek the
equations
numerical values for column vector U.
Finite Control
Volume
conservative and
non-conservative
Solution procedure

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem In CFD, marching solutions are not limited to time
Theoretical approach
(Analytical approach) alone. We can also march wrt space. This is done
Experimental
approach
Numerical approach
for steady state problems where we perform
(Computational
approach) integrations from one end of the space to another.
A comparison
Why computational
method is special The choice of space or time marching depends on
Types of
computational
the mathematical nature of the governing equations.
methods
For a steady state solution, ∂U
∂t
= 0.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Solution procedure

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the If we are marching along x direction,


problem
Theoretical approach
(Analytical approach) ∂F ∂G ∂H
Experimental
approach = −( + − |{z}J ) (5)
Numerical approach ∂x ∂y ∂z
(Computational
approach)
| {z } Source−term
A comparison Flux−term
Why computational
method is special

Types of In this case F becomes the solution vector. Ultimately


computational
methods one have to take a decision whether the problem to be
Finite volume in a
domain
analyzed is steady or unsteady ?
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Is the problem steady or unsteady??

OpenFOAM
If flow properties are not expected to change wrt
Dr. Anand Raj
Hariharan time it is steady.
Approach to the A problem can be steady in one frame of reference
problem
Theoretical approach
however can be unsteady in another.
(Analytical approach)
Experimental Unsteadiness in the problem can be due to time
approach
Numerical approach
(Computational
dependent BCs (for example, flapping of the wing of
approach)
A comparison the bird, pulsation of heart).
Why computational
method is special The BCs can be steady however problem can be still
Types of
computational
unsteady (for example, instabilities, flow during
methods
transition as well as turbulent, flow past bluff bodies
Finite volume in a
domain for certain range of Reynolds number).
Governing A problem can be steady however we have to proceed
equations
by assuming it to be unsteady (for example, blunt
Finite Control
Volume body problem and compressible flow through nozzle).
conservative and
non-conservative
Is the problem 2D or 3D ??

OpenFOAM

Dr. Anand Raj


Hariharan
The researcher should clearly understand the
Approach to the
problem
problem and physics involved in it.
Theoretical approach
(Analytical approach) A problem may be symmetric or 2D based on
Experimental
approach
Numerical approach
geometry however is 3D based on flow.
(Computational
approach)
A comparison
One have to look at the flowfield rather than
Why computational
method is special geometry alone to answer whether the problem is
Types of
computational
2D or 3D.
methods
A thorough understanding of the flow physics is
Finite volume in a
domain expected so that user can decide whether the
Governing
equations
problem is steady or unsteady.
Finite Control
Volume
conservative and
non-conservative
Mathematical nature of PDEs

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach Once the governing equations are known the next
(Analytical approach)
Experimental
approach
step is to understand the mathematical nature of
Numerical approach
(Computational the governing equation (either single equation or
approach)
A comparison
Why computational
system of equation controlling the problem).
method is special

Types of
Once the mathematical nature is known we can
computational
methods
think of solution strategies.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Classification of PDEs

OpenFOAM
The given PDE or family of PDEs are classified based on
Dr. Anand Raj
Hariharan the presence of characteristic lines or surfaces into the
Approach to the following:
problem
Theoretical approach
(Analytical approach)
Elliptic Differential equations: The characteristic lines or
Experimental
approach surfaces are imaginary or does not exist.
Numerical approach
(Computational
approach) Parabolic Differential equations: If there exist a single
A comparison
Why computational
method is special
characteristic line or a surface depending on
Types of whether the problem is 2D or 3D.
computational
methods Hyperbolic Differential equations: If there exist more
Finite volume in a
domain
than one characteristic lines or surfaces.
Governing
equations
The classification is reminiscent of different types of
Finite Control
conic sections. However one have to understand what is
Volume
conservative and
a characteristic line or a surface.
non-conservative
What is characteristic line???

OpenFOAM

Dr. Anand Raj Characteristic lines or curves are drawn through


Hariharan
those points where derivatives of the dependant
Approach to the
problem variables will change abruptly or discontinuously
Theoretical approach
(Analytical approach) (derivatives are indeterminant)
Experimental
approach
Numerical approach The slope of characteristic line is the direction in
(Computational
approach)
A comparison
which the derivatives jumps discontinuously.
Why computational
method is special For the characteristic line to exist the properties in
Types of
computational the flowfield should change discontinuously. For
methods
example, shock wave in supersonic flow, the surface
Finite volume in a
domain of cavitation bubble and so on.
Governing
equations How to find the presence or absence of characteristic
Finite Control line is the question to be answered next.
Volume
conservative and
non-conservative
Conic section - a reminder

OpenFOAM

Dr. Anand Raj


Hariharan Consider the equation ax 2 + bxy + cy 2 + dx + ey + f = 0
Approach to the where x and y are independent and dependent variables
problem
Theoretical approach
respectively. The conic section is classified as follows:
(Analytical approach)
2
Experimental
approach 1 b − 4ac > 0 : conic is a hyperbola.
Numerical approach
2
2 b − 4ac = 0 : conic is a parabola.
(Computational
approach)
A comparison
2
Why computational
method is special 3 b − 4ac < 0 : conic is an ellipse.

4 if b = 0; a 6= 0; c 6= 0 the curve is a circle.


Types of
computational
methods
5 if a = b = c = 0 then it is a straight line.
Finite volume in a
domain
The classification of PDE or system of PDEs is in line
Governing
equations with the above.
Finite Control
Volume
conservative and
non-conservative
How to identify the existence of
characteristic lines
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
The given system of PDEs can be classified by two
approach
Numerical approach
methods. This is as follows:
(Computational
1 Cramer’s rule
approach)
A comparison
Why computational
method is special
2 Eigen value method
Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Consider the given system of PDEs

OpenFOAM

Dr. Anand Raj ∂u ∂u ∂v ∂v


Hariharan a1 + b1 + c1 + d1 = f1 (6)
∂x ∂y ∂x ∂y
Approach to the
problem
∂u ∂u ∂v ∂v
Theoretical approach
(Analytical approach) a2 + b2 + c2 + d2 = f2 (7)
Experimental
approach
∂x ∂y ∂x ∂y
Numerical approach
(Computational
approach)
where u, v are dependent variables, functions of x and y .
A comparison
Why computational The coefficients and constant term are functions of x, y ,
method is special

Types of
u and v .
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Consider the given system of PDEs

OpenFOAM

Dr. Anand Raj ∂u ∂u ∂v ∂v


Hariharan a1 + b1 + c1 + d1 = f1 (6)
∂x ∂y ∂x ∂y
Approach to the
problem
∂u ∂u ∂v ∂v
Theoretical approach
(Analytical approach) a2 + b2 + c2 + d2 = f2 (7)
Experimental
approach
∂x ∂y ∂x ∂y
Numerical approach
(Computational
approach)
where u, v are dependent variables, functions of x and y .
A comparison
Why computational The coefficients and constant term are functions of x, y ,
method is special

Types of
u and v . Most importantly u and v are continuous
computational
methods
functions of x and y. Accordingly,
Finite volume in a 1 At every specified point (x,y) within the domain u
domain

Governing
and v should have a unique value.
equations
2 All the derivatives should have a finite value at a
Finite Control
Volume specified point.
conservative and
non-conservative
Writing u and v using total differentials

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach) ∂u ∂u
Experimental du = dx + dy (8)
approach
Numerical approach ∂x ∂y
(Computational
approach)
A comparison ∂v ∂v
Why computational dv = dx + dy (9)
method is special
∂x ∂y
Types of
computational
methods
Now combing eqns. 1 to 4 and writing in matrix form,
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Matrix form

OpenFOAM

Dr. Anand Raj


Hariharan
    
Approach to the a1 b1 c1 d1 ∂u/∂x f1
problem  a2 b2 c2 d2   ∂u/∂y   f2 
Theoretical approach   = 
(Analytical approach)
Experimental  dx dy 0 0   ∂v /∂x   du 
approach
Numerical approach
(Computational 0 0 dx dy ∂v /∂y dv
approach)
A comparison
Why computational
method is special
The above equation is of the form AX = B such that
Types of solution (derivatives) can be determined by Cramer’s rule.
computational
methods

Finite volume in a
∂u |B|
domain = (10)
∂x |A|
Governing
equations

Finite Control
Volume
conservative and
non-conservative
How to define derivatives

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Condition for the existence of
characteristic lines
OpenFOAM

Dr. Anand Raj


Hariharan We have seen that the derivatives can be evaluated
Approach to the
by equations like
problem
Theoretical approach
(Analytical approach) ∂u |B|
Experimental = (11)
approach
Numerical approach ∂x |A|
(Computational
approach)
A comparison
Why computational
method is special
As the derivatives are indeterminate in the directions
Types of of characteristic lines we have to choose dx and dy
computational
methods such that |A| = 0.
Finite volume in a
domain
What ever be the derivatives to be determined the
Governing necessary condition is |A| = 0 which is evaluated
equations
next.
Finite Control
Volume
conservative and
non-conservative
Condition for the existence of
characteristic lines
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
The condition is that |A| = 0 which implies,
Theoretical approach
(Analytical approach)
Experimental a1 b1 c1 d1
approach
Numerical approach
(Computational
a2 b2 c2 d2
approach)
dx =0 (12)
A comparison
Why computational dy 0 0
method is special 0 0 dx dy
Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Condition for the existence of
characteristic lines
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach) Upon expansion,
Experimental
approach
Numerical approach
(a1 c2 − a2 c1 )(dy )2 − (a1 d2 − a2 d1 + b1 c2 − b2 c1 )dx.dy
(Computational
approach) +(b1 d2 − b2 d1 )(dx)2 = 0
A comparison
Why computational
method is special
Now dividing through out by (dx)2 we get a quadratic
Types of equation.
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Condition for the existence of
characteristic lines
OpenFOAM

Dr. Anand Raj


Hariharan
dy 2 dy
Approach to the a( ) + b( ) + c = 0 (13)
problem
Theoretical approach
dx dx
(Analytical approach)
Experimental such that
approach
Numerical approach
(Computational
a = (a1 c2 − a2 c1 ) (14)
approach)
A comparison
Why computational
method is special
b = −(a1 d2 − a2 d1 + b1 c2 − b2 c1 ) (15)
Types of
computational
c = (b1 d2 − b2 d1 ) (16)
methods

Finite volume in a Eqn. 13 can be integrated to get the equation of


domain
characteristic line. The slope at a point is given by the
Governing
equations quadratic formula.
Finite Control
Volume
conservative and
non-conservative
Condition for the existence of
characteristic lines
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach) √
Experimental
approach dy −b ± b 2 − 4ac
Numerical approach ∴ = (17)
(Computational
approach) dx 2a
A comparison
Why computational
method is special
Thus the existence of characteristic lines will depend on
Types of the discriminant.
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Condition for the existence of
characteristic lines
OpenFOAM

Dr. Anand Raj


Hariharan If b 2 − 4ac > 0: Two real and distinct characteristics
Approach to the exist at each point in a given plane. The
problem
Theoretical approach
system of equations are known as
(Analytical approach)
Experimental
approach
hyperbolic.
2
Numerical approach
(Computational
approach)
If b − 4ac = 0: Only a single characteristic exist. The
A comparison
Why computational
system of equations are known as parabolic.
method is special
2
Types of If b − 4ac < 0: The characteristic lines are imaginary.
computational
methods This system of equations are known elliptic.
Finite volume in a
domain There are many PDEs which exhibit a mixed nature.
Governing Depending on the flowfield the equations can be
equations

Finite Control
parabolic, elliptic or hyperbolic.
Volume
conservative and
non-conservative
Behavior of PDEs

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the Once the equation(s) have been classified as elliptic,


problem
Theoretical approach
(Analytical approach)
parabolic, hyperbolic or mixed and so we need to
Experimental
approach look at the solution strategies.
Numerical approach
(Computational
approach) Each type of equation has a different mathematical
A comparison
Why computational
method is special
behavior (hence different physical characteristics)
Types of and solution strategies.
computational
methods Now we shall look at how each type of equation
Finite volume in a
domain
behaves.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Behavior of Hyperbolic equations

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach) A hyperbolic equation in 2D will have two
Experimental
approach
Numerical approach
characteristic curves - left and right running
(Computational
approach) depending on the direction.
A comparison
Why computational
method is special For 3D the characteristics can form a surface known
Types of
computational
as characteristic surface.
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Behavior of Hyperbolic equations

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Behavior of Hyperbolic equations

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
In hyperbolic equations there is a region known as
problem
Theoretical approach
domain of independence confined by the
(Analytical approach)
Experimental characteristics. Any change in the property within
approach
Numerical approach
(Computational
this region will not be conveyed upstream. Hence
approach)
A comparison there is a specific direction known as “marching”
Why computational
method is special direction. The algorithm is designed to match in
Types of
computational this direction.
methods

Finite volume in a
The marching can be done with respect to time or
domain space.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Behavior of Hyperbolic equations

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
In hyperbolic equations there is a region known as
problem
Theoretical approach
domain of independence confined by the
(Analytical approach)
Experimental characteristics. Any change in the property within
approach
Numerical approach
(Computational
this region will not be conveyed upstream. Hence
approach)
A comparison there is a specific direction known as “marching”
Why computational
method is special direction. The algorithm is designed to match in
Types of
computational this direction.
methods

Finite volume in a
The marching can be done with respect to time or
domain space.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Some examples

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
In hyperbolic equations there is a region known as
problem
Theoretical approach
domain of independence confined by the
(Analytical approach)
Experimental characteristics. Any change in the property within
approach
Numerical approach
(Computational
this region will not be conveyed upstream. Hence
approach)
A comparison there is a specific direction known as “marching”
Why computational
method is special direction. The algorithm is designed to match in
Types of
computational this direction.
methods

Finite volume in a
The marching can be done with respect to time or
domain space.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
3D Steady inviscid supersonic flow

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Unteady inviscid supersonic flow (2D)

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Unteady inviscid supersonic flow (3D)

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Behavior of Parabolic equations

OpenFOAM

Dr. Anand Raj


Hariharan In Parabolic equations there is a region known as
Approach to the domain of independence confined by the single
problem
Theoretical approach
characteristics. Any change in the property within
(Analytical approach)
Experimental
approach
this region will not be conveyed upstream. Hence
Numerical approach
(Computational
there is a specific direction known as “marching”
approach)
A comparison direction. The algorithm is designed to match in
Why computational
method is special
this direction.
Types of
computational
methods
The marching can be done with respect to time or
Finite volume in a
space.
domain

Governing
In 2D there is a single characteristic curve where as
equations in 3D we have a single characteristic surface.
Finite Control
Volume
conservative and
non-conservative
Behavior of Parabolic equations

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Behavior of Parabolic equations

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Parabolized viscous flows

OpenFOAM
If the streamwise derivatives in the viscous term of
Dr. Anand Raj
Hariharan the Navier-Stokes equation is neglected, the
Approach to the
resulting differential equation is known as
problem
Theoretical approach
Parabolized Navier-Stokes equations (PNS). They
(Analytical approach)
Experimental are very to solve by simply marching in the
approach
Numerical approach
(Computational
streamwise direction.
approach)
A comparison However if there is a flow separation in streamwise
Why computational
method is special
direction (In this case the streamwise derivatives are
Types of
computational compared to the gradients normal to the wall).
methods

Finite volume in a
Indeed the Prandtl’s Boundary layer equations are
domain parabolic in nature by simply assuming that the
Governing
equations streamwise gradients are negligible compared to
Finite Control vertical gradients. The exact solution is well known
Volume
conservative and as Blasius exact solution.
non-conservative
Unsteady heat equation

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
The unsteady heat equation is parabolic with respect to
(Analytical approach)
Experimental
approach
time. The equation is
Numerical approach
(Computational
approach) ∂T
A comparison
= α∇2 T . (18)
Why computational
method is special ∂t
Types of
computational
methods
The time marching is shown in the next slide.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Unsteady heat equation - time marching

OpenFOAM
The evolution of the temperature distribution can be
Dr. Anand Raj
Hariharan
computed using time marching method.
Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Elliptic equations

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
In elliptic differential equations the derivatives are
problem defined and continuous in all directions. This implies
Theoretical approach
(Analytical approach)
Experimental
the characteristic curves or surface does not exist.
approach
Numerical approach
(Computational
In the physical problems governed by hyperbolic and
approach)
A comparison parabolic equations nature allows discontinuities in
Why computational
method is special
some directions (we call the curves in those
Types of
computational directions as characteristics).
methods

Finite volume in a In nature the problems governed by elliptic equations


domain
are highly dominated by diffusion over convection.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Elliptic equations - mathematical nature

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem Any change in the properties are either dissipated or
Theoretical approach
(Analytical approach) transmitted to all directions equally if it is elliptic.
Experimental
approach
Numerical approach
(Computational
In contrary to marching techniques the governing
approach)
A comparison
equations should be solved in all the points
Why computational
method is special simultaneously.
Types of
computational All the boundary conditions should be utilized to
methods

Finite volume in a
solve the problem.
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Elliptic equations - mathematical nature

OpenFOAM

Dr. Anand Raj


Hariharan The solution at P should be solved simultaneously with
Approach to the
the solution at all the other points.
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Elliptic equations - mathematical nature

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
Incompressible boundary layer analyzed using the
approach
Numerical approach
(Computational
full Navier-Stokes equation.
approach)
A comparison Steady heat equation
Why computational
method is special

Types of
Steady subsonic Euler (inviscid) equations.
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Governing equations with mixed nature

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach We will now look at two cases where the solution
(Computational
approach)
A comparison
strategy is not straight forward.
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Governing equations with mixed nature

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
There are many problems in nature where equations of
Theoretical approach
(Analytical approach)
different mathematical nature governs different locations
Experimental
approach of the same domain. In this case we try to find the
Numerical approach
(Computational
approach)
solution at all the locations with a common solution
A comparison
Why computational strategy irrespective of the changes in governing
method is special

Types of
equations. The classic examples include Blunt body
computational
methods
problem, compressible flow through nozzle, compressible
Finite volume in a turbulent boundary layer over a body.
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Governing equations with mixed nature

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
There are also problems in nature where the entire
Theoretical approach
(Analytical approach)
domain is governed by the single equation. However the
Experimental
approach governing equation exhibit a mixed mathematical nature.
Numerical approach
(Computational
approach)
In this case we have to find a solution strategy
A comparison
Why computational irrespective of mixed nature of the equation. The
method is special

Types of
example include full Navier-Stokes equation. Another
computational
methods
example is unsteady Navier-Stokes equation where
Finite volume in a pressure field is elliptic and velocity field can be parabolic.
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Governing equations with mixed nature

OpenFOAM

Dr. Anand Raj


In both the previous cases the problem is posed as
Hariharan unsteady (this will make equation hyperbolic) and
Approach to the now we can use time marching.
problem
Theoretical approach
(Analytical approach)
If the problem is steady and analysis is stable the
Experimental
approach temporal derivative will asymptotically goes to zero.
Numerical approach
(Computational
approach)
The temporal derivative can give erratic fluctuations
A comparison
Why computational if the problem is unstable.
method is special

Types of This technique is used in all CFD softwares ANSYS,


computational
methods OpenFOAM to name a few.
Finite volume in a
domain The problems like Blunt body problem, compressible
Governing flow through nozzle, compressible turbulent
equations

Finite Control
boundary layer over a body and so on are no longer
Volume a challenge.
conservative and
non-conservative
What are Well posed and ill-posed
problems????
OpenFOAM

Dr. Anand Raj


Hariharan
Well posed problem: If the solution to the given
differential equation(s) exists and is unique.
Approach to the
problem If the solution depends continuously upon
Theoretical approach
(Analytical approach)
Experimental
the initial and boundary conditions, then the
approach
Numerical approach problem is well-posed. We have to ensure
(Computational
approach)
A comparison
that the problem is well-posed before
Why computational
method is special starting the simulations.
Types of
computational Ill-posed problem: If the solution is incorrect, analysis is
methods
unstable (diverges) then the problem is
Finite volume in a
domain ill-posed. Ill-posed problem can be caused
Governing
equations
by mesh quality, insufficient boundary
Finite Control conditions and so on.
Volume
conservative and
non-conservative
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach Discretization: how to
(Computational
approach)
A comparison
Why computational
method is special
represent the derivatives????
Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
What is discretization????

OpenFOAM

Dr. Anand Raj


Hariharan
The analytic solutions to the governing equations
are usually closed form solutions which are
Approach to the
problem applicable at every points within the domain.
Theoretical approach
(Analytical approach)
Experimental
A numerical solution obtained by solving an equation
approach
Numerical approach
(Computational
(by CFD or FEM) can give answers (in the form of
approach)
A comparison
numbers not functions) at specific points (discrete
Why computational
method is special points) in the domain known as grid points.
Types of
computational Through CFD we perform discretization to find
methods
solution at grid points. It is interesting to note that
Finite volume in a
domain we convert a governing equation (which is
Governing
equations
continuous through out the domain) into numerical
Finite Control solution which is discrete (discontinuous).
Volume
conservative and
non-conservative
What is discretization????

OpenFOAM

Dr. Anand Raj


Hariharan
Through discretization we have to specify the grid
points where numerical solution will be attempted.
Approach to the
problem During CFD analysis one should progressively
Theoretical approach
(Analytical approach)
Experimental
increase the number of grid points till the solution
approach
Numerical approach
(Computational
remains almost unchanged. This is known as grid
approach)
A comparison
sensitivity analysis.
Why computational
method is special
Increasing or doubling the number of grid points is
Types of
computational not grid sensitivity analysis (a common mistake
methods
made by researchers). While incresing the grid
Finite volume in a
domain points we have to ensure that the gradients have
Governing
equations
been resolved very well (region close to wall, shear
Finite Control layer, shock waves, to name a few).
Volume
conservative and
non-conservative
Discretization - notations

OpenFOAM

Dr. Anand Raj


Hariharan
In CFD the domain consists of several grid points
(this will be of the order of millions or crores for
Approach to the
problem high quality research works).
Theoretical approach
(Analytical approach)
Experimental The spacing between grid points in X, Y, Z
approach
Numerical approach
(Computational
directions are given by ∆x, ∆y , ∆z respectively.
approach)
A comparison The grid points are number using indices which are
Why computational
method is special denoted by i,j and k respectively in X, Y and Z
Types of
computational directions. The indices are denoted as suffixes like
methods
Ti,j,k
Finite volume in a
domain During time marching we perform integration wrt
Governing
equations time as time steps. The time step size is denoted as
Finite Control ∆t.
Volume
conservative and
non-conservative
Numbering the grid points

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Time marching strategy

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Use of Taylor series expansion

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
In Finite Difference Methods (FDMs) we replace
Theoretical approach
(Analytical approach)
derivatives (partial or ordinary) with a suitable
Experimental
approach algebraic differences based on Taylor series.
Numerical approach
(Computational
approach) When a function is known at specified points
A comparison
Why computational
method is special
(x, y , z) and if all the derivatives exists (C n
Types of continuity) then it is possible to expand the function
computational
methods at the neighbourhood of the point as an infinite
Finite volume in a
domain
series.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
What is Taylor series????

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the If f (x) is a continuous function of x then the value of


problem
Theoretical approach
(Analytical approach)
function at the neighbourhood of the point x + ∆x can
Experimental
approach be estimated as an expanded series as follows:
Numerical approach
(Computational
approach)
f (x + ∆x) =
A comparison ∂f ∆x ∂ 2 f (∆x)2 ∂ n f (∆x)n
Why computational f (x) + ∂x 1!
+ ∂x 2 2!
+ ....... + ∂x n n!
+ .......
method is special

Types of
Now using Taylor series we find velocity at point
computational
methods (i + 1, j), ui+1,j based on ui,j if u is the component of
Finite volume in a velocity.
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Notation used in discretization

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the The grid points are numbered from 1 to N as a


problem
Theoretical approach
(Analytical approach)
continuous count. The grid is numbered using
Experimental
approach
indices i, j and k respectively in X, Y, Z directions.
Numerical approach
(Computational
approach) For example T1,2,3 represents property denoted by T
A comparison
Why computational at the grid location first one in X, second along Y,
method is special

Types of third along Z-directions respectively.


computational
methods The time step is denoted as a superscript. If T1,2,3 is
Finite volume in a
domain
calculated at time step n it is denoted as T n 1,2,3
Governing
equations

Finite Control
Volume
conservative and
non-conservative
velocity at point (i + 1, j), ui+1,j

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
ui+1,j =
(Computational 2 2 3 3
approach)
A comparison
ui,j + ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
+ ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
How many number of terms to be used
from Taylor series????
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the A Taylor series is an infinite series. The series


problem
Theoretical approach
(Analytical approach)
converges and ∆x is a very very small quantity.
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
How many number of terms to be used
from Taylor series????
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the A Taylor series is an infinite series. The series


problem
Theoretical approach
(Analytical approach)
converges and ∆x is a very very small quantity.
Experimental
approach However when we represent derivatives we can use
Numerical approach
(Computational
approach) only finite number of terms from the Taylor series.
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
How many number of terms to be used
from Taylor series????
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the A Taylor series is an infinite series. The series


problem
Theoretical approach
(Analytical approach)
converges and ∆x is a very very small quantity.
Experimental
approach However when we represent derivatives we can use
Numerical approach
(Computational
approach) only finite number of terms from the Taylor series.
A comparison
Why computational
method is special
The number of terms used depends on the accuracy.
Types of The addition of more and more terms decreases
computational
methods error (so called Truncation error) but will make the
Finite volume in a
domain
analysis complicated.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
How many number of terms to be used
from Taylor series????
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative Source: John D. Anderson 3 .
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM

Dr. Anand Raj


Hariharan
Consider the Taylor series expansion ui+1,j =
2 2 3 3
) ∆x + ( ∂∂xu2 )i,j (∆x) + ( ∂∂xu3 )i,j (∆x)
Approach to the
problem ui,j + ( ∂u
∂x i,j 1! 2! 3!
+ ..........
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM

Dr. Anand Raj


Hariharan
Consider the Taylor series expansion ui+1,j =
2 2 3 3
) ∆x + ( ∂∂xu2 )i,j (∆x) + ( ∂∂xu3 )i,j (∆x)
Approach to the
problem ui,j + ( ∂u
∂x i,j 1! 2! 3!
+ ..........
Theoretical approach
(Analytical approach)
Experimental
Now rearranging the above for
approach
Numerical approach
(Computational
approach) ∂u ui+1,j − ui,j ∂ 2 u (∆x)2 ∂ 3 f (∆x)3
A comparison ( )i,j = − ( 2 )i,j − 3 + .......
Why computational
method is special
∂x | ∆x {z } | ∂x 2! ∂x
{z 3! }
Types of FD Truncation−error
computational
methods (19)
Finite volume in a FD is the Finite Difference representation of the
domain
derivative ( ∂u ) .
∂x i,j
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
The approximate representation is as follows
Dr. Anand Raj
Hariharan ∂u ui+1,j − ui,j
( )i,j ≈ (20)
Approach to the ∂x | ∆x {z }
problem
Theoretical approach
FD
(Analytical approach)
Experimental
approach
Numerical approach
The above equation is approximately same as partial
(Computational
approach) differential equation. The difference being
A comparison
Why computational
method is special
truncation error.
Types of The error resulting from the truncation of terms in
computational
methods Taylor series is known as Truncation error.
Finite volume in a
domain
The truncation error is of the order of first power of
Governing
∆x. This is known as first order accurate scheme.
equations
When represented by above scheme it should be
Finite Control
Volume noted that the higher order derivatives are
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
First order forward difference scheme
Dr. Anand Raj
Hariharan

Approach to the
∂u ui+1,j − ui,j
problem ( )i,j = + O(∆x). (21)
Theoretical approach
∂x ∆x
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach) The above equation is first order accurate with
A comparison
Why computational respect to space.
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
First order forward difference scheme
Dr. Anand Raj
Hariharan

Approach to the
∂u ui+1,j − ui,j
problem ( )i,j = + O(∆x). (21)
Theoretical approach
∂x ∆x
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach) The above equation is first order accurate with
A comparison
Why computational respect to space.
method is special

Types of If i, j is the present location, the finite difference


computational
methods uses the information.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
First order forward difference scheme
Dr. Anand Raj
Hariharan

Approach to the
∂u ui+1,j − ui,j
problem ( )i,j = + O(∆x). (21)
Theoretical approach
∂x ∆x
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach) The above equation is first order accurate with
A comparison
Why computational respect to space.
method is special

Types of If i, j is the present location, the finite difference


computational
methods uses the information. at present location as well as
Finite volume in a
domain
next location i + 1, j which is obtained by forward
Governing
differencing.
equations

Finite Control
Volume
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
First order forward difference scheme
Dr. Anand Raj
Hariharan

Approach to the
∂u ui+1,j − ui,j
problem ( )i,j = + O(∆x). (21)
Theoretical approach
∂x ∆x
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach) The above equation is first order accurate with
A comparison
Why computational respect to space.
method is special

Types of If i, j is the present location, the finite difference


computational
methods uses the information. at present location as well as
Finite volume in a
domain
next location i + 1, j which is obtained by forward
Governing
differencing.
equations

Finite Control
Hence the difference scheme is forward difference
Volume and first order in accuracy with respect to space.
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
Consider the Taylor series expansion ui−1,j =
2 2 3 3
Dr. Anand Raj
Hariharan ui,j − ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
− ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
Approach to the
Upon rearrangement and simplification,
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
Consider the Taylor series expansion ui−1,j =
2 2 3 3
Dr. Anand Raj
Hariharan ui,j − ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
− ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
Approach to the
Upon rearrangement and simplification,
problem
Theoretical approach
(Analytical approach)
First order forward difference scheme
Experimental
approach
Numerical approach
(Computational ∂u ui,j − ui−1,j
approach)
A comparison
( )i,j = + O(∆x) (22)
Why computational ∂x ∆x
method is special

Types of
computational
methods The above equation is first order accurate with
Finite volume in a
domain
respect to space based on truncation error.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
Consider the Taylor series expansion ui−1,j =
2 2 3 3
Dr. Anand Raj
Hariharan ui,j − ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
− ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
Approach to the
Upon rearrangement and simplification,
problem
Theoretical approach
(Analytical approach)
First order forward difference scheme
Experimental
approach
Numerical approach
(Computational ∂u ui,j − ui−1,j
approach)
A comparison
( )i,j = + O(∆x) (22)
Why computational ∂x ∆x
method is special

Types of
computational
methods The above equation is first order accurate with
Finite volume in a
domain
respect to space based on truncation error.
Governing The scheme is backward differencing in space.
equations

Finite Control
Volume
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
Consider the Taylor series expansion ui−1,j =
2 2 3 3
Dr. Anand Raj
Hariharan ui,j − ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
− ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
Approach to the
Upon rearrangement and simplification,
problem
Theoretical approach
(Analytical approach)
First order forward difference scheme
Experimental
approach
Numerical approach
(Computational ∂u ui,j − ui−1,j
approach)
A comparison
( )i,j = + O(∆x) (22)
Why computational ∂x ∆x
method is special

Types of
computational
methods The above equation is first order accurate with
Finite volume in a
domain
respect to space based on truncation error.
Governing The scheme is backward differencing in space.
equations

Finite Control Hence the difference scheme is first order backward


Volume
conservative and
difference scheme.
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
Consider the Taylor series expansion ui−1,j =
2 2 3 3
Dr. Anand Raj
Hariharan ui,j − ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
− ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
Approach to the
Upon rearrangement and simplification,
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
Consider the Taylor series expansion ui−1,j =
2 2 3 3
Dr. Anand Raj
Hariharan ui,j − ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
− ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
Approach to the
Upon rearrangement and simplification,
problem
Theoretical approach
(Analytical approach)
First order forward difference scheme
Experimental
approach
Numerical approach
(Computational ∂u ui,j − ui−1,j
approach)
A comparison
( )i,j = + O(∆x) (23)
Why computational ∂x ∆x
method is special

Types of
computational
methods The above equation is first order accurate with
Finite volume in a
domain
respect to space based on truncation error.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
Consider the Taylor series expansion ui−1,j =
2 2 3 3
Dr. Anand Raj
Hariharan ui,j − ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
− ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
Approach to the
Upon rearrangement and simplification,
problem
Theoretical approach
(Analytical approach)
First order forward difference scheme
Experimental
approach
Numerical approach
(Computational ∂u ui,j − ui−1,j
approach)
A comparison
( )i,j = + O(∆x) (23)
Why computational ∂x ∆x
method is special

Types of
computational
methods The above equation is first order accurate with
Finite volume in a
domain
respect to space based on truncation error.
Governing The scheme is backward differencing in space.
equations

Finite Control
Volume
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
Consider the Taylor series expansion ui−1,j =
2 2 3 3
Dr. Anand Raj
Hariharan ui,j − ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
− ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
Approach to the
Upon rearrangement and simplification,
problem
Theoretical approach
(Analytical approach)
First order forward difference scheme
Experimental
approach
Numerical approach
(Computational ∂u ui,j − ui−1,j
approach)
A comparison
( )i,j = + O(∆x) (23)
Why computational ∂x ∆x
method is special

Types of
computational
methods The above equation is first order accurate with
Finite volume in a
domain
respect to space based on truncation error.
Governing The scheme is backward differencing in space.
equations

Finite Control Hence the difference scheme is first order backward


Volume
conservative and
difference scheme.
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
Consider the Taylor series expansion ui−1,j =
2 2 3 3
Dr. Anand Raj
Hariharan ui,j − ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
− ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
Approach to the
Upon rearrangement and simplification,
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
Consider the Taylor series expansion ui−1,j =
2 2 3 3
Dr. Anand Raj
Hariharan ui,j − ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
− ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
Approach to the
Upon rearrangement and simplification,
problem
Theoretical approach
(Analytical approach)
First order forward difference scheme
Experimental
approach
Numerical approach
(Computational ∂u ui,j − ui−1,j
approach)
A comparison
( )i,j = + O(∆x) (24)
Why computational ∂x ∆x
method is special

Types of
computational
methods The above equation is first order accurate with
Finite volume in a
domain
respect to space based on truncation error.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
Consider the Taylor series expansion ui−1,j =
2 2 3 3
Dr. Anand Raj
Hariharan ui,j − ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
− ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
Approach to the
Upon rearrangement and simplification,
problem
Theoretical approach
(Analytical approach)
First order forward difference scheme
Experimental
approach
Numerical approach
(Computational ∂u ui,j − ui−1,j
approach)
A comparison
( )i,j = + O(∆x) (24)
Why computational ∂x ∆x
method is special

Types of
computational
methods The above equation is first order accurate with
Finite volume in a
domain
respect to space based on truncation error.
Governing The scheme is backward differencing in space.
equations

Finite Control
Volume
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j

OpenFOAM
Consider the Taylor series expansion ui−1,j =
2 2 3 3
Dr. Anand Raj
Hariharan ui,j − ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
− ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
Approach to the
Upon rearrangement and simplification,
problem
Theoretical approach
(Analytical approach)
First order forward difference scheme
Experimental
approach
Numerical approach
(Computational ∂u ui,j − ui−1,j
approach)
A comparison
( )i,j = + O(∆x) (24)
Why computational ∂x ∆x
method is special

Types of
computational
methods The above equation is first order accurate with
Finite volume in a
domain
respect to space based on truncation error.
Governing The scheme is backward differencing in space.
equations

Finite Control Hence the difference scheme is first order backward


Volume
conservative and
difference scheme.
non-conservative
Representation of first derivative ( ∂u
∂x )i,j -
central differencing scheme
OpenFOAM

Dr. Anand Raj


Hariharan To obtain this, we have ui+1,j =
2 2 3 3
Approach to the ui,j + ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
+ ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j -
central differencing scheme
OpenFOAM

Dr. Anand Raj


Hariharan To obtain this, we have ui+1,j =
2 2 3 3
Approach to the ui,j + ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
+ ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
problem
Theoretical approach
ui−1,j =
(Analytical approach)
∂2u (∆x)2 ∂3u (∆x)3
Experimental
approach
ui,j − ( ∂u
∂x
)i,j
∆x
1!
+ ( ∂x 2 )i,j 2!
− ( ∂x 3 )i,j 3!
+ ..........
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Representation of first derivative ( ∂u
∂x )i,j -
central differencing scheme
OpenFOAM

Dr. Anand Raj


Hariharan To obtain this, we have ui+1,j =
2 2 3 3
Approach to the ui,j + ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
+ ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
problem
Theoretical approach
ui−1,j =
(Analytical approach)
∂2u (∆x)2 ∂3u (∆x)3
Experimental
approach
ui,j − ( ∂u
∂x
)i,j
∆x
1!
+ ( ∂x 2 )i,j 2!
− ( ∂x 3 )i,j 3!
+ ..........
Numerical approach
(Computational
approach)
Now subtracting the second equation from first and
A comparison
Why computational
simplifying,
method is special

Types of
computational
First order Central difference scheme
methods

Finite volume in a ∂u ui+1,j − ui−1,j


domain
( )i,j = + O(∆x)2 (25)
Governing ∂x 2.∆x
equations

Finite Control
Volume
conservative and
non-conservative
Schemes for second derivatives

OpenFOAM

Dr. Anand Raj


Hariharan To obtain this, we have ui+1,j =
2 2 3 3
Approach to the
problem
ui,j + ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
+ ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Schemes for second derivatives

OpenFOAM

Dr. Anand Raj


Hariharan To obtain this, we have ui+1,j =
2 2 3 3
Approach to the
problem
ui,j + ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
+ ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
Theoretical approach
(Analytical approach)
ui−1,j =
2 2 3 3
) ∆x + ( ∂∂xu2 )i,j (∆x) − ( ∂∂xu3 )i,j (∆x)
Experimental
approach
Numerical approach
ui,j − ( ∂u
∂x i,j 1! 2! 3!
+ ..........
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Schemes for second derivatives

OpenFOAM

Dr. Anand Raj


Hariharan To obtain this, we have ui+1,j =
2 2 3 3
Approach to the
problem
ui,j + ( ∂u ) ∆x + ( ∂∂xu2 )i,j (∆x)
∂x i,j 1! 2!
+ ( ∂∂xu3 )i,j (∆x)
3!
+ ..........
Theoretical approach
(Analytical approach)
ui−1,j =
2 2 3 3
) ∆x + ( ∂∂xu2 )i,j (∆x) − ( ∂∂xu3 )i,j (∆x)
Experimental
approach
Numerical approach
ui,j − ( ∂u
∂x i,j 1! 2! 3!
+ ..........
(Computational
approach) Now adding the above equations and simplifying,
A comparison
Why computational
method is special
second order Central difference scheme
Types of
computational
methods
∂2u ui+1,j − ui,j + ui−1,j
Finite volume in a ( )i,j = + O(∆x)2 (26)
domain ∂x 2
∆x 2
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Higher order accurate schemes

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the As the order of accuracy increases (from first order


problem
Theoretical approach
(Analytical approach)
to second order) the truncation error decreases.
Experimental
approach
This can increase the quality of solution.
Numerical approach
(Computational
approach) While evolving the higher order schemes the number
A comparison
Why computational
method is special
of terms involved increases which in turn increases
Types of the computational effort.
computational
methods It is possible to improve the accuracy by using third
Finite volume in a
domain
order, fourth order and even higher orders.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
General observations - forward, and
backward differencing schemes
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach The forward and backward schemes are also known
(Analytical approach)
Experimental
approach
as one-sided differencing schemes. An r th derivative
Numerical approach
(Computational
approach)
of mth order will have r + m number of points For
A comparison
Why computational
example for representing first derivative (r = 1) with
method is special
first order accuracy (m = 1) we have 2 terms (i + 1
Types of
computational
methods
and i, if forward. i − 1 and i, if backward).
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
General observations - central differencing
schemes
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
An r th derivative of mth order will have r + m − 1
(Analytical approach)
Experimental
number of points (if r is even). If r is odd there will
approach
Numerical approach
(Computational
be r + m number of terms. For central differencing
approach)
A comparison schemes m is always even (2, 4 and so on with the
Why computational
method is special increase in accuracy). For example, r = 1 and
Types of
computational
m = 2 there is a need for 3 nodes or terms. When
methods
r = 2 and m = 2 we need 3 terms or nodes.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
General observations - Differencing
schemes
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach Representation of an nth derivative will have (∆x)n
(Analytical approach)
Experimental
approach
in the denominator of the differencing scheme.
Numerical approach
(Computational
approach)
When a scheme is said to be second order accurate
A comparison
Why computational
the truncation error is of the order of (∆x)2 . In this
method is special

Types of
scheme we consider up to the three terms (including
computational
methods
f (x)) in the Taylor series. The rest is truncated.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Need for higher order schemes

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the The higher order schemes increases accuracy (by


problem
Theoretical approach
(Analytical approach)
decreasing truncation error) at the expense of
Experimental
approach
computational effort.
Numerical approach
(Computational
approach) It should also be noted that the higher order
A comparison
Why computational
method is special
schemes can be unstable if higher order derivatives
Types of are not well behaved (unstable).
computational
methods We can derive higher order schemes using
Finite volume in a
domain
polynomial method (which is discussed next).
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Let us derive second order accurate
forward differencing scheme for
representing a first derivative
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Let us derive second order accurate
forward differencing scheme for
representing a first derivative
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
Now m = 2 and r = 1. There will be 3 terms (since
(Analytical approach)
Experimental
approach
forward differencing, ui , ui+1 , ui+2 ).
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Let us derive second order accurate
forward differencing scheme for
representing a first derivative
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
Now m = 2 and r = 1. There will be 3 terms (since
(Analytical approach)
Experimental
approach
forward differencing, ui , ui+1 , ui+2 ).
Numerical approach
(Computational
approach)
Let a,b and c be the coefficients of ui+2 , ui+1 and ui
A comparison
Why computational
respectively.
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Let us derive second order accurate
forward differencing scheme for
representing a first derivative
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
Now m = 2 and r = 1. There will be 3 terms (since
(Analytical approach)
Experimental
approach
forward differencing, ui , ui+1 , ui+2 ).
Numerical approach
(Computational
approach)
Let a,b and c be the coefficients of ui+2 , ui+1 and ui
A comparison
Why computational
respectively.
method is special

Types of The denominator of the difference scheme is ∆x


computational
methods since we are trying to represent a first derivative.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Let us derive second order accurate
forward differencing scheme for
representing a first derivative
OpenFOAM

Dr. Anand Raj


Hariharan
Let
Approach to the ∂u aui+2 + bui+1 + cui
problem ( )i = (27)
Theoretical approach
(Analytical approach)
∂x ∆x
Experimental
approach Now bringing ∆x to LHS will yield,
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Let us derive second order accurate
forward differencing scheme for
representing a first derivative
OpenFOAM

Dr. Anand Raj


Hariharan
Let
Approach to the ∂u aui+2 + bui+1 + cui
problem ()i = (27)
Theoretical approach
(Analytical approach)
∂x ∆x
Experimental
approach Now bringing ∆x to LHS will yield,
Numerical approach
(Computational
approach)
A comparison ∂u
Why computational ( )i .∆x = aui+2 + bui+1 + cui (28)
method is special
∂x
Types of
computational
methods Now, a×Taylor − series − expansion − of − ui+2 +
Finite volume in a
domain
b×Taylor − series − expansion − of − ui+1 + c×ui . Then
Governing
equating coefficients of above eqns. with eqn. 28 we get,
equations

Finite Control
Volume
conservative and
non-conservative
Let us derive second order accurate
forward differencing scheme for
representing a first derivative
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem     
Theoretical approach
(Analytical approach)
1 1 1 a 0
Experimental
approach
 2 1 0  b  =  1 
Numerical approach
(Computational
approach) 2 1/2 0 c 0
A comparison
Why computational
method is special Solving the above equation will yield a = −1/2, b = 4/2
Types of
computational
and c = −3/2.
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Let us derive second order accurate
forward differencing scheme for
representing a first derivative
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem     
Theoretical approach
(Analytical approach)
1 1 1 a 0
Experimental
approach
 2 1 0  b  =  1 
Numerical approach
(Computational
approach) 2 1/2 0 c 0
A comparison
Why computational
method is special Solving the above equation will yield a = −1/2, b = 4/2
Types of
computational
and c = −3/2. Now substituting the above values will
methods
yield,
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Second order accurate forward differencing
scheme for representing a first derivative
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach ∂u 4ui+1 − ui+2 − 3ui
(Computational
approach) ( ) = (29)
A comparison ∂x i 2.∆x
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Higher order accurate schemes

OpenFOAM

Dr. Anand Raj


Hariharan
The polynomial method can be used to derive higher
Approach to the
problem order accurate schemes for any derivatives. For example,
Theoretical approach
(Analytical approach) a fourth order accurate central difference scheme for the
Experimental
approach
Numerical approach
second derivative is given by
(Computational
approach)
A comparison
∂2u −ui+2 + 16ui+1 − 30ui + 16ui−1 − ui−2
+O(∆x)4
Why computational
method is special ( ) = 2
Types of ∂x 2 i 12.(∆x)
computational
methods (30)
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Higher order accurate schemes

OpenFOAM

Dr. Anand Raj


Hariharan
The polynomial method can be used to derive higher
Approach to the
problem order accurate schemes for any derivatives. For example,
Theoretical approach
(Analytical approach) a fourth order accurate central difference scheme for the
Experimental
approach
Numerical approach
second derivative is given by
(Computational
approach)
A comparison
∂2u −ui+2 + 16ui+1 − 30ui + 16ui−1 − ui−2
+O(∆x)4
Why computational
method is special ( ) = 2
Types of ∂x 2 i 12.(∆x)
computational
methods (30)
Finite volume in a For most of the CFD simulations second order accurate
domain

Governing
scheme is sufficient.
equations

Finite Control
Volume
conservative and
non-conservative
Concluding remarks - discretization

OpenFOAM

Dr. Anand Raj


Hariharan
Any derivative can be represented by forward,
Approach to the
problem backward or central difference scheme.
Theoretical approach
(Analytical approach)
Experimental
One can use central difference scheme at the interior
approach
Numerical approach of the domain. At boundaries however one is forced
(Computational
approach)
A comparison
to use forward difference or backward difference
Why computational
method is special depending on the location of boundary. A higher
Types of
computational
order differencing scheme is though accurate
methods destroys the banded matrix structure. This in turn
Finite volume in a
domain
will slow the solution procedure. There are
Governing techniques to overcome this limitation.
equations

Finite Control
Volume
conservative and
non-conservative
Concluding remarks - discretization

OpenFOAM

Dr. Anand Raj


Hariharan
The central differencing scheme is relatively stable
Approach to the
problem when the problem is dominated by diffusion
Theoretical approach
(Analytical approach) phenomena. However when the problem is
Experimental
approach
Numerical approach
dominated by convection we have to use forward or
(Computational
approach) backward differencing schemes depending on the
A comparison
Why computational
method is special
direction of upwind.
Types of
computational
For high-speed flow the convection term in
methods Navier-Stokes equation is discretized using
Finite volume in a
domain
upwinding scheme where as diffusion term can be
Governing discretized using central difference scheme.
equations

Finite Control
Volume
conservative and
non-conservative
Solution Procedure

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Openfoam Units

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
OpenFOAM is SI by default.
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Finite volume in a domain

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Schemes in OpenFOAM

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach) In OpenFOAM one should understand what are the
Experimental
approach
Numerical approach
available schemes to represent different terms in the
(Computational
approach) governing equation. These terms can be Laplacian, time
A comparison
Why computational
method is special
derivative (first or second), Convective, divergence,
Types of gradient and so on.
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Schemes in OpenFOAM - summary

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
how to evaluate Laplacian term?

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Consider the Laplacian term
Experimental
approach
Numerical approach
(Computational ∇.(Γ∇φ) (31)
approach)
A comparison
Why computational
method is special In the above term Γ is a transport coefficient and φ is
Types of
computational the property whose Laplacian is to be evaluated.
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
how to evaluate Laplacian term?

OpenFOAM
The first step is to integrate the Laplacian term over
Dr. Anand Raj
Hariharan the finite volume considered.
Z
Approach to the
problem
∇.(Γ∇φ).dV (32)
Theoretical approach v
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
how to evaluate Laplacian term?

OpenFOAM
The first step is to integrate the Laplacian term over
Dr. Anand Raj
Hariharan the finite volume considered.
Z
Approach to the
problem
∇.(Γ∇φ).dV (32)
Theoretical approach v
(Analytical approach)
Experimental
approach
Numerical approach Now Volume integral is cponverted to surface
(Computational
approach)
A comparison
integral by using Gauss-Divergence theorem.
Why computational Z Z
method is special

Types of ∇.(Γ∇φ).dV = dS.(Γ∇φ) (33)


computational v S
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
how to evaluate Laplacian term?

OpenFOAM
The first step is to integrate the Laplacian term over
Dr. Anand Raj
Hariharan the finite volume considered.
Z
Approach to the
problem
∇.(Γ∇φ).dV (32)
Theoretical approach v
(Analytical approach)
Experimental
approach
Numerical approach Now Volume integral is cponverted to surface
(Computational
approach)
A comparison
integral by using Gauss-Divergence theorem.
Why computational Z Z
method is special

Types of ∇.(Γ∇φ).dV = dS.(Γ∇φ) (33)


computational v S
methods

Finite volume in a
domain Now Surface integral is replaced by the summation
Governing of properties over the face areas.
equations Z X
Finite Control
Volume dS.(Γ∇φ) = Γf Sf .(∇φ)f (34)
conservative and S f
non-conservative
how to evaluate Laplacian term?

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
The term Sf .(∇φ)f is evaluated as follows:
(Analytical approach)
Experimental
approach
φN − φP
Numerical approach
(Computational Γf Sf .(∇φ)f = |Sf | (35)
approach)
A comparison
|d|
Why computational
method is special

Types of where |d| is the distance between the cell centre P


computational
methods and neighboring cell N.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
how to evaluate Convective term?

OpenFOAM

Dr. Anand Raj


Hariharan
1 The convective term is a non-linear term which
Approach to the
problem appears in the momentum equation for fluid flow
Theoretical approach
(Analytical approach)
Experimental
problems.
approach
Numerical approach
(Computational
2 The Convective term is to be integrated through out
approach)
A comparison the volume
Why computational
method is special
3 Gauss-Divergance theorem is applied to convert the
Types of
computational
methods
volume integral to surface integral.
Finite volume in a 4 The cell face values are then evaluated by schemes
domain
like upwind, central difference and so on.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
how to evaluate Convective term?

OpenFOAM

Dr. Anand Raj Using Gauss-Divergence theorem,


Hariharan
Z Z
Approach to the
problem ∇.(ρUφ)dV = dS.(ρUφ) (36)
Theoretical approach V S
(Analytical approach)
Experimental
approach
Numerical approach Now the surface integral is evaluated as a summation
(Computational
approach)
A comparison
over the cell faces.
Why computational
method is special Z X
Types of
computational
dS.(ρUφ) = Sf .(ρU)f φf (37)
methods S f
Finite volume in a
domain
Now the value of φ at cell face, φf is evaluated by
Governing
equations different schemes like upwind, central difference and so
Finite Control
Volume
on.
conservative and
non-conservative
Central Difference (CD) scheme

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the The central difference scheme is second order in accuracy.


problem
Theoretical approach
(Analytical approach)
Experimental φf = fx φP + (1 − fx )φN (38)
approach
Numerical approach
(Computational
approach)
A comparison
where
Why computational fN
method is special
fx = (39)
Types of
computational
PN
methods
The scheme is suitable when diffusion is dominating over
Finite volume in a
domain convection.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Upwinding scheme

OpenFOAM

Dr. Anand Raj


Hariharan
In this case the value of φ at cell face, φf is evaluated
Approach to the
problem
based on the direction of flow.
Theoretical approach
(Analytical approach) 
Experimental φP if F ≥ 0;
approach
φf =
Numerical approach
(Computational
approach)
φN if F < 0.
A comparison
Why computational
method is special
Where F is the mass flux (ρU) which decides the
Types of direction of flow.
computational
methods If the problem is such that the convection is
Finite volume in a
domain
predominating over the diffusion Upwinding scheme
Governing should be used to get a solution of better accuracy.
equations

Finite Control
Volume
conservative and
non-conservative
Evaluating the first derivative of time

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach Most of the unsteady problems in CFD is governed
(Analytical approach)
Experimental
approach
by equations which are first derivative of time.
Numerical approach
(Computational
approach)
The time derivatives can be evaluated with first and
A comparison
Why computational
second order accuracy.
method is special

Types of It is possible to have Euler explicit and Euler implicit


computational
methods schemes
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Evaluating the time derivatives

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Time marching

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental In time marching we progress forward by integrating
approach
Numerical approach
(Computational
with respect to time step by step.
approach)
A comparison
Why computational
It is possible to use schemes like Euler explicit, Euler
method is special
implicit and Crank-Nicolson method.
Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Time marching - an example

OpenFOAM

Dr. Anand Raj


Hariharan
If the governing equation is of the form,
Approach to the
problem Z Z
Theoretical approach ∂
(Analytical approach) ρφdV + AφdV = 0 (40)
Experimental
approach ∂t V V
Numerical approach
(Computational
approach)
A comparison Integration wrt time is done as follows:
Why computational
method is special
Z t+∆t Z Z
Types of ∂
computational [ ρφdV + AφdV ]dt (41)
methods
t ∂t V V
Finite volume in a
domain

Governing
These two terms are integrated separately.
equations

Finite Control
Volume
conservative and
non-conservative
Integration of first term

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
The integration of first term is easy as we integrate the
(Analytical approach)
Experimental
approach
temporal derivative.
Numerical approach
(Computational
The integration is done as follows:
approach) R t+∆t ∂ R R t+∆t (ρp φp V )n −(ρp φp V )0
A comparison
Why computational t
[ ∂t V
ρφdV ]dt = t 4t
dt
method is special n 0
Types of
= (ρp φp V ) − (ρp φp V ) ∆t∆t
computational
methods
Now the second term has to be integrated.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Integration of second term

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem The second term is integrated as follows:
Theoretical approach
(Analytical approach) Z t+∆t Z Z t+∆t
Experimental

A∗ φdt
approach
Numerical approach
(Computational
[ AφdV ]dt = (42)
approach) t V t
A comparison
Why computational
method is special
Where A∗ represents the spatial discretization of A. The
Types of
computational temporal integration is done by explicit, implicit or
methods

Finite volume in a
Crank-Nicolson method.
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Euler implicit scheme

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
It is done by taking the value of φ at next time step n.
Experimental
approach This is done as follows:
Numerical approach
(Computational Z t+∆t Z Z t+∆t
approach)

A∗ φn Vdt
A comparison
Why computational
method is special
AφdVdt = (43)
t V t
Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Euler explicit scheme

OpenFOAM

Dr. Anand Raj


Hariharan
It is done by taking the value of φ at current time step 0.
Approach to the
problem This is done as follows:
Theoretical approach
(Analytical approach)
Experimental
Z t+∆t Z Z t+∆t
approach
Numerical approach
(Computational
AφdVdt = A∗ φ0 Vdt (44)
approach) t V t
A comparison
Why computational
method is special
Even though the truncation error is the same as that of
Types of
computational implicit scheme the explicit method can go unstable.
methods

Finite volume in a
The level of stability depends on Courant number which
domain
has to be less than or equal to one.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Evaluating Divergence

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach) First Gauss-Divergence theorem is used to convert
Experimental
approach
Numerical approach
the volume integral to surface integral.
(Computational
approach)
A comparison
Now at each cell face the product is evaluated
Why computational
method is special between the required scalar and surface area of the
Types of
computational
face.
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Evaluating Divergence

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
OpenFOAM

OpenFOAM

Dr. Anand Raj


Hariharan OpenFOAM is Open Source Field Operation and
Approach to the
Manipulation.
problem
Theoretical approach It is a C ++ library which contains the functions
(Analytical approach)
Experimental
approach
which are used as applications to solve a problem.
Numerical approach
(Computational
approach)
The application involves a solver and a utility. A
A comparison
Why computational solver is designed to solve a specific problem in
method is special

Types of
continuum mechanics. Utility are functions which
computational
methods
are designed to perform data manipulation (like
Finite volume in a mesh generation post processing tools and so on)
domain

Governing
Let us first try to understand the file structures in
equations
OpenFOAM.
Finite Control
Volume
conservative and
non-conservative
OpenFOAM file structure

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach In OpenFOAM there is a file structure. The case to be
Numerical approach
(Computational
approach)
solved is saved as directories. Under Directories there are
A comparison
Why computational subdirectory.
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
OpenFOAM file structure

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
OpenFOAM file structure

OpenFOAM
A case file mainly contains the following three directories:
Dr. Anand Raj
Hariharan System It contains parameters which control the
Approach to the
solution procedure. It contains information
problem
Theoretical approach
like start and stop time, time step size,
(Analytical approach)
Experimental
algorithm, discretization schemes, tolerances
approach
Numerical approach
(Computational
and so on.
approach)
A comparison Constant It contains information regarding meshes
Why computational
method is special and mesh scheme used, physical and
Types of
computational transport properties.
methods

Finite volume in a
Time It contains information regarding initial and
domain boundary conditions for the properties. In
Governing
equations
addition to this it also stores the values of
Finite Control the field variables at every time steps
Volume
conservative and specified.
non-conservative
System Directory

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
It specifies the solution procedure - the numerical
Theoretical approach
(Analytical approach) schemes, discretization schemes and parameters
Experimental
approach that control the simulations. It is divided into three
Numerical approach
(Computational
approach)
subdirectories.
A comparison
Why computational 1 ControlDict
method is special

Types of
2 fvSchemes
computational
methods
3 fvSolutions
Finite volume in a
4 blockMeshDict
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Discretization summary

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
ControlDict

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach The ControlDict file contains the list of information
Numerical approach
(Computational
approach)
necessary to create, write and perform integration with
A comparison
Why computational respect to time step.
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Entries in a ControlDict file- details

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Entries in a ControlDict file

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
fvSchemes

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach The fvSchemes file contains the list of information
Numerical approach
(Computational
approach)
necessary to represent each and every differential terms
A comparison
Why computational in the governing equations.
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Components of fvSchemes

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Structure of fvSchemes

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Keywords used in fvSchemes

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Entries in a fvSchemes file

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Evaluation of gradient in fvSchemes

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Time derivative schemes

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem The time derivatives are defined under ddt or d2dt2
Theoretical approach
(Analytical approach)
Experimental
sub-directories. The command is :
approach
Numerical approach ddt Schemes
(Computational
approach)
A comparison
{
Why computational
method is special default Euler;
Types of
computational
}
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Schemes available for time derivatives

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Entries of time derivative

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Keywords used in fvSchemes

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem fvSchemes contains schemes and fluxes.
Theoretical approach
(Analytical approach)
Experimental
Schemes: A scheme may be a Laplacian, gradient and
approach
Numerical approach so on. For example gradient of pressure p is
(Computational
approach)
A comparison
written as grad(p).
Why computational
method is special Fluxes: It gives the field variable like pressure p in
Types of
computational grad(p). The flux can be a scalar or a
methods
vector.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Keywords used in fvSchemes

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem fvSchemes contains schemes and fluxes.
Theoretical approach
(Analytical approach)
Experimental
Schemes: A scheme may be a Laplacian, gradient and
approach
Numerical approach so on. For example gradient of pressure p is
(Computational
approach)
A comparison
written as grad(p).
Why computational
method is special Fluxes: It gives the field variable like pressure p in
Types of
computational grad(p). The flux can be a scalar or a
methods
vector.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Keywords used in fvSchemes

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Entries in a fvSchemes file

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Entries in a fvSchemes file

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Interpolation Schemes

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach It contains the information how the cell centre value
(Analytical approach)
Experimental
approach
is interpolated to the centre of cell face.
Numerical approach
(Computational
approach)
It is specified as a general scheme (this appears
A comparison
Why computational under interpolationSchemes) as well as under
method is special

Types of
each sub-directories to find Laplacians, divergence,
computational
methods
gradients and so on.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Interpolation Schemes - some examples

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
default linear; Here the flux is linearly interpolated
Theoretical approach
(Analytical approach)
from the cell centre to cell face.
Experimental
approach default upwind phi; The flux at the centre of cell
Numerical approach
(Computational
approach)
face is calculated by upwinding scheme. The phi (φ) is a
A comparison
Why computational correction factor whose value has to be specified. The
method is special

Types of
higher value of phi (becomes closer and closer to one)
computational
methods
increases stability. However the lower value of phi
Finite volume in a improves accuracy.
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Gradient schemes

OpenFOAM

Dr. Anand Raj The required commands are given under gradSchemes
Hariharan
sub-directory. The discretization schemes are given as
Approach to the
problem follows:
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Gradient schemes

OpenFOAM

Dr. Anand Raj


Hariharan
Gauss linear The keyword Gauss specifies Gaussian
integration is done from the cell centres to
Approach to the
problem cell faces. Gauss entry must be followed by
Theoretical approach
(Analytical approach)
Experimental
the interpolation scheme (usually linear is
approach
Numerical approach used). The command is
(Computational
approach)
A comparison
grad(p) Gauss linear;
Why computational
method is special leastSquares In this case the data at cell face is
Types of
computational determined from the cell centre using the
methods
least square technique. The command is
Finite volume in a
domain grad(p) leastSquares;. Another version
Governing
equations
of least square technique is also employed by
Finite Control
the keyword fourth.
Volume
conservative and
non-conservative
Gradient schemes available and their
capabilities
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Normal Surface gradients

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the The normal surface gradients are defined at


problem
Theoretical approach
(Analytical approach)
sub-directory known as snGradSchemes.
Experimental
approach It is evaluated at the cell face. It is the component
Numerical approach
(Computational
approach) normal to the face, of the gradient of the values at
A comparison
Why computational
method is special
the centres of 2 cells where the face is common.
Types of The evaluation of normal surface gradient is
computational
methods essential to perform Gaussian integration especially
Finite volume in a
domain
for Laplacian schemes.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Normal Surface gradients - where it is
defined??
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Normal Surface gradients - how it is
defined??
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach If the normal surface gradient is readily available. Then
(Analytical approach)
Experimental
approach
we can use the command
Numerical approach
(Computational
approach)
default orthogonal;
A comparison
Why computational
In this case we have to ensure that the gradient at the
method is special
cell face is same as normal surface gradient. We will also
Types of
computational
methods
see other schemes available.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Normal Surface gradients - Schemes
available
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Laplacian Schemes

OpenFOAM

Dr. Anand Raj


Hariharan
The Laplacian schemes can be identified under
Approach to the
problem
laplacianSchemes sub-directory.
Theoretical approach
(Analytical approach) The term ∇.(ν∇V ) is expressed in syntax as
Experimental
approach
Numerical approach
laplacian(nu,V).
(Computational
approach)
A comparison
In this case we require Gauss scheme for
Why computational
method is special discretization, an interpolation scheme and normal
Types of
computational
surface gradient scheme.
methods

Finite volume in a
The structure for the command is
domain Gauss <interpolationScheme>
Governing
equations
<snGradientScheme>
Finite Control
Volume
conservative and
non-conservative
Laplacian Schemes - an example

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
The interpolation scheme for most of the cases can
Numerical approach
(Computational
be linear. The entry for normal surface gradient
approach)
A comparison can be a choice from corrected, uncorrected,
Why computational
method is special
bounded, fourth to name a few.
Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Laplacian Schemes - syntax and options
available
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Laplacian Schemes - syntax and options
available
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Divergence schemes

OpenFOAM

Dr. Anand Raj


Hariharan
The divergence of a function is defined under the
Approach to the
problem
sub-directory divSchemes
Theoretical approach φ
(Analytical approach) z}|{
Experimental
approach
Numerical approach
The convection term in fluid mechanics ∇.( ρU U)
(Computational
approach) is expressed as div(phi,V). Where φ is the mass
A comparison
Why computational
method is special
flux.
Types of
computational
The choice of dicretization is Gauss. In addition to
methods this an interpolation scheme is also required.
Finite volume in a
domain The structure for the command is
Governing
equations
Gauss <interpolationScheme>
Finite Control
Volume
conservative and
non-conservative
Divergence schemes - Where it appears in
fvSchemes???
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Divergence schemes - Syntax and examples

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach) div(phi,U) Gauss upwind;
Experimental
approach
Numerical approach
div(phi,U) Gauss linear;
(Computational
approach) div(phi,U) skewLinear;
A comparison
Why computational
method is special
We will see what are the interpolation schemes available
Types of for the divergence scheme.
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Divergence schemes - interpolation
schemes available
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Time schemes - schemes to define
temporal derivatives
OpenFOAM

Dr. Anand Raj There are two types of time derivatives allowed in
Hariharan
OpenFOAM. The first and second derivatives.
Approach to the
problem First derivative: The first derivative of time is preferred if
Theoretical approach
(Analytical approach)
Experimental
the governing equation has a first derivative
approach
Numerical approach
of time. Most of the PDEs we deal in fluid
(Computational
approach)
A comparison
mechanics and thermodynamics involves
Why computational
method is special PDEs with first derivatives of time.
Types of
computational
Second derivative: This is preferred when the governing
methods
equation contains second derivative of time.
Finite volume in a
domain The second order wave equation is a classic
Governing
equations
example for such problems.
Finite Control Now we shall see them separately.
Volume
conservative and
non-conservative
First derivative of time

OpenFOAM
The first derivative of time is specified in
Dr. Anand Raj
Hariharan sub-directory named ddtSchemes.
Approach to the
It is also possible to chose a scheme under
problem
Theoretical approach
ddtSchemes sub-directory so as to run the problem
(Analytical approach)
Experimental as steady. If unsteady scheme is chosen the problem
approach
Numerical approach
(Computational
will be treated as unsteady and simulations will
approach)
A comparison perform time marching.
Why computational
method is special The choice of steady or unsteady should be
Types of
computational according to the solver (specified in controlDict).
methods
For example icoFoam is an unsteady laminar
Finite volume in a
domain incompressible flow solver. The choice of steady
Governing
equations
under the time derivative can make the simulations
Finite Control unstable. In this case changing the solver can be
Volume
conservative and
good strategy.
non-conservative
Time derivative sub-directory: where it
appears???
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Time derivative sub-directory: Schemes
available in detail
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Time derivative sub-directory: Schemes
available
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Time derivatives: how it is defined in
sub-directory
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach) default Euler;
Experimental
approach
Numerical approach
default localEuler;
(Computational
approach) default crankNicholson 0.5; 0.5 is the a correction
A comparison
Why computational
method is special
factor that blends Euler method (value is 0) and
Types of Crank-Nicholson (value is 1);
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Time derivatives - second

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental The second derivative is specified under the
approach
Numerical approach
(Computational
sub-directory d2dt2Schemes.
approach)
A comparison
Why computational
Only Euler scheme is available which is first order
method is special
accurate, bounded and implicit.
Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Flux calculation

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem The flux of the property calculated during the
Theoretical approach
(Analytical approach) simulation is listed in the sub-directory named
Experimental
approach
Numerical approach
fluxRequired.
(Computational
approach)
A comparison
The specified flux value is returned in other
Why computational
method is special sub-directories.
Types of
computational The flux of the variable required is mentioned by
methods

Finite volume in a
identifier. For example, p is the pressure.
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Flux calculation - Where it is found???

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
fvSolution
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
fvSolution - a directory for solution and
algorithm control
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach fvSolution dictionary in system directory contains
(Analytical approach)
Experimental
approach
all the information regarding equation solvers,
Numerical approach
(Computational tolerances and algorithm.
approach)
A comparison
Why computational
It contains subdirectories containing solvers,
method is special

Types of
relaxation factors, tolerances (based on mass
computational
methods
balance), relative tolerance and so on.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
fvSolution - Sample entries

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Solvers

OpenFOAM

Dr. Anand Raj It is specified under the sub-directory solvers.


Hariharan
Under the sub-directory solvers one should specify
Approach to the
problem the property (p or U), solver (solver),
Theoretical approach
(Analytical approach)
Experimental
preconditioning method (preconditioner),
approach
Numerical approach tolerance (tolerance) and relative tolerance
(Computational
approach)
A comparison
(relTol).
Why computational
method is special The solvers used in OpenFOAM can differentiate
Types of
computational between symmetric and assymetric matrices.
methods
However they are designed to handle only linearized
Finite volume in a
domain system of equations.
Governing
equations The command is solver <type>. For example
Finite Control solver PCG; solver PBiCG;
Volume
conservative and
non-conservative
List of Solvers used

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Error message due to improper solver
selection
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Solution Tolerances

OpenFOAM

Dr. Anand Raj


Hariharan A sparse matrix is solved by iterative methods.
Approach to the During iterations the difference between right and
problem
Theoretical approach left sides of the equation is calculated as a residue.
(Analytical approach)
Experimental
approach
The lesser the residue the more accurate the
Numerical approach
(Computational solution is.
approach)
A comparison
Why computational If the value of residue should be less than the
method is special

Types of
tolerance value.
computational
methods During every iteration the residue is re-evaluated
Finite volume in a
domain
and compared with the specified value of tolerances.
Governing The tolerances should be specified for all solvers
equations

Finite Control
under the sub-directories tolerance and relTol.
Volume
conservative and
non-conservative
Solution Tolerances

OpenFOAM

Dr. Anand Raj


Hariharan
The numerical simulations will stop if either of the
Approach to the
problem following conditions are met:
Theoretical approach
1 If the residue falls below the solver tolerance,
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
tolerance;
approach)
A comparison 2 If the ratio of current to initial residues falls below
Why computational
method is special
the relative tolerance, relTol.
Types of
computational
methods
For transient simulations, the solution convergence is
Finite volume in a checked during every time steps by having inner
domain
iterations.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Preconditioned Conjugate Gradient Solvers

OpenFOAM

Dr. Anand Raj


Hariharan
Preconditioning is a treatment done on a system of
equations to enhance faster solutions.
Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Preconditioned Conjugate Gradient Solvers

OpenFOAM

Dr. Anand Raj


Hariharan
Preconditioning is a treatment done on a system of
equations to enhance faster solutions.
Approach to the
problem While solving Navier-Stokes equations the eigen
Theoretical approach
(Analytical approach)
Experimental
values for the coefficient matrix will be speed of
approach
Numerical approach
(Computational
sound and flow velocity. If eigen values differ
approach)
A comparison
appreciably the convergence will be slower. This will
Why computational
method is special happen at problems with pockets of low speed flow.
Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Preconditioned Conjugate Gradient Solvers

OpenFOAM

Dr. Anand Raj


Hariharan
Preconditioning is a treatment done on a system of
equations to enhance faster solutions.
Approach to the
problem While solving Navier-Stokes equations the eigen
Theoretical approach
(Analytical approach)
Experimental
values for the coefficient matrix will be speed of
approach
Numerical approach
(Computational
sound and flow velocity. If eigen values differ
approach)
A comparison
appreciably the convergence will be slower. This will
Why computational
method is special happen at problems with pockets of low speed flow.
Types of
computational Gradient based solution procedure will ensure that
methods

Finite volume in a
the solution is obtained with minimum number of
domain iterations. If the system of equations are “well
Governing
equations
behaved” the number of iterations taken for
Finite Control convergence will be same as the order of matrix.
Volume
conservative and
non-conservative
Preconditioned Conjugate Gradient Solvers

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
It is specified under solver in solver dictionary.
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Smooth solvers

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
It is specified under preconditioner in solver
(Analytical approach)
Experimental dictionary.
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Constant Directory
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Constant Directory

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
A constant directory contains information regarding
Experimental
approach parameters which are fairly constant during the
Numerical approach
(Computational
approach)
simulations. It contains two directories:
A comparison
Why computational 1 Properties
method is special

Types of 2 PolyMesh
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Properties

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
It includes the relevant information regarding the
approach
Numerical approach
following:
(Computational
1 Turbulence models
approach)
A comparison
Why computational
method is special
2 Thermophysical properties
Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Turbulence models

OpenFOAM

Dr. Anand Raj


Hariharan
During simulations the approach to capture the turbulent
properties should be specified if flow is turbulent.
Approach to the
problem turbulentProperties dictionary is read by the solver.
Theoretical approach
(Analytical approach)
Experimental
There are three approaches in this regard which are as
approach
Numerical approach follows:
(Computational
approach)
A comparison laminar solver does not use turbulence models.
Why computational
method is special

Types of
RASModel solver uses Reynolds Averaged Navier-Stokes
computational
methods
equation to capture turbulence. In this case
Finite volume in a
the type of model used should be specified
domain
along with modelling constants.
Governing
equations LESModel uses Large Eddy Simulation
Finite Control
Volume
conservative and
non-conservative
Turbulence models for incompressible fluids

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Turbulence models for compressible fluids

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Turbulence models for compressible fluids

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
LES filters and deltas

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
LES models for incompressible flow

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
LES models for compressible flow

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
polyMesh Directory
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
polyMesh Directory

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
The details of the mesh (points, faces, cells and so
(Analytical approach)
Experimental
approach
on) are defined in the directory named as polyMesh.
Numerical approach
(Computational
approach)
OpenFOAM is always 3D. For solving a 2D problem
A comparison
Why computational
one have specify the number of nodes as unity in
method is special

Types of
the direction normal to the plane of interest.
computational
methods A mesh consists of points, faces, cells and so on.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
polyMesh Directory - points

OpenFOAM

Dr. Anand Raj


Hariharan
point is a directory which contains the list of points
Approach to the
problem in a 3D space.
Theoretical approach
(Analytical approach)
Experimental The points given in the list is numbered from zero.
approach
Numerical approach
(Computational The numbering can be done in any order.
approach)
A comparison
Why computational When a list of points are defined it should not have
method is special

Types of
same points with different names (named by
computational
methods
numbers).
Finite volume in a
domain
When a point is defined it should be part of at least
Governing
one face.
equations

Finite Control
Volume
conservative and
non-conservative
polyMesh Directory - faces

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the faces is a directory which contains the list of points


problem
Theoretical approach
(Analytical approach)
which forms the face of a cell.
Experimental
approach The points given in the list is numbered from zero.
Numerical approach
(Computational
approach)
A comparison
Two neighboring points are connected by edges.
Why computational
method is special The vertices of the face should be defined using the
Types of
computational
right-hand screw rule such that the unit normal is
methods
always pointing outward direction for the face of the
Finite volume in a
domain cell considered.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Numbering of vertices in a face

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing The face should be numbered as 01234, 12340 and so on


equations
(anti-clockwise).
Finite Control
Volume
conservative and
non-conservative
Types of faces

OpenFOAM

Dr. Anand Raj


Hariharan There are two types of faces:
Approach to the Internal faces: These are the faces within the
problem
Theoretical approach computational domain. When we consider a
(Analytical approach)
Experimental
approach
cell from the interior of computational
Numerical approach
(Computational domain the unit normal for each of the faces
approach)
A comparison
Why computational
should be pointing outwards.
method is special

Types of
Boundary faces: These are the faces coinciding the
computational
methods
boundary of the domain. The numbering of
Finite volume in a the faces should be done such that the unit
domain
normal is always pointing outside the
Governing
equations domain.
Finite Control
Volume
conservative and
non-conservative
Cells

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
A cell is a collection of faces such that it forms a finite
Theoretical approach
(Analytical approach) volume. A cell should obey the following conditions:
Experimental
approach
Numerical approach
Contiguous: A cell should completely cover the
(Computational
approach)
A comparison
computational domain without overlapping
Why computational
method is special each other.
Types of
computational
Convex: Convexity ensures the cell centre should
methods
always inside the cell considered.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Cells

OpenFOAM

Dr. Anand Raj


Hariharan A cell is a collection of faces such that it forms a finite
Approach to the
volume. A cell should obey the following conditions:
problem
Theoretical approach Closed: A cell is composed of several faces such that
(Analytical approach)
Experimental
approach
the unit normal for each face should be
Numerical approach
(Computational pointing outwards. The closedness requires
approach)
A comparison
Why computational
that the sum of all face area vectors should
method is special
be less than machine error. In addition to
Types of
computational this every should be part of two faces.
methods

Finite volume in a Orthogonality: The angle between the vector connecting


domain
the adjacent cell centres and the unit normal
Governing
equations to the cell face should be almost the same.
Finite Control
Volume
conservative and
non-conservative
Cell shapes

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Cell shapes specification format

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Boundaries

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
These are the parameters specified at the ends of
Experimental
approach the computational domain.
Numerical approach
(Computational
approach)
A comparison
Even though the boundary is specified as an entity it
Why computational
method is special
should be part of solution, numerics and geometries.
Types of
computational
A boundary is divided into sets known as patches.
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Boundaries

OpenFOAM

Dr. Anand Raj


patch: This type of boundary condition does not
Hariharan
have any geometrical information. For
Approach to the example, inlet or outlet.
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Boundaries

OpenFOAM

Dr. Anand Raj


patch: This type of boundary condition does not
Hariharan
have any geometrical information. For
Approach to the example, inlet or outlet.
problem
Theoretical approach
(Analytical approach) wall: It is used for wall boundary conditions (slip
Experimental
approach or no-slip). The part of the geometry
Numerical approach
(Computational
approach) defined as wall should be identifiable (for
A comparison
Why computational
method is special
example, wall functions used in turbulence
Types of models., slip boundaries, no-slip boundaries).
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Boundaries

OpenFOAM

Dr. Anand Raj


patch: This type of boundary condition does not
Hariharan
have any geometrical information. For
Approach to the example, inlet or outlet.
problem
Theoretical approach
(Analytical approach) wall: It is used for wall boundary conditions (slip
Experimental
approach or no-slip). The part of the geometry
Numerical approach
(Computational
approach) defined as wall should be identifiable (for
A comparison
Why computational
method is special
example, wall functions used in turbulence
Types of models., slip boundaries, no-slip boundaries).
computational
methods symmetryPlane: When a boundary is defined as
Finite volume in a
domain
symmetry, the plane acts as a mirroring
Governing surface. The component of velocity normal
equations
to this plane is zero. It is also known as slip
Finite Control
Volume boundary.
conservative and
non-conservative
Boundaries

OpenFOAM
empty: When a boundary is specified by this
Dr. Anand Raj
Hariharan keyword the solution is not attempted in
Approach to the normal direction. For example OpenFOAM
problem
Theoretical approach
is always 3D. However for 2D we can specify
(Analytical approach)
Experimental
approach
the boundary normal to the third dimension
Numerical approach
(Computational as empty where solution is not required.
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Boundaries

OpenFOAM
empty: When a boundary is specified by this
Dr. Anand Raj
Hariharan keyword the solution is not attempted in
Approach to the normal direction. For example OpenFOAM
problem
Theoretical approach
is always 3D. However for 2D we can specify
(Analytical approach)
Experimental
approach
the boundary normal to the third dimension
Numerical approach
(Computational as empty where solution is not required.
approach)
A comparison
Why computational
wedge: A 2D axi-symmetric cases, like cylinder can
method is special

Types of
be specified using this keyword.
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Boundaries

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
cyclic: The cyclic is the keyword used to connect
Experimental
approach
the boundaries which are repeated and
Numerical approach
(Computational
approach)
connected. This can be used for problems
A comparison
Why computational
with repeated geometries. The connecting
method is special

Types of
faces must have the one to one
computational
methods
correspondence.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
boundary data required

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
boundary data required

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
boundary data required

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
boundary data required

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
How to write mesh file????

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach) The details of the mesh (vertices, faces, boundaries,
Experimental
approach
Numerical approach
mesh type and so on) are specified in the directory
(Computational
approach) known as blockMeshDict.
A comparison
Why computational
method is special The structure of blockMeshDict file is discussed
Types of
computational
next.
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Consider the domain

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Structure of blockMeshDict file (1)

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
unit conversion
approach
Numerical approach
(Computational
convertsToMeters 0.001;
approach)
A comparison
Why computational
method is special
This means all the coordinate values are multiplied with
Types of 0.001, the scaling factor.
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Structure of blockMeshDict file (2)

OpenFOAM

Dr. Anand Raj


Hariharan
specify the vertices of the domain
Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Structure of blockMeshDict file (3)

OpenFOAM

Dr. Anand Raj


Hariharan
specify the edges of the domain
Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain In this section we have to specify all possible edges in the
Governing domain.
equations

Finite Control
Volume
conservative and
non-conservative
Structure of blockMeshDict file (4)

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach The computational domain is divided into blocks. In this
Numerical approach
(Computational
approach)
section we have to specify the vertices of blocks, number
A comparison
Why computational of cells in each direction and discretization schemes.
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Structure of blockMeshDict file (4)

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
structure of block
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Meshing schemes

OpenFOAM

Dr. Anand Raj The mesh scheme is specified by the keyword


Hariharan
simpleGrading.
Approach to the
problem The command is “simpleGrading (1 2 3);”. Where
Theoretical approach
(Analytical approach)
Experimental
1, 2, 3 are the expansion ratios in X, Y and Z
approach
Numerical approach
directions respectively.
(Computational
approach)
A comparison The expansion ratio is defined as the ratio of last to
Why computational
method is special the first mesh size.
Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Meshing schemes - further insights

OpenFOAM

Dr. Anand Raj


Hariharan
For many applications non-uniform mesh scheme is used.
If l is the length of the edge, n is the number of nodes
Approach to the
problem required with ratio R (the ratio of last and first cells),
Theoretical approach
(Analytical approach)
Experimental
then the smallest cell size δxs is given by,
approach
Numerical approach
(Computational r −1
approach)
A comparison δxs = l (45)
Why computational
method is special
αr − 1
Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Meshing schemes - further insights

OpenFOAM

Dr. Anand Raj


Hariharan
For many applications non-uniform mesh scheme is used.
If l is the length of the edge, n is the number of nodes
Approach to the
problem required with ratio R (the ratio of last and first cells),
Theoretical approach
(Analytical approach)
Experimental
then the smallest cell size δxs is given by,
approach
Numerical approach
(Computational r −1
approach)
A comparison δxs = l (45)
Why computational
method is special
αr − 1
Types of
computational 1
methods r = R n−1 (46)
Finite volume in a 
domain R, R > 1;
Governing α= −n −1 (47)
equations 1 - r + r , R < 1;
Finite Control
Volume
conservative and
non-conservative
Structure of blockMeshDict file (5)

OpenFOAM
structure of boundary
Dr. Anand Raj
Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Solvers - Basic CFD codes

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the laplacianFoam It is a solver meant to solve Laplacian


problem
Theoretical approach
(Analytical approach)
equation (for example thermal diffusion in a
Experimental
approach
solid).
Numerical approach
(Computational
approach) potentialFoam Solver meant for potenital flows. It can
A comparison
Why computational
method is special
be used as a starting solution before solving
Types of the Navier-Stokes equations.
computational
methods scalarTransportFoam Solves a transport equation for
Finite volume in a
domain
passive scalar.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Solvers - Basic CFD codes

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the laplacianFoam It is a solver meant to solve Laplacian


problem
Theoretical approach
(Analytical approach)
equation (for example thermal diffusion in a
Experimental
approach
solid).
Numerical approach
(Computational
approach) potentialFoam Solver meant for potential flows. It can
A comparison
Why computational
method is special
be used as a starting solution before solving
Types of the Navier-Stokes equations.
computational
methods scalarTransportFoam Solves a transport equation for
Finite volume in a
domain
passive scalar.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Solvers - incompressible flow

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Solvers - compressible flow

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Setting up a case in OpenFOAM

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach A problem can be set up in OpenFOAM in 6 steps as
(Computational
approach)
A comparison
discussed in the next slide
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Setting up a case in OpenFOAM

OpenFOAM

Dr. Anand Raj 1 Understand the problem physically and select a


Hariharan
solver from OpenFOAM library.
Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Setting up a case in OpenFOAM

OpenFOAM

Dr. Anand Raj 1 Understand the problem physically and select a


Hariharan
solver from OpenFOAM library.
Approach to the
problem 2 Copy a case or an example which is very close to the
Theoretical approach
(Analytical approach)
Experimental
problem or solver.
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Setting up a case in OpenFOAM

OpenFOAM

Dr. Anand Raj 1 Understand the problem physically and select a


Hariharan
solver from OpenFOAM library.
Approach to the
problem 2 Copy a case or an example which is very close to the
Theoretical approach
(Analytical approach)
Experimental
problem or solver.
approach
Numerical approach
(Computational
3 Edit, modify and create a mesh and complete the
approach)
A comparison computational domain.
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Setting up a case in OpenFOAM

OpenFOAM

Dr. Anand Raj 1 Understand the problem physically and select a


Hariharan
solver from OpenFOAM library.
Approach to the
problem 2 Copy a case or an example which is very close to the
Theoretical approach
(Analytical approach)
Experimental
problem or solver.
approach
Numerical approach
(Computational
3 Edit, modify and create a mesh and complete the
approach)
A comparison computational domain.
Why computational
method is special
4 Select the models and transport coefficients
Types of
computational required.
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Setting up a case in OpenFOAM

OpenFOAM

Dr. Anand Raj 1 Understand the problem physically and select a


Hariharan
solver from OpenFOAM library.
Approach to the
problem 2 Copy a case or an example which is very close to the
Theoretical approach
(Analytical approach)
Experimental
problem or solver.
approach
Numerical approach
(Computational
3 Edit, modify and create a mesh and complete the
approach)
A comparison computational domain.
Why computational
method is special
4 Select the models and transport coefficients
Types of
computational required.
methods

Finite volume in a 5 Edit 0 directory and initialize the BCs like p, U and
domain
so on.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Setting up a case in OpenFOAM

OpenFOAM

Dr. Anand Raj 1 Understand the problem physically and select a


Hariharan
solver from OpenFOAM library.
Approach to the
problem 2 Copy a case or an example which is very close to the
Theoretical approach
(Analytical approach)
Experimental
problem or solver.
approach
Numerical approach
(Computational
3 Edit, modify and create a mesh and complete the
approach)
A comparison computational domain.
Why computational
method is special
4 Select the models and transport coefficients
Types of
computational required.
methods

Finite volume in a 5 Edit 0 directory and initialize the BCs like p, U and
domain
so on.
Governing
equations 6 Set the controls like solvers, tolerances, time step
Finite Control
Volume sizes and so on.
conservative and
non-conservative
Geometry creation

OpenFOAM

Dr. Anand Raj


Hariharan
Prepare the sketch of the computational domain and
Approach to the
problem
understand the dimensions along with the units.
Theoretical approach
(Analytical approach) If the domain is 2D (flow is along XY plane) take
Experimental
approach
Numerical approach
the Z-direction as 0.1 times the height of the
(Computational
approach) domain in Y-direction.
A comparison
Why computational
method is special Now understand the conversion factor. OpenFOAM
Types of
computational
is SI.
methods
Divide the domain into blocks. Then number the
Finite volume in a
domain vertices and blocks starting from 0 at the origin.
Governing
equations
(see the example in next slide)
Finite Control
Volume
conservative and
non-conservative
Geometry creation

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations The domain has 18 vertices (starting from 0) and 4
Finite Control blocks. The conversion factor is 0.1.
Volume
conservative and
non-conservative
Geometry creation - commands

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Geometry creation - commands

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Deciding the blocks, mesh

OpenFOAM

Dr. Anand Raj


Hariharan There are 4 blocks in the computational domain.
Approach to the We are planning to use hexahedral cells to discretize
problem
Theoretical approach
each blocks.
(Analytical approach)
Experimental
approach The number of nodes are 10, 10, 1 in X, Y, Z
Numerical approach
(Computational
approach)
directions respectively.
A comparison
Why computational
method is special
Use a simple grading mesh scheme and specify the
Types of expansion ratios in X, Y and Z directions.
computational
methods When we specify the blocks using vertex numbers
Finite volume in a
domain
the order is critical. The order should define the
Governing local coordinate system (X, Y then Z). The first 4 in
equations
one plane next 4 in another plane.
Finite Control
Volume
conservative and
non-conservative
Deciding the blocks, mesh - commands

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Deciding the boundaries and types

OpenFOAM

Dr. Anand Raj


Hariharan
The top surface of the computational domain has 2
faces. We call the surface by the name
Approach to the
problem movingWall. We define them as wall however we
Theoretical approach
(Analytical approach) shall specify the velocity.
Experimental
approach
Numerical approach
(Computational
There are 3 surfaces (right, left and bottom of the
approach)
A comparison
domain) which is named as fixedWalls. Each
Why computational
method is special surface is made of 2 faces. We call all of them as
Types of
computational
wall.
methods

Finite volume in a
There are 2 surfaces (on the front and back of the
domain domain) composed of 8 faces. We name the
Governing
equations
surfaces as frontAndBack. We use the entity
Finite Control empty to represent them.
Volume
conservative and
non-conservative
Boundaries and their entities - summary

OpenFOAM
Name of Entity Vertices
Dr. Anand Raj Boundary (type)
Hariharan
movingWall wall (6 15 16 7)
Approach to the (7 16 17 8)
problem (3 12 15 6)
Theoretical approach
(Analytical approach) (0 9 12 3)
Experimental (0 1 10 9)
approach
Numerical approach fixedWalls wall (1 2 11 10)
(Computational
approach) (2 5 14 11)
A comparison
Why computational
(5 8 17 14)
method is special (0 3 4 1)
Types of (1 4 5 2)
computational
methods
(3 6 7 4)
(0 3 4 1)
Finite volume in a
domain
frontAndBack empty (4 7 8 5)
(9 10 13 12)
Governing
equations
(10 11 14 13)
(12 13 16 15)
Finite Control
Volume
(13 14 17 16)
conservative and
non-conservative
Boundaries and their entities - summary -
commands
OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
approach
Numerical approach
(Computational
approach)
A comparison
Why computational
method is special

Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
How to check and create mesh

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
Creating Mesh: Once the blockMeshDict directory is
problem ready we have to type blockMesh to
Theoretical approach
(Analytical approach)
Experimental
generate mesh. If everything is perfect the
approach
Numerical approach
(Computational
mesh will be generated.
approach)
A comparison Viewing the mesh: The generated mesh can be viewed
Why computational
method is special
using paraFOAM or paraview.
Types of
computational
methods
Mesh quality: The mesh quality is evaluated by
Finite volume in a command checkMesh >&log. The mesh
domain
quality data will be written in log file.
Governing
equations

Finite Control
Volume
conservative and
non-conservative
Attaching BCs

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental
Each properties should be given as a separate directories
approach
Numerical approach
like p, U, k, omega and so on.
(Computational
1 The dimensions of each property should be known.
approach)
A comparison
Why computational
method is special
2 Now identify the boundary conditions required.
Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Attaching BCs - information

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Boundary Property Fixed Gradient
Theoretical approach
(Analytical approach)
value
Experimental
approach movingWall velocity 10,0,0 –
Numerical approach
(Computational
approach)
pressure – –
A comparison
Why computational fixedWall velocity 0 –
method is special

Types of
pressure – 0
computational
methods frontAndBack velocity – –
Finite volume in a pressure – –
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Attaching BCs - information

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem The BCs are either fixed value or gradient type.
Theoretical approach
(Analytical approach)
Experimental
In movingWall BC the velocity is known as 10 m/s
approach
Numerical approach and for fixedWall it is zero.
(Computational
approach)
A comparison We need not solve the equations for the
Why computational
method is special frontAndBack as they are defined as empty.
Types of
computational Some BCs requires calculated values (for example,
methods

Finite volume in a
k, ).
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Attaching BCs - information

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem
Theoretical approach
(Analytical approach)
Experimental BC type Additional Data Example
approach
Numerical approach
(Computational
fixedValue value U = (10, 0, 0)
approach) ∂T
A comparison fixedGradient gradient ∂n
= 2.5
Why computational ∂T
method is special zeroGradient – ∂n
=0
Types of
computational
methods

Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
BC for turbulent flow

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the The turbulent kinetic energy (k) is given by


problem
Theoretical approach
(Analytical approach)
1
Experimental
approach k = (Ux 2 + Uy 2 + Uz 2 ) (48)
Numerical approach
(Computational
2
approach)
A comparison
Why computational
method is special
Where Ux , Uy and Uz are fluctuating components of
Types of velocity in X, Y and Z directions. We can assume that
computational
methods turbulence is isotropic (Ux , Uy and Uz are equal) and
Finite volume in a fluctuation is equal to 5 % of reference velocity.
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
BC for turbulent flow

OpenFOAM

Dr. Anand Raj


Hariharan

Approach to the
problem The dissipation rate () is given by,
Theoretical approach
(Analytical approach)
Experimental
approach Cµ k 1 .5
Numerical approach = (49)
(Computational
approach) l
A comparison
Why computational
method is special The term Cµ is a modelling constant and is equal to
Types of
computational 0.09. The l length scale can be taken as 20 % of the
methods
reference length.
Finite volume in a
domain

Governing
equations

Finite Control
Volume
conservative and
non-conservative
Time step size

OpenFOAM

Dr. Anand Raj


Hariharan The time step size is given by,
Approach to the
problem C δx
Theoretical approach δt = (50)
(Analytical approach)
Experimental
U
approach
Numerical approach
(Computational
approach)
Where C is Courant number (taken as one), δx is the
A comparison
Why computational smallest mesh size and U is the maximum velocity in the
method is special

Types of
domain. The time step size for a problem should be
computational
methods
chosen based on smallest mesh size and largest possible
Finite volume in a velocity. If the problem is unsteady the time step size
domain
should be minimum of residence time and stability
Governing
equations criteria.
Finite Control
Volume
conservative and
non-conservative
References

OpenFOAM
ANSYS 18.1: theory and User Guide.
Dr. Anand Raj
Hariharan OpenFOAM User and Programming Guide.
Approach to the
John D Anderson, Jr., Computational Fluid
problem
Theoretical approach
Dynamics: The basics with applications., Tata
(Analytical approach)
Experimental
McGraw-Hill Edition., 2012.
approach
Numerical approach
(Computational
John C Tannehill, Dale A Anderson, Richard H
approach)
A comparison Pletcher., Computational Fluid Mechanics and Heat
Why computational
method is special transfer., Taylor and Francis., Second Edition.
Types of
computational
Chapman D. R., Computational Aerodynamics
methods
Development and Outlook., AIAAJ., Vol. 17., pp.
Finite volume in a
domain 1293 - 1313.
Governing Kutlet P., Steger J. L., Baily F. R., Status of
equations

Finite Control
Computational Fluid Dynamics in United States.,
Volume
conservative and
AIAA-87-1135-CP.
non-conservative
Acknowlegements

OpenFOAM

Dr. Anand Raj


Hariharan I would like to thank Dr. S. Anillal (CET, Thrivandrum),
Approach to the Prof. T Sundararajan (HOD, ME, IITM), Prof. V. Babu
problem
Theoretical approach (ME,IITM), Prof. V. Raghavan (ME, IITM), Prof. M.
(Analytical approach)
Experimental
approach
Ramakrishna (Aerospace, IITM), Prof. Tapan Senguptha
Numerical approach
(Computational
approach)
(Aerospace, IITK), Prof. Srinivasa Jayanthi (Chemical,
A comparison
Why computational
IITM) who taught me Computational Fluid Dynamics
method is special
(CFD) during PG and PhD. I have gained knowledge just
Types of
computational
methods
because my teachers taught me very well and they made
Finite volume in a
the subject interesting. I would also like to thank Prof.
domain
H. K. Versteeg and Prof. Urmila Ghia for interacting
Governing
equations with research scholars in IITM
Finite Control
Volume
conservative and
non-conservative

You might also like