Simulation of Flow through a pipe in OpenFoam
Objectives-1 :
(1) To Write a program in Matlab that can generate the computational mesh automatically for any wedge angle and grading schemes.
(2) For a baseline mesh, show that the velocity profile matches with the Hagen poiseuille's equation. Show that the velocity profile is fully developed.
(3) Post process velocity and shear stress.
The Hagen–Poiseuille equation can be derived from the Navier-Stokes equations. The Laminar flow through a pipe of uniform (circular) cross-section is known as Hagen–Poiseuille flow. The equations governing the Hagen–Poiseuille flow can be derived directly from the Navier-Stokes momentum equations in 3D cylindrical coordinates by making the following set of assumptions:
- The flow is Steady & Laminar.
- The radial and azimuthal components of the fluid velocity are zero.
- The flow is axisymmetric.
- The flow is fully developed.
Normally, Hagen–Poiseuille flow implies not just the relation for the pressure drop, above, but also the full solution for the laminar flow profile, which is parabolic. However, the result for the pressure drop can be extended to turbulent flow by inferring an effective turbulent viscosity in the case of turbulent flow, even though the flow profile in turbulent flow is strictly speaking not actually parabolic. In both cases, laminar or turbulent, the pressure drop is related to the stress at the wall, which determines the so-called friction factor. The wall stress can be determined phenomenologically by the Darcy-Weisbach equation in the field of hydraulics, given a relationship for the friction factor in terms of the Reynolds number.
That's why
The finer mesh is required near the wall to get the more accurate simulation.

The region from the inlet of pipe to the point, at which the velocity profile is fully developed is called hydrodynamic entry region.
Fully developed flow implies that the velocity profile does not change in the fluid flow direction hence the momentum also does not change in the flow direction. In such a case, the pressure in the flow direction will balance the shear stress near the wall.
Let consider the fluid flowing through pipe be water at room temperature.
Diameter of Pipe = 0.02 m


