Beruflich Dokumente
Kultur Dokumente
Contents
Contents
iii
List of Figures
List of Tables
vii
1 Introduction
2 Data Structure and Connectivity Information
2.1 CGNS File Format . . . . . . . . . . . . . . . . . .
2.2 Unstructured Grid Element Numbering Convention
2.3 Evaluating Geometrical Properties . . . . . . . . .
2.4 Need for Efficient Data Structure . . . . . . . . . .
2.5 Data Structure . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3
3
4
7
11
12
21
4 3-D
4.1
4.2
4.3
23
23
23
29
iv
CONTENTS
6.2
6.3
Heated Cavity
49
. . . . . . . . . . . . . . . 49
. . . . . . . . . . . . . . . 50
. . . . . . . . . . . . . . . 56
59
59
60
67
69
69
70
77
Wire Electrostatic
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
Precipitator
79
. . . . . . . . . . 79
. . . . . . . . . . 80
. . . . . . . . . . 84
Term
87
. . . . . . . . . . . . . . . . . . 87
. . . . . . . . . . . . . . . . . . 87
. . . . . . . . . . . . . . . . . . 95
107
. 107
. 108
. 116
119
List of Figures
2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.8
2.9
2.10
2.11
2.12
2.13
2.14
2.15
2.16
2.17
2.18
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4
5
6
6
7
7
8
8
8
9
10
11
12
13
14
15
17
19
. . . . . . . . . . . . . . . . . . 24
. . . . . . . . . . . . . . . . . . 29
(b) v-velocity along horizontal
. . . . . . . . . . . . . . . . . . 30
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
32
37
38
38
vi
LIST OF FIGURES
7.1
7.2
8.1
8.2
8.3
8.4
8.5
9.1
9.2
9.3
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
60
67
67
68
68
. . . . 70
. . . . 77
lines
. . . . 78
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
98
105
105
106
106
List of Tables
7.1 A comparison of average Nusselt number values (a) present solution,
(b) Bennett and Hsueh (non-uniform) [1], (c) Bennett and Hsueh
(uniform) [1], (d) Fusegi et al. [2], (e) %error (relative to (b)) . . . . 57
8.1 A comparison of different parameters with Sharma et al. [3] . . . . . 68
10.1 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
11.1 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Chapter 1
Introduction
This user manual is for the CFD solver, Anupravaha II as a part of the project titled
Development of a General Purpose CFD Solver over a Hybrid Unstructured Grid
that was sanctioned to run from August 03, 2013 to July 02, 2018. The main objective of the proposed project is to develop a general purpose, robust computational
fluid dynamics solver over hybrid unstructured grids.
The generic solver is designed for cross-platform compatibility and works with
Windows, Linux and Mac operating systems. The solver is written in C++ and
requires a C/C++ compiler installed for compilation. In addition, the solver is
linked with thirdparty open source software for efficient solution of linear systems
of equations which requires a Fortran compiler. The solver works with CGNS input
and output data, which is fast becoming an industry standard. The data structure and connectivity information for different elemental topologies are described
in Chapter 2. A detailed overview of setting up and solving a test case within the
Anupravaha II framework are discussed in Chapter 3. The following chapters discuss
the results of validation of specific modules implemented within the framework to
date. Chapters 4 to 6 discuss incompressible constant density flows, while Chapters
7 and 8 deal with heat transfer problems. Phase change forms the subject matter
of Chapter 9 while flows with electric field are presented in Chapters 10 and 11.
Immiscible multifluid flows are discussed in Chapter 12 and turbulent flows with
eddy viscosity models are studied in Chapter 13. Comparative studies are presented
for all reference test problems to demonstrate the efficacy of the implementation.
Introduction
Chapter 2
Data Structure and Connectivity
Information
2.1
The CFD General Notation System (CGNS) provides a general, portable, and extensible standard for the storage and retrieval of computational fluid dynamics
(CFD) analysis data. It is an effort to standardize CFD input and output including grid(both structured and unstructured), flow solutions, connectivity, boundary
conditions and auxiliary information with in a single format.
The system consists of two parts: a standard format for recording the data
and software that reads, writes, and modifies data in that format.The format is
a conceptual entity established by the documentation; the software is a physical
product supplied to enable developers to access and produce data recorded in that
format.
A CGNS file is an entity that is organized (inside the file itself) into a set of
nodes in a tree like structure, in much the same way as directories are organized
in the UNIX environment. The top most node is referred as the root node. Each
node below the root node is defined by both a name and a label, and may or may
not contain information data. Each node can also be a parent to one or more child
node. An example of the CGNS tree like structure is shown in Fig. 2.1
A typical grid for a CFD problem may be divided into several zones each representing a section of the flow domain. In CGNS the CFD data is organised according
Root
Node
Name
Label
Data
Name
Label
Data
Name
Label
Data
Name
Label
Name
Label
Name
Data
Data
Data
Label
2.2
The major difference in the way structured and unstructured grids are recorded
lies in the element definition. In a structured grid, the indices are recorded in
CGNS database
Reference state
zone 1
zone 2
zone N
Grid Coordinates
Multizone interface
Flow solution
connectivity
x
Boundary
conditions
(i1,j+1)
(i+1,j+1)
(i,j+1)
(i,j)
(i1,j)
(i1,j1)
(i+1,j)
(i,j1)
(i+1,j1)
13
12
11
8
18
15
2
9
11
17
22
16
21
6
18
17
13
3
7
19
20
5
2
8
20
15
12
16
4
14
19
10
1
14
10
is shown in Fig. 2.4. The circled numbers are element numbers while the uncircled
ones are the node numbers. For 3-D meshes, CGNS supports four types of linear
element shapes for unstructured grids. These are Tetrahedrals (with four triangular
faces), Pyramids (with one quadrilateral and four triangular faces), Prisms (with two
triangular faces and three quadrilateral faces) and Hexahedrals (with six quadrilateral faces). The boundary patches are described using 2D elements which may be
Triangular or Quadrilateral depending on the type of face of the corresponding 3D
cell that falls on the boundary patch.
The ordering of nodes with in an element is important. Since the nodes in each
element type could be ordered in multiple ways, it is necessary to define numbering
conventions. The following insets describe the element numbering conventions used
in CGNS for the different element types.
N
FACE DEFINITION
FACE
CORNOR NODES
F1
N
3
FACE DEFINITION
2
N1,N2,N3
1
Figure 2.6: Triangular Element- boundary sections only
2.3
The following subsection describes how the different geometrical parameters are calculated.
FACE DEFINITION
FACE CORNOR NODES
3
1
F1
N1 ,N3 ,N2
F2
N1, N2, N4
F3
N2, N3, N4
F4
N3, N1 ,N4
FACE DEFINITION
FACE CORNOR NODES
3
4
F1
N1,N4,N3,N2
F2
N1,N2,N5
F3
N2,N3,N5
F4
N3,N4,N5
F5
N4,N1,N5
N1,N2,N5,N4
N2,N3,N6,N5
F3
F4
F5
N3,N1,N4,N6
N1,N3,N2
N4,N5,N6
5
3
2
1
FACE DEFINITION
FACE CORNOR NODES
F1 N1, N4, N3, N2
F2 N1, N2, N6, N5
F3 N2, N3, N7, N6
F4 N3, N4, N8, N7
F5 N1, N5, N8, N4
F6 N5, N6, N7, N8
Cell center
Cell-center coordinates are evaluated from the means of the coordinate values of
that elements constituting nodes. The number of nodes may vary depending on its
type. So we have,
Pn
Xi
(2.1)
Xc = i=1
n
where n is the number of nodes the element has. For 2D boundary elements, the
formula is same as in Eq. 2.1; only this will be Face Centers.
Surface area
For a triangle as shown in (see Fig. 2.11), with vertices 1, 2, 3. For calculating its
normal or area the idea is to calculate its normal and area is half the length of its
normal. The classical approach is to compute the edge vectors (2-1) and (3-1) and
cross them. Normal(1, 2 ,3)= (2-1) (3-1) and Area(1, 2, 3)= |Normal(1, 2, 3)|/2.
If we expand the cross product, by distribution
(2-1) (3-1) =(2 3) - (2 1) - (1 3) + (1 1)
Since cross product is anticommutative, -(2 1)= (1 2), and since (1 1)=0 we
have Normal(1, 2, 3)= (1 2) + (2 3) + (3 1)
which is the sum of one cross product per side of the triangle, involving two vertices
in the side, in cyclic order.
Similarly for a quad with four vertices 1,2,3,4 we will compute both its surface
area and normal as the sum of the areas and normal of two triangles it is composed
of. (see Fig. 2.12). In this case
Normal(1, 2, 3, 4) = normal(1, 2, 4) + normal (2, 3, 4) = (1 2) + (2 4) + (4
1) + (2 3) + (3 4) + (4 2), again due to anticommutativity of the cross
product (2 4 = -4 2)
10
r31
r21
Volume
The volume of a orientable polyhedron can be calculated using the divergence theorem. Consider the vector field
x1 x2 x3
1
(2.2)
, ,
F (x) = x =
3
3 3 3
whose divergence is identically one. The divergence theorem implies that the volume
is equal to the surface integral ofF (x)
V olume =
FdV =
hence
V olume =
F.
ni dS
1X
xi .ni Ai
3
f acei
(2.3)
(2.4)
11
3
r31
r24
1
2.4
The role of a data structure is to make zones, cells, faces and neighbours easily
accessible for a developer. In case of a structured grids the cells are numbered in
i,j,k format which makes accessing neighbours very easy. In case of an unstructured
grid the cells are numbered in a random way which makes it difficult to know the
neighbours. On a unstructured grid if a cell wants to know its neighbour it has
to go through each N cells, check whether they have a common face and then
decide whether it is a neighbour or not. The job seems to be very easy but it is
computationally very expensive as it is of the order of N 2 as every cell has to go
through each N cells. In order to reduce the computational time we require an
efficient data structure. An efficient data structure will make the code writing a
time taking job initially but it will make sure in the future that for any changes, one
has to do minimum modifications in the code, hence it is very important to have an
efficient data structure for writing a general purpose program.
12
2.5
Data Structure
VERTEX LIST
EDGE LIST
CELL LIST
FACE LIST
13
V5
V3
V4
V1
V2
Figure 2.14: Data Structure
14
Co-ordinates
x1, y1, z1
x2, y2, z2
x3, y3, z3
x4, y4, z4
x5, y5, z5
V1
V2
V3
V4
V5
Now edges will be formed from the vertices and are stored in edge list, edge list
will contain the vertices from which the edges are formed.
E7
E3
E9
E6
E2
E4
E5
E1
Figure 2.15: Data Structure
Table 2: Edge list
Edges
E1
E2
E3
E4
E5
E6
E7
E7
E9
Vertices
V1, V2
V2, V3
V1, V3
V1, V4
V2, V4
V3, V4
V3, V5
V2, V5
V4, V5
E8
15
Now each edge knows its vertices similarly each vertex will also have a list which
will show their respective edges.
Table 3: Vertex List For Edges
Vertex
Edges
E1, E3, E4
E1, E2, E5, E8
E2, E3, E6, E7
E4, E5, E6, E9
E7, E8, E9
V1
V2
V3
V4
V5
From the edges faces will be formed and will be stored in face list, so the face
list will contain the list of edges that form a particular face, from those edges we
can further access the vertexlist.
F7
F5
F3
F4
F2
F1
Figure 2.16: Data Structure
Table 4: Face List
Face
F1
F2
F3
F4
F5
F6
F7
Edges
E1, E5, E4
E1, E2, E3
E4, E6, E3
E5, E2, E6
E5, E8, E9
E2, E8, E7
E7, E9, E6
F6
16
Now since the faces have a list of their respective edges similarly all edges will
also have a list which will store the respective faces for a edge.
17
Faces
F1, F2
F2, F4, F6
F2, F3
F1, F3
F1, F4, F5
F3, F4, F7
F6, F7
F5, F6
F5, F7
E1
E2
E3
E4
E5
E6
E7
E7
E9
Now cells will be formed from the faces and each cell will have a list which will
tell the faces it is made of called cell list.
C1
C0
Faces
F1, F2, F4, F3
F4, F5, F6, F7
As the cells know what faces they are made of similarly faces will also have a list
which will tell the cells they have.
18
Cells
C0
C0
C0
C0, C1
C1
C1
C1
Each cell will also have a vertex list and like wise the vertex will also have a cell
list.
Table 8: Cell List
Cell
C0
C1
Vertex
V1, V2, V3, V4,
V2, V3, V4, V5
Cells
C0
C0, C1
C0, C1
C0, C1
c1
In addition to this a cell will also have a neighbour list, in this case C0 is neighbour of C1 and vice-versa. The entire data structure can be accessed from a Reader.
Thus a reader will have a Zonelist, Celllist, Vertexlist, Boundary list and a Interfacelist.
19
READER
ZONE LIST
Z1, Z2, Z3.......
CELL LIST
VERTEX LIST
VERTEX LIST
CELL LIST
FACE LIST
INTERIOR FACES
BOUNDARY[0]
EDGE LIST
NEIGHBOUR LIST
BOUNDARY FACES
BOUNDARY [1],[2],[3]..
20
Chapter 3
General Procedure for Setting up
a Test Case
The Anupravaha II solver is capable of solving a variety of fluid flow and heat transfer problems. We describe here the generic procedure any user has to follow to set
up a test case and solve it using the Anupravaha II solver. A test case starts with
the problem definition. This includes
a) Knowledge of type of flow and necessary governing equations to be solved.
b) Geometry of the body (if any) and dimensions of closed domain containing it as
well as material properties for the test case.
c) Initial conditions for various parameters and boundary conditions at surfaces.
The user describes the domain into a suitable number of non-overlapping control
volumes (of a suitable shape) using GAMBIT or any commercial software. The
grid generated therein is stored in CGNS (CFD General Notation System) format
for use by the solver. The solver is fundamentally a dimensional solver where all
the inputs are to be given in dimensional form in SI units. However, most of the
available literature presents results in non-dimensional form. So, in order to make
the final results obtained from the solver comparable to the non-dimensional results
of literature, geometry and input parameters are chosen in a way such that the
characteristic scales become unity. For instance, for flow over a circular cylinder,
the cylinder diameter (D) and inlet velocity (U) is made unity; while for flow over
22
backward facing step, the inlet channel width (h) and the mean infow velocity are
kept as unity. The Reynolds number is varied by varying the viscosity of the fluid.
To run any test case, the user generates a file following the steps below.
Step1
The user sets up the specific classes and header files pertaining to the problem.
The user also sets up classes for source terms and diagonal terms according to his
problem specification, as deemed necessary.
Step2
The user defines the argument and sets application for a test case. The user also
defines the CGNS files to be read (corresponding to his problem) in the directory.
The user further needs to define pointers to associate solution variables with different source and diagonal term classes.
Step3
The pointers and the values for the boundary conditions are then defined and the
boundary conditions for various boundaries are explicitly set according to the problem.
Step4
The user then needs to define the initial conditions for the problem and has to provide all necessary inputs for material properties specific to his own problem. These
includes material properties like thermal conductivity (k), dynamic viscosity () etc.
Step5
The convergence criteria for the linear solver as well as time step are defined by the
user. Other constants pertaining to discretization may also be defined at this stage.
The statement application -> execute executes the program and the final output may be saved into a suitable CGNS file. If user feels necessary, the output
at intermediate time intervals may be written into temporary files at a frequency
defined by the user.
Each chapter that follows illustrates these steps as applied to specific problems, so
as to help any new user to learn easily and set up a problem and execute it successfully. Comparisons with references into open literature are provided to enable the
user to assess the accuracy of the solver.
Chapter 4
3-D Lid Driven Cavity Problem
4.1
Problem Definition
The problem considers the laminar flow in a cubical enclosure of dimension 1X1X1
of which the lid is driven by a constant velocity u = 1 as shown in the figure below.
We choose length of the cavity to be unity and density ()=1. The value of dynamic
viscosity () is calculated from
=
1
Re
(4.1)
However, the computation has been carried out in an 1X1X0.5 domain where at
z = 0.5 we have considered a symmetry plane.
4.2
Step1:- Include the header files needed for the test case
a) Including header files for application
#include PravahaFVMApplicationForMomentum.h
b) Including header files for reader and writer
#include PravahaCGNSReader.h
#include PravahaCGNSWriter.h
24
Lid (u=1,v=w=0)
Back wall
(u , v, w =0)
Right wall
(u , v, w =0)
Left
wall
(u , v, w =0)
Bottom wall
Front wall
(u , v, w =0)
(u , v, w =0)
25
#else
#ifdef HAVE CONFIG WIN H
#include lis config win.h
#endif
#endif
Step2:- Begin the test case
a) Set the argument for the test case
int BigNSSolverTestForMomentum(int argc, char *argv[])
int failed = 0;
b) Set the application for the test case
PravahaFVMApplicationForMomentum *application=
PravahaFVMApplicationForMomentum ::New();
c) Read from the CGNS file
char *env = getenv(PRAVAHA DATA ROOT);
Pravahastd::string file name;
if (env == NULL)
cout << Set the environment variable for PRAVAHA DATA ROOT;
failed=1;
else
file name = Pravahastd::string(getenv(PRAVAHA DATA ROOT))
+ /CGNS/3dcavity hex.cgns;
where squareduct2d.cgns is the file read from the folder
Pravaha /PravahaData /CGNS /3dcavity hex.cgns
d) Creating pointers for various source terms
PravahaVelocityUSourceTerm *sourceU=PravahaVelocityUSourceTerm::New();
PravahaVelocityVSourceTerm *sourceV=PravahaVelocityVSourceTerm::New();
PravahaVelocityWSourceTerm *sourceW=PravahaVelocityWSourceTerm::New();
26
PravahaMassVelocityUSourceTerm *masssourceU=PravahaMassVelocityUSourceTerm::New();
PravahaMassVelocityVSourceTerm *masssourceV=PravahaMassVelocityVSourceTerm::New();
PravahaMassVelocityWSourceTerm *masssourceW=PravahaMassVelocityWSourceTerm::New();
e) Attaching variables for invoking source class
reader->SetSourceTerm(MOMENTUM X,sourceU);
reader->SetSourceTerm(MOMENTUM Y,sourceV);
reader->SetSourceTerm(MOMENTUM Z,sourceW);
f) Creating pointers for various diagonal terms
PravahaMomentumDiagonalTermForMomentum *diagonal=
PravahaMomentumDiagonalTermForMomentum::New();
PravahaPressureDiagonalTerm *diagonalp=PravahaPressureDiagonalTerm::New();
PravahaDiagonalTermLis *diagonallis=PravahaDiagonalTermLis::New();
g) Attaching variables for invoking diagonal class
reader->SetDiagonalTerm(PRESSURE,diagonalp);
reader->SetDiagonalTerm(MOMENTUM X,diagonallis);
reader->SetDiagonalTerm(MOMENTUM Y,diagonallis);
Step3:- Applying the boundary conditions
a)Creating pointers for various boundary conditions PravahaDirichletCondition *dirichlet conditionT1=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet condition1=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet conditionT0=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet condition=PravahaDirichletCondition::New();
PravahaNeumannCondition *neumann condition=PravahaNeumannCondition::New();
PravahaSymmetryCondition *symmetry condition=PravahaSymmetryCondition::New();
b) Setting values for various boundary conditions
dirichlet conditionT0->SetValue(0.0);
dirichlet condition->SetValue(0.0);
dirichlet conditionT1->SetValue(1.0);
dirichlet condition1->SetValue(0.0);
neumann condition->SetValue(0.0);
27
28
29
4.3 Results
failed=1;
if (! failed)
cout << Simple Lam Test PASSED ! << endl;
return failed;
These statements must be added by the user in his own test case in order to perform
the simulations.
4.3
Results
Numerical simulation has been performed for Re = 100 for this test case. The
streamlines at z = 0 and z = 0.5 are shown in Fig. 5.2. The u-velocity profile along
the vertical centerline and the v-velocity profile along the horizontal centerlines for
the cubic cavity are shown in the figure below. The comarison with the result of Ku
et al. [4] is good.
0.8
0.6
0.4
0.2
0.1
0.2
0.3
0.4
0.2
0.4
0.6
0.8
30
0.6
Ku et al.
Re = 100
Present results
Ku et al.
Re = 100
present resu
0.4
0.8
0.2
0.6
0
0.4
-0.2
0.2
-0.4
0
-1
(a)
-0.6
0.2
0.4
0.6
0.8
(b)
Figure 4.3: (a) u-velocity along vertical centerline, (b) v-velocity along horizontal
centerline
Chapter 5
Backward Facing Step Flow
5.1
Problem Definition
The problem consists of a flow over a backward facing step with expansion ratio
H/h =1.94. As seen in figure below, h is the inlet height, H is the total height
(S + h) where S denotes the step height. All geometrical length scales are made
dimensionless based on the channel height h, the length of the channel Ld is equal
to 20 times inlet height. In order to simulate a fully developed laminar channel flow
upstream of the step, a standard parabolic velocity profile with a maximum velocity
Umax =3/2Ub is given where Ub is the bulk(average) velocity of the inlet flow. The
only non-dimensional parameter in the governing equation is the Reynolds number.
For the flow problem considered, the following definition is used:
Re = ReD =
Ub D
(5.1)
where and are the density and the dynamic viscosity, respectively. As mentioned
before Ub is the bulk(average) velocity of the inlet flow. D is chosen as the hydraulic
diameter of the inlet channel, which is equivalent to twice its height, D=2h. For the
present test case the inlet velocity is parabolic with Ub =1, =1 and Reynolds no is
varied by changing the dynamic viscosity. This problem has been solved by various
researchers and results of these studies may be found in [5, 6].
32
h
H
Outlet
Inlet
Wall
S=0.94 h
Wall
20 h
5.2
Step1:- Include the header files needed for the test case
a) Including header files for application
#include PravahaFVMApplicationApplicationForMomentum.h
b) Including header files for reader and writer
#include PravahaCGNSReader.h
#include PravahaCGNSWriter.h
c) Including header files for boundary conditions
#include PravahaDirichletCondition.h
#include PravahaNeumannCondition.h
#include PravahaUserDefinedFunctionCondition.h
#include PravahaSymmetryCondition.h
d) Including header files for source terms and diagonal terms appearing in different equations
#include PravahaMassVelocityUSourceTerm.h
#include PravahaMassVelocityVSourceTerm.h
#include PravahaMassVelocityWSourceTerm.h
#include PravahaMomentumDiagonalTerm.h
#include PravahaMomentumDiagonalTermForMomentum.h
33
#include PravahaDiagonalTermLis.h
#include PravahaTemperatureDiagonalTerm.h
#include PravahaPressureDiagonalTerm.h
e) Including Lis header files
The user has to include the header files for the linear solver Lis as shown below:#ifdef HAVE CONFIG H
#include lis config.h
#else
#ifdef HAVE CONFIG WIN H
#include lis config win.h
#endif
#endif
Step2:- Begin the test case
a) Set the argument for the test case
int BackwardStepTestForMomentum(int argc, char *argv[])
int failed = 0;
b) Set the application for the test case
PravahaFVMApplicationForMomentum *application=
PravahaFVMApplicationForMomentum::New();
c) Read from the CGNS file
char *env = getenv(PRAVAHA DATA ROOT);
Pravahastd::string file name;
if (env == NULL)
cout << Set the environment variable for PRAVAHA DATA ROOT;
failed=1;
else
file name = Pravahastd::string(getenv(PRAVAHA DATA ROOT))
+ /CGNS/Step2.cgns;
34
35
dirichlet conditionV->SetValue(0.0);
dirichlet conditionP->SetValue(0.0);
neumann condition->SetValue(0.0);
c) setting the boundary conditions
reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM X,symmetry condition);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MOMENTUM X,function);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM X,dirichlet conditionV);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM X,neumann condition);
reader->GetZone(0)->GetBoundary(1)
->SetCondition(MASS MOMENTUM X,symmetry condition);
reader->GetZone(0)->GetBoundary(4)
->SetCondition(MASS MOMENTUM X,function);
reader->GetZone(0)->GetBoundary(3)
->SetCondition(MASS MOMENTUM X,dirichlet conditionV);
reader->GetZone(0)->GetBoundary(2)
->SetCondition(MASS MOMENTUM X,neumann condition);
reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM Y,symmetry condition);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MOMENTUM Y,dirichlet conditionV);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM Y,dirichlet conditionV);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM Y,neumann condition);
reader->GetZone(0)->GetBoundary(1)
->SetCondition(MASS MOMENTUM Y,symmetry condition);
reader->GetZone(0)->GetBoundary(2)
->SetCondition(MASS MOMENTUM Y,neumann condition);
reader->GetZone(0)->GetBoundary(3)
->SetCondition(MASS MOMENTUM Y,dirichlet conditionV);
reader->GetZone(0)->GetBoundary(4)
->SetCondition(MASS MOMENTUM Y,dirichlet conditionV);
reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM Z,symmetry condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM Z,neumann condition);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM Z,dirichlet conditionV);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MOMENTUM Z,dirichlet conditionV);
reader->GetZone(0)->GetBoundary(1)
->SetCondition(MASS MOMENTUM Z,symmetry condition);
36
reader->GetZone(0)->GetBoundary(2)
->SetCondition(MASS MOMENTUM Z,neumann condition);
reader->GetZone(0)->GetBoundary(3)
->SetCondition(MASS MOMENTUM Z,dirichlet conditionV);
reader->GetZone(0)->GetBoundary(4)
->SetCondition(MASS MOMENTUM Z,dirichlet conditionV);
Step4:- Apply initial condition and set material properties
a) Applying initial condition
reader->ApplyInitialCondition();
b) Set the material properties
reader->SetMaterialProperty(DENSITY,1.0);
reader->SetMaterialProperty(DYNAMIC VISCOSITY,1.0e-2);
c) Set the linear solver mode
i.e., Lis (Matrix Mode Linear) or Gauss-Seidel (Matrix Mode Point by Point). By
default it is point by point. Set this to Lis by
static cast<PravahaNavierStokesTimeStepping *> (application->GetApproach()
->GetTimeStepping())->SetMatrixMode(MATRIX MODE LINEAR);
Step5:- Set time step and convergence criteria
a) Set the time step
PravahaTimeStepping::SetTimeStepType(TIME STEP TYPE MANUAL);
PravahaTimeStepping::SetTimeStep(1.0e-2);
b) Set the convergence value for the variables
PravahaFlowSolution::SetConvergence(MASS VELOCITY U,1.0e-7);
PravahaFlowSolution::SetConvergence(PRESSURE,1.0e-4);
If not specified, the variables takes the the default convergence value set in the
PravahaFlowSolution.cxx.
To run the test case, the following statement must be added.
application->Execute();
The output may be saved in a CGNS file using the following statements.
PravahaWriter *writer=PravahaCGNSWriter::New();
Pravahastd::string write file name = Pravahastd::string(getenv(PRAVAHA DATA ROOT))
37
5.3 Results
+/CGNS/Step out.cgns;
writer->SetName(write file name);
application->SetWriter(writer);
if(!application->Write())
cout <<Failed to Create File Name :<<write file name <<;
cout << Set the environment variable for PRAVAHA DATA ROOT;
failed=1;
if (! failed)
cout << Simple Lam Test PASSED ! << endl;
return failed;
These statements must be added by the user in his own test case in order to perform
the simulations.
5.3
Results
A hexahedral grid with 36000 cells is used for the simulations. The streamlines at
Re=50 and 100 are shown in Figs. 5.2 and 5.3 respectively. The variation of length
x of the primary recirculation region normalized by the step height S is shown in
Fig. 5.4 and results are compared with the published results of Biswas et al. [5].
38
12
11
Biswas et al. [2004]
Anupravaha
10
9
8
x/S
7
6
5
4
3
2
1
0
100
200
300
400
500
600
700
800
ReD
Chapter 6
Unconfined Flow Over Square
Cylinder
6.1
Problem Definition
This problem considers the laminar flow over a heated 2D square shape body. Since
the solver can handle only 3D grids, so in order to simulate 2D problems we specify
symmetry boundary conditions in the z direction. The schematic diagram is shown
in Fig 6.1 where the channel height has been taken as unity and the Reynolds number for the flow is 100. Other quantities like specific heat (Cp ) and density () are
taken as unity. The values of thermal conductivity (k) and dynamic viscosity ()
are calculated from the following relation
1
Re
(6.1)
1
ReP r
(6.2)
=
and
k=
Where Pr is Prandtl number.
6.2
Step1:- Include the header files needed for the test case
a) Including header files for application
40
Outlet
Solid body
boundary no. 1
boundary no. 2
Inlet
boundary no. 3
boundary no. 4
Symmetry
boundary no. 4
41
42
43
reader->SetDiagonalTerm(PRESSURE,diagonalp);
Step3:- Applying the boundary conditions
a)Creating pointers for various boundary conditions
Different classes are available for different types boundaries, so we have to create
different pointers for the respective boundary types.
PravahaDirichletCondition *dirichlet T1=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet 1=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet T0=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet 0=PravahaDirichletCondition::New();
PravahaNeumannCondition *neumann=PravahaNeumannCondition::New();
44
45
reader->SetMaterialProperty(DYNAMIC VISCOSITY,0.05);
reader->SetMaterialProperty(SPECIFIC HEAT,1.0);
reader->SetMaterialProperty(THERMAL CONDUCTIVITY,(1.0/14.0));
c) Set the linear solver mode
For solving pressure, there are different linear solvers available. Please refer Iterative Solver Manual for more details. By default Gauss seidel solver is set. To
change it, we have to change the matrix mode of the respective TimeStepping class
in the following manner:
46
+/CGNS/square out.cgns;
writer->SetName(write file name);
application->SetWriter(writer);
if(!application->Write())
{
cout <<Failed to Create File Name :<<write file name <<;
cout << Set the environment variable for PRAVAHA DATA ROOT;
failed=1;
}
if (! failed)
cout << Simple Lam Test PASSED ! << endl;
return failed;
}
These statements must be added by the user in his own test case in order to perform
the simulations.
6.3
Results
Instantaneous streamlines and isotherms are shown in Fig. 6.2 for Re=100 and time
evolution of drag & lift coefficient and space-averaged Nusselt number are shown in
Fig. 6.3. The values of time averaged drag coefficient and Nusselt number are 1.54
(1.41 in Breuer et al. [7]) and 4.12 (4.03 in Sharma and Eswaran [8]) respectively.
The values are found to be in good comparision with the published results.
47
6.3 Results
(a)
(b)
Figure 6.2: Instantaneous snapshot of (a) streamlines, (b) isotherms
48
CD
CL
1.48
0.4
0.3
0.2
1.47
0.1
0
CD
-0.1
-0.2
CL
1.46
1.45
-0.3
-0.4
1.44
-0.5
-0.6
1.43
50
100
150
200
-0.7
250
Time (s)
(a)
Nusselt Number
4.1275
4.127
4.1265
4.126
4.1255
0
50
100
150
200
250
Time (s)
(b)
Figure 6.3: Time evoultion of (a) drag and lift coefficients, (b) space-averaged Nusselt number
Chapter 7
Natural Convection in a 3-D
Differentially Heated Cavity
7.1
Problem Definition
The problem considers the laminar flow in a cubical enclosure driven by natural
convection where two opposite walls (left and right) are heated differentially. The
other four walls are kept perfectly insulated as shown in the figure below. The fluid
inside the cavity is considered to be air with Prandtl number 0.7. We choose length
of the cavity to be unity. Other quantities are acceleration due to gravity (g)=1;
co-efficient of volume expansion ()=1, specific heat (Cp )=1 and density ()=1. The
values of thermal conductivity (k) and dynamic viscosity () are calculated from
Pr
Ra
(7.1)
1
RaP r
(7.2)
and
k=
Where Ra and Pr are Rayleigh and Prandtl number. This problem has been solved
by various researchers and results of these studies may be found in [1], [2].
50
Adiabatic
Isothermal
(T=1)
Isothermal
(T=0)
Adiabatic
Adiabatic
(u , v, w =0 for all boundaries)
7.2
Step1:- Include the header files needed for the test case
a) Including header files for application
#include PravahaNaturalConvectionApplicationForMomentum.h
b) Including header files for reader and writer
#include PravahaCGNSReader.h
#include PravahaCGNSWriter.h
c) Including header files for boundary conditions
#include PravahaDirichletCondition.h
#include PravahaNeumannCondition.h
d) Including header files for source terms and diagonal terms appearing in different equations
#include PravahaVelocityUBuoyancySourceTerm.h
#include PravahaVelocityVBuoyancySourceTerm.h
#include PravahaVelocityWBuoyancySourceTerm.h
#include PravahaMassVelocityUSourceTerm.h
51
#include PravahaMassVelocityVSourceTerm.h
#include PravahaMassVelocityWSourceTerm.h
#include PravahaMomentumDiagonalTerm.h
#include PravahaMomentumDiagonalTermForMomentum.h
#include PravahaTemperatureDiagonalTerm.h
#include PravahaPressureDiagonalTerm.h
e) Including Lis header files
The user has to include the header files for the linear solver Lis as shown below:#ifdef HAVE CONFIG H
#include lis config.h
#else
#ifdef HAVE CONFIG WIN H
#include lis config win.h
#endif
#endif
Step2:- Begin the test case
a) Set the argument for the test case
int NaturalConvectionSolverTestForMomentum(int argc, char *argv[])
int failed = 0;
b) Set the application for the test case
PravahaNaturalConvectionApplicationForMomentum *application=
PravahaNaturalConvectionApplicationForMomentum::New();
c) Read from the CGNS file
char *env = getenv(PRAVAHA DATA ROOT);
Pravahastd::string file name;
if (env == NULL)
cout << Set the environment variable for PRAVAHA DATA ROOT;
failed=1;
52
else
file name = Pravahastd::string(getenv(PRAVAHA DATA ROOT))
+ /CGNS/squareduct2d.cgns;
where squareduct2d.cgns is the file read from the folder
Pravaha /PravahaData /CGNS /squareduct2d.cgns
d) Creating pointers for various source terms
PravahaVelocityUBuoyancySourceTerm *sourceU=
PravahaVelocityUBuoyancySourceTerm::New();
PravahaVelocityVBuoyancySourceTerm *sourceV=
PravahaVelocityVBuoyancySourceTerm::New();
PravahaVelocityWBuoyancySourceTerm *sourceW=
PravahaVelocityWBuoyancySourceTerm::New();
PravahaMassVelocityUSourceTerm *masssourceU=PravahaMassVelocityUSourceTerm::New();
PravahaMassVelocityVSourceTerm *masssourceV=PravahaMassVelocityVSourceTerm::New();
PravahaMassVelocityWSourceTerm *masssourceW=PravahaMassVelocityWSourceTerm::New();
e) Attaching variables for invoking source class
reader->SetSourceTerm(MOMENTUM X,sourceU);
reader->SetSourceTerm(MOMENTUM Y,sourceV);
reader->SetSourceTerm(MOMENTUM Z,sourceW);
reader->SetSourceTerm(MASS MOMENTUM X,masssourceU);
reader->SetSourceTerm(MASS MOMENTUM Y,masssourceV);
reader->SetSourceTerm(MASS MOMENTUM Z,masssourceW);
f) Creating pointers for various diagonal terms
PravahaMomentumDiagonalTermForMomentum *diagonal=
PravahaMomentumDiagonalTermForMomentum::New();
PravahaTemperatureDiagonalTerm *diagonalt=PravahaTemperatureDiagonalTerm::New();
PravahaPressureDiagonalTerm *diagonalp=PravahaPressureDiagonalTerm::New();
g) Attaching variables for invoking diagonal class
reader->SetDiagonalTerm(MOMENTUM X,diagonal);
reader->SetDiagonalTerm(TEMPERATURE,diagonalt);
53
reader->SetDiagonalTerm(PRESSURE,diagonalp);
Step3:- Applying the boundary conditions
a)Creating pointers for various boundary conditions PravahaDirichletCondition *dirichlet conditionT1=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet condition1=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet conditionT0=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet condition=PravahaDirichletCondition::New();
PravahaNeumannCondition *neumann condition=PravahaNeumannCondition::New();
b) Setting values for various boundary conditions
dirichlet conditionT0->SetValue(0.0);
dirichlet condition->SetValue(0.0);
dirichlet conditionT1->SetValue(1.0);
dirichlet condition1->SetValue(0.0);
neumann condition->SetValue(0.0);
c) setting the boundary conditions
reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM X,dirichlet condition1);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM X,dirichlet condition1);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM X,dirichlet condition1);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MOMENTUM X,dirichlet condition1);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MOMENTUM X,dirichlet condition1);
reader->GetZone(0)->GetBoundary(6)->SetCondition(MOMENTUM X,dirichlet condition1);
reader->GetZone(0)->GetBoundary(1)
->SetCondition(MASS MOMENTUM X,dirichlet condition1);
reader->GetZone(0)->GetBoundary(2)
->SetCondition(MASS MOMENTUM X,dirichlet condition1);
reader->GetZone(0)->GetBoundary(3)
->SetCondition(MASS MOMENTUM X,dirichlet condition1);
reader->GetZone(0)->GetBoundary(4)
->SetCondition(MASS MOMENTUM X,dirichlet condition1);
reader->GetZone(0)->GetBoundary(5)
->SetCondition(MASS MOMENTUM X,dirichlet condition1);
reader->GetZone(0)->GetBoundary(6)
54
55
reader->GetZone(0)->GetBoundary(6)
->SetCondition(MASS MOMENTUM Z,dirichlet condition1);
reader->GetZone(0)->GetBoundary(1)->SetCondition(TEMPERATURE,neumann condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(TEMPERATURE,neumann condition);
reader->GetZone(0)->GetBoundary(3)->SetCondition(TEMPERATURE,neumann condition);
reader->GetZone(0)->GetBoundary(4)->SetCondition(TEMPERATURE,neumann condition);
reader->GetZone(0)->GetBoundary(5)->SetCondition(TEMPERATURE,dirichlet conditionT0);
reader->GetZone(0)->GetBoundary(6)->SetCondition(TEMPERATURE,neumann conditionT1)
Step4:- Apply initial condition and set material properties
a) Applying initial condition
reader->ApplyInitialCondition(TEMPERATURE);
b) Set the material properties
reader->SetMaterialProperty(DENSITY,1.0);
reader->SetMaterialProperty(DYNAMIC VISCOSITY,0.0083666);
reader->SetMaterialProperty(SPECIFIC HEAT,1.0);
reader->SetMaterialProperty(THERMAL CONDUCTIVITY,0.0119522);
reader->SetMaterialProperty(VOLUMETRIC EXPANSION COEFFICIENT,1.0);
reader->SetMaterialProperty(ACCELERATION DUE TO GRAVITY X,0.0);
reader->SetMaterialProperty(ACCELERATION DUE TO GRAVITY Y,(-1.0));
reader->SetMaterialProperty(ACCELERATION DUE TO GRAVITY Z,0.0);
c) Set the linear solver mode
i.e., Lis (Matrix Mode Linear) or Gauss-Seidel (Matrix Mode Point by Point). By
default it is point by point. Set this to Lis by
static cast<PravahaNavierStokesTimeStepping *> (application->GetApproach()
->GetTimeStepping())->SetMatrixMode(MATRIX MODE LINEAR);
Step5:- Set time step and convergence criteria
a) Set the time step
PravahaTimeStepping::SetTimeStepType(TIME STEP TYPE MANUAL);
PravahaTimeStepping::SetTimeStep(1.0e-2);
b) Set the convergence value for the variables
PravahaFlowSolution::SetConvergence(MASS VELOCITY U,1.0e-7);
PravahaFlowSolution::SetConvergence(PRESSURE,1.0e-4);
56
PravahaFlowSolution::SetConvergence(TEMPERATURE,9.0e-7);
If not specified, the variables takes the the default convergence value set in the
PravahaFlowSolution.cxx.
To run the test case, the following statement must be added.
application->Execute();
The output may be saved in a CGNS file using the following statements.
PravahaWriter *writer=PravahaCGNSWriter::New();
Pravahastd::string write file name = Pravahastd::string(getenv(PRAVAHA DATA ROOT))
+/CGNS/squareduct2d out.cgns;
writer->SetName(write file name);
application->SetWriter(writer);
if(!application->Write())
cout <<Failed to Create File Name :<<write file name <<;
cout << Set the environment variable for PRAVAHA DATA ROOT;
failed=1;
if (! failed)
cout << Simple Lam Test PASSED ! << endl;
return failed;
These statements must be added by the user in his own test case in order to perform
the simulations.
7.3
Results
Numerical simulations have been performed for different values of Ra and Pr under
Boussinesqs approximation for this test case. The isotherms obtained for three dif-
57
7.3 Results
ferent Ra for Pr=0.7 are shown below. Undulations observed in the isotherms are
by virtue of different elements employed in the hybrid mesh.
(a)
(b)
(c)
104
105
106
2.2%
Chapter 8
Mixed Convection Over a 2-D
Square Cylinder
8.1
Problem Definition
This test case presents the steps for solving a mixed convective flow around bluff
bodies. The physical geometry of the problem considered is shown in Fig.8.1.A fixed
two-dimensional square cylinder with side B = 1 is heated or cooled to a constant
temperature TW = 1. This cylinder is exposed to a constant free-stream upward
velocity and temperature fields represented by vf = 1 and Tf = 0 respectively. In
order to make the problem computationally feasible, artificial confining boundaries
are placed around the flow, where free-slip boundary conditions are applied. The
blockage ratio ( i.e. the ratio of the width of the cylinder B to the horizontal
1
distance between the left and right artificial boundaries, L) is taken as 30
.The total
nondimensional vertical length of the computational domain is taken as 40 where
the distance between the inlet plane and the bottom surface of the cylinder, HU ,
and the distance between the top surface of the cylinder and the exit plane, HD , are
taken as 5 and 34 respectively.
The Reynolds number, Prandtl number and Richardson number are 100, 0.7, 1.0
respectively. Most of the researchers solved this type of problem by using nondimensional governing equations. In order to compare the present results with Sharma et
al. [3], the fluid and thermodynamic properties are chosen as follows:
Dynamic viscosity () =
1
Re
1
100
= 0.01,
60
Outflow Boundary
H D =34
H=40
B=1
Slip
Boundary
Square
TW =1
H U =5
X
Vf =1 Tf =0
Inflow Boundary
1
ReP r
1
1000.7
= 0.0142857,
8.2
Step1:- Include the header files needed for the test case
a) Including header files for application
#include PravahaNaturalConvectionApplicationForMomentum.h
b) Including header files for reader and writer
#include PravahaCGNSReader.h
#include PravahaCGNSWriter.h
c) Including header files for boundary conditions
#include PravahaDirichletCondition.h
#include PravahaNeumannCondition.h
61
d) Including header files for source terms and diagonal terms appearing in different equations
#include PravahaVelocityUBuoyancySourceTerm.h
#include PravahaVelocityVBuoyancySourceTerm.h
#include PravahaVelocityWBuoyancySourceTerm.h
#include PravahaMassVelocityUSourceTerm.h
#include PravahaMassVelocityVSourceTerm.h
#include PravahaMassVelocityWSourceTerm.h
#include PravahaMomentumDiagonalTerm.h
#include PravahaMomentumDiagonalTermForMomentum.h
#include PravahaTemperatureDiagonalTerm.h
#include PravahaPressureDiagonalTerm.h
e) Including Lis header files
The user has to include the header files for the linear solver Lis as shown below:#ifdef HAVE CONFIG H
#include lis config.h
#else
#ifdef HAVE CONFIG WIN H
#include lis config win.h
#endif
#endif
Step2:- Begin the test case
a) Set the argument for the test case
int NaturalConvectionSolverTestForMomentum(int argc, char *argv[])
int failed = 0;
b) Set the application for the test case
PravahaNaturalConvectionApplicationForMomentum *application=
PravahaNaturalConvectionApplicationForMomentum::New();
c) Read from the CGNS file
62
63
PravahaMomentumDiagonalTermForMomentum::New();
PravahaTemperatureDiagonalTerm *diagonalt=PravahaTemperatureDiagonalTerm::New();
PravahaPressureDiagonalTerm *diagonalp=PravahaPressureDiagonalTerm::New();
g) Attaching variables for invoking diagonal class
reader->SetDiagonalTerm(MOMENTUM X,diagonal);
reader->SetDiagonalTerm(TEMPERATURE,diagonalt);
reader->SetDiagonalTerm(PRESSURE,diagonalp);
Step3:- Applying the boundary conditions
a)Creating pointers for various boundary conditions PravahaDirichletCondition *dirichlet conditionT1=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet condition1=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet conditionT0=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet condition=PravahaDirichletCondition::New();
PravahaNeumannCondition *neumann condition=PravahaNeumannCondition::New();
b) Setting values for various boundary conditions
dirichlet conditionT0->SetValue(0.0);
dirichlet condition->SetValue(0.0);
dirichlet conditionT1->SetValue(1.0);
dirichlet condition1->SetValue(1.0);
neumann condition->SetValue(0.0);
c) setting the boundary conditions
reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM X,neumann condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM X,dirichlet condition);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM X,dirichlet condition);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MOMENTUM X,neumann condition);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MOMENTUM X,dirichlet condition);
reader->GetZone(0)->GetBoundary(1)
->SetCondition(MASS MOMENTUM X,neumann condition);
reader->GetZone(0)->GetBoundary(2)
->SetCondition(MASS MOMENTUM X,dirichlet condition);
reader->GetZone(0)->GetBoundary(3)
64
65
reader->GetZone(0)->GetBoundary(1)->SetCondition(TEMPERATURE,neumann condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(TEMPERATURE,neumann condition);
reader->GetZone(0)->GetBoundary(3)->SetCondition(TEMPERATURE,dirichlet conditionT1);
reader->GetZone(0)->GetBoundary(4)->SetCondition(TEMPERATURE,neumann condition);
reader->GetZone(0)->GetBoundary(5)->SetCondition(TEMPERATURE,dirichlet conditionT0);
reader->GetZone(0)->GetBoundary(1)->SetCondition(PRESSURE,neumann condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(PRESSURE,neumann condition);
reader->GetZone(0)->GetBoundary(3)->SetCondition(PRESSURE,neumann condition);
reader->GetZone(0)->GetBoundary(4)->SetCondition(PRESSURE,dirichlet condition);
reader->GetZone(0)->GetBoundary(5)->SetCondition(PRESSURE,neumann condition);
Step4:- Apply initial condition and set material properties
a) Applying initial condition
reader->ApplyInitialCondition(TEMPERATURE);
b) Set the material properties
reader->SetMaterialProperty(DENSITY,1.0);
reader->SetMaterialProperty(DYNAMIC VISCOSITY,0.01);
reader->SetMaterialProperty(SPECIFIC HEAT,1.0);
reader->SetMaterialProperty(THERMAL CONDUCTIVITY,0.0142857);
reader->SetMaterialProperty(VOLUMETRIC EXPANSION COEFFICIENT,1.0);
reader->SetMaterialProperty(ACCELERATION DUE TO GRAVITY X,0.0);
reader->SetMaterialProperty(ACCELERATION DUE TO GRAVITY Y,(-1.0));
reader->SetMaterialProperty(ACCELERATION DUE TO GRAVITY Z,0.0);
c) Set the linear solver mode
i.e., Lis (Matrix Mode Linear) or Gauss-Seidel (Matrix Mode Point by Point). By
default it is point by point. Set this to Lis by
static cast<PravahaNavierStokesTimeStepping *> (application->GetApproach()
->GetTimeStepping())->SetMatrixMode(MATRIX MODE LINEAR);
Step5:- Set time step and convergence criteria
a) Set the time step
PravahaTimeStepping::SetTimeStepType(TIME STEP TYPE MANUAL);
PravahaTimeStepping::SetTimeStep(1.0e-3);
b) Set the convergence value for the variables
66
PravahaFlowSolution::SetConvergence(PRESSURE,1.0e-12);
PravahaFlowSolution::SetConvergence(TEMPERATURE,1.0e-8);
If not specified, the variables takes the the default convergence value (1.0e 6)
set in the PravahaFlowSolution.cxx.
To run the test case, the following statement must be added.
application->Execute();
The output may be saved in a CGNS file using the following statements.
PravahaWriter *writer=PravahaCGNSWriter::New();
Pravahastd::string write file name = Pravahastd::string(getenv(PRAVAHA DATA ROOT))
+/CGNS/SquareCyl Ri1 Re100 Pr07 dt-3 Tconv-8 out.cgns;
writer->SetName(write file name);
application->SetWriter(writer);
if(!application->Write())
cout <<Failed to Create File Name :<<write file name <<;
cout << Set the environment variable for PRAVAHA DATA ROOT;
failed=1;
if (! failed)
cout << Simple Lam Test PASSED ! << endl;
return failed;
These statements must be added by the user in his own test case in order to perform
the simulations.
67
8.3 Results
8.3
Results
By following the above mentioned steps, a case with Re = 100, P r = 0.7 and
Ri = 1.0 was tested whose results are shown below.
68
CL
0.04
-0.04
-0.08
10
20
30
40
50
2.8
CD
2.6
2.4
2.2
10
20
30
40
50
Present
% error
2.74
2.63
-0.04 %
2.29
2.258
-0.014 %
4.94
4.9
-0.008%
Chapter 9
Mushy Region Phase Change
Problem with Convection
9.1
Problem Definition
This is a general phase change problem with natural convection. In this case, phase
change occurs over a temperature range (e.g. alloys). To solve two-dimensional
problem (1 1) in three-dimensional code, one cell is used in the z-direction. A
cubical enclosure is filled with the liquid having initial temperature T =0.5. The
following properties of the liquid are taken in the simulation Voller and Prakash [9].
specific heat (cp )=1
thermal conductivity ()=0.001
dynamic viscosity ()=0.01
density ()=1
volume expansion ()=0.01
half-mushy range ()=0.1
latent heat (L) =5.0
melting temperature(Tm )=0.0
These parameters leads to Ra=104, Pr=10 and St=5.0. At time t > 0 left wall
temperature is reduced to 0.5 which is below the melting point temperature and
right wall is kept at its initial temperature. All the other faces are having adiabatic
boundary condition. As a result, solidification occurs in the presence of natural
convection and the mushy zone is moving in the positive x direction. The solver
70
finds the position of the mushy zone at different times. The problem is actually taken
from , but they have taken very high Pr (Pr=1000). A very high Pr liquid demands
a high computational time [10]. Therefore to reduce the time for the present case
T = 0.5
T = 0.5
T = 0.5
H= 1
L=1
9.2
Step1:- Include the header files needed for the test case
a) Including header files for application
#include PravahaSolidificationApplication.h
b) Including header files for reader and writer
#include PravahaCGNSReader.h
#include PravahaCGNSWriter.h
c) Including header files for boundary conditions
#include PravahaDirichletCondition.h
#include PravahaNeumannCondition.h
71
d) Including header files for source terms and diagonal terms appearing in different equations
#include PravahaSolution.h
#include PravahaEnthalpyVelocityUSourceTerm.h
#include PravahaEnthalpyVelocityVSourceTerm.h
#include PravahaEnthalpyVelocityWSourceTerm.h
#include PravahaEnthalpyMassVelocityUsourceTerm.h
#include PravahaEnthalpyMassVelocityVsourceTerm.h
#include PravahaEnthalpyMassVelocityWsourceTerm.h
#include PravahaEnthalpyDiagonalTerm.h
#include PravahaMomentumDiagonalTerm.h
#include PravahaMushyLatentSourceTerm.h
#include PravahaPressureDiagonalTerm.h
#include PravahaInterpolateFaceFlux.h
e) Including Lis header files
The user has to include the header files for the linear solver Lis as shown below:#ifdef HAVE CONFIG H
#include lis config.h
#else
#ifdef HAVE CONFIG WIN H
#include lis config win.h
#endif
#endif
Step2:- Begin the test case
a) Set the argument for the test case
int MushyRegionTest(int argc, char *argv[])
int failed = 0;
b) Set the application for the test case
PravahaSolidificationApplication *application=PravahaSolidificationApplication::New();
c) Read from the CGNS file
72
73
PravahaMomentumDiagonalTerm *diagonal=PravahaMomentumDiagonalTerm::New();
PravahaEnthalpyDiagonalTerm *diagonalt=PravahaEnthalpyDiagonalTerm::New();
PravahaPressureDiagonalTerm *diagonalp=PravahaPressureDiagonalTerm::New();
g) Attaching variables for invoking diagonal class
reader->SetDiagonalTerm(VELOCITY U,diagonal);
reader->SetDiagonalTerm(ENTHALPY S,diagonalt);
reader->SetDiagonalTerm(PRESSURE,diagonalp);
Step3:- Applying the boundary conditions
a)Creating pointers for various boundary conditions PravahaDirichletCondition *dirichlet conditionT1=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet condition1=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet conditionT0=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet condition=PravahaDirichletCondition::New();
PravahaNeumannCondition *neumann condition=PravahaNeumannCondition::New();
b) Setting values for various boundary conditions
dirichlet conditionT0->SetValue(-0.5);
dirichlet condition->SetValue(0.0);
dirichlet conditionT1->SetValue(0.5);
dirichlet condition1->SetValue(0.0);
neumann condition->SetValue(0.0);
c) setting the boundary conditions
reader->GetZone(0)->GetBoundary(1)->SetCondition(ENTHALPY S,neumann condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(ENTHALPY S,dirichlet conditionT0);
reader->GetZone(0)->GetBoundary(4)->SetCondition(ENTHALPY S,neumann condition);
reader->GetZone(0)->GetBoundary(6)->SetCondition(ENTHALPY S,neumann condition);
reader->GetZone(0)->GetBoundary(5)->SetCondition(ENTHALPY S,dirichlet conditionT1);
reader->GetZone(0->GetBoundary(3)->SetCondition(ENTHALPY S,neumann condition);
reader->GetZone(0)->GetBoundary(1)->SetCondition(VELOCITY U,neumann condition);
reader->GetZone(0)->GetBoundary(6)->SetCondition(VELOCITY U,neumann condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(VELOCITY U,dirichlet condition1);
reader->GetZone(0)->GetBoundary(5)->SetCondition(VELOCITY U,dirichlet condition1);
74
75
76
PravahaSolution::SetMeltingTemp(0.0);
PravahaSolution::SetSolidusTemperature(-0.1);
PravahaSolution::SetLiquidusTemperature(0.1);
PravahaSolution::SetLatentHeat(5.0);
PravahaSolution::SetVolumetricExpansionCoefficient(0.01);
PravahaSolution::SetAccelerationDuetoGravityY(10.00);
PravahaSolution::SetAccelerationDuetoGravityX(0.00);
PravahaSolution::SetAccelerationDuetoGravityZ(0.00);
Step5:- Set time step and convergence criteria
PravahaFlowSolution::SetConvergence(MASS VELOCITY U,1.0e-7);
PravahaFlowSolution::SetConvergence(PRESSURE,1.0e-4);
PravahaFlowSolution::SetConvergence(ENTHALPY S,9.0e-7);
PravahaFlowSolution::SetConvergence(ENTHALPY L,9.0e-7);
If not specified, the variables takes the the default convergence value set in the
PravahaFlowSolution.cxx.
To run the test case, the following statement must be added.
application->Execute();
The output may be saved in a CGNS file using the following statements.
PravahaWriter *writer=PravahaCGNSWriter::New();
Pravahastd::string write file name = Pravahastd::string(getenv(PRAVAHA DATA ROOT))
+/CGNS/MUSHYREGION out.cgns;
writer->SetName(write file name);
application->SetWriter(writer);
if(!application->Write())
cout <<Failed to Create File Name :<<write file name <<;
cout << Set the environment variable for PRAVAHA DATA ROOT;
failed=1;
77
9.3 Results
if (! failed)
cout << Simple Lam Test PASSED ! << endl;
return failed;
These statements must be added by the user in his own test case in order to perform
the simulations.
9.3
Results
0.1
0.1
-0.1
0.8
MUSHY REGION
0.6
0.2
SOLID
0.4
LIQUID
0.4
MUSHY ZONE
SOLID
0.6
LIQUID
-0.1
0.8
0.2
0.2
0.4
0.6
0.8
1
0
(a)
0.2
0.4
0.6
0.8
(b)
Figure 9.2: Mushy zone and vector plot at (a) t=200 sec, (b) t=600 sec
78
1
Anupravaha I
Anupravaha I
Anupravaha I
Present
Y=0.25
0.8
0.5
0.6
0
Anupravaha I
Anupravaha I
Present
Y=0.5
0.4
-0.5
0.2
Y=0.75
-1
0.2
0.4
0.6
0.8
0.2
0.4
(a)
0.6
0.8
(b)
Figure 9.3: (a) u-velocity comparison at t=500sec, (b) solidus and liquidus lines
comparison at t=1000sec
Chapter 10
Electrical Field in a 3-D Single
Wire Electrostatic Precipitator
10.1
Problem Definition
The problem consists of a wire, to which potential is applied and a plate which
is electrically grounded as shown in Fig.10.1 below. Below table 10.1 shows the
dimensions and properties used for calculations.
76 mm
Wire-Plate spacing, H
114 mm
2 mm
Permittivity,
1.6 e-04 m2 /V s
1.0 e-02 m2 /s
80
Plate
123
Plate
Symmetry
Solution
domain
Cyclic
114 mm
Symmetry
Wire
y
z
x
0.5 m
152 mm
10.2
Step1:- Include the header files needed for the test case
a) Including header files for application
#include PravahaElectricfieldApplication.h
b) Including header files for reader and writer
#include PravahaCGNSReader.h
#include PravahaCGNSWriter.h
c) Including header files for boundary conditions
#include PravahaDirichletCondition.h
#include PravahaNeumannCondition.h
#include PravahaElectricCondition.h
d) Including header files for source terms and diagonal terms appearing in different equations
#include PravahaElectricfieldDiagonalTerm.h
#include PravahaChargeDiagonalTerm.h
e) Including Lis header files
The user has to include the header files for the linear solver Lis as shown below:#ifdef HAVE CONFIG H
81
82
83
84
if (! failed)
cout << Simple Lam Test PASSED ! << endl;
return failed;
These statements must be added by the user in his own test case in order to perform
the simulations.
10.3
Results
Numerical simulations have been performed for a applied volate of 46200 V. The
Fig. 10.2(a) shows the contours of electric potential and Fig. 10.2(b) shows contours
of ion charge density.
(a)
(b)
Figure 10.2: Contours, (a) Electric potential, (b) Ion charge density
85
10.3 Results
Variation of electric potential along the plane from wire to plate can be seen in
Fig. 10.3(a). And at end plane in Fig. 10.3(b). The results obtained are in good
agreement with Long et al. [11].
50000
25000
Pravaha
Long et.al.
Pravaha
Long et.al.
20000
40000
30000
15000
20000
10000
10000
5000
0.02
0.04
0.06
0.08
Coordinate Y (m)
(a)
0.1
0.12
0.02
0.04
0.06
0.08
0.1
0.12
Coordinate Y (m)
(b)
Figure 10.3: Potential variation along, (a) Wire-Plate plane, (b) End plane
Chapter 11
Fluid Flow with Electric Field
Source Term
11.1
Problem Definition
The problem considers fully developed laminar flow in a channel as shown in Fig.11.1.
It consists of imaginary discharge electrode at the inlet and imaginary collecting
electrode at the outlet. By assuming linear variation of electric potential (Eq.11.1)
along the length of the channel and a constant value of charge density throughout
the channel, analytical solution can be postulated (Eq.11.2). The table 11.1 consists
of properties used for the calculations.
11.2
h
xi
= 0 1
L
(11.1)
(11.2)
Step1:- Include the header files needed for the test case
a) Including header files for application
#include PravahaElectricfieldApplication.h
88
11111111111111111111111111111111111111
00000000000000000000000000000000000000
00000000000000000000000000000000000000
11111111111111111111111111111111111111
00000000000000000000000000000000000000
11111111111111111111111111111111111111
Y
u(y)
H
X
11111111111111111111111111111111111111
00000000000000000000000000000000000000
00000000000000000000000000000000000000
11111111111111111111111111111111111111
6.0 m
1.0 m
102 N-s/m2
0.0
103 coulombs/m3
Electric potential,
0 to 1000 V
89
#include PravahaElectricMassVSourceTerm.h
#include PravahaElectricMassWSourceTerm.h
#include PravahaElectricfieldDiagonalTerm.h
#include PravahaChargeDiagonalTerm.h
#include PravahaMomentumDiagonalTerm.h
#include PravahaPressureDiagonalTerm.h
e) Including Lis header files
The user has to include the header files for the linear solver Lis as shown below:#ifdef HAVE CONFIG H
#include lis config.h
#else
#ifdef HAVE CONFIG WIN H
#include lis config win.h
#endif
#endif
Step2:- Begin the test case
a) Set the argument for the test case
int ElectricfieldSolverTest(int argc, char *argv[])
int failed = 0;
b) Set the application for the test case
PravahaElectricfieldApplication *application=PravahaElectricfieldApplication::New();
c) Read from the CGNS file
char *env = getenv(PRAVAHA DATA ROOT);
Pravahastd::string file name;
if (env == NULL)
cout << Set the environment variable for PRAVAHA DATA ROOT;
failed=1;
else
file name = Pravahastd::string(getenv(PRAVAHA DATA ROOT))
90
+ /CGNS/channel.cgns;
where channel.cgns is the file read from the folder
Pravaha /PravahaData /CGNS /channel.cgns
d) Creating pointers for various source terms
PravahaElectricUSourceTerm *sourceElectricU=PravahaElectricUSourceTerm::New();
PravahaElectricVSourceTerm *sourceElectricV=PravahaElectricVSourceTerm::New();
PravahaElectricWSourceTerm *sourceElectricW=PravahaElectricWSourceTerm::New();
PravahaElectricMassUSourceTerm *sourceElectricMassU=
PravahaElectricMassUSourceTerm::New();
PravahaElectricMassVSourceTerm *sourceElectricMassV=
PravahaElectricMassVSourceTerm::New();
PravahaElectricMassWSourceTerm *sourceElectricMassW=
PravahaElectricMassWSourceTerm::New();
e) Attaching variables for invoking source class
reader->SetSourceTerm(VELOCITY U,sourceElectricU);
reader->SetSourceTerm(VELOCITY V,sourceElectricV);
reader->SetSourceTerm(VELOCITY W,sourceElectricW);
reader->SetSourceTerm(MASS VELOCITY U,sourceElectricMassU);
reader->SetSourceTerm(MASS VELOCITY V,sourceElectricMassV);
reader->SetSourceTerm(MASS VELOCITY W,sourceElectricMassW);
f) Creating pointers for various diagonal terms
PravahaElectricfieldDiagonalTerm *diagonale=
PravahaElectricfieldDiagonalTerm::New();
PravahaChargeDiagonalTerm *diagonalc=PravahaChargeDiagonalTerm::New();
PravahaMomentumDiagonalTerm *diagonal=PravahaMomentumDiagonalTerm::New();
PravahaPressureDiagonalTerm *diagonalp=PravahaPressureDiagonalTerm::New();
g) Attaching variables for invoking diagonal class
reader->SetDiagonalTerm(ELECTRIC POTENTIAL,diagonale);
reader->SetDiagonalTerm(ION CHARGE DENSITY,diagonalc);
reader->SetDiagonalTerm(VELOCITY U,diagonal);
91
reader->SetDiagonalTerm(PRESSURE,diagonalp);
Step3:- Applying the boundary conditions
a)Creating pointers for various boundary conditions PravahaDirichletCondition *dirichlet conditionE1=PravahaDirichletCondition::New();
PravahaElectricCondition *iterative condition=PravahaElectricCondition::New();
PravahaDirichletCondition *dirichlet conditionE0=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet condition=PravahaDirichletCondition::New();
PravahaNeumannCondition *neumann condition=PravahaNeumannCondition::New();
PravahaUserDefinedFunctionCondition *UDF condition=
PravahaUserDefinedFunctionCondition::New();
b) Setting values for various boundary conditions
dirichlet conditionE0->SetValue(46200.0);
dirichlet conditionE1->SetValue(0.0);
dirichlet condition1->SetValue(0.0);
neumann condition->SetValue(0.0);
c) setting the boundary conditions
reader->GetZone(0)->GetBoundary(1)->
SetCondition(ELECTRIC POTENTIAL,dirichlet conditionE0);
reader->GetZone(0)->GetBoundary(2)->
SetCondition(ELECTRIC POTENTIAL,dirichlet conditionE1);
reader->GetZone(0)->GetBoundary(3)->
SetCondition(ELECTRIC POTENTIAL,neumann condition);
reader->GetZone(0)->GetBoundary(4)->
SetCondition(ELECTRIC POTENTIAL,neumann condition);
reader->GetZone(0)->GetBoundary(5)->
SetCondition(ELECTRIC POTENTIAL,neumann condition);
reader->GetZone(0)->GetBoundary(6)->
SetCondition(ELECTRIC POTENTIAL,neumann condition1);
reader->GetZone(0)->GetBoundary(1)->
SetCondition(ION CHARGE DENSITY,iterative condition);
reader->GetZone(0)->GetBoundary(2)->
92
93
94
reader->GetZone(0)->GetBoundary(1)->SetCondition(PRESSURE,dirichlet condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(PRESSURE,neumann condition);
reader->GetZone(0)->GetBoundary(3)->SetCondition(PRESSURE,neumann condition);
reader->GetZone(0)->GetBoundary(4)->SetCondition(PRESSURE,neumann condition);
reader->GetZone(0)->GetBoundary(5)->SetCondition(PRESSURE,neumann condition);
reader->GetZone(0)->GetBoundary(6)->SetCondition(PRESSURE,neumann condition);
Step4:- Set timestep and material properties
a) Setting timestep
PravahaSolution::SetTimeStep(1.0e-3);
b) Set the material properties
reader->SetChargeDiffusionCoefficient(1.0e-2);
reader->SetIonMobilityRate(1.6e-4);
reader->SetDielectricConstant(8.854e-12);
reader->SetRho(1.0);
reader->SetDynamicViscosity(1.0e-2);
b) Set the convergence value for the variables
PravahaFlowSolution::SetConvergence(ELECTRIC POTENTIAL,1.0e-4);
PravahaFlowSolution::SetConvergence(ION CHARGE DENSITY,1.0e-10);
PravahaFlowSolution::SetConvergence(VELOCITY U,1.0e-8);
PravahaFlowSolution::SetConvergence(VELOCITY V,1.0e-8);
PravahaFlowSolution::SetConvergence(VELOCITY W,1.0e-8);
PravahaFlowSolution::SetConvergence(PRESSURE,1.0e-4);
If not specified, the variables takes the the default convergence value set in the
PravahaFlowSolution.cxx.
To run the test case, the following statement must be added.
application->Execute();
The output may be saved in a CGNS file using the following statements.
PravahaWriter *writer=PravahaCGNSWriter::New();
Pravahastd::string write file name = Pravahastd::string(getenv(PRAVAHA DATA ROOT))
+/CGNS/channel out.cgns;
11.3 Results
95
if (! failed)
cout << Simple Lam Test PASSED ! << endl;
return failed;
These statements must be added by the user in his own test case in order to perform
the simulations.
11.3
Results
We calculated the inlet pressure with parabolic inlet velocity u = 4y(1y) for different applied potential on the imaginary discharge electrode and compared with the
analytical solution of Eq. 11.2. The results shown in Fig.11.2 are in good agreement
with analytical solution.
96
0.4
Analytical
Numerical
Pressure
0.2
-0.2
-0.4
200
400
600
800
1000
Chapter 12
Collapse of Water Column
12.1
Problem Definition
This test case is also referred as the Dam break problem. The domain is a 5 1.5
rectangular tank with a 1 1 water column placed at the left corner. The fluids are
water and air. The Reynolds number for the simulation is chosen to be 43000, while
the Froude number is unity. The domain is discretised using hexahedral elements.
The simulation is carried out using a constant time step of t = 0.001 until t=2.5.
The schematic diagram is shown in Fig. 12.1 . The values of dynamic viscosity ()
is calculated from the following relation
=
12.2
1
Re
Step1:- Include the header files needed for the test case
a) Including header files for application
#include PravahaVOFapplication.h
b) Including header files for reader and writer
#include PravahaCGNSReader.h
#include PravahaCGNSWriter.h
(12.1)
98
Water Column
boundary 4
Open Atmosphere
boundary 3
Slip Wall
boundary 1
Slip Wall
boundary 2
99
100
Similar to boundary condition, there are different source term classes for different
types of problems. In order to create pointers for it and to set it for different variables, following has to be written in the test cases.
PravahaVOFVelocityUSourceTerm *sourceU;
sourceU=PravahaVOFVelocityUSourceTerm::New();
PravahaVOFVelocityVSourceTerm *sourceV
sourceV=PravahaVOFVelocityVSourceTerm::New();
PravahaVOFVelocityWSourceTerm *sourceW
sourceW=PravahaVOFVelocityWSourceTerm::New();
PravahaVOFMassVelocityUSourceTerm *sourceMassU;
sourceMassU=PravahaVOFMassVelocityUSourceTerm::New();
PravahaVOFMassVelocityVSourceTerm *sourceMassV
sourceMassV=PravahaVOFMassVelocityVSourceTerm::New();
PravahaVOFMassVelocityWSourceTerm *sourceMassW
sourceMassW=PravahaVOFMassVelocityWSourceTerm::New();
PravahaVolumeFractionSourceTerm *sourceVOF
sourceVOF=PravahaVolumeFractionSourceTerm::New();
e) Attaching variables for invoking source class
reader->SetSourceTerm(VELOCITY U,sourceU);
reader->SetSourceTerm(VELOCITY V,sourceV);
reader->SetSourceTerm(VELOCITY W,sourceW);
reader->SetSourceTerm(MASS VELOCITY U,sourceMassU);
reader->SetSourceTerm(MASS VELOCITY V,sourceMassV);
reader->SetSourceTerm(MASS VELOCITY W,sourceMassW);
reader->SetSourceTerm(VOLUME FRACTION,sourceVOF);
f) Creating pointers for various diagonal terms
By default the solver is Gauss Seidel for Pressure and Jacobi for Momentum, so in
order to create pointers for its diagonal term and to set it for different variables,
following has to be written in the test cases.
PravahaMomentumDiagonalTerm *diagonal;
*diagonal=PravahaMomentumDiagonalTerm::New();
101
PravahaVolumeFractionDiagonalTerm *diagonalvof;
diagonalvof=PravahaVolumeFractionDiagonalTerm::New();
PravahaVOFPressureDiagonalTerm *diagonalp;
diagonalp=PravahaVOFPressureDiagonalTerm::New();
g) Attaching variables for invoking diagonal class
reader->SetDiagonalTerm(MOMENTUM X,diagonal);
reader->SetDiagonalTerm(VOLUME FRACTION,diagonalvof);
reader->SetDiagonalTerm(PRESSURE,diagonalp);
Step3:- Applying the boundary conditions
a)Creating pointers for various boundary conditions
Different classes are available for different types boundaries, so we have to create
different pointers for the respective boundary types.
102
103
reader->GetZone(0)->GetBoundary(2)->SetCondition(VOLUME FRACTION,neumann);
reader->GetZone(0)->GetBoundary(3)->SetCondition(VOLUME FRACTION,neumann);
reader->GetZone(0)->GetBoundary(4)->SetCondition(VOLUME FRACTION,neumann);
reader->GetZone(0)->GetBoundary(5)->SetCondition(VOLUME FRACTION,neumann);
reader->GetZone(0)->GetBoundary(6)->SetCondition(VOLUME FRACTION,neumann);
reader->GetZone(0)->GetBoundary(1)->SetCondition(PRESSURE,dirichlet 0);
reader->GetZone(0)->GetBoundary(2)->SetCondition(PRESSURE,neumann);
reader->GetZone(0)->GetBoundary(3)->SetCondition(PRESSURE,neumann);
reader->GetZone(0)->GetBoundary(4)->SetCondition(PRESSURE,dirichlet 0);
reader->GetZone(0)->GetBoundary(5)->SetCondition(PRESSURE,neumann);
reader->GetZone(0)->GetBoundary(6)->SetCondition(PRESSURE,neumann);
Step4:- Setting material properties and linear solver mode
b) Set the properties
PravahaVOFApproach::SetRho1(1000.0);
PravahaVOFApproach::SetRho2(20.0);
PravahaVOFApproach::SetDynamicViscosity1(0.00024);
PravahaVOFApproach::SetDynamicViscosity2(0.000024);
c) Set the linear solver mode
For solving pressure, there are different linear solvers available. Please refer Iterative Solver Manual for more details. By default Gauss seidel solver is set. To
change it, we have to change the matrix mode of the respective TimeStepping class
in the following manner:
104
105
12.3 Results
the simulations.
12.3
Results
Initial position and position of the water column after 2 sec has been shown in Fig.
12.2 and 12.3 respectively. The position of the water front and height of water
column has been compared with the benchmark result of Martin and Moyce [12]
and is shown in Figs. 12.4 and 12.5. The results are found to be in good agreement
with the published results.
106
3.5
Present
Martin & Moyce
Interface Position
2.5
1.5
0.5
1.5
2.5
Non-Dimensional Time
Present
Martin & Moyce
Column height
0.9
0.8
0.7
0.6
0.5
0
0.5
1.5
2.5
Non-Dimensional time
Chapter 13
Turbulent Flows Through Channel
13.1
Problem Definition
This problem considers the turbulent flow through a channel with a Reynolds number based on inlet height and inlet velocity of 13750. The schematic diagram has
been shown in Fig. 13.1. The values of molecular dynamic viscosity () is calculated
from the following relation.
=
1
Re
(13.1)
Wall
Outlet
boundary no 1
boundary no 6
Inlet
boundary no 4
Wall
boundary no 2
108
13.2
Step1:- Include the header files needed for the test case
a) Including header files for application
#include PravahaTurbulentKepsilonApplication.h
b) Including header files for reader and writer
#include PravahaCGNSReader.h
#include PravahaCGNSWriter.h
c) Including header files for boundary conditions
#include PravahaDirichletCondition.h
#include PravahaNeumannCondition.h
#include PravahaTurbulentEpsilonWallCondition.h
#include PravahaTurbulentMassVelocitiesWallCondition.h
#include PravahaTurbulentVelocitiesWallCondition.h
#include PravahaNeumannCondition.h
d) Including header files for source terms and diagonal terms appearing in different equations
#include PravahaTurbulentVelocityUSourceTerm.h
#include PravahaTurbulentVelocityVSourceTerm.h
#include PravahaTurbulentVelocityWSourceTerm.h
#include PravahaTurbulentMassVelocityUSourceTerm.h
#include PravahaTurbulentMassVelocityVSourceTerm.h
#include PravahaTurbulentMassVelocityWSourceTerm.h
#include PravahaTurbulentEpsilonSourceTerm.h
#include PravahaTurbulentKineticEnergySourceTerm.h
#include PravahaMomentumDiagonalTermForMomentum.h
#include PravahaPressureDiagonalTerm.h
e) Including Lis header files
109
The user has to include the header files for the linear solver Lis as shown below:#ifdef HAVE CONFIG H
#include lis config.h
#else
#ifdef HAVE CONFIG WIN H
#include lis config win.h
#endif
#endif
Step2:- Begin the test case
a) Set the argument for the test case
int TurbulentChannelSolverTest(int argc, char *argv[])
int failed = 0;
b) Set the application for the test case
There are different applications available for dealing with different types of problems. For this problem we need the following application:
PravahaTurbulentKepsilonApplication *application=
PravahaTurbulentKepsilonApplication::New();
c) Read from the CGNS file
In order to read and write the files, first we have to set the environment variable for
our system. And then put the input file inside the CGNS folder which is a subfolder
of the PravahaData folder.
char *env = getenv(PRAVAHA DATA ROOT);
Pravahastd::string file name;
if (env == NULL)
cout << Set the environment variable for PRAVAHA DATA ROOT;
failed=1;
else
file name = Pravahastd::string(getenv(PRAVAHA DATA ROOT))
+ /CGNS/chn.cgns;
110
111
112
113
reader->GetZone(0)->GetBoundary(5)->SetCondition(MOMENTUM Y,neumann);
reader->GetZone(0)->GetBoundary(6)->SetCondition(MOMENTUM Y,dirichlet 0);
reader->GetZone(0)->GetBoundary(1)->
SetCondition(MASS MOMENTUM Y,neumann);
reader->GetZone(0)->GetBoundary(2)->
SetCondition(MASS MOMENTUM Y,MsVelWallCndtn);
reader->GetZone(0)->GetBoundary(3)->
SetCondition(MASS MOMENTUM Y,neumann);
reader->GetZone(0)->GetBoundary(4)->
SetCondition(MASS MOMENTUM Y,MsVelWallCndtn);
reader->GetZone(0)->GetBoundary(5)->
SetCondition(MASS MOMENTUM Y,neumann);
reader->GetZone(0)->GetBoundary(6)->
SetCondition(MASS MOMENTUM Y,dirichlet 0);
reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM Z,neumann);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM Z,VelWallCndtn);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM Z,dirichlet 0);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MOMENTUM Z,VelWallCndtn);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MOMENTUM Z,dirichlet 0);
reader->GetZone(0)->GetBoundary(6)->SetCondition(MOMENTUM Z,dirichlet 0);
reader->GetZone(0)->GetBoundary(1)->
SetCondition(MASS MOMENTUM Z,neumann);
reader->GetZone(0)->GetBoundary(2)->
SetCondition(MASS MOMENTUM Z,MsVelWallCndtn);
reader->GetZone(0)->GetBoundary(3)->
SetCondition(MASS MOMENTUM Z,dirichlet 0);
reader->GetZone(0)->GetBoundary(4)->
SetCondition(MASS MOMENTUM Z,MsVelWallCndtn);
reader->GetZone(0)->GetBoundary(5)->
SetCondition(MASS MOMENTUM Z,dirichlet 0);
reader->GetZone(0)->GetBoundary(6)->
SetCondition(MASS MOMENTUM Z,dirichlet 0);
114
reader->GetZone(0)->GetBoundary(1)
->SetCondition(TURBULENT KINETIC ENERGY,neumann);
reader->GetZone(0)->GetBoundary(2)
->SetCondition(TURBULENT KINETIC ENERGY,neumann);
reader->GetZone(0)->GetBoundary(3)
->SetCondition(TURBULENT KINETIC ENERGY,neumann);
reader->GetZone(0)->GetBoundary(4)
->SetCondition(TURBULENT KINETIC ENERGY,neumann);
reader->GetZone(0)->GetBoundary(5)
->SetCondition(TURBULENT KINETIC ENERGY,neumann);
reader->GetZone(0)->GetBoundary(6)
->SetCondition(TURBULENT KINETIC ENERGY,dirichlet K0);
reader->GetZone(0)->GetBoundary(1)->SetCondition(EPSILON,neumann);
reader->GetZone(0)->GetBoundary(2)->SetCondition(EPSILON,EwallCondition);
reader->GetZone(0)->GetBoundary(3)->SetCondition(EPSILON,neumann);
reader->GetZone(0)->GetBoundary(4)->SetCondition(EPSILON,EwallCondition);
reader->GetZone(0)->GetBoundary(5)->SetCondition(EPSILON,neumann);
reader->GetZone(0)->GetBoundary(6)->SetCondition(EPSILON,dirichlet E0);
Step4:- Setting material properties and linear solver mode
double dynamic viscosity=(1.0/13750.0);
b) Set the material properties
reader->SetMaterialProperty(DENSITY,1.0);
reader->SetMaterialProperty(TURBULENT CONSTANT VISCOSITY,dynamic viscosity);
reader->SetMaterialProperty(DYNAMIC VISCOSITY,dynamic viscosity);
reader->SetMaterialProperty(SPECIFIC HEAT,1.0);
reader->SetMaterialProperty(THERMAL CONDUCTIVITY,1.0);
c) Set the linear solver mode
For solving pressure, there are different linear solvers available. Please refer Iterative Solver Manual for more details. By default Gauss seidel solver is set. To
change it, we have to change the matrix mode of the respective TimeStepping class
in the following manner:
115
116
}
if (! failed)
cout << Simple Lam Test PASSED ! << endl;
return failed;
}
These statements must be added by the user in his own test case in order to perform
the simulations.
13.3
Results
The velocity vector in channel flow is shown in Fig. 13.2(a). The results for this
test case is compared with the results of Mansour et al. [13] and Kumar [14] in Fig.
13.2(b) and it is found to be in good agreement with the published results.
117
13.3 Results
0.8
0.6
0.4
0.2
0
48.5
49
49.5
(a)
Present
Inder
DNS (Mansour et al.)
Y/(H/2)
0.8
0.6
0.4
0.2
0.6
0.7
0.8
0.9
U/Uc
(b)
Figure 13.2: (a) Velocity vector, (b) velocity profile comparison at outlet
References
[1] Bennet B.A.V. and Hsueh J. (2006) Natural convection in a cubical cavity: Implicit numerical solution of two benchmark problems, Numerical Heat Transfer
A, vol. 50, pp. 99123.
[2] Fusegi T., Hyun J.M., Kuwahara K., and Farouk B. (1991) A numerical study
of three-dimensional natural convection in a differntially heated cubic cavity
enclosure, International Journal of Heat and Mass Transfer, vol. 34, pp. 1543
1557.
[3] Sharma A. and Eswaran V. (2004) Efeect of aiding and opposing buoyancy
on the heat and fluid flow across a square cylinder at re=100, Numerical Heat
Transfer, Part A, vol. 45, pp. 601624.
[4] Ku H.C., Hirish R.C., and Taylor T. (1987) A pseudospectral method for solution of the three-dimensional incompressible navier-stokes equation, Journal
of Computational Physics, vol. 70, pp. 439462.
[5] Biswas G., Breuer M., and Durst F. (2004) Backward-facing step flows for
various expansion ratios at low and moderate reynolds numbers, ASME, vol.
126.
[6] Armaly B., Durst F., Peireira J., and Schonung B. (1983) Experimental and
theoretical investigation of backward-facing step flow, J. Fluid Mech, vol. 127,
pp. 473496.
[7] M. Breuer J. Bernsdorf T.Z.F.D. (2000) Accurate computations of the laminar
flow past a square cylinder based on two different methods: lattice-boltzmann
and finite-volume, International Journal of Heat and Fluid Flow, vol. 21, pp.
186196.
120
REFERENCES
[8] M. Breuer J. Bernsdorf T.Z.F.D. (2004) Heat and fluid flow across a square
cylinder in the two-dimensional laminar flow regime, Numerical Heat Transfer
Part A, vol. 45, pp. 247269.
[9] Voller V. and Prakash C. (1987) A fixed grid numerical modelling methodology
for convection-diffusion mushy region phase change problems, Int. J. Heat mass
transfer, vol. 30(8), pp. 17091719.
[10] Babu A.B. (2006) Numerical simulation of solidification and melting problems,
iit kanpur, Masters thesis.
[11] Long Z., Yao Q., Song Q., and Li S. (2009) A second-order accurate finite
volume method for the computation of electrical conditions inside a wire-plate
electrostatic precipitator on unstructured meshes, Journal of Electrostatics,
vol. 67, pp. 597604.
[12] J. C. Martin W.M. (1952) An experimental study of collaspe of liquid column
on the rigid horizontal plan, Mathematical and Physical Sciences, vol. 244, pp.
312324.
[13] Mansour N.N. Kim J. M.P. (1988) Reynolds stress and dissipation rete budgets
in a turbulet channel flow, Journal of Fluid Mechanics, vol. 194, pp. 1544.
[14] Kumar I. (2008) Development of an unstructured hybrid grid solver with implementation of eddy viscosity turbulence models and conjugate heat transfer,
m.tech. thesis, .