Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
VALIDATION STUDIES OF SYMMETRY BC v/s WEDGE BC IN OPEN FOAM v/s ANALYTICAL H.P. EQUATION :
AIM :
To simulate the wedge flow using the OpenFOAM for different angles of wedge and to capture the results that is the given angle for the flow are :
- 10 degree
- 25 degree
- 45 degree
- SIMULATION FLOW THROUGH A PIPE FROM OPEN FOAM :
- OBJECTIVE :
- The main objective of the project is to simulate the flow through the pipe in Open FOAM software.
- We have to write the program for the generation of the blockMeshDict file,or computational mesh for wedge angle and grading system.
- Calculate the length of the pipe using the entry length formula through the laminar flow through the pipe.
- And we compare the velocity profile at the different lengths of the pipe.
- We have to show our velocity profile is fully developed.
- Post-process velocity and shear stress.
- Assumptions :
- Flow is steady, incompressible and laminar.
- Flow is two dimensional.
- Fluid properties are constant (viscosity, density etc)
- Introduction to laminar flow through a pipe :
In this project we aim to simulate a section by pipe (wedge shape geometry) to understand various aspects of flow through the pipe.
The fluid chosen is water and the flow is laminar and incompressible .Also, we choose to neglect any changes in cross-section. The specified Reynolds number Re is 2100.
Internal flow occurs when the fluid is filled entirely in a conduit and is driven primarily by a pressure difference.
Fluid velocity in a pipe changes from zero at the surface because of the no-Slip boundary conditions to a maximum at the pipe center.The average velocity remains constant in an incompressible flow when the cross-section of the pipe is constant.

