Sie sind auf Seite 1von 128

Development of a General Purpose CFD Solver

Over a Hybrid Unstructured Grid

User Manual (DRAFT)

IITG-IITH-IITK-DAE MOU signed on March 14, 2013


Sanction No. 2013/36/25-BRNS/1303 dated August 03, 2013

DEPARTMENT OF MECHANICAL ENGINEERING


INDIAN INSTITUTE OF TECHNOLOGY GUWAHATI
GUWAHATI - 781 039, INDIA
April 2014

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

3 General Procedure for Setting up a Test Case

21

4 3-D
4.1
4.2
4.3

23
23
23
29

Lid Driven Cavity Problem


Problem Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Detailed Steps for Test Case . . . . . . . . . . . . . . . . . . . . . . .
Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5 Backward Facing Step Flow


31
5.1 Problem Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.2 Detailed Steps for Test Case . . . . . . . . . . . . . . . . . . . . . . . 32
5.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6 Unconfined Flow Over Square Cylinder
39
6.1 Problem Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

iv

CONTENTS

6.2
6.3

Detailed Steps for Test Case . . . . . . . . . . . . . . . . . . . . . . . 39


Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

7 Natural Convection in a 3-D Differentially


7.1 Problem Definition . . . . . . . . . . . . .
7.2 Detailed Steps for Test Case . . . . . . . .
7.3 Results . . . . . . . . . . . . . . . . . . . .

Heated Cavity
49
. . . . . . . . . . . . . . . 49
. . . . . . . . . . . . . . . 50
. . . . . . . . . . . . . . . 56

8 Mixed Convection Over a 2-D Square Cylinder


8.1 Problem Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.2 Detailed Steps for Test Case . . . . . . . . . . . . . . . . . . . . . . .
8.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

59
59
60
67

69
69
70
77

Mushy Region Phase Change Problem with Convection


9.1 Problem Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2 Detailed Steps for Test Case . . . . . . . . . . . . . . . . . . . . . . .
9.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10 Electrical Field in a 3-D Single


10.1 Problem Definition . . . . . .
10.2 Detailed Steps for Test Case .
10.3 Results . . . . . . . . . . . . .

Wire Electrostatic
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .

11 Fluid Flow with Electric Field Source


11.1 Problem Definition . . . . . . . . . .
11.2 Detailed Steps for Test Case . . . . .
11.3 Results . . . . . . . . . . . . . . . . .

Precipitator
79
. . . . . . . . . . 79
. . . . . . . . . . 80
. . . . . . . . . . 84

Term
87
. . . . . . . . . . . . . . . . . . 87
. . . . . . . . . . . . . . . . . . 87
. . . . . . . . . . . . . . . . . . 95

12 Collapse of Water Column


97
12.1 Problem Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
12.2 Detailed Steps for Test Case . . . . . . . . . . . . . . . . . . . . . . . 97
12.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
13 Turbulent Flows Through Channel
13.1 Problem Definition . . . . . . . . . . . . . . . . . . . . . . . . . . .
13.2 Detailed Steps for Test Case . . . . . . . . . . . . . . . . . . . . . .
13.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
References

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

CGNS tree structure . . . . . . . . . . . . . .


CGNS DataBase Hierarchy . . . . . . . . . . .
Example of a 2D Structured Grid . . . . . . .
Example of a 2D Unstructured Grid . . . . . .
Quadrilateral Element- boundary section only
Triangular Element- boundary sections only .
Tetrahedral Element . . . . . . . . . . . . . .
Pyramidal Element . . . . . . . . . . . . . . .
Prismatic Element . . . . . . . . . . . . . . .
Hexahedral Element . . . . . . . . . . . . . .
Surface Area evaluation for Triangular face . .
Surface Area evaluation for Quadrilateral face
Data Structure . . . . . . . . . . . . . . . . .
Data Structure . . . . . . . . . . . . . . . . .
Data Structure . . . . . . . . . . . . . . . . .
Data Structure . . . . . . . . . . . . . . . . .
Data Structure . . . . . . . . . . . . . . . . .
Data Structure . . . . . . . . . . . . . . . . .

4.1 differentially heated cavity . . . . . .


4.2 differentially heated cavity . . . . . .
4.3 (a) u-velocity along vertical centerline,
centerline . . . . . . . . . . . . . . .
5.1
5.2
5.3
5.4

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

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

Backward Step flow configuration . . . . . . . .


Streamlines at Re=50 . . . . . . . . . . . . . . .
Streamlines at Re=100 . . . . . . . . . . . . . .
Comparison of the primary recirculation length

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

32
37
38
38

6.1 Flow over bluff body . . . . . . . . . . . . . . . . . . . . . . . . . . . 40


6.2 Instantaneous snapshot of (a) streamlines, (b) isotherms . . . . . . . 47
6.3 Time evoultion of (a) drag and lift coefficients, (b) space-averaged
Nusselt number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

vi

LIST OF FIGURES

7.1
7.2

differentially heated cavity . . . . . . . . . . . . . . . . . . . . . . . . 50


Isotherms, (a) Ra=104, (b) Ra=105, (c) Ra=106 . . . . . . . . . . . . 57

8.1
8.2
8.3
8.4
8.5

Mixed convection over square cylinder . . . . .


Streamlines near the cylinder at Ri=1.0 . . . . .
Isotherms near the cylinder at Ri=1.0 . . . . . .
Temporal variation of lift coefficient at Ri=1.0 .
Temporal variation of drag coefficient at Ri=1.0

9.1
9.2
9.3

Geometry for mushy region problem . . . . . . . . . . . . . . .


Mushy zone and vector plot at (a) t=200 sec, (b) t=600 sec . .
(a) u-velocity comparison at t=500sec, (b) solidus and liquidus
comparison at t=1000sec . . . . . . . . . . . . . . . . . . . . .

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

60
67
67
68
68

. . . . 70
. . . . 77
lines
. . . . 78

10.1 Electrostatic precipitator model . . . . . . . . . . . . . . . . . . . . . 80


10.2 Contours, (a) Electric potential, (b) Ion charge density . . . . . . . . 84
10.3 Potential variation along, (a) Wire-Plate plane, (b) End plane . . . . 85
11.1 Fully developed channel flow . . . . . . . . . . . . . . . . . . . . . . . 88
11.2 Variation of inlet pressure with electric potential . . . . . . . . . . . . 96
12.1
12.2
12.3
12.4
12.5

Collapse of Water Column . . . . . . .


Initial position of water column . . . .
Position of water front after 2 seconds .
Comparision of dam front . . . . . . .
Comparision of dam height . . . . . . .

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

98
105
105
106
106

13.1 Turbulent Flow through Channel . . . . . . . . . . . . . . . . . . . . 107


13.2 (a) Velocity vector, (b) velocity profile comparison at outlet . . . . . 117

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

CGNS File Format

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

Data Structure and Connectivity Information

Root
Node
Name
Label
Data

Name
Label
Data

Name
Label
Data

Name
Label

Name
Label

Name

Data

Data

Data

Label

Figure 2.1: CGNS tree structure


to a topologically based hierarchal tree structure. In this topologically based graph,
overall organization is by the zone; information pertaining to a particular zone,
including its grid coordinates or flow solution, hangs off that zone.
A simplified illustration of the database hierarchy is shown in Fig. 2.2. Hanging off the root node of the database is a node containing global reference state
information, such as free stream condition, global convergence criteria etc. Grid
Coordinates of the mesh points, flow solution data arrays, boundary conditions and
connectivity information etc, all hang from the individual zone nodes. The Fig. 2.2
only shows the nodes that hang off the first zone; similar nodes will hang off each
zone in the database.

