Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
objective:
will need to simulate the same problem as in week 1 but by applying Symmetry Boundary Condition. You will do the simulation for the below-mentioned angles using both symmetry and wedge boundary conditions and validate them with HP equations as you did in the week 11 challenge.
Angles to test:
- 10o">10 deg
- 25o">25 deg
- 45o">45 deg
Assumptions made:
Flow is steady and incompressible and laminar flow
Flow is two dimensional (flow with respect to theta is ignored
Constant fluid properties.
Introduction to laminar flow through a pipe:
In this project, we aim to simulate the section of pipe (wedge-shaped geometry) to understand various aspects of flow through a pipe. The fluid chosen is water and flow is laminar and incompressible. Also, we are neglecting the changes in cross-section. The specified Re number is 2100
Internal flow occurs when the flow is 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 a no-slip boundary condition to a maximum at a pipe centre. The average velocity in a pipe remains constant in an incompressible flow when the cross-section of the pipe is constant.
Reynolds number (Re): the transition from laminar to turbulent occurs from (Re< 210) to transition (Re<2100 Re<4000) to turbulent (Re>4000) for smooth flow with no dissipation. It depends upon the geometry faces and roughness, flow velocity, surface temperature and etc. Re number is important in non-dimensional number which is the ratio of internal forces to viscous forces.

Hydrodynamic entry length:
The region from the pipe inlet to the point at which the velocity boundary layer merges at the centre line is called as hydrodynamic entrance length region. The region beyond the entrance area in which the velocity profile is fully developed is called a fully developed region.

In laminar flow, entry length is given approximately as
To do the simulation we need to find properties using some variables. Those are Hagen-poisulles equations.
Variables:
Diameter D=0.004
Radiur r=0.002
Radial distance R=0 to r
Dynamic viscosity mu=0.00089 N/m^2
Density rho= 997 kg/m^3
Reynolds number Re=2100
Hagen-poissule equation:
In Newtonian fluid dynamic, the Hagen-poiseuille equation also known as the Hagen-possible law is a physical law that gives pressure drop in an incompressible and Newtonian fluid laminar flow through a long cylindrical pipe of the constant cross-section.
Formulaes:
Program:
- In the task of generating the block mesh dict file which generates the mesh file in the OpenFOAM tool, we need to write code in Matlab.
- We have also included the codes that produce the analytical solution for the fluid Vavg, Vmax, pressure difference, kinematic pressure difference, and shear stress.
program to create the BlockMeshDict using matlab codeing:
clear all
close all
clc
% the reynolds number
Re=2100;
% diameter of the pipe
d=10
%entry length of the pipe
L=1500
%radius of the pipe
r=d/2
%angle of wedge
theta= input('input the wedge angle= ')
height_wedge=r*cosd(theta/2)
width_wedge=r*sind(theta/2)
header1='/*----------------------------*-C++ -*--------------------------------*\'
header2=' ======== | '
header3=' \\ / Field |OpenFOAM: The Open Source CFD Toolbox '
header4=' \\ / Operation |Website: https://openfoam.org '
header5=' \\ / And |Version: 8 '
header6=' \\ / Manipulation | '
header7='\*---------------------------------------------------------------------*/'
f1=fopen('blockMeshDict1','w')
fprintf(f1, '%s\n', header1);
fprintf(f1, '%s\n', header2);
fprintf(f1, '%s\n', header3);
fprintf(f1, '%s\n', header4);
fprintf(f1, '%s\n', header5);
fprintf(f1, '%s\n', header6);
fprintf(f1, '%s\n', header7);
fprintf(f1, 'FoamFile\n{\n')
fprintf(f1, '%12s \t 2.0;\n','version')
fprintf(f1, '%12s \t ascii;\n','format')
fprintf(f1, '%12s \t dictionary;\n','class')
fprintf(f1, '%12s \t blockMeshDict;\n','object')
fprintf(f1, '}\n')
header8= '// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //'
fprintf(f1, '%s\n\n',header8)
fprintf(f1, 'convertToMeters 0.0011;\n\n')
fprintf(f1, 'vertices\n')
fprintf(f1, '(\n')
fprintf(f1, ' \t (%d %d %d)\n',0,0,0);
fprintf(f1, ' \t (%d %d %d)\n',0,height_wedge,-width_wedge)
fprintf(f1, ' \t (%d %d %d)\n',0,height_wedge,width_wedge);
fprintf(f1, ' \t (%d %d %d)\n',1500,0,0)
fprintf(f1, ' \t (%d %d %d)\n',L,height_wedge,-width_wedge)
fprintf(f1, ' \t (%d %d %d)\n',L,height_wedge,width_wedge)
fprintf(f1, ');\n\n')
fprintf(f1, 'blocks\n')
fprintf(f1, '(\n')
fprintf(f1, '\t hex (0 1 2 0 3 4 5 3) (%d %d %d)',50,1,400)
fprintf(f1, ' simpleGrading (0.1 1 10)\n\n')
fprintf(f1, ');\n\n')
fprintf(f1, 'edges\n')
fprintf(f1, '(\n')
fprintf(f1, '\t arc %d %d (%d %d %d)\n',1,2,0,r,0)
fprintf(f1, '\t arc %d %d (%d %d %d)\n',4,5,L,r,0)
fprintf(f1, ');\n\n')
fprintf(f1, 'boundary\n')
fprintf(f1, '(\n')
fprintf(f1, '\t inlet \n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t type patch;\n')
fprintf(f1, '\t\t faces\n')
fprintf(f1, '\t\t (\n')
fprintf(f1, '\t\t\t (0 2 1 0)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '\t outlet\n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t type patch;\n')
fprintf(f1, '\t\t faces\n')
fprintf(f1, '\t\t (\n')
fprintf(f1, '\t\t \t (3 4 5 3)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '\t upperwall\n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t type wall;\n')
fprintf(f1, '\t\t faces\n')
fprintf(f1, '\t\t (\n')
fprintf(f1, '\t\t \t (1 2 5 4)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '\t lowerwall\n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t type empty;\n')
fprintf(f1, '\t\t faces\n')
fprintf(f1, '\t\t (\n')
fprintf(f1, '\t\t \t (0 3 3 0)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '\t front\n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t type symmetry;\n')
fprintf(f1, '\t\t faces\n')
fprintf(f1, '\t\t (\n')
fprintf(f1, '\t\t \t (0 3 5 2)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '\t back\n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t type symmetry;\n')
fprintf(f1, '\t\t faces\n')
fprintf(f1, '\t\t (\n')
fprintf(f1, '\t\t \t (0 1 4 3)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, ');\n')
fprintf(f1, 'mergePatchPairs\n')
fprintf(f1, '(\n')
fprintf(f1, ');\n')
header9='// ************************************************************ //'
fprintf(f1, '%s\n', header9)
fclose(f1)
blockMeshDcict file that creates the wedge angle of 10:
/*----------------------------*-C++ -*--------------------------------*\
======== |
\\ / Field |OpenFOAM: The Open Source CFD Toolbox
\\ / Operation |Website: https://openfoam.org
\\ / And |Version: 8
\\ / Manipulation |
\*---------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.0011;
vertices
(
(0 0 0)
(0 4.98097 -0.435779)
(0 4.98097 0.435779)
(1500 0 0)
(1500 4.98097 -0.435779)
(1500 4.98097 0.435779)
);
blocks
(
hex (0 1 2 0 3 4 5 3) (50 1 400) simpleGrading (0.1 1 10)
);
edges
(
arc 1 2 (0 5 0)
arc 4 5 (1500 5 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
upperwall
{
type wall;
faces
(
(1 2 5 4)
);
}
lowerwall
{
type empty;
faces
(
(0 3 3 0)
);
}
front
{
type symmetry;
faces
(
(0 3 5 2)
);
}
back
{
type symmetry;
faces
(
(0 1 4 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************ //
blockMeshDcict file that creates the wedge angle of 25:
/*----------------------------*-C++ -*--------------------------------*\
======== |
\\ / Field |OpenFOAM: The Open Source CFD Toolbox
\\ / Operation |Website: https://openfoam.org
\\ / And |Version: 8
\\ / Manipulation |
\*---------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.0011;
vertices
(
(0 0 0)
(0 4.88148 -1.0822)
(0 4.88148 1.0822)
(1500 0 0)
(1500 4.88148 -1.0822)
(1500 4.88148 1.0822)
);
blocks
(
hex (0 1 2 0 3 4 5 3) (50 1 400) simpleGrading (0.1 1 10)
);
edges
(
arc 1 2 (0 5 0)
arc 4 5 (1500 5 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
upperwall
{
type wall;
faces
(
(1 2 5 4)
);
}
lowerwall
{
type empty;
faces
(
(0 3 3 0)
);
}
front
{
type symmetry;
faces
(
(0 3 5 2)
);
}
back
{
type symmetry;
faces
(
(0 1 4 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************ //
blockMeshDcict file that creates the wedge angle of 45:
/*----------------------------*-C++ -*--------------------------------*\
======== |
\\ / Field |OpenFOAM: The Open Source CFD Toolbox
\\ / Operation |Website: https://openfoam.org
\\ / And |Version: 8
\\ / Manipulation |
\*---------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.0011;
vertices
(
(0 0 0)
(0 4.6194 -1.91342)
(0 4.6194 1.91342)
(1500 0 0)
(1500 4.6194 -1.91342)
(1500 4.6194 1.91342)
);
blocks
(
hex (0 1 2 0 3 4 5 3) (50 1 400) simpleGrading (0.1 1 10)
);
edges
(
arc 1 2 (0 5 0)
arc 4 5 (1500 5 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
upperwall
{
type wall;
faces
(
(1 2 5 4)
);
}
lowerwall
{
type empty;
faces
(
(0 3 3 0)
);
}
front
{
type symmetry;
faces
(
(0 3 5 2)
);
}
back
{
type symmetry;
faces
(
(0 1 4 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************ //
controlDict file:
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 5;
deltaT 0.001;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
velocity File:
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
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;
}
upperwall
{
type noSlip;
}
lowerwall
{
type empty;
}
front
{
type symmetry;
}
back
{
type symmetry;
}
}
// ************************************************************************* //
presure file:
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ 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;
}
upperwall
{
type zeroGradient;
}
lowerwall
{
type empty;
}
front
{
type symmetry;
}
back
{
type symmetry;
}
}
// ************************************************************************* //
transport propertirs:
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 8.9e-7;
// ************************************************************************* //
results:
output for the wedge angle of10 degree:


output for the wedge angle 25 degree:


output for the wedge angle of 45 degree:


conclusion:
we can observe that there is not much change in the velocity, the only difference observed is execution time will be a little high than type wedge. while the angle increases the error in the maximum velocity is decreased. through there is mot much difference between analytical and numerical results and also with increasing the angle of the wedge. the concurrent number is slightly increasing. we can say that the symmetric boundary condition plays an important role in terms of accuracy in the result.