Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
OBJECTIVE.
- To simulate an axis-symmetric laminar flow through the constant cross-sectional of the pipe by applying the symmetry boundary condition.
- To simulating for the mentioned angles i.e for 10, 25, 45 degrees using both symmetry and wedge boundary conditions and validate them with HP equations.
Hagen-Poiseuille's law:
In nonideal fluid dynamics, the Hagen–Poiseuille equation, also known as the Hagen–Poiseuille law, is a physical law that gives the pressure drop in an incompressible and Newtonian fluid in laminar flow flowing through a long cylindrical pipe of constant cross-section. The pressure drop is given by:
`DeltaP=(32muLV)/D^2`
where,
`DeltaP`is the pressure drop
`mu` is the dynamic viscosity
L is the length of the pipe.
V is the velocity.

At the entrance, the flow is said to be in the hydrodynamic entrance region where the velocity profile gradually takes the shape of a parabola from a straight line. As soon as the parabolic velocity profile becomes steady the flow is said to be in its fully developed state. Normally Hagen Poiseuille's Equation is applicable for a fully developed flow which helps us to calculate the pressure loss.
Assumptions made:
Geometry: Axisymmetric.
Reynolds number: 2100.
Working fluid: Water.
Diameter of the pipe: 0.02 m.
Dynamic viscosity(μ)='0.89x10^-3 Pa s`
Kinematic viscosity(ν)`'0.8927x10^-6 m^2/s`
theta=10, 25, 45