2.2

Unstructured Grid Element Numbering Convention

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

2.2 Unstructured Grid Element Numbering Convention

CGNS database

Reference state

zone 1

zone 2

zone N

Grid Coordinates
Multizone interface

Flow solution

connectivity
x

Boundary
conditions

Figure 2.2: CGNS DataBase Hierarchy


(i, j, k) format (for 3D cases) and elements are indexed by the minimum of the
connecting vertices. An example is shown for a 2D structured grid in Fig. 2.3.
Thus in a structured grid, the elements can be recomputed using the computational
coordinates.
The element number [i, j] will always be made up of nodes [i, j], [i+1, j], [i+1,
j+1] and [i, j+1]. Its four neighboring elements will be [i-1, j] to the left, [i+1, j] to
the right, [i, j+1] at the top, and [i, j-1] at the bottom. Clearly there is no need to
store element connectivity information for structured grids. However, connectivity
between zones would have to be stored as the latter do not have the same predictable
pattern as elements with in zones.
In an unstructured grid, the nodes are numbered using single index convention
from 1 to N, where N denotes the number of nodes in that zone. Further the node
numbering follows no particular order. So element-connectivity information i.e., the
information that tells us what are the node numbers that constitute a particular
element, cannot be built easily. This additional information is generally added to
the data file. The element information typically includes the element type or shape,
and list of nodes for each element.
An example of 2D unstructured grid with Quadrilateral and Triangular elements

Data Structure and Connectivity Information

(i1,j+1)

(i+1,j+1)

(i,j+1)

(i,j)

(i1,j)

(i1,j1)

(i+1,j)

(i,j1)

(i+1,j1)

Figure 2.3: Example of a 2D Structured Grid

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

Figure 2.4: Example of a 2D Unstructured Grid

2.3 Evaluating Geometrical Properties

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

N1, N2, N3, N4

Figure 2.5: Quadrilateral Element- boundary section only

N
3

FACE DEFINITION
2

FACE CORNOR NODES


F1

N1,N2,N3

1
Figure 2.6: Triangular Element- boundary sections only

2.3

Evaluating Geometrical Properties

The following subsection describes how the different geometrical parameters are calculated.

Data Structure and Connectivity Information


4

FACE DEFINITION
FACE CORNOR NODES
3
1

F1

N1 ,N3 ,N2

F2

N1, N2, N4

F3

N2, N3, N4

F4

N3, N1 ,N4

Figure 2.7: Tetrahedral Element


5

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

Figure 2.8: Pyramidal Element


6
FACE DEFINITION
4

FACE CORNER NODES


F1
F2

N1,N2,N5,N4
N2,N3,N6,N5

F3
F4
F5

N3,N1,N4,N6
N1,N3,N2
N4,N5,N6

Figure 2.9: Prismatic Element

2.3 Evaluating Geometrical Properties


7

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

Figure 2.10: Hexahedral Element

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

Data Structure and Connectivity Information

r31

r21

Figure 2.11: Surface Area evaluation for Triangular face


hence Normal (1, 2, 3, 4)= (1 2) + (2 3) + (3 4) + (4 1) which is again a
cyclic alphabetically sorted summation of one cross product per side of the polygon.
and Area= |Normal(1, 2, 3, 4)|/2
This can be applied for any n sided polygon. Thus for n vertices Vi i=(0,1,2.....n-1)
forming a polygon
Pn1
Normal(V0 , V1 ....Vn1 ) = i=0
Vi Vi+1

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

2.4 Need for Efficient Data Structure

3
r31

r24
1

Figure 2.12: Surface Area evaluation for Quadrilateral face


Using this formula the volume can be calculated for any type of cell like prism,
pyramid, hexahedral, tetrahedral, which we are going to use for our general purpose
solver.

2.4

Need for Efficient Data Structure

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 and Connectivity Information

Data Structure

The large computational time required for neighbour calculation is overcome by


creating a data structure which has provision for a vertex list, cell list and boundary
list(which includes face list) these are the high level data structure, using this the
large computational time is overcome at the expense of memory required for storing
data. In general the data structure is made of vertexlist, edgelist, facelist and celllist.
A vertex can have access to its celllist and edge list, similarly a edge can have access
to its facelist and vertexlist, a face can have access to its edgelist and cell-list and
cell can have access to its vertex list and facelist. In addition to this a cell will have
an extra neighbour list. Further the complete data structure is explained with the

VERTEX LIST

EDGE LIST

CELL LIST

FACE LIST

Figure 2.13: Data Structure


help of two pyramid cells. The moment a grid is read by CGNS it will automatically
number the vertices which have the co-ordinates, these vertices are stored in a list
called vertex list which will have x,y,z co-ordinates of respective vertex.

13

2.5 Data Structure

V5
V3

V4

V1

V2
Figure 2.14: Data Structure

14

Data Structure and Connectivity Information

Table 1: Vertex list


Vertices

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

2.5 Data Structure

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

Data Structure and Connectivity Information

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

2.5 Data Structure

Table 5: Edge List For a Face


Edges

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

Figure 2.17: Data Structure


Table 6: Cell List
Cell
C0
C1

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

Data Structure and Connectivity Information

Table 7: Face List


Face
F1
F2
F3
F4
F5
F6
F7

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

Table 9: Vertex List For Cells


Vertex
V1
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

2.5 Data Structure

READER
ZONE LIST
Z1, Z2, Z3.......

CELL LIST

VERTEX LIST

BOUNDARY LIST INTERFACE LIST


ZONE LIST

VERTEX LIST
CELL LIST
FACE LIST

INTERIOR FACES
BOUNDARY[0]
EDGE LIST

NEIGHBOUR LIST
BOUNDARY FACES
BOUNDARY [1],[2],[3]..

Figure 2.18: Data Structure


The following information can be accessed from the data structure.
Number of zones, number of cells, for each cell the cellid, cellcenter and volume
of the cell.
Number of boundary. Boundary[0] corresponds to interior faces and rest are
boundary faces.
For each face one can get the center, normal, unit normal, component area
and distance between the cell centers of the cells adjoined by that face in case of a
boundary face, distance is the distance between face center and cell center of the
cell adjoining boundary face.
Each face can access its owner and neighbour cells. cell[0] is owner cell for a
face and cell[1] is neighbour cell for a face. For a cell to be owner cell its unit normal
should point outward i.e (positive) and for a cell to be neighbour its unit normal
will be pointing inward i.e (negative).

20

Data Structure and Connectivity Information

Number of interfaces. From each interface the corresponding zones can be


accessed.

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

General Procedure for Setting up a Test Case

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

Detailed Steps for Test Case

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

3-D Lid Driven Cavity Problem

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)

Figure 4.1: differentially heated cavity


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 PravahaVelocityUSourceTerm.h
#include PravahaVelocityVSourceTerm.h
#include PravahaVelocityWSourceTerm.h
#include PravahaMassVelocityUSourceTerm.h
#include PravahaMassVelocityVSourceTerm.h
#include PravahaMassVelocityWSourceTerm.h
#include PravahaMomentumDiagonalTerm.h
#include PravahaMomentumDiagonalTermForMomentum.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

4.2 Detailed Steps for Test Case

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

3-D Lid Driven Cavity Problem

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);

4.2 Detailed Steps for Test Case

27

c) setting the boundary conditions


reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM X,dirichlet condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM X,neumann condition);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM X,dirichlet condition1);
reader->GetZone(0)->GetBoundary(1)
->SetCondition(MASS MOMENTUM X,dirichlet condition);
reader->GetZone(0)->GetBoundary(2)
->SetCondition(MASS MOMENTUM X,neumann condition);
reader->GetZone(0)->GetBoundary(3)
->SetCondition(MASS MOMENTUM X,dirichlet condition1);
reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM Y,dirichlet condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM Y,neumann condition);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM Y,dirichlet condition);
reader->GetZone(0)->GetBoundary(1)
->SetCondition(MASS MOMENTUM Y,dirichlet condition);
reader->GetZone(0)->GetBoundary(2)
->SetCondition(MASS MOMENTUM Y,neumann condition);
reader->GetZone(0)->GetBoundary(3)
->SetCondition(MASS MOMENTUM Y,dirichlet condition);
reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM Z,dirichlet condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM Z,dirichlet condition);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM Z,dirichlet condition);
reader->GetZone(0)->GetBoundary(1)
->SetCondition(MASS MOMENTUM Z,dirichlet condition);
reader->GetZone(0)->GetBoundary(2)
->SetCondition(MASS MOMENTUM Z,dirichlet condition);
reader->GetZone(0)->GetBoundary(3)
->SetCondition(MASS MOMENTUM Z,dirichlet condition);
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);
Step4:- Apply initial condition and set material properties
b) Set the material properties
reader->SetMaterialProperty(DENSITY,1.0);
reader->SetMaterialProperty(DYNAMIC VISCOSITY,0.01);

28

3-D Lid Driven Cavity Problem

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 MOMENTUM X,CONVERGENCE);
PravahaFlowSolution::SetConvergence(MASS MOMENTUM Y,CONVERGENCE);
PravahaFlowSolution::SetConvergence(MASS MOMENTUM Z,CONVERGENCE);
PravahaFlowSolution::SetConvergence(MOMENTUM X,CONVERGENCE);
PravahaFlowSolution::SetConvergence(MOMENTUM Y,CONVERGENCE);
PravahaFlowSolution::SetConvergence(MOMENTUM Z,CONVERGENCE);
PravahaFlowSolution::SetConvergence(PRESSURE,CONVERGENCE);
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/3dcavity hex 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;

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

Figure 4.2: differentially heated cavity

30

3-D Lid Driven Cavity Problem

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

-0.8 -0.6 -0.4 -0.2

(a)

0.2 0.4 0.6 0.8

-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

Backward Facing Step Flow

h
H

Outlet

Inlet

Wall

S=0.94 h
Wall
20 h

Figure 5.1: Backward Step flow configuration

5.2

Detailed Steps for Test Case

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

5.2 Detailed Steps for Test Case

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

Backward Facing Step Flow

where Step2.cgns.cgns is the file read from the folder


Pravaha /PravahaData /CGNS /Step2.cgns
d) Creating pointers for various source terms
PravahaVelocityUSourceTerm *sourceU=PravahaVelocityUSourceTerm::New();
PravahaVelocityVSourceTerm *sourceV=PravahaVelocityVSourceTerm::New();
PravahaVelocityWSourceTerm *sourceW=PravahaVelocityWSourceTerm::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();
PravahaTemperatureDiagonalTerm *diagonalt=PravahaTemperatureDiagonalTerm::New();
PravahaPressureDiagonalTerm *diagonalp=PravahaPressureDiagonalTerm::New();
PravahaDiagonalTermLis *diagonallis=PravahaDiagonalTermLis::New();
g) Attaching variables for invoking diagonal class
reader->SetDiagonalTerm(MOMENTUM X,diagonal);
reader->SetDiagonalTerm(MASS MOMENTUM X,diagonallis);
reader->SetDiagonalTerm(TEMPERATURE,diagonalt);
reader->SetDiagonalTerm(PRESSURE,diagonalp);
Step3:- Applying the boundary conditions
a)Creating pointers for various boundary conditions PravahaDirichletCondition *dirichlet conditionV=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet conditionP=PravahaDirichletCondition::New();
PravahaNeumannCondition *neumann condition=PravahaNeumannCondition::New();
PravahaUserDefinedFunctionCondition *function=PravahaUserDefinedFunctionCondition::New();
PravahaSymmetryCondition *symmetry condition=PravahaSymmetryCondition::New();
b) Setting values for various boundary conditions

5.2 Detailed Steps for Test Case

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

Backward Facing Step Flow

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].

Figure 5.2: Streamlines at Re=50

38

Backward Facing Step Flow

Figure 5.3: Streamlines at Re=100

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

Figure 5.4: Comparison of the primary recirculation length

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

Detailed Steps for Test Case

Step1:- Include the header files needed for the test case
a) Including header files for application

40

Unconfined Flow Over Square Cylinder


Symmetry

Outlet

Solid body
boundary no. 1

boundary no. 2

Inlet

boundary no. 3

boundary no. 4

Symmetry
boundary no. 4

Figure 6.1: Flow over bluff body


#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 PravahaVelocityUSourceTerm.h
#include PravahaVelocityVSourceTerm.h
#include PravahaVelocityWSourceTerm.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

6.2 Detailed Steps for Test Case

41

#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 FlowOverCylinderTest(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 coupled approach which is available in Natural
Convection Application.
PravahaNaturalConvectionApplicationForMomentum *application=
PravahaNaturalConvectionApplicationForMomentum::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/square.cgns;
}

42

Unconfined Flow Over Square Cylinder

where square.cgns is the file read from the folder


Pravaha /PravahaData /CGNS /square.cgns
d) Creating pointers for various source terms
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.
PravahaVelocityUSourceTerm *sourceU;
sourceU=PravahaVelocityUSourceTerm::New();
PravahaVelocityVSourceTerm *sourceV
sourceV=PravahaVelocityVSourceTerm::New();
PravahaVelocityWSourceTerm *sourceW
sourceW=PravahaVelocityWSourceTerm::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
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.
PravahaMomentumDiagonalTermForMomentum *diagonal;
*diagonal=PravahaMomentumDiagonalTermForMomentum::New();
PravahaTemperatureDiagonalTerm *diagonalt;
diagonalt=PravahaTemperatureDiagonalTerm::New();
PravahaPressureDiagonalTerm *diagonalp;
diagonalp=PravahaPressureDiagonalTerm::New();
g) Attaching variables for invoking diagonal class
reader->SetDiagonalTerm(MOMENTUM X,diagonal);
reader->SetDiagonalTerm(TEMPERATURE,diagonalt);

6.2 Detailed Steps for Test Case

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();

b) Setting values for various boundary conditions


And then we have to specify the constants for different boundary condition types.
Like for homogeneous dirichlet boundary conditon, the value of the constant is 0.
dirichlet T0->SetValue(0.0);
dirichlet 0->SetValue(0.0);
dirichlet T1->SetValue(1.0);
dirichlet 1->SetValue(1.0);
neumann condition->SetValue(0.0);
c) setting the boundary conditions
reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM X,dirichlet 0);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM X,neumann);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM X,dirichlet 1);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MOMENTUM X,neumann);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MOMENTUM X,neumann);
reader->GetZone(0)->GetBoundary(1)->SetCondition(MASS MOMENTUM X,dirichlet 0);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MASS MOMENTUM X,neumann);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MASS MOMENTUM X,dirichlet 1)
reader->GetZone(0)->GetBoundary(4)->SetCondition(MASS MOMENTUM X,neumann);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MASS MOMENTUM X,neumann);

44

Unconfined Flow Over Square Cylinder

reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM Y,dirichlet 0);


reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM Y,neumann);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM Y,neumann);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MOMENTUM Y,dirichlet 0);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MOMENTUM Y,neumann);
reader->GetZone(0)->GetBoundary(1)->SetCondition(MASS MOMENTUM Y,dirichlet 0);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MASS MOMENTUM Y,neumann);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MASS MOMENTUM Y,neumann);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MASS MOMENTUM Y,dirichlet 0);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MASS MOMENTUM Y,neumann);
reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM Z,dirichlet 0);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM Z,neumann);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM Z,neumann);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MOMENTUM Z,neumann);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MOMENTUM Z,dirichlet 0);
reader->GetZone(0)->GetBoundary(1)->SetCondition(MASS MOMENTUM Z,dirichlet 0);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MASS MOMENTUM Z,neumann);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MASS MOMENTUM Z,neumann);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MASS MOMENTUM Z,neumann);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MASS MOMENTUM Z,dirichlet 0);
reader->GetZone(0)->GetBoundary(1)->SetCondition(TEMPERATURE,dirichlet T1);
reader->GetZone(0)->GetBoundary(2)->SetCondition(TEMPERATURE,neumann);
reader->GetZone(0)->GetBoundary(3)->SetCondition(TEMPERATURE,dirichlet T0);
reader->GetZone(0)->GetBoundary(4)->SetCondition(TEMPERATURE,neumann);
reader->GetZone(0)->GetBoundary(5)->SetCondition(TEMPERATURE,neumann);
Step4:- Setting material properties and linear solver mode
b) Set the material properties
reader->SetMaterialProperty(DENSITY,1.0);

6.2 Detailed Steps for Test Case

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:

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
All the variables takes the the default convergence value set in the PravahaFlowSolution.cxx. If convergence criterion for a particular variable has to be changed, then
it can be done in the following manner:
PravahaFlowSolution::SetConvergence(MASS MOMENTUM U,1.0e-5);
PravahaFlowSolution::SetConvergence(MASS MOMENTUM V,1.0e-5);
PravahaFlowSolution::SetConvergence(MASS MOMENTUM W,1.0e-5);
PravahaFlowSolution::SetConvergence(PRESSURE,1.0e-4);
PravahaFlowSolution::SetConvergence(TEMPERATURE,9.0e-7);
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))

46

Unconfined Flow Over Square Cylinder

+/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

Unconfined Flow Over Square Cylinder

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

Natural Convection in a 3-D Differentially Heated Cavity


Adiabatic

Adiabatic

Isothermal
(T=1)

Isothermal
(T=0)

Adiabatic
Adiabatic
(u , v, w =0 for all boundaries)

Figure 7.1: differentially heated cavity

7.2

Detailed Steps for Test Case

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

7.2 Detailed Steps for Test Case

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

Natural Convection in a 3-D Differentially Heated Cavity

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);

7.2 Detailed Steps for Test Case

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

Natural Convection in a 3-D Differentially Heated Cavity

->SetCondition(MASS MOMENTUM X,dirichlet condition1);


reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM Y,dirichlet condition1);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM Y,dirichlet condition1);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM Y,dirichlet condition1);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MOMENTUM Y,dirichlet condition1);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MOMENTUM Y,dirichlet condition1);
reader->GetZone(0)->GetBoundary(6)->SetCondition(MOMENTUM Y,dirichlet condition1);
reader->GetZone(0)->GetBoundary(1)
->SetCondition(MASS MOMENTUM Y,dirichlet condition1);
reader->GetZone(0)->GetBoundary(2)
->SetCondition(MASS MOMENTUM Y,dirichlet condition1);
reader->GetZone(0)->GetBoundary(3)
->SetCondition(MASS MOMENTUM Y,dirichlet condition1);
reader->GetZone(0)->GetBoundary(4)
->SetCondition(MASS MOMENTUM Y,dirichlet condition1);
reader->GetZone(0)->GetBoundary(5)
->SetCondition(MASS MOMENTUM Y,dirichlet condition1);
reader->GetZone(0)->GetBoundary(6)
->SetCondition(MASS MOMENTUM Y,dirichlet condition1);
reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM Z,dirichlet condition1);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM Z,dirichlet condition1);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM Z,dirichlet condition1);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MOMENTUM Z,dirichlet condition1);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MOMENTUM Z,dirichlet condition1);
reader->GetZone(0)->GetBoundary(6)->SetCondition(MOMENTUM Z,dirichlet condition1);
reader->GetZone(0)->GetBoundary(1)
->SetCondition(MASS MOMENTUM Z,dirichlet condition1);
reader->GetZone(0)->GetBoundary(2)
->SetCondition(MASS MOMENTUM Z,dirichlet condition1);
reader->GetZone(0)->GetBoundary(3)
->SetCondition(MASS MOMENTUM Z,dirichlet condition1);
reader->GetZone(0)->GetBoundary(4)
->SetCondition(MASS MOMENTUM Z,dirichlet condition1);
reader->GetZone(0)->GetBoundary(5)
->SetCondition(MASS MOMENTUM Z,dirichlet condition1);

7.2 Detailed Steps for Test Case

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

Natural Convection in a 3-D Differentially Heated Cavity

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)

Figure 7.2: Isotherms, (a) Ra=104, (b) Ra=105 , (c) Ra=106


Table 7.1 shows the comparison of maximum Nusselt number values obtained in
the present case with published results which shows a reasonably good match.
Table 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))
Ra

104

2.072 2.057 2.055 2.100 0.72%

105

4.499 4.399 4.337 4.361

106

9.642 9.219 8.783 8.770 4.33%

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

Mixed Convection Over a 2-D Square Cylinder


L=30

Outflow Boundary

H D =34
H=40

B=1

Slip
Boundary

Square
TW =1

H U =5

X
Vf =1 Tf =0

Inflow Boundary

Figure 8.1: Mixed convection over square cylinder


Thermal conductivity (k) =

1
ReP r

1
1000.7

= 0.0142857,

Co-efficient of volume expansion () = Ri = 1.0,


Specific heat (Cp ) = 1.0,
Density () = 1.0 and
Acceleration due to gravity (g) = 1.0.

8.2

Detailed Steps for Test Case

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

8.2 Detailed Steps for Test Case

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

Mixed Convection Over a 2-D Square Cylinder

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/MixConvectionOverSquareCyl.cgns;
where MixConvectionOverSquareCyl.cgns is the file read from the folder
Pravaha /PravahaData /CGNS /MixConvectionOverSquareCyl.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=

8.2 Detailed Steps for Test Case

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

Mixed Convection Over a 2-D Square Cylinder

->SetCondition(MASS MOMENTUM X,dirichlet conditio);


reader->GetZone(0)->GetBoundary(4)
->SetCondition(MASS MOMENTUM X,neumann condition);
reader->GetZone(0)->GetBoundary(5)
->SetCondition(MASS MOMENTUM X,dirichlet condition);
reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM Y,neumann condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM Y,neumann condition);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM Y,dirichlet condition);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MOMENTUM Y,neumann condition);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MOMENTUM Y,dirichlet condition1);
reader->GetZone(0)->GetBoundary(1)
->SetCondition(MASS MOMENTUM Y,neumann condition);
reader->GetZone(0)->GetBoundary(2)
->SetCondition(MASS MOMENTUM Y,neumann condition);
reader->GetZone(0)->GetBoundary(3)
->SetCondition(MASS MOMENTUM Y,dirichlet condition);
reader->GetZone(0)->GetBoundary(4)
->SetCondition(MASS MOMENTUM Y,neumann condition);
reader->GetZone(0)->GetBoundary(5)
->SetCondition(MASS MOMENTUM Y,dirichlet condition1);
reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM Z,dirichlet condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM Z,neumann condition);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM Z,dirichlet condition);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MOMENTUM Z,neumann condition);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MOMENTUM Z,dirichlet condition);
reader->GetZone(0)->GetBoundary(1)
->SetCondition(MASS MOMENTUM Z,dirichlet condition);
reader->GetZone(0)->GetBoundary(2)
->SetCondition(MASS MOMENTUM Z,neumann condition);
reader->GetZone(0)->GetBoundary(3)
->SetCondition(MASS MOMENTUM Z,dirichlet condition);
reader->GetZone(0)->GetBoundary(4)
->SetCondition(MASS MOMENTUM Z,neumann condition);
reader->GetZone(0)->GetBoundary(5)
->SetCondition(MASS MOMENTUM Z,dirichlet condition);

