Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
Objective:
To study the effect of the wedge angle and the Boundary Conditions on the simulation of an axisymmetric laminar flow in a cylindrical pipe.
The given wedge angles in degrees are-
- 10
- 25
- 45
Axi-symmetric flow:
A flow pattern is axisymmetric when it is identical in every plane that passes through a certain straight line. The straight line is the symmetry axis. Every longitudinal plane through the axis would exhibit the same streamline pattern.
Hagen Poiseuille's Equation:
In nonideal fluid dynamics, the Hagen–Poiseuille equation 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 a constant cross-section.
Laminar Flow:
In fluid dynamics, laminar flow is a type of fluid flow in which the fluid travels smoothly or in regular paths.
The diagrammatic representation of flow through the pipe. This is what the fluid profile looks like.

Assumption:
- Flow is steady, incompressible, and laminar.
- Flow is two-dimensional.
- Fluid properties are constant (viscosity, density, etc)
Given:
- Reynolds number: 2100
- Working fluid: Water
- Fluid temperature: `25^0C`
- Diameter of the pipe, D = 0.02 m
- Dynamic viscosity, (`mu`) = `0.89xx10^(-3)`Pa-s
- Kinematic Viscosity,`nu`= `0.89xx10^(-6)` `m^2s^-1`
- `Delta P = (32*mu*L*V_(avg))/(D^2)`
- `theta` = wedge angle
- L = 2.52 m
Analytical Solution:
- Average Velocity, `V_(avg) = (R_e*mu)/(rho*D)` = 0.09373 `ms^-1`
- Maximum velocity, `V_(max) = 2*V_(avg)` = 0.18746 `ms^-1`
- Pressure Drop = `(32xx0.00089xx2.52xx0.09373)/(0.02^2)` = 16.817 Pa
- Kinematic Pressure Drop, `(DeltaP)/P` = 0.016817 m
MATLAB:
The code for Wedge Boundary Condition (Wedge angle will be taken from user input)
% Matlab code for generating the blockMeshDict file
% Wedge Boundary Condition
% Wedge angles = 10, 25, 45 degrees
clear all
close all
clc
% Inputs
% Wedge angle
% Take angle as input from 10, 25, 45 degrees
theta = input('Enter the value of wedge angle = ');
% Reynolds number
Re =2100;
% Diameter
D=0.02;
% Length
L=0.06*Re*D;
% Radius
R=D/2;
% Dynamic viscosity
mu=0.89e-3;
% Density
rho=997.0;
% Kinematic viscosity
nu=mu/rho;
% Pressure and velocity
v_avg=Re*mu/(D*rho);
v_max=2*v_avg;
del_P =(32*mu*v_avg*L)/(D^2);
kin_P=del_P/rho;
n1=50;
n2=1;
n3=300;
gfactor=0.5;
% Vertices of the wedge
V0=[0 0 0 ];
V1=[0 R*cosd(theta/2) -R*sind(theta/2)];
V2=[0 R*cosd(theta/2) R*sind(theta/2)];
V3=[L 0 0 ];
V4=[L R*cosd(theta/2) -R*sind(theta/2)];
V5=[L R*cosd(theta/2) R*sind(theta/2)];
% Printing the contents of blockMesh file
string1='/*-------------------------------------*- C++ -*---------------------*\';
string2=' ========= | ';
string3=' \ / F ield | ';
string4=' \ / O peration |OPENFOAM:The Open Source CFD Toolbox ';
string5=' \ / A nd |Version: 9 ';
string6=' \ / M anipulation |Website: https://openfoam.org ';
string7='\*-------------------------------------------------------------------*/';
string8='FoamFile';
string9='{';
string10=' version 2.0;';
string11=' format ascii;';
string12=' class dictionary;';
string13=' object blockMeshDict;';
string14='}';
string15='//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //';
string16='//*******************************************************************//';
fpointer=fopen('blockMeshDict.txt','wt');
fprintf(fpointer,'%s\n',string1);
fprintf(fpointer,'%s\n',string2);
fprintf(fpointer,'%s\n',string3);
fprintf(fpointer,'%s\n',string4);
fprintf(fpointer,'%s\n',string5);
fprintf(fpointer,'%s\n',string6);
fprintf(fpointer,'%s\n \n',string7);
fprintf(fpointer,'%s\n',string8);
fprintf(fpointer,'%s\n',string9);
fprintf(fpointer,'%s\n',string10);
fprintf(fpointer,'%s\n',string11);
fprintf(fpointer,'%s\n',string12);
fprintf(fpointer,'%s\n',string13);
fprintf(fpointer,'%s\n',string14);
fprintf(fpointer,'%s\n \n',string15);
fprintf(fpointer,'%s\n','convertToMeters 1;');
fprintf(fpointer,'%s\n','vertices');
fprintf(fpointer,'%s\n','(');
fprintf(fpointer,'%s (%f %f %f)\n',blanks(5),V0(1),V0(2),V0(3));
fprintf(fpointer,'%s (%f %f %f)\n',blanks(5),V1(1),V1(2),V1(3));
fprintf(fpointer,'%s (%f %f %f)\n',blanks(5),V2(1),V2(2),V2(3));
fprintf(fpointer,'%s (%f %f %f)\n',blanks(5),V3(1),V3(2),V3(3));
fprintf(fpointer,'%s (%f %f %f)\n',blanks(5),V4(1),V4(2),V4(3));
fprintf(fpointer,'%s (%f %f %f)\n',blanks(5),V5(1),V5(2),V5(3));
fprintf(fpointer,'%s\n',');');
fprintf(fpointer,'\n');
fprintf(fpointer,'%s\n','blocks');
fprintf(fpointer,'%s\n','(');
fprintf(fpointer,'%s %s \n',blanks(5),'hex (0 1 2 0 3 4 5 3 ) (50 1 200) simpleGrading (0.5 1 1)');
fprintf(fpointer,'%s\n',');');
fprintf(fpointer,'\n');
fprintf(fpointer,'%s\n','edges');
fprintf(fpointer,'%s\n','(');
fprintf(fpointer,'%s arc 1 2 (%f %f %f)\n',blanks(5),0,R,0);
fprintf(fpointer,'%s arc 4 5 (%f %f %f)\n',blanks(5),0,R,0);
fprintf(fpointer,'%s\n',');');
fprintf(fpointer,'\n');
fprintf(fpointer,'%s\n','boundary');
fprintf(fpointer,'%s\n','(');
fprintf(fpointer,'%s %s\n',blanks(5),'inlet');
fprintf(fpointer,'%s %s\n',blanks(5),'{');
fprintf(fpointer,'%s %s\n',blanks(10),'type patch;');
fprintf(fpointer,'%s %s\n',blanks(10),'faces');
fprintf(fpointer,'%s %s\n',blanks(10),'(');
fprintf(fpointer,'%s %s\n',blanks(15),'(0 1 2 0 )');
fprintf(fpointer,'%s %s\n',blanks(10),');');
fprintf(fpointer,'%s %s\n',blanks(5),'}');
fprintf(fpointer,'%s %s\n',blanks(5),'outlet');
fprintf(fpointer,'%s %s\n',blanks(5),'{');
fprintf(fpointer,'%s %s\n',blanks(10),'type patch;');
fprintf(fpointer,'%s %s\n',blanks(10),'faces');
fprintf(fpointer,'%s %s\n',blanks(10),'(');
fprintf(fpointer,'%s %s\n',blanks(15),'(3 4 5 3)');
fprintf(fpointer,'%s %s\n',blanks(10),');');
fprintf(fpointer,'%s %s\n',blanks(5),'}');
fprintf(fpointer,'%s %s\n',blanks(5),'front');
fprintf(fpointer,'%s %s\n',blanks(5),'{');
fprintf(fpointer,'%s %s\n',blanks(10),'type wedge;');
fprintf(fpointer,'%s %s\n',blanks(10),'faces');
fprintf(fpointer,'%s %s\n',blanks(10),'(');
fprintf(fpointer,'%s %s\n',blanks(15),'(0 3 5 2)');
fprintf(fpointer,'%s %s\n',blanks(10),');');
fprintf(fpointer,'%s %s\n',blanks(5),'}');
fprintf(fpointer,'%s %s\n',blanks(5),'back');
fprintf(fpointer,'%s %s\n',blanks(5),'{');
fprintf(fpointer,'%s %s\n',blanks(10),'type wedge;');
fprintf(fpointer,'%s %s\n',blanks(10),'faces');
fprintf(fpointer,'%s %s\n',blanks(10),'(');
fprintf(fpointer,'%s %s\n',blanks(15),'(0 1 4 3)');
fprintf(fpointer,'%s %s\n',blanks(10),');');
fprintf(fpointer,'%s %s\n',blanks(5),'}');
fprintf(fpointer,'%s %s\n',blanks(5),'pipe');
fprintf(fpointer,'%s %s\n',blanks(5),'{');
fprintf(fpointer,'%s %s\n',blanks(10),'type wall;');
fprintf(fpointer,'%s %s\n',blanks(10),'faces');
fprintf(fpointer,'%s %s\n',blanks(10),'(');
fprintf(fpointer,'%s %s\n',blanks(15),'(1 4 5 2)');
fprintf(fpointer,'%s %s\n',blanks(10),');');
fprintf(fpointer,'%s %s\n',blanks(5),'}');
fprintf(fpointer,'%s %s\n',blanks(5),'axis');
fprintf(fpointer,'%s %s\n',blanks(5),'{');
fprintf(fpointer,'%s %s\n',blanks(10),'type empty;');
fprintf(fpointer,'%s %s\n',blanks(10),'faces');
fprintf(fpointer,'%s %s\n',blanks(10),'(');
fprintf(fpointer,'%s %s\n',blanks(15),'(0 3 3 0)');
fprintf(fpointer,'%s %s\n',blanks(10),');');
fprintf(fpointer,'%s %s\n',blanks(5),'}');
fprintf(fpointer,'%s\n',');');
fprintf(fpointer,'\n');
fprintf(fpointer,'%s\n','mergePatchPairs');
fprintf(fpointer,'%s\n','(');
fprintf(fpointer,'%s\n',');');
fprintf(fpointer,'\n');
fprintf(fpointer,'%s\n',string16);
fclose(fpointer);
The blockMeshDict File for wedge boundary condition at 45 degrees
/*-------------------------------------*- C++ -*---------------------*\
========= |
\ / F ield |
\ / O peration |OPENFOAM:The Open Source CFD Toolbox
\ / A nd |Version: 9
\ / M anipulation |Website: https://openfoam.org
\*-------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0.000000 0.000000 0.000000)
(0.000000 0.009239 -0.003827)
(0.000000 0.009239 0.003827)
(2.520000 0.000000 0.000000)
(2.520000 0.009239 -0.003827)
(2.520000 0.009239 0.003827)
);
blocks
(
hex (0 1 2 0 3 4 5 3 ) (50 1 200) simpleGrading (0.5 1 1)
);
edges
(
arc 1 2 (0.000000 0.010000 0.000000)
arc 4 5 (0.000000 0.010000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0 )
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
front
{
type wedge;
faces
(
(0 3 5 2)
);
}
back
{
type wedge;
faces
(
(0 1 4 3)
);
}
pipe
{
type wall;
faces
(
(1 4 5 2)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
//*******************************************************************//
The blockMeshDict File for wedge boundary condition at 25 degrees
/*-------------------------------------*- C++ -*---------------------*\
========= |
\ / F ield |
\ / O peration |OPENFOAM:The Open Source CFD Toolbox
\ / A nd |Version: 9
\ / M anipulation |Website: https://openfoam.org
\*-------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0.000000 0.000000 0.000000)
(0.000000 0.009763 -0.002164)
(0.000000 0.009763 0.002164)
(2.520000 0.000000 0.000000)
(2.520000 0.009763 -0.002164)
(2.520000 0.009763 0.002164)
);
blocks
(
hex (0 1 2 0 3 4 5 3 ) (50 1 200) simpleGrading (0.5 1 1)
);
edges
(
arc 1 2 (0.000000 0.010000 0.000000)
arc 4 5 (0.000000 0.010000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0 )
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
front
{
type wedge;
faces
(
(0 3 5 2)
);
}
back
{
type wedge;
faces
(
(0 1 4 3)
);
}
pipe
{
type wall;
faces
(
(1 4 5 2)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
//*******************************************************************//
The blockMeshDict File for wedge boundary condition at 10 degrees
/*-------------------------------------*- C++ -*---------------------*\
========= |
\ / F ield |
\ / O peration |OPENFOAM:The Open Source CFD Toolbox
\ / A nd |Version: 9
\ / M anipulation |Website: https://openfoam.org
\*-------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0.000000 0.000000 0.000000)
(0.000000 0.009962 -0.000872)
(0.000000 0.009962 0.000872)
(2.520000 0.000000 0.000000)
(2.520000 0.009962 -0.000872)
(2.520000 0.009962 0.000872)
);
blocks
(
hex (0 1 2 0 3 4 5 3 ) (50 1 200) simpleGrading (0.5 1 1)
);
edges
(
arc 1 2 (0.000000 0.010000 0.000000)
arc 4 5 (0.000000 0.010000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0 )
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
front
{
type wedge;
faces
(
(0 3 5 2)
);
}
back
{
type wedge;
faces
(
(0 1 4 3)
);
}
pipe
{
type wall;
faces
(
(1 4 5 2)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
//*******************************************************************//
ControlDict File for wedge Boundary Condition
/*--------------------------------*- 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 10;
deltaT 0.001;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Pressure File for Wedge Boundary Condition
/*--------------------------------*- 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.0168682;
}
axis
{
type empty;
}
pipe
{
type zeroGradient;
}
front
{
type wedge;
}
back
{
type wedge;
}
}
// ************************************************************************* //
Velocity File for Wedge Boundary Condition
/*--------------------------------*- 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.0937312 0 0);
}
outlet
{
type zeroGradient;
}
axis
{
type empty;
}
pipe
{
type noSlip;
}
front
{
type wedge;
}
back
{
type wedge;
}
}
// ************************************************************************* //
TransportProperties File for Wedge Boundary Condition
/*--------------------------------*- 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.927e-07;
// ************************************************************************* //
The code for Symmetry Boundary Condition (Wedge angle will be taken from user input)
% Matlab code for generating the blockMeshDict file
% Symmetry Boundary Condition
% Wedge angles = 10, 25, 45 degrees
clear all
close all
clc
% Inputs
% Wedge angle
% Take angle as input from 10, 25, 45 degrees
theta = input('Enter the value of wedge angle = ');
% Reynolds number
Re =2100;
% Diameter
D=0.02;
% Length
L=0.06*Re*D;
% Radius
R=D/2;
% Dynamic viscosity
mu=0.89e-3;
% Density
rho=997.0;
% Kinematic viscosity
nu=mu/rho;
% Pressure and velocity
v_avg=Re*mu/(D*rho);
v_max=2*v_avg;
del_P =(32*mu*v_avg*L)/(D^2);
kin_P=del_P/rho;
n1=50;
n2=1;
n3=300;
gfactor=0.5;
% Vertices of the wedge
V0=[0 0 0 ];
V1=[0 R*cosd(theta/2) -R*sind(theta/2)];
V2=[0 R*cosd(theta/2) R*sind(theta/2)];
V3=[L 0 0 ];
V4=[L R*cosd(theta/2) -R*sind(theta/2)];
V5=[L R*cosd(theta/2) R*sind(theta/2)];
% Printing the contents of blockMesh file
string1='/*-------------------------------------*- C++ -*---------------------*\';
string2=' ========= | ';
string3=' \ / F ield | ';
string4=' \ / O peration |OPENFOAM:The Open Source CFD Toolbox ';
string5=' \ / A nd |Version: 9 ';
string6=' \ / M anipulation |Website: https://openfoam.org ';
string7='\*-------------------------------------------------------------------*/';
string8='FoamFile';
string9='{';
string10=' version 2.0;';
string11=' format ascii;';
string12=' class dictionary;';
string13=' object blockMeshDict;';
string14='}';
string15='//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //';
string16='//*******************************************************************//';
fpointer=fopen('blockMeshDict.txt','wt');
fprintf(fpointer,'%s\n',string1);
fprintf(fpointer,'%s\n',string2);
fprintf(fpointer,'%s\n',string3);
fprintf(fpointer,'%s\n',string4);
fprintf(fpointer,'%s\n',string5);
fprintf(fpointer,'%s\n',string6);
fprintf(fpointer,'%s\n \n',string7);
fprintf(fpointer,'%s\n',string8);
fprintf(fpointer,'%s\n',string9);
fprintf(fpointer,'%s\n',string10);
fprintf(fpointer,'%s\n',string11);
fprintf(fpointer,'%s\n',string12);
fprintf(fpointer,'%s\n',string13);
fprintf(fpointer,'%s\n',string14);
fprintf(fpointer,'%s\n \n',string15);
fprintf(fpointer,'%s\n','convertToMeters 1;');
fprintf(fpointer,'%s\n','vertices');
fprintf(fpointer,'%s\n','(');
fprintf(fpointer,'%s (%f %f %f)\n',blanks(5),V0(1),V0(2),V0(3));
fprintf(fpointer,'%s (%f %f %f)\n',blanks(5),V1(1),V1(2),V1(3));
fprintf(fpointer,'%s (%f %f %f)\n',blanks(5),V2(1),V2(2),V2(3));
fprintf(fpointer,'%s (%f %f %f)\n',blanks(5),V3(1),V3(2),V3(3));
fprintf(fpointer,'%s (%f %f %f)\n',blanks(5),V4(1),V4(2),V4(3));
fprintf(fpointer,'%s (%f %f %f)\n',blanks(5),V5(1),V5(2),V5(3));
fprintf(fpointer,'%s\n',');');
fprintf(fpointer,'\n');
fprintf(fpointer,'%s\n','blocks');
fprintf(fpointer,'%s\n','(');
fprintf(fpointer,'%s %s \n',blanks(5),'hex (0 1 2 0 3 4 5 3 ) (50 1 200) simpleGrading (0.5 1 1)');
fprintf(fpointer,'%s\n',');');
fprintf(fpointer,'\n');
fprintf(fpointer,'%s\n','edges');
fprintf(fpointer,'%s\n','(');
fprintf(fpointer,'%s arc 1 2 (%f %f %f)\n',blanks(5),0,R,0);
fprintf(fpointer,'%s arc 4 5 (%f %f %f)\n',blanks(5),0,R,0);
fprintf(fpointer,'%s\n',');');
fprintf(fpointer,'\n');
fprintf(fpointer,'%s\n','boundary');
fprintf(fpointer,'%s\n','(');
fprintf(fpointer,'%s %s\n',blanks(5),'inlet');
fprintf(fpointer,'%s %s\n',blanks(5),'{');
fprintf(fpointer,'%s %s\n',blanks(10),'type patch;');
fprintf(fpointer,'%s %s\n',blanks(10),'faces');
fprintf(fpointer,'%s %s\n',blanks(10),'(');
fprintf(fpointer,'%s %s\n',blanks(15),'(0 1 2 0 )');
fprintf(fpointer,'%s %s\n',blanks(10),');');
fprintf(fpointer,'%s %s\n',blanks(5),'}');
fprintf(fpointer,'%s %s\n',blanks(5),'outlet');
fprintf(fpointer,'%s %s\n',blanks(5),'{');
fprintf(fpointer,'%s %s\n',blanks(10),'type patch;');
fprintf(fpointer,'%s %s\n',blanks(10),'faces');
fprintf(fpointer,'%s %s\n',blanks(10),'(');
fprintf(fpointer,'%s %s\n',blanks(15),'(3 4 5 3)');
fprintf(fpointer,'%s %s\n',blanks(10),');');
fprintf(fpointer,'%s %s\n',blanks(5),'}');
fprintf(fpointer,'%s %s\n',blanks(5),'front');
fprintf(fpointer,'%s %s\n',blanks(5),'{');
fprintf(fpointer,'%s %s\n',blanks(10),'type symmetry;');
fprintf(fpointer,'%s %s\n',blanks(10),'faces');
fprintf(fpointer,'%s %s\n',blanks(10),'(');
fprintf(fpointer,'%s %s\n',blanks(15),'(0 3 5 2)');
fprintf(fpointer,'%s %s\n',blanks(10),');');
fprintf(fpointer,'%s %s\n',blanks(5),'}');
fprintf(fpointer,'%s %s\n',blanks(5),'back');
fprintf(fpointer,'%s %s\n',blanks(5),'{');
fprintf(fpointer,'%s %s\n',blanks(10),'type symmetry;');
fprintf(fpointer,'%s %s\n',blanks(10),'faces');
fprintf(fpointer,'%s %s\n',blanks(10),'(');
fprintf(fpointer,'%s %s\n',blanks(15),'(0 1 4 3)');
fprintf(fpointer,'%s %s\n',blanks(10),');');
fprintf(fpointer,'%s %s\n',blanks(5),'}');
fprintf(fpointer,'%s %s\n',blanks(5),'pipe');
fprintf(fpointer,'%s %s\n',blanks(5),'{');
fprintf(fpointer,'%s %s\n',blanks(10),'type wall;');
fprintf(fpointer,'%s %s\n',blanks(10),'faces');
fprintf(fpointer,'%s %s\n',blanks(10),'(');
fprintf(fpointer,'%s %s\n',blanks(15),'(1 4 5 2)');
fprintf(fpointer,'%s %s\n',blanks(10),');');
fprintf(fpointer,'%s %s\n',blanks(5),'}');
fprintf(fpointer,'%s %s\n',blanks(5),'axis');
fprintf(fpointer,'%s %s\n',blanks(5),'{');
fprintf(fpointer,'%s %s\n',blanks(10),'type empty;');
fprintf(fpointer,'%s %s\n',blanks(10),'faces');
fprintf(fpointer,'%s %s\n',blanks(10),'(');
fprintf(fpointer,'%s %s\n',blanks(15),'(0 3 3 0)');
fprintf(fpointer,'%s %s\n',blanks(10),');');
fprintf(fpointer,'%s %s\n',blanks(5),'}');
fprintf(fpointer,'%s\n',');');
fprintf(fpointer,'\n');
fprintf(fpointer,'%s\n','mergePatchPairs');
fprintf(fpointer,'%s\n','(');
fprintf(fpointer,'%s\n',');');
fprintf(fpointer,'\n');
fprintf(fpointer,'%s\n',string16);
fclose(fpointer);
The blockMeshDict File for symmetry boundary condition at 45 degrees
/*-------------------------------------*- C++ -*---------------------*\
========= |
\ / F ield |
\ / O peration |OPENFOAM:The Open Source CFD Toolbox
\ / A nd |Version: 9
\ / M anipulation |Website: https://openfoam.org
\*-------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0.000000 0.000000 0.000000)
(0.000000 0.009239 -0.003827)
(0.000000 0.009239 0.003827)
(2.520000 0.000000 0.000000)
(2.520000 0.009239 -0.003827)
(2.520000 0.009239 0.003827)
);
blocks
(
hex (0 1 2 0 3 4 5 3 ) (50 1 200) simpleGrading (0.5 1 1)
);
edges
(
arc 1 2 (0.000000 0.010000 0.000000)
arc 4 5 (0.000000 0.010000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0 )
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
front
{
type symmetry;
faces
(
(0 3 5 2)
);
}
back
{
type symmetry;
faces
(
(0 1 4 3)
);
}
pipe
{
type wall;
faces
(
(1 4 5 2)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
//*******************************************************************//
The blockMeshDict File for symmetry boundary condition at 25 degrees
/*-------------------------------------*- C++ -*---------------------*\
========= |
\ / F ield |
\ / O peration |OPENFOAM:The Open Source CFD Toolbox
\ / A nd |Version: 9
\ / M anipulation |Website: https://openfoam.org
\*-------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0.000000 0.000000 0.000000)
(0.000000 0.009763 -0.002164)
(0.000000 0.009763 0.002164)
(2.520000 0.000000 0.000000)
(2.520000 0.009763 -0.002164)
(2.520000 0.009763 0.002164)
);
blocks
(
hex (0 1 2 0 3 4 5 3 ) (50 1 200) simpleGrading (0.5 1 1)
);
edges
(
arc 1 2 (0.000000 0.010000 0.000000)
arc 4 5 (0.000000 0.010000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0 )
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
front
{
type symmetry;
faces
(
(0 3 5 2)
);
}
back
{
type symmetry;
faces
(
(0 1 4 3)
);
}
pipe
{
type wall;
faces
(
(1 4 5 2)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
//*******************************************************************//
The blockMeshDict File for symmetry boundary condition at 10 degrees
/*-------------------------------------*- C++ -*---------------------*\
========= |
\ / F ield |
\ / O peration |OPENFOAM:The Open Source CFD Toolbox
\ / A nd |Version: 9
\ / M anipulation |Website: https://openfoam.org
\*-------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0.000000 0.000000 0.000000)
(0.000000 0.009962 -0.000872)
(0.000000 0.009962 0.000872)
(2.520000 0.000000 0.000000)
(2.520000 0.009962 -0.000872)
(2.520000 0.009962 0.000872)
);
blocks
(
hex (0 1 2 0 3 4 5 3 ) (50 1 200) simpleGrading (0.5 1 1)
);
edges
(
arc 1 2 (0.000000 0.010000 0.000000)
arc 4 5 (0.000000 0.010000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0 )
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
front
{
type symmetry;
faces
(
(0 3 5 2)
);
}
back
{
type symmetry;
faces
(
(0 1 4 3)
);
}
pipe
{
type wall;
faces
(
(1 4 5 2)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
//*******************************************************************//
Pressure File for symmetry boundary condition
/*--------------------------------*- 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.0168682;
}
axis
{
type empty;
}
pipe
{
type zeroGradient;
}
front
{
type symmetry;
}
back
{
type symmetry;
}
}
// ************************************************************************* //
Velocity File for symmetry boundary condition
/*--------------------------------*- 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.0937312 0 0);
}
outlet
{
type zeroGradient;
}
axis
{
type empty;
}
pipe
{
type noSlip;
}
front
{
type symmetry;
}
back
{
type symmetry;
}
}
// ************************************************************************* //
Output:
Velocity Profile
Wedge BC at 10-degree Symmetry BC at 10 degree

Wedge BC at 25-degree Symmetry BC at 25 degree

Wedge BC at 45-degree Symmetry BC at 45 degree

Pressure Profile
Wedge BC at 10-degree Symmetry BC at 10 degree

Wedge BC at 25-degree Symmetry BC at 25 degree

Wedge BC at 45-degree Symmetry BC at 45 degree

Velocity Graph
Wedge BC at 10-degree Symmetry BC at 10 degree

Wedge BC at 25-degree Symmetry BC at 25 degree

Wedge BC at 45-degree Symmetry BC at 45 degree

Pressure Graph
Wedge BC at 10-degree Symmetry BC at 10 degree

Wedge BC at 25-degree Symmetry BC at 25 degree

Wedge BC at 45-degree Symmetry BC at 45 degree

Shear Stress Graph
Wedge BC at 10-degree Symmetry BC at 10 degree

Wedge BC at 25-degree Symmetry BC at 25 degree

Wedge BC at 45-degree Symmetry BC at 45 degree

Results:
- From Velocity graphs, we can observe that the slope for symmetry BC is more than that of wedge BC. Also, for both wedge BC and symmetry BC slope is increasing as the wedge angle is increasing.
- From Pressure graphs, we can observe that for wedge BC the line is straight, but not for symmetry BC.
- From shear stress graphs, we can observe that the slope for wedge BC is more than that of symmetry BC. Also, for both wedge BC and symmetry BC slope is increasing as the wedge angle is increasing.
To validate the Hydrodynamic length with the Numerical Result:
In fluid dynamics, the entrance length is the distance a flow travels after entering a pipe before the flow becomes fully developed.
Numerically, we know that the velocity profile will be different before and after the Hydrodynamic entry length. After the Hydrodynamic entry length, the Velocity profile will be the final parabolic profile that it must have in a fully developed region.
To calculate the Hydrodynamic length analytically,
`L_h = 0.005*R_e*D`
where, Re = Reynolds number; D = Diameter.
`L_h` = 0.005*2100*0.02 = 0.21 m
To validate Maximum Pressure drop in the Fully developed Region:
Pressure Drop, `DeltaP` = `(32xx0.00089xx2.52xx0.09373)/(0.02^2)` = 16.817 Pa
From the graph, max P = 0.039 * 1000 Pa; min P = 0.022 * 1000 Pa
so, Pressure drop = 0.017*1000 = 17 Pa
Error in drop = Numerical - Practical = 17 - 16.817 = 0.183 Pa
To validate Maximum Velocity:
Average Velocity, `V_(avg) = (R_e*mu)/(rho*D)` = 0.09373 `ms^-1`
Maximum velocity, `V_(max) = 2*V_(avg)` = 0.18746 `ms^-1`
From the graph, we can that observe max velocity is 0.15 `ms^-1`
Error = |Numerical Velocity - Graphical Velocity| = |0.15 - 0.18746| = 0.03746
Comparison between the two Boundary Conditions:
- We have performed Simulations for two Boundary Conditions, which are Symmetry Boundary Condition and the Wedge Boundary Condition.
- During the Wedge Boundary condition simulation, the simulation across the arc of the wedge is not done, but whereas in the case of Symmetry Boundary Condition, the calculation across the arc of the wedge is done. Hence, the simulation time is higher in that case.
- The Courant number is increasing slightly in the case of wedge Boundary Condition and hence the Symmetry Boundary Condition will be slightly more accurate.
- The Symmetry Boundary condition considers the Mesh as 3D and the calculation is done along all the three global axes.