MATLAB Code :
clear all
clc
%MATLAB Program to Automate BlockMeshDict file generation for user
%specified wedge angle for simulating a flow through a pipe
%Comments Portion
C1 = '/*------------------------------*- C++ -*------------------------------*';
C2 = ' ========= |';
C3 = ' / F ield | OpenFOAM : The Opensource CFD Toolbox';
C4 = ' / O peration | Website : https://openfoam.org';
C5 = ' / A nd | Version : 7';
C6 = ' / M anipulation |';
C7 = '*----------------------------------------------------------------------*/';
%Dictionary
D1 = 'FoamFile';
D2 = '{';
D3 = ' version 2.0;';
D4 = ' format ascii;';
D5 = ' class dictionary;';
D6 = ' object blockMeshDict;';
D7 = '}';
D8 = '//*********************************************************************//';
C = 'convertToMeters 0.001;';
%Values for Calculation
th = input('Enter the value of Wedge Angle : ');
d = 20; %Diameter in mm
r = d/2;
l = 2520; %Length of Pipe
f = 0.2;
%Vertices of Wedge Shaped Block
w01 = 'vertices';
w02 = '(';
w0 = [0 0 0];
w1 = [r*cosd(th/2), -r*sind(th/2), 0];
w2 = [r*cosd(th/2), r*sind(th/2), 0];
w3 = [0 0 l];
w4 = [r*cosd(th/2), -r*sind(th/2), l];
w5 = [r*cosd(th/2), r*sind(th/2), l];
w06 = ');';
%Blocks
b1 = 'blocks';
b2 = '(';
b3 = ' hex(0 1 2 0 3 4 5 3) (20 1 500) simpleGrading(0.1 1 1)';
b4 = ');';
%Edges
e1 = 'edges';
e2 = '(';
e3 = ' arc 2 1 (10 0 0)';
e4 = ' arc 4 5 (10 0 2100)';
e5 = ');';
%Boundaries
B1 = 'boundary';
B2 = '(';
B3 = ' inlet';
B4 = ' {';
B5 = ' type patch;';
B6 = ' faces';
B7 = ' (';
B8 = ' (0 2 1 0)';
B9 = ' );';
B10= ' }';
B11= ' outlet';
B12= ' {';
B13= ' type patch;';
B14= ' faces';
B15= ' (';
B16= ' (3 4 5 3)';
B17= ' );';
B18= ' }';
B19= ' topwall';
B20= ' {';
B21= ' type wall;';
B22= ' faces';
B23= ' (';
B24= ' (5 4 1 2)';
B25= ' );';
B26= ' }';
B27= ' front';
B28= ' {';
B29= ' type wedge;';
B30= ' faces';
B31= ' (';
B32= ' (3 5 2 0)';
B33= ' );';
B34= ' }';
B35= ' back';
B36= ' {';
B37= ' type wedge;';
B38= ' faces';
B39= ' (';
B40= ' (4 3 0 1)';
B41= ' );';
B42= ' }';
B43= ' baseaxis';
B44= ' {';
B45= ' type empty;';
B46= ' faces';
B47= ' (';
B48= ' (0 3 3 0)';
B49= ' );';
B50= ' }';
B51= ');';
%Merging Patch Pairs & Ending
m1 = 'mergePatchPairs';
m2 = '(';
m3 = ');';
End= '// ***************************************************************** //';
%Creating Text file
t1 = fopen('blockMeshDict','wt');
%Comments
fprintf(t1,'%sn',C1);
fprintf(t1,'%sn',C2);
fprintf(t1,'%sn',C3);
fprintf(t1,'%sn',C4);
fprintf(t1,'%sn',C5);
fprintf(t1,'%sn',C6);
fprintf(t1,'%snn',C7);
%Dictionary
fprintf(t1,'%sn',D1);
fprintf(t1,'%sn',D2);
fprintf(t1,'%sn',D3);
fprintf(t1,'%sn',D4);
fprintf(t1,'%sn',D5);
fprintf(t1,'%sn',D6);
fprintf(t1,'%sn',D7);
fprintf(t1,'%snn',D8);
fprintf(t1,'%snn',C);
%Vertices of Wedge
fprintf(t1,'%sn',w01);
fprintf(t1,'%sn',w02);
fprintf(t1,'%s (%f %f %f)n',blanks(5),w0(1),w0(2),w0(3));
fprintf(t1,'%s (%f %f %f)n',blanks(5),w1(1),w1(2),w1(3));
fprintf(t1,'%s (%f %f %f)n',blanks(5),w2(1),w2(2),w2(3));
fprintf(t1,'%s (%f %f %f)n',blanks(5),w3(1),w3(2),w3(3));
fprintf(t1,'%s (%f %f %f)n',blanks(5),w4(1),w4(2),w4(3));
fprintf(t1,'%s (%f %f %f)n',blanks(5),w5(1),w5(2),w5(3));
fprintf(t1,'%snn',w06);
%Blocks
fprintf(t1,'%sn',b1);
fprintf(t1,'%sn',b2);
fprintf(t1,'%sn',b3);
fprintf(t1,'%snn',b4);
%Edges
fprintf(t1,'%sn',e1);
fprintf(t1,'%sn',e2);
fprintf(t1,'%sn',e3);
fprintf(t1,'%sn',e4);
fprintf(t1,'%snn',e5);
%Boundaries
fprintf(t1,'%sn',B1);
fprintf(t1,'%sn',B2);
fprintf(t1,'%sn',B3);
fprintf(t1,'%sn',B4);
fprintf(t1,'%sn',B5);
fprintf(t1,'%sn',B6);
fprintf(t1,'%sn',B7);
fprintf(t1,'%sn',B8);
fprintf(t1,'%sn',B9);
fprintf(t1,'%sn',B10);
fprintf(t1,'%sn',B11);
fprintf(t1,'%sn',B12);
fprintf(t1,'%sn',B13);
fprintf(t1,'%sn',B14);
fprintf(t1,'%sn',B15);
fprintf(t1,'%sn',B16);
fprintf(t1,'%sn',B17);
fprintf(t1,'%sn',B18);
fprintf(t1,'%sn',B19);
fprintf(t1,'%sn',B20);
fprintf(t1,'%sn',B21);
fprintf(t1,'%sn',B22);
fprintf(t1,'%sn',B23);
fprintf(t1,'%sn',B24);
fprintf(t1,'%sn',B25);
fprintf(t1,'%sn',B26);
fprintf(t1,'%sn',B27);
fprintf(t1,'%sn',B28);
fprintf(t1,'%sn',B29);
fprintf(t1,'%sn',B30);
fprintf(t1,'%sn',B31);
fprintf(t1,'%sn',B32);
fprintf(t1,'%sn',B33);
fprintf(t1,'%sn',B34);
fprintf(t1,'%sn',B35);
fprintf(t1,'%sn',B36);
fprintf(t1,'%sn',B37);
fprintf(t1,'%sn',B38);
fprintf(t1,'%sn',B39);
fprintf(t1,'%sn',B40);
fprintf(t1,'%sn',B41);
fprintf(t1,'%sn',B42);
fprintf(t1,'%sn',B43);
fprintf(t1,'%sn',B44);
fprintf(t1,'%sn',B45);
fprintf(t1,'%sn',B46);
fprintf(t1,'%sn',B47);
fprintf(t1,'%sn',B48);
fprintf(t1,'%sn',B49);
fprintf(t1,'%sn',B50);
fprintf(t1,'%sn',B51);
%Merging Patches & Ending
fprintf(t1,'%sn',m1);
fprintf(t1,'%sn',m2);
fprintf(t1,'%snn',m3);
fprintf(t1,'%sn',End);
BlockMeshDict file for Wedge Angle 4 degree :
/*------------------------------*- C++ -*------------------------------*
========= |
/ F ield | OpenFOAM : The Opensource CFD Toolbox
/ O peration | Website : https://openfoam.org
/ A nd | Version : 7
/ M anipulation |
*----------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
//*********************************************************************//
convertToMeters 0.001;
vertices
(
(0.000000 0.000000 0.000000)
(9.993908 -0.348995 0.000000)
(9.993908 0.348995 0.000000)
(0.000000 0.000000 2520.000000)
(9.993908 -0.348995 2520.000000)
(9.993908 0.348995 2520.000000)
);
blocks
(
hex(0 1 2 0 3 4 5 3) (20 1 500) simpleGrading(0.1 1 1)
);
edges
(
arc 2 1 (10 0 0)
arc 4 5 (10 0 2100)
);
boundary
(
inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
topwall
{
type wall;
faces
(
(5 4 1 2)
);
}
front
{
type wedge;
faces
(
(3 5 2 0)
);
}
back
{
type wedge;
faces
(
(4 3 0 1)
);
}
baseaxis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ***************************************************************** //
Here, Wedge shaped geometry contains 6 vertices, 5 faces , 2 arc shaped faces and 1 base axis.
Mesh refinement is done at wall using appropriate grading factor.
Wedge shaped Geometry :


Boundary Conditions :
Velocity
/*--------------------------------*- C++ -*----------------------------------*
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 7 |
| \ / A nd | Web: www.OpenFOAM.org |
| \/ M anipulation | |
*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
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 0 0.1053);
}
outlet
{
type zeroGradient;
}
topWall
{
type noSlip;
}
front
{
type wedge;
}
back
{
type wedge;
}
baseaxis
{
type empty;
}
}
// ************************************************************************* //
Velocity Distribution :


Pressure
/*--------------------------------*- C++ -*----------------------------------*
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 7 |
| \ / A nd | Web: www.OpenFOAM.org |
| \/ M anipulation | |
*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
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;
}
topWall
{
type zeroGradient;
}
front
{
type wedge;
}
back
{
type wedge;
}
baseaxis
{
type empty;
}
}
// ************************************************************************* //
Pressure Distribution :

Here, Pressure is high at inlet and it reduces up to Gauge Pressure at outlet.
ControDict file :
/*--------------------------------*- C++ -*----------------------------------*
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 7 |
| \ / A nd | Web: www.OpenFOAM.org |
| \/ M anipulation | |
*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 24;
deltaT 0.001;
writeControl timeStep;
writeInterval 200;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //

Transport Properties file :
/*--------------------------------*- C++ -*----------------------------------*
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 7 |
| \ / A nd | Web: www.OpenFOAM.org |
| \/ M anipulation | |
*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 1.0034e-6;
// ************************************************************************* //
Kinematic viscosity of water at room temperature is 1.0034e-6.
Results :
icoFoam solver was used.
Velocity Profile variation with radius at x distance from inlet


So, we can see that velocity at center is maximum and it is almost zero at the wall. And, the magnitude of velocity at center from inlet to hydrodynamic entrance length is shown below,


We can see that velocity magnitude (at center) of fully developed flow is 0.2066 m/s. It is our numerical solution and required to validate with exact solution.

After comparing the numerical solution and exact solution, there is only 1.89% of deviation which is negligible.
Shear Stress variation with radius at x distance from inlet
At x = 0.5

At x = 1.0

At x = 2.52

Above figures show that shear stress is almost zero at center and maximum at the wall.
Conclusion :
- Velocity Profile is fully developed at Hydrodynamic Entrance Length
- Pressure is maximum at inlet and tends to gauge pressure at outlet.
- Shear Stress is zero at center and maximum at wall region.
- Numerical data is valid with Exact solution with negligible deviation.
#########################################################################
#########################################################################
Objective-2 :
- Write a Matlab program that takes an angle as input and generates a blockMesh file for the given angle.
- Angles to test 10,25,45 degree
- Obtain results from simulating the pipe flow with Symmetry BC
- Compare it with the Wedge BC & Hagen Poisuelle's Equation (Analytical Solution)
MATLAB Code :
For Symmetry BC
clear all
clc
%MATLAB Program to Automate BlockMeshDict file generation for user
%specified wedge angle for simulating a flow through a pipe
%Comments Portion
C1 = '/*------------------------------*- C++ -*------------------------------*';
C2 = ' ========= |';
C3 = ' / F ield | OpenFOAM : The Opensource CFD Toolbox';
C4 = ' / O peration | Website : https://openfoam.org';
C5 = ' / A nd | Version : 7';
C6 = ' / M anipulation |';
C7 = '*----------------------------------------------------------------------*/';
%Dictionary
D1 = 'FoamFile';
D2 = '{';
D3 = ' version 2.0;';
D4 = ' format ascii;';
D5 = ' class dictionary;';
D6 = ' object blockMeshDict;';
D7 = '}';
D8 = '//*********************************************************************//';
C = 'convertToMeters 0.001;';
%Values for Calculation
th = input('Enter the value of Wedge Angle : ');
d = 20; %Diameter in mm
r = d/2;
l = 2520; %Length of Pipe
f = 0.2;
%Vertices of Wedge Shaped Block
w01 = 'vertices';
w02 = '(';
w0 = [0 0 0];
w1 = [r*cosd(th/2), -r*sind(th/2), 0];
w2 = [r*cosd(th/2), r*sind(th/2), 0];
w3 = [0 0 l];
w4 = [r*cosd(th/2), -r*sind(th/2), l];
w5 = [r*cosd(th/2), r*sind(th/2), l];
w06 = ');';
%Blocks
b1 = 'blocks';
b2 = '(';
b3 = ' hex(0 1 2 0 3 4 5 3) (20 1 500) simpleGrading(0.1 1 1)';
b4 = ');';
%Edges
e1 = 'edges';
e2 = '(';
e3 = ' arc 2 1 (10 0 0)';
e4 = ' arc 4 5 (10 0 2100)';
e5 = ');';
%Boundaries
B1 = 'boundary';
B2 = '(';
B3 = ' inlet';
B4 = ' {';
B5 = ' type patch;';
B6 = ' faces';
B7 = ' (';
B8 = ' (0 2 1 0)';
B9 = ' );';
B10= ' }';
B11= ' outlet';
B12= ' {';
B13= ' type patch;';
B14= ' faces';
B15= ' (';
B16= ' (3 4 5 3)';
B17= ' );';
B18= ' }';
B19= ' topwall';
B20= ' {';
B21= ' type wall;';
B22= ' faces';
B23= ' (';
B24= ' (5 4 1 2)';
B25= ' );';
B26= ' }';
B27= ' front';
B28= ' {';
B29= ' type symmetry;';
B30= ' faces';
B31= ' (';
B32= ' (3 5 2 0)';
B33= ' );';
B34= ' }';
B35= ' back';
B36= ' {';
B37= ' type symmetry;';
B38= ' faces';
B39= ' (';
B40= ' (4 3 0 1)';
B41= ' );';
B42= ' }';
B43= ' baseaxis';
B44= ' {';
B45= ' type empty;';
B46= ' faces';
B47= ' (';
B48= ' (0 3 3 0)';
B49= ' );';
B50= ' }';
B51= ');';
%Merging Patch Pairs & Ending
m1 = 'mergePatchPairs';
m2 = '(';
m3 = ');';
End= '// ***************************************************************** //';
%Creating Text file
t1 = fopen('blockMeshDict','wt');
%Comments
fprintf(t1,'%sn',C1);
fprintf(t1,'%sn',C2);
fprintf(t1,'%sn',C3);
fprintf(t1,'%sn',C4);
fprintf(t1,'%sn',C5);
fprintf(t1,'%sn',C6);
fprintf(t1,'%snn',C7);
%Dictionary
fprintf(t1,'%sn',D1);
fprintf(t1,'%sn',D2);
fprintf(t1,'%sn',D3);
fprintf(t1,'%sn',D4);
fprintf(t1,'%sn',D5);
fprintf(t1,'%sn',D6);
fprintf(t1,'%sn',D7);
fprintf(t1,'%snn',D8);
fprintf(t1,'%snn',C);
%Vertices of Wedge
fprintf(t1,'%sn',w01);
fprintf(t1,'%sn',w02);
fprintf(t1,'%s (%f %f %f)n',blanks(5),w0(1),w0(2),w0(3));
fprintf(t1,'%s (%f %f %f)n',blanks(5),w1(1),w1(2),w1(3));
fprintf(t1,'%s (%f %f %f)n',blanks(5),w2(1),w2(2),w2(3));
fprintf(t1,'%s (%f %f %f)n',blanks(5),w3(1),w3(2),w3(3));
fprintf(t1,'%s (%f %f %f)n',blanks(5),w4(1),w4(2),w4(3));
fprintf(t1,'%s (%f %f %f)n',blanks(5),w5(1),w5(2),w5(3));
fprintf(t1,'%snn',w06);
%Blocks
fprintf(t1,'%sn',b1);
fprintf(t1,'%sn',b2);
fprintf(t1,'%sn',b3);
fprintf(t1,'%snn',b4);
%Edges
fprintf(t1,'%sn',e1);
fprintf(t1,'%sn',e2);
fprintf(t1,'%sn',e3);
fprintf(t1,'%sn',e4);
fprintf(t1,'%snn',e5);
%Boundaries
fprintf(t1,'%sn',B1);
fprintf(t1,'%sn',B2);
fprintf(t1,'%sn',B3);
fprintf(t1,'%sn',B4);
fprintf(t1,'%sn',B5);
fprintf(t1,'%sn',B6);
fprintf(t1,'%sn',B7);
fprintf(t1,'%sn',B8);
fprintf(t1,'%sn',B9);
fprintf(t1,'%sn',B10);
fprintf(t1,'%sn',B11);
fprintf(t1,'%sn',B12);
fprintf(t1,'%sn',B13);
fprintf(t1,'%sn',B14);
fprintf(t1,'%sn',B15);
fprintf(t1,'%sn',B16);
fprintf(t1,'%sn',B17);
fprintf(t1,'%sn',B18);
fprintf(t1,'%sn',B19);
fprintf(t1,'%sn',B20);
fprintf(t1,'%sn',B21);
fprintf(t1,'%sn',B22);
fprintf(t1,'%sn',B23);
fprintf(t1,'%sn',B24);
fprintf(t1,'%sn',B25);
fprintf(t1,'%sn',B26);
fprintf(t1,'%sn',B27);
fprintf(t1,'%sn',B28);
fprintf(t1,'%sn',B29);
fprintf(t1,'%sn',B30);
fprintf(t1,'%sn',B31);
fprintf(t1,'%sn',B32);
fprintf(t1,'%sn',B33);
fprintf(t1,'%sn',B34);
fprintf(t1,'%sn',B35);
fprintf(t1,'%sn',B36);
fprintf(t1,'%sn',B37);
fprintf(t1,'%sn',B38);
fprintf(t1,'%sn',B39);
fprintf(t1,'%sn',B40);
fprintf(t1,'%sn',B41);
fprintf(t1,'%sn',B42);
fprintf(t1,'%sn',B43);
fprintf(t1,'%sn',B44);
fprintf(t1,'%sn',B45);
fprintf(t1,'%sn',B46);
fprintf(t1,'%sn',B47);
fprintf(t1,'%sn',B48);
fprintf(t1,'%sn',B49);
fprintf(t1,'%sn',B50);
fprintf(t1,'%sn',B51);
%Merging Patches & Ending
fprintf(t1,'%sn',m1);
fprintf(t1,'%sn',m2);
fprintf(t1,'%snn',m3);
fprintf(t1,'%sn',End);
Here, symmetry geometry contains 6 vertices, 5 faces , 2 arc shaped faces and 1 base axis.
Mesh refinement is done at wall using appropriate grading factor.
BlockMeshDict file for 10 degree :
/*------------------------------*- C++ -*------------------------------*
========= |
/ F ield | OpenFOAM : The Opensource CFD Toolbox
/ O peration | Website : https://openfoam.org
/ A nd | Version : 7
/ M anipulation |
*----------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
//*********************************************************************//
convertToMeters 0.001;
vertices
(
(0.000000 0.000000 0.000000)
(9.961947 -0.871557 0.000000)
(9.961947 0.871557 0.000000)
(0.000000 0.000000 2520.000000)
(9.961947 -0.871557 2520.000000)
(9.961947 0.871557 2520.000000)
);
blocks
(
hex(0 1 2 0 3 4 5 3) (20 1 500) simpleGrading(0.1 1 1)
);
edges
(
arc 2 1 (10 0 0)
arc 4 5 (10 0 2100)
);
boundary
(
inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
topwall
{
type wall;
faces
(
(5 4 1 2)
);
}
front
{
type symmetry;
faces
(
(3 5 2 0)
);
}
back
{
type symmetry;
faces
(
(4 3 0 1)
);
}
baseaxis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ***************************************************************** //
Created geometry (10 Degree) :

BlockMeshDict file for 25 degree :
/*------------------------------*- C++ -*------------------------------*
========= |
/ F ield | OpenFOAM : The Opensource CFD Toolbox
/ O peration | Website : https://openfoam.org
/ A nd | Version : 7
/ M anipulation |
*----------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
//*********************************************************************//
convertToMeters 0.001;
vertices
(
(0.000000 0.000000 0.000000)
(9.762960 -2.164396 0.000000)
(9.762960 2.164396 0.000000)
(0.000000 0.000000 2520.000000)
(9.762960 -2.164396 2520.000000)
(9.762960 2.164396 2520.000000)
);
blocks
(
hex(0 1 2 0 3 4 5 3) (20 1 500) simpleGrading(0.1 1 1)
);
edges
(
arc 2 1 (10 0 0)
arc 4 5 (10 0 2100)
);
boundary
(
inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
topwall
{
type wall;
faces
(
(5 4 1 2)
);
}
front
{
type symmetry;
faces
(
(3 5 2 0)
);
}
back
{
type symmetry;
faces
(
(4 3 0 1)
);
}
baseaxis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ***************************************************************** //
Created geometry (25 Degree) :

BlockMeshDict file for 45 degree :
/*------------------------------*- C++ -*------------------------------*
========= |
/ F ield | OpenFOAM : The Opensource CFD Toolbox
/ O peration | Website : https://openfoam.org
/ A nd | Version : 7
/ M anipulation |
*----------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
//*********************************************************************//
convertToMeters 0.001;
vertices
(
(0.000000 0.000000 0.000000)
(9.238795 -3.826834 0.000000)
(9.238795 3.826834 0.000000)
(0.000000 0.000000 2520.000000)
(9.238795 -3.826834 2520.000000)
(9.238795 3.826834 2520.000000)
);
blocks
(
hex(0 1 2 0 3 4 5 3) (20 1 500) simpleGrading(0.1 1 1)
);
edges
(
arc 2 1 (10 0 0)
arc 4 5 (10 0 2100)
);
boundary
(
inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
topwall
{
type wall;
faces
(
(5 4 1 2)
);
}
front
{
type symmetry;
faces
(
(3 5 2 0)
);
}
back
{
type symmetry;
faces
(
(4 3 0 1)
);
}
baseaxis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ***************************************************************** //
Created geometry (45 Degree) :

Symmetry Boundary Condition :
Velocity
/*--------------------------------*- C++ -*----------------------------------*
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 7 |
| \ / A nd | Web: www.OpenFOAM.org |
| \/ M anipulation | |
*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
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 0 0.1053);
}
outlet
{
type zeroGradient;
}
topWall
{
type noSlip;
}
front
{
type symmetry;
}
back
{
type symmetry;
}
baseaxis
{
type empty;
}
}
// ************************************************************************* //
Pressure
/*--------------------------------*- C++ -*----------------------------------*
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 7 |
| \ / A nd | Web: www.OpenFOAM.org |
| \/ M anipulation | |
*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
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;
}
topWall
{
type zeroGradient;
}
front
{
type symmetry;
}
back
{
type symmetry;
}
baseaxis
{
type empty;
}
}
// ************************************************************************* //
Results :
Velocity at x=2.52m for 10,25,45 Degree

Velocity magnitude is zero at the wall region and maximum at the center for all the angles.
Comparison :

From the above plot, we can see that velocity at fully developed region is 0.2075 m/s
Shear Stress profile at x=2.52 m for 10 Degree

Shear Stress profile at x=2.52 m for 25 Degree

Shear Stress profile at x=2.52 m for 45 Degree

Above figures show that shear stress is almost zero at center and maximum at the wall.
Conclusion :

- Velocity Profile is fully developed at Hydrodynamic Entrance Length in both Boundary Conditions.
- Pressure is maximum at inlet and tends to gauge pressure at outlet.
- Shear Stress is zero at center and maximum at wall region.
- Numerical data is valid with Exact solution with negligible deviation.
- Symmetry BC has little less deviation w.r.t. Wedge BC
##############################################################################