8.2 Detailed Steps for Test Case

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

Mixed Convection Over a 2-D Square Cylinder

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.

Figure 8.2: Streamlines near the cylinder at Ri=1.0

Figure 8.3: Isotherms near the cylinder at Ri=1.0

68

Mixed Convection Over a 2-D Square Cylinder


0.08

CL

0.04

-0.04

-0.08

10

20

30

40

50

Figure 8.4: Temporal variation of lift coefficient at Ri=1.0


3

2.8

CD

2.6

2.4

2.2

10

20

30

40

50

Figure 8.5: Temporal variation of drag coefficient at Ri=1.0


Table 8.1 shows the comparison of different parameters obtained in the present
case with published results which shows a reasonably good match.

Table 8.1: A comparison of different parameters with Sharma et al. [3]


Parameter

Present

Sharma et al. [3]

% error

Coefficient of total drag

2.74

2.63

-0.04 %

Coefficient of pressure drag

2.29

2.258

-0.014 %

Average Nusselt No.for the cylinder

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

Mushy Region Phase Change Problem with Convection

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

Pr=10 has been taken.

L=1

Figure 9.1: Geometry for mushy region problem

9.2

Detailed Steps for Test Case

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

9.2 Detailed Steps for Test Case

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

Mushy Region Phase Change Problem with Convection

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/mushy.cgns;
where mushy.cgns is the file read from the folder
Pravaha /PravahaData /CGNS /mushy.cgns
d) Creating pointers for various source terms
PravahaEnthalpyVelocityUSourceTerm *sourceU=PravahaEnthalpyVelocityUSourceTerm::New();
PravahaEnthalpyVelocityVSourceTerm *sourceV=PravahaEnthalpyVelocityVSourceTerm::New();
PravahaEnthalpyVelocityWSourceTerm *sourceW=PravahaEnthalpyVelocityWSourceTerm::New();
PravahaEnthalpyMassVelocityUsourceTerm *massU
=PravahaEnthalpyMassVelocityUsourceTerm::New();
PravahaEnthalpyMassVelocityVsourceTerm *massV
=PravahaEnthalpyMassVelocityVsourceTerm::New();
PravahaEnthalpyMassVelocityWsourceTerm *massW
=PravahaEnthalpyMassVelocityWsourceTerm::New();
PravahaMushyLatentSourceTerm *latentsour=PravahaMushyLatentSourceTerm::New();
e) Attaching variables for invoking source class
reader->SetSourceTerm(MASS VELOCITY U,massU);
reader->SetSourceTerm(MASS VELOCITY V,massV);
reader->SetSourceTerm(MASS VELOCITY W,massW);
reader->SetSourceTerm(VELOCITY U,sourceU);
reader->SetSourceTerm(VELOCITY V,sourceV);
reader->SetSourceTerm(VELOCITY W,sourceW);
reader->SetSourceTerm(ENTHALPY S,latentsour);
f) Creating pointers for various diagonal terms

9.2 Detailed Steps for Test Case

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

Mushy Region Phase Change Problem with Convection

reader->GetZone(0)->GetBoundary(3)->SetCondition(VELOCITY U,dirichlet condition1);