- Reynold's Number(Re) :
The transitions from the laminar flow to turbulent flows occurs from laminar
to Transition (2100 `<=` Le = 0.06 . 2100 . 0.001Re `<=` Re = `(V.d.4000)/v` ) to turbulent (Re `>=` 8.9 . `10^-7` . 4000) for smooth pipe with no viscous dissipation . It depends on the geometry, face roughness, flow velocity, surface temprature, etc. Reynolds number is an inportant non-dimensionless number which is the ratio of the inertial force to viscous force and is expressed for internal flow in a circular section pipe as,
`R_e =((V_(avg).D)/v) = ((rho . V_(avg).D)/mu)`
- Hydrodynamic Length (`L_e)` :
The region from the pipe inlet to the point at which the velocity boundary layers merges at the centerline is calles the hydrodynamic entrance region in which the velocity profile is fully developed is called the fully developed region.

In laminar flow, the entry length is given approximately as,
- Diameter of pipe :
We can assume the diameter of the pipe i.e;
diameter =10 mm = 0.001 meter
To calculate the hydrodynamic entry length we have a formula, and the Reynolds number for the laminar flow is 2100 i.e; `R_e` = 2100.
`L_e` =12.6 meter
So, we can take the nearer value of length that is equal to =15.
- To calculate the velocity of the fluid that is average velocity :
At the inlet of the pipe :
where v is the viscosity of the fluid i.e;
Re, is the Reynolds number, for laminar flow = 2100.
D, is the density of the liquid at 25 degree celcius = 0.01.
So, by this equation we can calculate the velocity of the moving fluid inside the pipe ,
`V_(avg) =(2100 . (8.9) . 10^-7)/0.01`
which, gives the result of V =0.1869 m/s
According, to Haigen Poiseulli equation :
The pressure drop `delta P = (32. mu .Lv)/D^2`
`deltaP =((32.84) . 10^-4 . (1.5) . 0.1869)/(0.01)^2`
`deltaP =79.84 p`
`delta P =0.0789 m^2/s`
To calculate the maximum velocity, we have formula
`V_max = 2.V_(avg)`
`V_max = 0.3738 m/s`
- Programme that create the blockMeshDict for wedge file using the MATLAB :
close all
clear all
clc
theta =input('input the wedge angle =')
theta =theta/2;
L =1.5;
d =0.01;
r =d/2;
height_wedge =r*cosd(theta)
width_wedge =r*sind(theta)
H1 ='/*--------------------------------------*-C++-*---------------------------------------*\';
H2 =' ========= | ';
H3 =' \\ / F ield |OpenFoam : The Open Source CFD Tutorial ';
H4 =' \\ / O peration |Website : https://openfoam.org ';
H5 =' \\ / A nd |Version : 9 ';
H6 =' \\/ M anipulation | ';
H7 ='\*-------------------------------------------------------------------------------------*/';
H8 ='FoamFile';
H9 ='{'
H10 =' version 2.0;';
H11 =' format ascii;';
H12 =' class dicitionary;';
H13 =' object blockMeshDict;';
H14 ='}'
H15 ='//************************************************************************************//';
f1 =fopen('blockMeshDict.text','w')
fprintf(f1,'%s \n',H1)
fprintf(f1,'%s \n',H2)
fprintf(f1,'%s \n',H3)
fprintf(f1,'%s \n',H4)
fprintf(f1,'%s \n',H5)
fprintf(f1,'%s \n',H6)
fprintf(f1,'%s \n',H7)
fprintf(f1,'%s \n',H8)
fprintf(f1,'%s \n',H9)
fprintf(f1,'%s \n',H10)
fprintf(f1,'%s \n',H11)
fprintf(f1,'%s \n',H12)
fprintf(f1,'%s \n',H13)
fprintf(f1,'%s \n',H14)
fprintf(f1,'%s \n',H15)
fprintf(f1,'\n')
fprintf(f1,'%s \n \n','convertToMeter 1;')
fprintf(f1,'\nvertices \n(\n\n')
%Creating the vertices
fprintf(f1,' (0 0 0)')
fprintf(f1,'\n (0 0 0)')
ver3 =zeros(1,3)
ver4 =zeros(1,3)
ver3(2) =height_wedge
ver3(3) =-width_wedge
ver4(2) =height_wedge
ver4(3) =width_wedge
fprintf(f1,'\n (%f %f %f)',ver3)
fprintf(f1,'\n (%f %f %f)',ver4)
fprintf(f1,'\n (1.5 0 0)')
fprintf(f1,'\n (1.5 0 0)')
ver3 =zeros(1,3)
ver4 =zeros(1,3)
ver3(1) =L
ver3(2) =height_wedge
ver3(3) =-width_wedge
ver4(1) =L
ver4(2) =height_wedge
ver4(3) =width_wedge
fprintf(f1,'\n (%d %f %f)',ver3)
fprintf(f1,'\n (%d %f %f)',ver4)
fprintf(f1,'\n);\n\n')
fprintf(f1,'blocks \n(\n')
fprintf(f1,' hex(0 1 2 3 4 5 6 7)(1 20 100)simpleGrading(1 1 1)\n); \nedges\n(\n);\n')
fprintf(f1,'boundary \n(\n top\n {\n type wall;\n faces\n (\n (2 3 7 6)\n );\n }')
fprintf(f1,'\n(\n bottom\n {\n type empty;\n faces\n (\n (1 5 4 0)\n );\n }')
fprintf(f1,'\n(\n frontwedge\n {\n type wedge;\n faces\n (\n (0 4 7 3)\n );\n }')
fprintf(f1,'\n(\n backwedge\n {\n type wedge;\n faces\n (\n (1 2 6 5)\n );\n }')
fprintf(f1,'\n(\n inlet\n {\n type patch;\n faces\n (\n (1 0 3 2)\n );\n }')
fprintf(f1,'\n(\n outlet\n {\n type patch;\n faces\n (\n (5 6 7 4)\n );\n }')
fprintf(f1,'\n); \nmergePatchPairs \n(\n);')
H16 =('//************************************************************************************//')
fprintf(f1,'\n\n%s',H16)
fclose(f1)
- Programme that create the blockMeshDict file for symmetry using the MATLAB :
close all
clear all
clc
theta =input('input the wedge angle =')
theta =theta/2;
L =1.5;
d =0.01;
r =d/2;
height_wedge =r*cosd(theta)
width_wedge =r*sind(theta)
H1 ='/*--------------------------------------*-C++-*---------------------------------------*\';
H2 =' ========= | ';
H3 =' \\ / F ield |OpenFoam : The Open Source CFD Tutorial ';
H4 =' \\ / O peration |Website : https://openfoam.org ';
H5 =' \\ / A nd |Version : 9 ';
H6 =' \\/ M anipulation | ';
H7 ='\*-------------------------------------------------------------------------------------*/';
H8 ='FoamFile';
H9 ='{'
H10 =' version 2.0;';
H11 =' format ascii;';
H12 =' class dicitionary;';
H13 =' object blockMeshDict;';
H14 ='}'
H15 ='//************************************************************************************//';
f1 =fopen('blockMeshDict.text','w')
fprintf(f1,'%s \n',H1)
fprintf(f1,'%s \n',H2)
fprintf(f1,'%s \n',H3)
fprintf(f1,'%s \n',H4)
fprintf(f1,'%s \n',H5)
fprintf(f1,'%s \n',H6)
fprintf(f1,'%s \n',H7)
fprintf(f1,'%s \n',H8)
fprintf(f1,'%s \n',H9)
fprintf(f1,'%s \n',H10)
fprintf(f1,'%s \n',H11)
fprintf(f1,'%s \n',H12)
fprintf(f1,'%s \n',H13)
fprintf(f1,'%s \n',H14)
fprintf(f1,'%s \n',H15)
fprintf(f1,'\n')
fprintf(f1,'%s \n \n','convertToMeter 1;')
fprintf(f1,'\nvertices \n(\n\n')
%Creating the vertices
fprintf(f1,' (0 0 0)')
fprintf(f1,'\n (0 0 0)')
ver3 =zeros(1,3)
ver4 =zeros(1,3)
ver3(2) =height_wedge
ver3(3) =-width_wedge
ver4(2) =height_wedge
ver4(3) =width_wedge
fprintf(f1,'\n (%f %f %f)',ver3)
fprintf(f1,'\n (%f %f %f)',ver4)
fprintf(f1,'\n (1.5 0 0)')
fprintf(f1,'\n (1.5 0 0)')
ver3 =zeros(1,3)
ver4 =zeros(1,3)
ver3(1) =L
ver3(2) =height_wedge
ver3(3) =-width_wedge
ver4(1) =L
ver4(2) =height_wedge
ver4(3) =width_wedge
fprintf(f1,'\n (%d %f %f)',ver3)
fprintf(f1,'\n (%d %f %f)',ver4)
fprintf(f1,'\n);\n\n')
fprintf(f1,'blocks \n(\n')
fprintf(f1,' hex(0 1 2 3 4 5 6 7)(1 20 100)simpleGrading(1 1 1)\n); \nedges\n(\n);\n')
fprintf(f1,'boundary \n(\n top\n {\n type wall;\n faces\n (\n (2 3 7 6)\n );\n }')
fprintf(f1,'\n(\n bottom\n {\n type empty;\n faces\n (\n (1 5 4 0)\n );\n }')
fprintf(f1,'\n(\n frontwedge\n {\n type symmetry;\n faces\n (\n (0 4 7 3)\n );\n }')
fprintf(f1,'\n(\n backwedge\n {\n type symmetry;\n faces\n (\n (1 2 6 5)\n );\n }')
fprintf(f1,'\n(\n inlet\n {\n type patch;\n faces\n (\n (1 0 3 2)\n );\n }')
fprintf(f1,'\n(\n outlet\n {\n type patch;\n faces\n (\n (5 6 7 4)\n );\n }')
fprintf(f1,'\n); \nmergePatchPairs \n(\n);')
H16 =('//************************************************************************************//')
fprintf(f1,'\n\n%s',H16)
fclose(f1)
- blockMeshDict for wedge at 10 degree :
/*--------------------------------------*-C++-*---------------------------------------*\
========= |
\\ / F ield |OpenFoam : The Open Source CFD Tutorial
\\ / O peration |Website : https://openfoam.org
\\ / A nd |Version : 9
\\/ M anipulation |
\*-------------------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dicitionary;
object blockMeshDict;
}
//************************************************************************************//
convertToMeter 1;
vertices
(
(0 0 0)
(0 0 0)
(0.000000 0.004981 -0.000436)
(0.000000 0.004981 0.000436)
(1.5 0 0)
(1.5 0 0)
(1.500000e+00 0.004981 -0.000436)
(1.500000e+00 0.004981 0.000436)
);
blocks
(
hex(0 1 2 3 4 5 6 7)(1 20 100)simpleGrading(1 1 1)
);
edges
(
);
boundary
(
top
{
type wall;
faces
(
(2 3 7 6)
);
}
(
bottom
{
type empty;
faces
(
(1 5 4 0)
);
}
(
frontwedge
{
type wedge;
faces
(
(0 4 7 3)
);
}
(
backwedge
{
type wedge;
faces
(
(1 2 6 5)
);
}
(
inlet
{
type patch;
faces
(
(1 0 3 2)
);
}
(
outlet
{
type patch;
faces
(
(5 6 7 4)
);
}
);
mergePatchPairs
(
);
//************************************************************************************//
- blockMeshDict for wedge at 25 degree :
/*--------------------------------------*-C++-*---------------------------------------*\
========= |
\\ / F ield |OpenFoam : The Open Source CFD Tutorial
\\ / O peration |Website : https://openfoam.org
\\ / A nd |Version : 9
\\/ M anipulation |
\*-------------------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dicitionary;
object blockMeshDict;
}
//************************************************************************************//
convertToMeter 1;
vertices
(
(0 0 0)
(0 0 0)
(0.000000 0.004881 -0.001082)
(0.000000 0.004881 0.001082)
(1.5 0 0)
(1.5 0 0)
(1.500000e+00 0.004881 -0.001082)
(1.500000e+00 0.004881 0.001082)
);
blocks
(
hex(0 1 2 3 4 5 6 7)(1 20 100)simpleGrading(1 1 1)
);
edges
(
);
boundary
(
top
{
type wall;
faces
(
(2 3 7 6)
);
}
(
bottom
{
type empty;
faces
(
(1 5 4 0)
);
}
(
frontwedge
{
type wedge;
faces
(
(0 4 7 3)
);
}
(
backwedge
{
type wedge;
faces
(
(1 2 6 5)
);
}
(
inlet
{
type patch;
faces
(
(1 0 3 2)
);
}
(
outlet
{
type patch;
faces
(
(5 6 7 4)
);
}
);
mergePatchPairs
(
);
//************************************************************************************//
- blockMeshDict for wedge at 45 degree :
/*--------------------------------------*-C++-*---------------------------------------*\
========= |
\\ / F ield |OpenFoam : The Open Source CFD Tutorial
\\ / O peration |Website : https://openfoam.org
\\ / A nd |Version : 9
\\/ M anipulation |
\*-------------------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dicitionary;
object blockMeshDict;
}
//************************************************************************************//
convertToMeter 1;
vertices
(
(0 0 0)
(0 0 0)
(0.000000 0.004619 -0.001913)
(0.000000 0.004619 0.001913)
(1.5 0 0)
(1.5 0 0)
(1.500000e+00 0.004619 -0.001913)
(1.500000e+00 0.004619 0.001913)
);
blocks
(
hex(0 1 2 3 4 5 6 7)(1 20 100)simpleGrading(1 1 1)
);
edges
(
);
boundary
(
top
{
type wall;
faces
(
(2 3 7 6)
);
}
(
bottom
{
type empty;
faces
(
(1 5 4 0)
);
}
(
frontwedge
{
type wedge;
faces
(
(0 4 7 3)
);
}
(
backwedge
{
type wedge;
faces
(
(1 2 6 5)
);
}
(
inlet
{
type patch;
faces
(
(1 0 3 2)
);
}
(
outlet
{
type patch;
faces
(
(5 6 7 4)
);
}
);
mergePatchPairs
(
);
//************************************************************************************//
- blockMeshDict for symmetry at 10 degree :
/*--------------------------------------*-C++-*---------------------------------------*\
========= |
\\ / F ield |OpenFoam : The Open Source CFD Tutorial
\\ / O peration |Website : https://openfoam.org
\\ / A nd |Version : 9
\\/ M anipulation |
\*-------------------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dicitionary;
object blockMeshDict;
}
//************************************************************************************//
convertToMeter 1;
vertices
(
(0 0 0)
(0 0 0)
(0.000000 0.004981 -0.000436)
(0.000000 0.004981 0.000436)
(1.5 0 0)
(1.5 0 0)
(1.500000e+00 0.004981 -0.000436)
(1.500000e+00 0.004981 0.000436)
);
blocks
(
hex(0 1 2 3 4 5 6 7)(1 20 100)simpleGrading(1 1 1)
);
edges
(
);
boundary
(
top
{
type wall;
faces
(
(2 3 7 6)
);
}
(
bottom
{
type empty;
faces
(
(1 5 4 0)
);
}
(
frontwedge
{
type symmetry;
faces
(
(0 4 7 3)
);
}
(
backwedge
{
type symmetry;
faces
(
(1 2 6 5)
);
}
(
inlet
{
type patch;
faces
(
(1 0 3 2)
);
}
(
outlet
{
type patch;
faces
(
(5 6 7 4)
);
}
);
mergePatchPairs
(
);
//************************************************************************************//
- blockMeshDict for symmetry at 25 degree :
/*--------------------------------------*-C++-*---------------------------------------*\
========= |
\\ / F ield |OpenFoam : The Open Source CFD Tutorial
\\ / O peration |Website : https://openfoam.org
\\ / A nd |Version : 9
\\/ M anipulation |
\*-------------------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dicitionary;
object blockMeshDict;
}
//************************************************************************************//
convertToMeter 1;
vertices
(
(0 0 0)
(0 0 0)
(0.000000 0.004881 -0.001082)
(0.000000 0.004881 0.001082)
(1.5 0 0)
(1.5 0 0)
(1.500000e+00 0.004881 -0.001082)
(1.500000e+00 0.004881 0.001082)
);
blocks
(
hex(0 1 2 3 4 5 6 7)(1 20 100)simpleGrading(1 1 1)
);
edges
(
);
boundary
(
top
{
type wall;
faces
(
(2 3 7 6)
);
}
(
bottom
{
type empty;
faces
(
(1 5 4 0)
);
}
(
frontwedge
{
type symmetry;
faces
(
(0 4 7 3)
);
}
(
backwedge
{
type symmetry;
faces
(
(1 2 6 5)
);
}
(
inlet
{
type patch;
faces
(
(1 0 3 2)
);
}
(
outlet
{
type patch;
faces
(
(5 6 7 4)
);
}
);
mergePatchPairs
(
);
//************************************************************************************//
- blockMeshDict for symmetry at 45 degree :
/*--------------------------------------*-C++-*---------------------------------------*\
========= |
\\ / F ield |OpenFoam : The Open Source CFD Tutorial
\\ / O peration |Website : https://openfoam.org
\\ / A nd |Version : 9
\\/ M anipulation |
\*-------------------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dicitionary;
object blockMeshDict;
}
//************************************************************************************//
convertToMeter 1;
vertices
(
(0 0 0)
(0 0 0)
(0.000000 0.004619 -0.001913)
(0.000000 0.004619 0.001913)
(1.5 0 0)
(1.5 0 0)
(1.500000e+00 0.004619 -0.001913)
(1.500000e+00 0.004619 0.001913)
);
blocks
(
hex(0 1 2 3 4 5 6 7)(1 20 100)simpleGrading(1 1 1)
);
edges
(
);
boundary
(
top
{
type wall;
faces
(
(2 3 7 6)
);
}
(
bottom
{
type empty;
faces
(
(1 5 4 0)
);
}
(
frontwedge
{
type symmetry;
faces
(
(0 4 7 3)
);
}
(
backwedge
{
type symmetry;
faces
(
(1 2 6 5)
);
}
(
inlet
{
type patch;
faces
(
(1 0 3 2)
);
}
(
outlet
{
type patch;
faces
(
(5 6 7 4)
);
}
);
mergePatchPairs
(
);
//************************************************************************************//
- controlDict 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;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.4;
deltaT 0.00004;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
- pressure (p) 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;
}
frontwedge
{
type wedge;
}
backwedge
{
type wedge;
}
top
{
type zeroGradient;
}
bottom
{
type empty;
}
}
// ************************************************************************* //
- velocity (U) 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.1869 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (0.1869 0 0);
}
outlet
{
type zeroGradient;
}
frontwedge
{
type wedge;
}
backwedge
{
type wedge;
}
top
{
type noSlip;
}
bottom
{
type empty;
}
}
// ************************************************************************* //
- transportProperties 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;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 0.001;
// ************************************************************************* //
- RESULTS:
- Mesh Structure at 10 degree wedge condition

- Mesh Structure at 25 degree wedge condition


- Mesh Structure at 45 degree wedge condition


- Mesh Structure at 10 degree symmetry condition


- Mesh Structure at 25 degree symmetry condition


- Mesh Structure at 45 degree symmetry condition


Comparison plot of velocity of 10 degree wedge & symmetry condition
- Plot of velocity at 10 degree wedge

- Plot of velocity at 10 degree symmetry

Comparison plot of velocity of 25 degree wedge & symmetry condition
- Plot of velocity at 25 degree wedge

- Plot of velocity at 25 degree symmetry

Comparison plot of velocity of 45 degree wedge & symmetry condition
- Plot of velocity at 45 degree wedge

- Plot of velocity at 45 degree symmetry

- Conclusion :
We can observe that there is not much change in the maximum velocities .The only difference observed in the execution time a little high than the 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 also with increasing the angle of the wedge. The Courant number is slightly increasing, we can say that the symmetric boundary conditions plays an important role in terms of accuracy in the results.