PROCEDURE.
- Will start with copying the cavity file from the tutorial to the FOAM_RUN folder.
- In the run folder only we are going to simulate and whatever we want to do the changes in the blockMeshDict file and pressure and velocity files and controlDict files we will be doing here.
- creating the block in the OpenFoam here we are creating the wedge after making the required changes in the blockMeshDict file to check the geometry run the blockMesh command.
- After creating the wedge assign the boundary conditions, and also sitting the simulation end time and time-step in such a way that the courant number should be less than 0.5 and also in the transportProperties enter the kinematic viscosity.
-
Run the simulation using the icoFoam solver after calculating the time needed for the fluid to travel from inlet to outlet
-
After the simulation, use paraFoam to view the flow inside the wedge and use plot over line command to plot the velocity and shear stress changes at a point after the hydrodynamical entry region so that we analyse the fully developed region of the fluid.
-
Use Matlab to parse the blockMeshDict so that the same file can be used for any wedge values.
Matlab Script to generate blockMesh dict
The blockMeshdict file was directly shared with us and we were required to not develop a matlab script to generate blockMesh by Ashwanth due to live classes and time constraints.
For symmetry conditions along with wedge angles 10,25 and 45 degrees the controldict,pressure,velocity and transport properties files are the same.
Controldict
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 5;
deltaT 0.001;
writeControl timeStep;
writeInterval 500;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Pressure file
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
front
{
type symmetry; // symmetry
}
back
{
type symmetry; // symmetry
}
wall
{
type zeroGradient;
}
axis
{
type empty;
}
}
// ************************************************************************* //
Velocity file
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (0.0223169508525577 0 0);
}
outlet
{
type zeroGradient;
}
front
{
type symmetry; // symmetry
}
back
{
type symmetry; // symmetry
}
wall
{
type noSlip;
}
axis
{
type empty;
}
}
// ************************************************************************* //
Transport Properties
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 8.9267803410231e-07;
// ************************************************************************* //
BlockMesh files
1. 10 degree wedge angle
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// blockMesh parameterization
/* Geometrical Info */
D 0.004; // Diameter
r #calc "0.5*$D"; // Radius
angle 10; // Angle in degrees
theta #calc "degToRad($angle)"; // Angle in radians
Re 100; // Reynolds Number
Le #calc "0.06*$Re*$D"; // Entrance Length
L #calc "0.2 + $Le"; // Total length of pipe
/* Vertices Info */
xmin 0;
xmax $L;
ymax #calc "$r*cos($theta)";
zmax #calc "$r*sin($theta)";
zmin #calc "-$r*sin($theta)";
curve #calc "$r*cos($theta)+1e-4";
/* Mesh Info */
nx 10; // Cells along local X
ny 1; // Cells along local Y
nz 50; // Cells along local Z
gx 0.2; // SG along local X
gy 1; // SG along local Y
gz 1; // SG along local Z
convertToMeters 1;
vertices
(
($xmin 0 0) //0
($xmin $ymax $zmax) //1
($xmin $ymax $zmin) //2
($xmax 0 0) //3
($xmax $ymax $zmax) //4
($xmax $ymax $zmin) //5
);
blocks
(
hex (0 2 1 0 3 5 4 3) ($nx $ny $nz) simpleGrading ($gx $gy $gz)
);
edges
(
arc 1 2 ($xmin $curve 0)
arc 4 5 ($xmax $curve 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
back
{
type symmetry; // symmetry
faces
(
(0 2 5 3)
);
}
wall
{
type wall; // symmetry
faces
(
(2 1 4 5)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Paraview screenshots and output plots
Mesh

Velocity

Pressure

Velocity Plot

Shear stress plot

Shear stress comparison

2. 25 degree wedge angle
BlockMesh file
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// blockMesh parameterization
/* Geometrical Info */
D 0.004; // Diameter
r #calc "0.5*$D"; // Radius
angle 25; // Angle in degrees
theta #calc "degToRad($angle)"; // Angle in radians
Re 100; // Reynolds Number
Le #calc "0.06*$Re*$D"; // Entrance Length
L #calc "0.2 + $Le"; // Total length of pipe
/* Vertices Info */
xmin 0;
xmax $L;
ymax #calc "$r*cos($theta)";
zmax #calc "$r*sin($theta)";
zmin #calc "-$r*sin($theta)";
curve #calc "$r*cos($theta)+1e-4";
/* Mesh Info */
nx 10; // Cells along local X
ny 1; // Cells along local Y
nz 50; // Cells along local Z
gx 0.2; // SG along local X
gy 1; // SG along local Y
gz 1; // SG along local Z
convertToMeters 1;
vertices
(
($xmin 0 0) //0
($xmin $ymax $zmax) //1
($xmin $ymax $zmin) //2
($xmax 0 0) //3
($xmax $ymax $zmax) //4
($xmax $ymax $zmin) //5
);
blocks
(
hex (0 2 1 0 3 5 4 3) ($nx $ny $nz) simpleGrading ($gx $gy $gz)
);
edges
(
arc 1 2 ($xmin $curve 0)
arc 4 5 ($xmax $curve 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
back
{
type symmetry; // symmetry
faces
(
(0 2 5 3)
);
}
wall
{
type wall; // symmetry
faces
(
(2 1 4 5)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Mesh

Velocity

Pressure

Velocity plot

Shear stress plot

Shear stress comparison

3. 45 degree wedge angle
BlockMesh file
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// blockMesh parameterization
/* Geometrical Info */
D 0.004; // Diameter
r #calc "0.5*$D"; // Radius
angle 45; // Angle in degrees
theta #calc "degToRad($angle)"; // Angle in radians
Re 100; // Reynolds Number
Le #calc "0.06*$Re*$D"; // Entrance Length
L #calc "0.2 + $Le"; // Total length of pipe
/* Vertices Info */
xmin 0;
xmax $L;
ymax #calc "$r*cos($theta)";
zmax #calc "$r*sin($theta)";
zmin #calc "-$r*sin($theta)";
curve #calc "$r*cos($theta)+1e-4";
/* Mesh Info */
nx 10; // Cells along local X
ny 1; // Cells along local Y
nz 50; // Cells along local Z
gx 0.2; // SG along local X
gy 1; // SG along local Y
gz 1; // SG along local Z
convertToMeters 1;
vertices
(
($xmin 0 0) //0
($xmin $ymax $zmax) //1
($xmin $ymax $zmin) //2
($xmax 0 0) //3
($xmax $ymax $zmax) //4
($xmax $ymax $zmin) //5
);
blocks
(
hex (0 2 1 0 3 5 4 3) ($nx $ny $nz) simpleGrading ($gx $gy $gz)
);
edges
(
arc 1 2 ($xmin $curve 0)
arc 4 5 ($xmax $curve 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
back
{
type symmetry; // symmetry
faces
(
(0 2 5 3)
);
}
wall
{
type wall; // symmetry
faces
(
(2 1 4 5)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Mesh

Velocity

Pressure

Velocity plot

Shear stress

Shear stress comparison

CONCLUSION.
We can observe there is no much change in the maximum velocities. The only difference observed is execution time a little high than type-wedge. While the angle increases the error in the maximum velocity is decreased. Though there is not much difference between analytical and numerical results and also with increasing the angle of the wedge, The Courant number is slightly increasing. we can say that the symmetric boundary condition plays an important role in terms of accuracy in the result.