reader->GetZone(0)->GetBoundary(4)->SetCondition(VELOCITY U,dirichlet condition1);
reader->GetZone(0)->GetBoundary(1)
->SetCondition(MASS VELOCITY U,neumann condition);
reader->GetZone(0)->GetBoundary(6)
->SetCondition(MASS VELOCITY U,neumann condition);
reader->GetZone(0)->GetBoundary(2)
->SetCondition(MASS VELOCITY U,dirichlet condition1);
reader->GetZone(0)->GetBoundary(5)
->SetCondition(MASS VELOCITY U,dirichlet condition1);
reader->GetZone(0)->GetBoundary(3)
->SetCondition(MASS VELOCITY U,dirichlet condition1);
reader->GetZone(0)->GetBoundary(4)
->SetCondition(MASS VELOCITY U,dirichlet condition1);
reader->GetZone(0)->GetBoundary(1)->SetCondition(VELOCITY V,neumann condition);
reader->GetZone(0)->GetBoundary(6)->SetCondition(VELOCITY V,neumann condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(VELOCITY V,dirichlet condition1);
reader->GetZone(0)->GetBoundary(5)->SetCondition(VELOCITY V,dirichlet condition1);
reader->GetZone(0)->GetBoundary(3)->SetCondition(VELOCITY V,dirichlet condition1);
reader->GetZone(0)->GetBoundary(4)->SetCondition(VELOCITY V,dirichlet condition1);
reader->GetZone(0)->GetBoundary(1)
->SetCondition(MASS VELOCITY V,neumann condition);
reader->GetZone(0)->GetBoundary(6)
->SetCondition(MASS VELOCITY V,neumann condition);
reader->GetZone(0)->GetBoundary(2)
->SetCondition(MASS VELOCITY V,dirichlet condition1);
reader->GetZone(0)->GetBoundary(5)
->SetCondition(MASS VELOCITY V,dirichlet condition1);
reader->GetZone(0)->GetBoundary(3)
->SetCondition(MASS VELOCITY V,dirichlet condition1);
reader->GetZone(0)->GetBoundary(4)
->SetCondition(MASS VELOCITY V,dirichlet condition1);
reader->GetZone(0)->GetBoundary(1)->SetCondition(VELOCITY W,dirichlet condition1);
reader->GetZone(0)->GetBoundary(6)->SetCondition(VELOCITY W,dirichlet condition1);
reader->GetZone(0)->GetBoundary(2)->SetCondition(VELOCITY W,dirichlet condition1);

9.2 Detailed Steps for Test Case

75

reader->GetZone(0)->GetBoundary(5)->SetCondition(VELOCITY W,dirichlet condition1);


reader->GetZone(0)->GetBoundary(3)->SetCondition(VELOCITY W,dirichlet condition1);
reader->GetZone(0)->GetBoundary(4)->SetCondition(VELOCITY W,dirichlet condition1);

reader->GetZone(0)->GetBoundary(1)->SetCondition(MASS VELOCITY W,dirichlet condition


reader->GetZone(0)->GetBoundary(6)->SetCondition(MASS VELOCITY W,dirichlet condition

reader->GetZone(0)->GetBoundary(2)->SetCondition(MASS VELOCITY W,dirichlet condition


reader->GetZone(0)->GetBoundary(5)->SetCondition(MASS VELOCITY W,dirichlet condition

reader->GetZone(0)->GetBoundary(3)->SetCondition(MASS VELOCITY W,dirichlet condition


reader->GetZone(0)->GetBoundary(4)->SetCondition(MASS VELOCITY W,dirichlet condition
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,neumann condition);
reader->GetZone(0)->GetBoundary(5)->SetCondition(PRESSURE,neumann condition);
reader->GetZone(0)->GetBoundary(6)->SetCondition(PRESSURE,neumann condition);
Step4:- Apply initial condition and set material properties
for(int cel nu=0;cel nureader->GetZone(0)->GetNumberOfCells();cel nu++)
{
reader->GetZone(0)->GetCell(cel nu)
->GetOldFlowSolution()->SetVariableValue(ENTHALPY S,0.5);
reader->GetZone(0)->GetCell(cel nu)
->GetOldFlowSolution()->SetVariableValue(ENTHALPY L,5.0);
reader->GetZone(0)->GetCell(cel nu)
->GetPresentFlowSolution()->SetVariableValue(ENTHALPY S,0.5);
reader->GetZone(0)->GetCell(cel nu)
->GetPresentFlowSolution()->SetVariableValue(ENTHALPY L,5.0);
}
PravahaSolution::SetTimeStep(1.0e-3);
reader->SetRho(1.0);
reader->SetDynamicViscosity(0.01);
reader->SetSpecificHeat(1.0);
reader->SetThermalConductivity(0.001);

76

Mushy Region Phase Change Problem with Convection

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

Numerical simulation is performed on 50 50 uniform hexahedral grid. The zone


lies between the solidus and liquidus lines is known as mushy zone. In this zone,
both liquid and solid co-exists as shown in Fig. 9.2(a). This is an unsteady problem and therefore the mushy zone is moving as the time passes as shown in Fig.
9.2(b). Isotherms and x velocity has been compared with the previous result and
the comparison is good enough o validate the code. Figures 9.3(a) and (b) show
the comparison of u-velocity at different y section and solidus & liquidus lines at
t=1000 sec respectively with the result of Anupravaha I.
1
1

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

Mushy Region Phase Change Problem with Convection

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.

Table 10.1: Properties


Half Wire-Wire spacing, L

76 mm

Wire-Plate spacing, H

114 mm

Radius of wire, Rwire

2 mm

Permittivity,

8.854 e-12 F/m

Ion mobility rate, b

1.6 e-04 m2 /V s

Charge diffusion coefficient, D

1.0 e-02 m2 /s

80

Plate

123

Electrical Field in a 3-D Single Wire Electrostatic Precipitator

Plate

Symmetry

Solution
domain

Cyclic

114 mm
Symmetry

Wire

y
z

x
0.5 m

152 mm

Figure 10.1: Electrostatic precipitator model

10.2

Detailed Steps for Test Case

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

10.2 Detailed Steps for Test Case

81

#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))
+ /CGNS/chargedWire.cgns;
where chargedWire.cgns is the file read from the folder
Pravaha /PravahaData /CGNS /chargedWire.cgns
f) Creating pointers for various diagonal terms
PravahaElectricfieldDiagonalTerm *diagonale=
PravahaElectricfieldDiagonalTerm::New();
PravahaChargeDiagonalTerm *diagonalc=PravahaChargeDiagonalTerm::New();

82

Electrical Field in a 3-D Single Wire Electrostatic Precipitator

g) Attaching variables for invoking diagonal class


reader->SetDiagonalTerm(ELECTRIC POTENTIAL,diagonale);
reader->SetDiagonalTerm(ION CHARGE DENSITY,diagonalc);
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();
PravahaNeumannCondition *neumann condition=PravahaNeumannCondition::New();
b) Setting values for various boundary conditions
dirichlet conditionE0->SetValue(46200.0);
dirichlet conditionE1->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)->
SetCondition(ION CHARGE DENSITY,neumann condition);
reader->GetZone(0)->GetBoundary(3)->

10.2 Detailed Steps for Test Case

83

SetCondition(ION CHARGE DENSITY,neumann condition);


reader->GetZone(0)->GetBoundary(4)->
SetCondition(ION CHARGE DENSITY,neumann condition);
reader->GetZone(0)->GetBoundary(5)->
SetCondition(ION CHARGE DENSITY,neumann condition);
reader->GetZone(0)->GetBoundary(6)->
SetCondition(ION CHARGE DENSITY,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);
b) Set the convergence value for the variables
PravahaFlowSolution::SetConvergence(ELECTRIC POTENTIAL,1.0e-4);
PravahaFlowSolution::SetConvergence(ION CHARGE DENSITY,1.0e-10);
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/chargedWire out.cgns;
writer->SetName(write file name);
application->SetWriter(writer);
if(!application->Write())

84

Electrical Field in a 3-D Single Wire Electrostatic Precipitator

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.

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

Electric Potential (V)

Electric Potential (V)

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)

pinlet = 8L + poutlet ions 0

(11.2)

Detailed Steps for Test Case

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

Imaginary Grounded Electrode

Imaginary Discharge Electrode

Fluid Flow with Electric Field Source Term

Figure 11.1: Fully developed channel flow


Table 11.1: Properties
Length of the channel, L

6.0 m

Height of the channel, H

1.0 m

Viscosity of the fluid,

102 N-s/m2

Outlet pressure, poutlet

0.0

Ion charge density, ions

103 coulombs/m3

Electric potential,

0 to 1000 V

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
#include PravahaUserDefinedFunctionCondition.h
d) Including header files for source terms and diagonal terms appearing in different equations
#include PravahaElectricUSourceTerm.h
#include PravahaElectricVSourceTerm.h
#include PravahaElectricWSourceTerm.h
#include PravahaElectricMassUSourceTerm.h

11.2 Detailed Steps for Test Case

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

Fluid Flow with Electric Field Source Term

+ /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);

11.2 Detailed Steps for Test Case

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

Fluid Flow with Electric Field Source Term

SetCondition(ION CHARGE DENSITY,neumann condition);


reader->GetZone(0)->GetBoundary(3)->
SetCondition(ION CHARGE DENSITY,neumann condition);
reader->GetZone(0)->GetBoundary(4)->
SetCondition(ION CHARGE DENSITY,neumann condition);
reader->GetZone(0)->GetBoundary(5)->
SetCondition(ION CHARGE DENSITY,neumann condition);
reader->GetZone(0)->GetBoundary(6)->
SetCondition(ION CHARGE DENSITY,neumann condition);
reader->GetZone(0)->GetBoundary(1)->SetCondition(VELOCITY U,UDF condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(VELOCITY U,dirichlet condition);
reader->GetZone(0)->GetBoundary(3)->SetCondition(VELOCITY U,dirichlet condition);
reader->GetZone(0)->GetBoundary(4)->SetCondition(VELOCITY U,neumann condition);
reader->GetZone(0)->GetBoundary(5)->SetCondition(VELOCITY U,neumann condition);
reader->GetZone(0)->GetBoundary(6)->SetCondition(VELOCITY U,neumann condition);
reader->GetZone(0)->GetBoundary(1)->
SetCondition(MASS VELOCITY U,UDF condition);
reader->GetZone(0)->GetBoundary(2)->
SetCondition(MASS VELOCITY U,dirichlet condition);
reader->GetZone(0)->GetBoundary(3)->
SetCondition(MASS VELOCITY U,dirichlet condition);
reader->GetZone(0)->GetBoundary(4)->
SetCondition(MASS VELOCITY U,neumann condition);
reader->GetZone(0)->GetBoundary(5)->
SetCondition(MASS VELOCITY U,neumann condition);
reader->GetZone(0)->GetBoundary(6)->
SetCondition(MASS VELOCITY U,neumann condition);
reader->GetZone(0)->GetBoundary(1)->SetCondition(VELOCITY V,dirichlet condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(VELOCITY V,dirichlet condition);
reader->GetZone(0)->GetBoundary(3)->SetCondition(VELOCITY V,neumann condition);
reader->GetZone(0)->GetBoundary(4)->SetCondition(VELOCITY V,neumann condition);
reader->GetZone(0)->GetBoundary(5)->SetCondition(VELOCITY V,neumann condition);

11.2 Detailed Steps for Test Case

93

reader->GetZone(0)->GetBoundary(6)->SetCondition(VELOCITY V,neumann condition);


reader->GetZone(0)->GetBoundary(1)->
SetCondition(MASS VELOCITY V,dirichlet condition);
reader->GetZone(0)->GetBoundary(2)->
SetCondition(MASS VELOCITY V,dirichlet condition);
reader->GetZone(0)->GetBoundary(3)->
SetCondition(MASS VELOCITY V,neumann condition);
reader->GetZone(0)->GetBoundary(4)->
SetCondition(MASS VELOCITY V,neumann condition);
reader->GetZone(0)->GetBoundary(5)->
SetCondition(MASS VELOCITY V,neumann condition);
reader->GetZone(0)->GetBoundary(6)->
SetCondition(MASS VELOCITY V,neumann condition);
reader->GetZone(0)->GetBoundary(1)->SetCondition(VELOCITY W,dirichlet condition);
reader->GetZone(0)->GetBoundary(2)->SetCondition(VELOCITY W,dirichlet condition);
reader->GetZone(0)->GetBoundary(3)->SetCondition(VELOCITY W,neumann condition);
reader->GetZone(0)->GetBoundary(4)->SetCondition(VELOCITY W,neumann condition);
reader->GetZone(0)->GetBoundary(5)->SetCondition(VELOCITY W,neumann condition);
reader->GetZone(0)->GetBoundary(6)->SetCondition(VELOCITY W,neumann condition);
reader->GetZone(0)->GetBoundary(1)->
SetCondition(MASS VELOCITY W,dirichlet condition);
reader->GetZone(0)->GetBoundary(2)->
SetCondition(MASS VELOCITY W,dirichlet condition);
reader->GetZone(0)->GetBoundary(3)->
SetCondition(MASS VELOCITY W,neumann condition);
reader->GetZone(0)->GetBoundary(4)->
SetCondition(MASS VELOCITY W,neumann condition);
reader->GetZone(0)->GetBoundary(5)->
SetCondition(MASS VELOCITY W,neumann condition);
reader->GetZone(0)->GetBoundary(6)->
SetCondition(MASS VELOCITY W,neumann condition);

94

Fluid Flow with Electric Field Source Term

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

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.

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

Fluid Flow with Electric Field Source Term

0.4
Analytical
Numerical

Pressure

0.2

-0.2

-0.4

200

400

600

800

1000

Electric Potential (V)

Figure 11.2: Variation of inlet pressure with electric potential

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

Detailed Steps for Test Case

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

Collapse of Water Column


Open Atmosphere

Water Column

boundary 4

Open Atmosphere

boundary 3

Slip Wall

boundary 1

Slip Wall
boundary 2

Figure 12.1: Collapse of Water Column

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 PravahaVOFVelocityUSourceTerm.h
#include PravahaVOFVelocityVSourceTerm.h
#include PravahaVOFVelocityWSourceTerm.h
#include PravahaVOFMassVelocityUSourceTerm.h
#include PravahaVOFMassVelocityVSourceTerm.h
#include PravahaVOFMassVelocityWSourceTerm.h
#include PravahaVolumeFractionSourceTerm.h
#include PravahaMomentumDiagonalTerm.h
#include PravahaVolumeFractionDiagonalTerm.h
#include PravahaVOFPressureDiagonalTerm.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

12.2 Detailed Steps for Test Case

99

#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 DamBreak(int argc, char *argv[])
{
int failed = 0;
b) Set the application for the test case
PravahaVOFApplication *application=
PravahaVOFApplication::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/Dam.cgns;
}
where square.cgns is the file read from the folder
Pravaha /PravahaData /CGNS /Dam.cgns
d) Creating pointers for various source terms

100

Collapse of Water Column

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();

12.2 Detailed Steps for Test Case

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.

PravahaDirichletCondition *dirichlet 0=PravahaDirichletCondition::New();


PravahaNeumannCondition *neumann=PravahaNeumannCondition::New();

b) Setting values for various boundary conditions


And then we have to specify the constants for different boundary condition types.
Like for homogeneous dirichlet boundary conditon, the value of the constant is 0.
dirichlet 0->SetValue(0.0);
neumann condition->SetValue(0.0);
c) setting the boundary conditions
reader->GetZone(0)->GetBoundary(1)->SetCondition(VELOCITY U,neumann);
reader->GetZone(0)->GetBoundary(2)->SetCondition(VELOCITY U,neumann);
reader->GetZone(0)->GetBoundary(3)->SetCondition(VELOCITY U,dirichlet 0);
reader->GetZone(0)->GetBoundary(4)->SetCondition(VELOCITY U,neumann);
reader->GetZone(0)->GetBoundary(5)->SetCondition(VELOCITY U,neumann);
reader->GetZone(0)->GetBoundary(6)->SetCondition(VELOCITY U,neumann);
reader->GetZone(0)->GetBoundary(1)->SetCondition(MASS VELOCITY U,neumann);

102

Collapse of Water Column

reader->GetZone(0)->GetBoundary(2)->SetCondition(MASS VELOCITY U,neumann);


reader->GetZone(0)->GetBoundary(3)->SetCondition(MASS VELOCITY U,dirichlet 0)
reader->GetZone(0)->GetBoundary(4)->SetCondition(MASS VELOCITY U,neumann);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MASS VELOCITY U,neumann);
reader->GetZone(0)->GetBoundary(6)->SetCondition(MASS VELOCITY U,neumann);
reader->GetZone(0)->GetBoundary(1)->SetCondition(VELOCITY V,neumann);
reader->GetZone(0)->GetBoundary(2)->SetCondition(VELOCITY V,dirichlet 0);
reader->GetZone(0)->GetBoundary(3)->SetCondition(VELOCITY V,neumann);
reader->GetZone(0)->GetBoundary(4)->SetCondition(VELOCITY V,neumann);
reader->GetZone(0)->GetBoundary(5)->SetCondition(VELOCITY V,neumann);
reader->GetZone(0)->GetBoundary(6)->SetCondition(VELOCITY V,neumann);
reader->GetZone(0)->GetBoundary(1)->SetCondition(MASS VELOCITY V,neumann);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MASS VELOCITY V,dirichlet 0);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MASS VELOCITY V,neumann);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MASS VELOCITY V,neumann);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MASS VELOCITY V,neumann);
reader->GetZone(0)->GetBoundary(6)->SetCondition(MASS VELOCITY V,neumann);
reader->GetZone(0)->GetBoundary(1)->SetCondition(VELOCITY W,neumann);
reader->GetZone(0)->GetBoundary(2)->SetCondition(VELOCITY W,neumann);
reader->GetZone(0)->GetBoundary(3)->SetCondition(VELOCITY W,neumann);
reader->GetZone(0)->GetBoundary(4)->SetCondition(VELOCITY W,neumann);
reader->GetZone(0)->GetBoundary(5)->SetCondition(VELOCITY W,dirichlet 0);
reader->GetZone(0)->GetBoundary(6)->SetCondition(VELOCITY W,dirichlet 0);
reader->GetZone(0)->GetBoundary(1)->SetCondition(MASS VELOCITY W,neumann);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MASS VELOCITY W,neumann);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MASS VELOCITY W,neumann);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MASS VELOCITY W,neumann);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MASS VELOCITY W,dirichlet 0);
reader->GetZone(0)->GetBoundary(6)->SetCondition(MASS VELOCITY W,dirichlet 0);
reader->GetZone(0)->GetBoundary(1)->SetCondition(VOLUME FRACTION,neumann);

12.2 Detailed Steps for Test Case

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:

static cast<PravahaNavierStokesTimeStepping *> (application->GetApproach()


->GetTimeStepping())->SetMatrixMode(MATRIX MODE LINEAR);
Step5:- Set time step and convergence criteria
a) Set the time step
PravahaTimeStepping::SetTimeStep(1.0e-3);

104

Collapse of Water Column

b) Set the convergence value for the variables


All the variables takes the the default convergence value set in the PravahaFlowSolution.cxx. If convergence criterion for a particular variable has to be changed, then
it can be done in the following manner:
PravahaFlowSolution::SetConvergence(MASS VELOCITY U,1.0e-4);
. PravahaFlowSolution::SetConvergence(MASS VELOCITY V,1.0e-4);
PravahaFlowSolution::SetConvergence(MASS VELOCITY W,1.0e-4);
PravahaFlowSolution::SetConvergence(PRESSURE,1.0e-4);
PravahaFlowSolution::SetConvergence(VOLUME FRACTION,1.0e-7);
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/Dam 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

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.

Figure 12.2: Initial position of water column

Figure 12.3: Position of water front after 2 seconds

106

Collapse of Water Column

3.5

Present
Martin & Moyce

Interface Position

2.5

1.5

0.5

1.5

2.5

Non-Dimensional Time

Figure 12.4: Comparision of dam front

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

Figure 12.5: Comparision of dam height

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 3 and 5 are symmetry

boundary no 2

Figure 13.1: Turbulent Flow through Channel

108

13.2

Turbulent Flows Through Channel

Detailed Steps for Test Case

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

13.2 Detailed Steps for Test Case

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

Turbulent Flows Through Channel

where square.cgns is the file read from the folder


Pravaha /PravahaData /CGNS /chn.cgns
d) Creating pointers for various source terms
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.
PravahaTurbulentVelocityUSourceTerm *sourceU;
sourceU=PravahaTurbulentVelocityUSourceTerm::New();
PravahaTurbulentVelocityVSourceTerm *sourceV
sourceV=PravahaTurbulentVelocityVSourceTerm::New();
PravahaTurbulentVelocityWSourceTerm *sourceW
sourceW=PravahaTurbulentVelocityWSourceTerm::New();
PravahaTurbulentMassVelocityUSourceTerm *sourceMassU;
sourceMassU=PravahaTurbulentMassVelocityUSourceTerm::New();
PravahaTurbulentMassVelocityVSourceTerm *sourceMassV
sourceMassV=PravahaTurbulentMassVelocityVSourceTerm::New();
PravahaTurbulentMassVelocityWSourceTerm *sourceMassW
sourceMassW=PravahaTurbulentMassVelocityWSourceTerm::New();
PravahaTurbulentKineticEnergySourceTerm *sourceTKE;
sourceMassU=PravahaTurbulentKineticEnergySourceTerm::New();
PravahaTurbulentEpsilonSourceTerm*sourceEPS
sourceEPS=PravahaTurbulentEpsilonSourceTerm.::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,sourceMassU);
reader->SetSourceTerm(MASS MOMENTUM Y,sourceMassV);
reader->SetSourceTerm(MASS MOMENTUM Z,sourceMassW);
reader->SetSourceTerm(TURBULENT KINETIC ENERGY,sourceTKE);
reader->SetSourceTerm(EPSILON,sourceEPS);

13.2 Detailed Steps for Test Case

111

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.
PravahaMomentumDiagonalTermForMomentum *diagonal;
*diagonal=PravahaMomentumDiagonalTermForMomentum::New();
PravahaPressureDiagonalTerm *diagonalp;
diagonalp=PravahaPressureDiagonalTerm::New();
g) Attaching variables for invoking diagonal class
reader->SetDiagonalTerm(MOMENTUM X,diagonal);
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 E0=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet 1=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet K0=PravahaDirichletCondition::New();
PravahaDirichletCondition *dirichlet 0=PravahaDirichletCondition::New();
PravahaNeumannCondition *neumann=PravahaNeumannCondition::New();
PravahaTurbulentEpsilonWallCondition *EwallCondition;
EwallCondition=PravahaTurbulentEpsilonWallCondition::New();
PravahaTurbulentMassVelocitiesWallCondition *MsVelWallCndtn;
MsVelWallCndtn=PravahaTurbulentMassVelocitiesWallCondition::New();
PravahaTurbulentVelocitiesWallCondition *VelWallCndtn;
VelWallCndtn=PravahaTurbulentVelocitiesWallCondition::New();

112

Turbulent Flows Through Channel

b) Setting values for various boundary conditions


And then we have to specify the constants for different boundary condition types.
Like for homogeneous dirichlet boundary conditon, the value of the constant is 0.
dirichlet E0->SetValue(0.046);
dirichlet 0->SetValue(0.0);
dirichlet K0->SetValue(0.00375);
dirichlet 1->SetValue(1.0);
neumann condition->SetValue(0.0);
c) Setting the boundary conditions
reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM X,neumann);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM X,VelWallCndtn);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM X,neumann);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MOMENTUM X,VelWallCndtn);
reader->GetZone(0)->GetBoundary(5)->SetCondition(MOMENTUM X,neumann);
reader->GetZone(0)->GetBoundary(6)->SetCondition(MOMENTUM X,dirichlet 1);
reader->GetZone(0)->GetBoundary(1)->
SetCondition(MASS MOMENTUM X,neumann);
reader->GetZone(0)->GetBoundary(2)->
SetCondition(MASS MOMENTUM X,MsVelWallCndtn);
reader->GetZone(0)->GetBoundary(3)->
SetCondition(MASS MOMENTUM X,neumann)
reader->GetZone(0)->GetBoundary(4)->
SetCondition(MASS MOMENTUM X,MsVelWallCndtn);
reader->GetZone(0)->GetBoundary(5)->
SetCondition(MASS MOMENTUM X,neumann);
reader->GetZone(0)->GetBoundary(6)->
SetCondition(MASS MOMENTUM X,dirichlet 1);
reader->GetZone(0)->GetBoundary(1)->SetCondition(MOMENTUM Y,neumann);
reader->GetZone(0)->GetBoundary(2)->SetCondition(MOMENTUM Y,VelWallCndtn);
reader->GetZone(0)->GetBoundary(3)->SetCondition(MOMENTUM Y,neumann);
reader->GetZone(0)->GetBoundary(4)->SetCondition(MOMENTUM Y,VelWallCndtn);

13.2 Detailed Steps for Test Case

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

Turbulent Flows Through Channel

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:

13.2 Detailed Steps for Test Case

115

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
All the variables takes the the default convergence value set in the PravahaFlowSolution.cxx. If convergence criterion for a particular variable has to be changed, then
it can be done in the following manner:
PravahaFlowSolution::SetConvergence(MASS MOMENTUM U,1.0e-5);
PravahaFlowSolution::SetConvergence(MASS MOMENTUM V,1.0e-5);
PravahaFlowSolution::SetConvergence(MASS MOMENTUM W,1.0e-5);
PravahaFlowSolution::SetConvergence(PRESSURE,1.0e-5);
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/chn 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;

116

Turbulent Flows Through Channel

}
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, .

Das könnte Ihnen auch gefallen