Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
VALIDATION STUDY OF SYMMETRY BC Vs WEDGE BC IN OpenFOAM VS ANALYTICAL HAGEN - POISEUILLE EQUATION:-
Angles to Test:-
- 10°
- 25°
- 45°
To do the simulation for the given angles using both symmetry and wedge boundary condition and validate with Hagen - poiseuille equation.
Expected result:-
- Validate Hydro-dynamic length with numerical results.
- Validate the fully developed flow velocity profile with its analytical profile.
- Validate maximum velocity and pressure drop for fully developed flow.
- Post-process Shear stress and validate wall shear stress for fully developed flow.
- Highlight the difference in both boundary conditions in terms of their usage and application.
Physical Properties:-
The water is considered as a working fluid.
- Diameter of the Pipe (D) = 0.02 m
- Reynolds Number (Re) = 2100
- Density of the water(`rho`) = `998.2 kg//m^3`
- Dynamic Viscosity of water (`mu`) = `1.005 xx 10^-3 Pa.s`
- Kinematic Viscosity of water (`nu`) = `1.002 xx 10^-6 m^2//s`
Hagen -Poiseuille Equation:-
The Hagen - Poiseuille equation is a physical law that gives the pressure drop in a fluid flow through a long cylindrical pipe. The assumption of the equation is that the flow is laminar viscous and incompressible and the flow is through a constant circular cross-section that is substantially longer than its diameter. the equation is also known as the Hagen - Poiseuille law.
`Q = (DeltaPpiD^4)/(128muL)`
Hydrodynamic entry region.

- The region of the flow in which the effects of the viscous shearing force caused by fluid viscosity are felt is called the velocity boundary layer.
- The Hypothetical boundary surface divides the flow in a pipe into two regions. The boundary layer region, in which the viscous effects and the velocity changes are significant, and the rotational flow region, in which the frictional effects are negligible and the velocity remains essentially constant in the radial direction.
- The thickness of this boundary layer increases in the flow direction until the boundary layer reaches the pipe center and thus fills the entire pipe. The region from the pipe inlet to the point at which the velocity profile is fully developed is called the hydrodynamic entrance region, and the length of this region is called the hydrodynamic entry length.
`L_(h,"laminar")/(D) = 0.05Re`
- The region beyond the entrance region in which the velocity profile is fully developed and remains unchanged is called the hydrodynamically fully developed region. The flow is said to be fully developed when the normalized temperature profile remains unchanged as well.
- The velocity Profile in the fully developed region is parabolic in laminar flow and much flatter in turbulent flow due to eddy motion and more vigorous in the radial direction.
- The shear stress at the pipe wall `(tau_w)` is related to the slope of the velocity profile at the surface. The velocity profile remains unchanged in the hydrodynamically fully developed region, the wall shear stress also remains constant in that region.
1. Velocity Average:
`Re = (rhoDV)/(mu)`
`2100 = (998.0 xx 0.02 xx V_(avg)) / (1.005 xx 10^-3)`
`V_(avg) = 0.1057(m//s^2)`
2. Maximum Velocity:
`U_(max) = 2* V_(avg) => U_(max) = 2 xx 0.1057`
`U_(max) = 0.2114 (m//s^2)`
3. Hydrodynamic Entrance Length of the Pipe:
`L_(h,"laminar") ~= 0.05*Re*D`
`L_(h,"laminar") ~= 0.05 xx 2100 xx 0.02`
`L _(h, "laminar") = 2.1 m`
4. Total Length of the Pipe:
`L_T = 3 m`
5. Pressure Drop `(DeltaP)`:
`DeltaP = (32 mu L V_(avg))/(D^2)`
`DeltaP = (32 xx 1.005 xx 10^-3 xx 2.5 xx 0.1057)/(0.02^2)`
`DeltaP = 21.2457 (Pa)`
where,
L = 2.5 m is taken which is the length after the hydrodynamic length.
Geometry Model:

In this geometry, the original model is reduced to find the flow of a fluid. It is easy to find the geometr vertices.
WEDGE BOUNDARY CONDITION:-
For the wedge boundary condition the controlDict File, Pressure File, Velocity File and transportProperties file are same in all angles of (10°, 25°, 45°).
contrlDict 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 startTime;
startTime 0;
stopAt endTime;
endTime 50;
deltaT 0.01;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Pressure File (p):
/*--------------------------------*- 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;
}
axis
{
type empty;
}
fixedWalls
{
type zeroGradient;
}
front
{
type wedge;
}
back
{
type wedge;
}
}
// ************************************************************************* //
Velocity File (U):
/*--------------------------------*- 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 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (0.1057 0 0);
}
outlet
{
type zeroGradient;
}
axis
{
type empty;
}
fixedWalls
{
type fixedValue;
value uniform (0 0 0);
}
front
{
type wedge;
}
back
{
type wedge;
}
}
// ************************************************************************* //
transportProperties 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 "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 0.000001002;
// ************************************************************************* //
1. Angle 10°
The angle is applied in the vertices of the blocks in the blockMeshDict File and the wedge boundary condition is applied in the pressure and velocity file
Matlab blockMeshDict File:
clear all
close all
clc
% Input Parameters
Re = 2100; % Reynolds number
D = 0.02; % Diameter of Pipe
R = D/2; % Radius of Pipe
theta = 10; % Wedge angle
rho = 998.2; % Denssity of water @ 20° in 'kg/m3'
mu = 1.005e-3; % Dynamic viscosity @ 20° in 'Pa*s'
nu = 1.002e-6; % Kinematic viscosity @ 20° in 'm2/s'
% Calculation of velocity, pressure and entrance length
Length_E = 0.05*Re*D;
Length_T = 3;
Velocity_avg = (Re*mu)/(rho*D);
% Vertices of blocks
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 = [Length_T 0 0];
v4 = [Length_T R*cosd(theta/2) R*sind(theta/2)];
v5 = [Length_T R*cosd(theta/2) -R*sind(theta/2)];
% BlockMeshDict File
f1 = fopen('blockMeshDict.txt','w');
fprintf(f1, '%s', '/*--------------------------------*- C++ -*----------------------------------*\');
fprintf(f1, '\n');
fprintf(f1, '%s',' ========= |');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / F ield | OpenFOAM: The Open Source CFD Toolbox');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / O peration | Website: https://openfoam.org');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / A nd | Version: 8');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\/ M anipulation |');
fprintf(f1, '\n');
fprintf(f1, '%s', '\*---------------------------------------------------------------------------*/');
fprintf(f1, '\nFoamFile\n');
fprintf(f1, '{\n');
fprintf(f1, ' version 2.0;\n');
fprintf(f1, ' format ascii;\n');
fprintf(f1, ' class dictionary;\n');
fprintf(f1, ' object blockMeshDict;\n');
fprintf(f1, '}\n');
fprintf(f1, '%s','// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //');
fprintf(f1, '\n\nconvertToMeters 1;\n\n');
fprintf(f1, 'vertices\n');
fprintf(f1, '(\n');
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v0(1),v0(2),v0(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v1(1),v1(2),v1(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v2(1),v2(2),v2(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v3(1),v3(2),v3(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v4(1),v4(2),v4(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v5(1),v5(2),v5(3));
fprintf(f1, ');\n\n');
fprintf(f1, 'blocks\n');
fprintf(f1, '(\n');
fprintf(f1, '%s', ' hex (0 1 4 3 0 2 5 3) (20 500 1) simpleGrading (1 1 1)');
fprintf(f1, '\n);\n');
fprintf(f1, '\nedges\n');
fprintf(f1, '(\n');
fprintf(f1, ' arc 2 1 (%f %f %f)\n',0,R,0);
fprintf(f1, ' arc 5 4 (%f %f %f)\n',Length_T,R,0);
fprintf(f1, ');\n\n');
fprintf(f1, 'boundary\n');
fprintf(f1, '(\n');
fprintf(f1, ' inlet\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type patch;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 1 2 0)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' outlet\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type patch;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (3 5 4 3)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' axis\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type empty;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 3 3 0)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' fixedWalls\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type wall;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (1 4 5 2)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' front\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type wedge;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 3 4 1)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' back\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type wedge;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' ( 0 2 5 3)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ');\n\n');
fprintf(f1, '%s', 'mergePatchPairs');
fprintf(f1, '\n(\n');
fprintf(f1, ');\n\n');
fprintf(f1, '%s', '// ************************************************************************* //');
fclose(f1);
blockMeshDict 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0.000000 0.000000 0.000000)
(0.000000 0.009962 0.000872)
(0.000000 0.009962 -0.000872)
(3.000000 0.000000 0.000000)
(3.000000 0.009962 0.000872)
(3.000000 0.009962 -0.000872)
);
blocks
(
hex (0 1 4 3 0 2 5 3) (20 500 1) simpleGrading (1 1 1)
);
edges
(
arc 2 1 (0.000000 0.010000 0.000000)
arc 5 4 (3.000000 0.010000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
fixedWalls
{
type wall;
faces
(
(1 4 5 2)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
( 0 2 5 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
To Run the Simulation:-
- After entering all the values for the geometry to run the simulation by entering the solver name 'icoFoam' to start the simulation.
- To check the uniform Mesh in Paraview by entering the command in terminal 'paraFoam'
Mesh Grid:

Result:
A. Validate velocity profile for fully developed flow:

- From the above graph, the velocity is plotted from the different lengths of the pipe ( 0.1m, 0.5m, 1m, 2m, 2.8m)
- The fully developed region is starting from 2.1m to 3m.
- The velocity profile in the fully developed region is parabolic. The above graph at 'x = 2.8 m' of the velocity curve is Parabolic. Hence, the flow is fully developed.
B. Validate Wall shear stress for fully developed flow:

- The Shear stress plot is linear in most of the regions. The shear stress is taken from the fully developed flow region of the pipe at 'x = 2.8m'.
- The wall shear stress remains constant in the hydrodynamically fully developed flow region.
- Therefore the flow is fully developed because the velocity profile is parabolic, and shear stress is propotional to the velocity gradient in the y-direction.
2. Angle 25°
Matlab blockMeshDict File:
clear all
close all
clc
% Input Parameters
Re = 2100; % Reynolds number
D = 0.02; % Diameter of Pipe
R = D/2; % Radius of Pipe
theta = 25; % Wedge angle
rho = 998.2; % Denssity of water @ 20° in 'kg/m3'
mu = 1.005e-3; % Dynamic viscosity @ 20° in 'Pa*s'
nu = 1.002e-6; % Kinematic viscosity @ 20° in 'm2/s'
% Calculation of velocity, pressure and entrance length
Length_E = 0.05*Re*D;
Length_T = 3;
Velocity_avg = (Re*mu)/(rho*D);
% Vertices of blocks
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 = [Length_T 0 0];
v4 = [Length_T R*cosd(theta/2) R*sind(theta/2)];
v5 = [Length_T R*cosd(theta/2) -R*sind(theta/2)];
% BlockMeshDict File
f1 = fopen('blockMeshDict.txt','w');
fprintf(f1, '%s', '/*--------------------------------*- C++ -*----------------------------------*\');
fprintf(f1, '\n');
fprintf(f1, '%s',' ========= |');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / F ield | OpenFOAM: The Open Source CFD Toolbox');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / O peration | Website: https://openfoam.org');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / A nd | Version: 8');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\/ M anipulation |');
fprintf(f1, '\n');
fprintf(f1, '%s', '\*---------------------------------------------------------------------------*/');
fprintf(f1, '\nFoamFile\n');
fprintf(f1, '{\n');
fprintf(f1, ' version 2.0;\n');
fprintf(f1, ' format ascii;\n');
fprintf(f1, ' class dictionary;\n');
fprintf(f1, ' object blockMeshDict;\n');
fprintf(f1, '}\n');
fprintf(f1, '%s','// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //');
fprintf(f1, '\n\nconvertToMeters 1;\n\n');
fprintf(f1, 'vertices\n');
fprintf(f1, '(\n');
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v0(1),v0(2),v0(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v1(1),v1(2),v1(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v2(1),v2(2),v2(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v3(1),v3(2),v3(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v4(1),v4(2),v4(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v5(1),v5(2),v5(3));
fprintf(f1, ');\n\n');
fprintf(f1, 'blocks\n');
fprintf(f1, '(\n');
fprintf(f1, '%s', ' hex (0 1 4 3 0 2 5 3) (20 500 1) simpleGrading (1 1 1)');
fprintf(f1, '\n);\n');
fprintf(f1, '\nedges\n');
fprintf(f1, '(\n');
fprintf(f1, ' arc 2 1 (%f %f %f)\n',0,R,0);
fprintf(f1, ' arc 5 4 (%f %f %f)\n',Length_T,R,0);
fprintf(f1, ');\n\n');
fprintf(f1, 'boundary\n');
fprintf(f1, '(\n');
fprintf(f1, ' inlet\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type patch;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 1 2 0)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' outlet\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type patch;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (3 5 4 3)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' axis\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type empty;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 3 3 0)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' fixedWalls\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type wall;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (1 4 5 2)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' front\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type wedge;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 3 4 1)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' back\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type wedge;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' ( 0 2 5 3)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ');\n\n');
fprintf(f1, '%s', 'mergePatchPairs');
fprintf(f1, '\n(\n');
fprintf(f1, ');\n\n');
fprintf(f1, '%s', '// ************************************************************************* //');
fclose(f1);
blockMeshDict 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0.000000 0.000000 0.000000)
(0.000000 0.009763 0.002164)
(0.000000 0.009763 -0.002164)
(3.000000 0.000000 0.000000)
(3.000000 0.009763 0.002164)
(3.000000 0.009763 -0.002164)
);
blocks
(
hex (0 1 4 3 0 2 5 3) (20 500 1) simpleGrading (1 1 1)
);
edges
(
arc 2 1 (0.000000 0.010000 0.000000)
arc 5 4 (3.000000 0.010000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
fixedWalls
{
type wall;
faces
(
(1 4 5 2)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
( 0 2 5 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
To Run the Simulation:-
- After entering all the values for the geometry to run the simulation by entering the solver name 'icoFoam' to start the simulation.
- To check the uniform Mesh in Paraview by entering the command in terminal 'paraFoam'
Mesh Grid:

Result:
A. Validate velocity profile for fully developed flow:

- From the above graph, the velocity is plotted from the different lengths of the pipe ( 0.1m, 0.5m, 1m, 2m, 2.8m)
- The fully developed region is starting from 2.1m to 3m.
- The velocity profile in the fully developed region is parabolic. The above graph at 'x = 2.8 m' of the velocity curve is Parabolic. Hence, the flow is fully developed.
B. Validate Wall shear stress for fully developed flow:

- The Shear stress plot is linear in most of the regions. The shear stress is taken from the fully developed flow region of the pipe at 'x = 2.8m'.
- The wall shear stress remains constant in the hydrodynamically fully developed flow region.
- Therefore the flow is fully developed because the velocity profile is parabolic, and shear stress is proportional to the velocity gradient in the y-direction.
3. Angle 45°
Matlab blockMeshDict File:
clear all
close all
clc
% Input Parameters
Re = 2100; % Reynolds number
D = 0.02; % Diameter of Pipe
R = D/2; % Radius of Pipe
theta = 45; % Wedge angle
rho = 998.2; % Denssity of water @ 20° in 'kg/m3'
mu = 1.005e-3; % Dynamic viscosity @ 20° in 'Pa*s'
nu = 1.002e-6; % Kinematic viscosity @ 20° in 'm2/s'
% Calculation of velocity, pressure and entrance length
Length_E = 0.05*Re*D;
Length_T = 3;
Velocity_avg = (Re*mu)/(rho*D);
% Vertices of blocks
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 = [Length_T 0 0];
v4 = [Length_T R*cosd(theta/2) R*sind(theta/2)];
v5 = [Length_T R*cosd(theta/2) -R*sind(theta/2)];
% BlockMeshDict File
f1 = fopen('blockMeshDict.txt','w');
fprintf(f1, '%s', '/*--------------------------------*- C++ -*----------------------------------*\');
fprintf(f1, '\n');
fprintf(f1, '%s',' ========= |');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / F ield | OpenFOAM: The Open Source CFD Toolbox');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / O peration | Website: https://openfoam.org');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / A nd | Version: 8');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\/ M anipulation |');
fprintf(f1, '\n');
fprintf(f1, '%s', '\*---------------------------------------------------------------------------*/');
fprintf(f1, '\nFoamFile\n');
fprintf(f1, '{\n');
fprintf(f1, ' version 2.0;\n');
fprintf(f1, ' format ascii;\n');
fprintf(f1, ' class dictionary;\n');
fprintf(f1, ' object blockMeshDict;\n');
fprintf(f1, '}\n');
fprintf(f1, '%s','// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //');
fprintf(f1, '\n\nconvertToMeters 1;\n\n');
fprintf(f1, 'vertices\n');
fprintf(f1, '(\n');
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v0(1),v0(2),v0(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v1(1),v1(2),v1(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v2(1),v2(2),v2(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v3(1),v3(2),v3(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v4(1),v4(2),v4(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v5(1),v5(2),v5(3));
fprintf(f1, ');\n\n');
fprintf(f1, 'blocks\n');
fprintf(f1, '(\n');
fprintf(f1, '%s', ' hex (0 1 4 3 0 2 5 3) (20 500 1) simpleGrading (1 1 1)');
fprintf(f1, '\n);\n');
fprintf(f1, '\nedges\n');
fprintf(f1, '(\n');
fprintf(f1, ' arc 2 1 (%f %f %f)\n',0,R,0);
fprintf(f1, ' arc 5 4 (%f %f %f)\n',Length_T,R,0);
fprintf(f1, ');\n\n');
fprintf(f1, 'boundary\n');
fprintf(f1, '(\n');
fprintf(f1, ' inlet\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type patch;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 1 2 0)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' outlet\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type patch;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (3 5 4 3)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' axis\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type empty;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 3 3 0)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' fixedWalls\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type wall;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (1 4 5 2)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' front\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type wedge;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 3 4 1)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' back\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type wedge;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' ( 0 2 5 3)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ');\n\n');
fprintf(f1, '%s', 'mergePatchPairs');
fprintf(f1, '\n(\n');
fprintf(f1, ');\n\n');
fprintf(f1, '%s', '// ************************************************************************* //');
fclose(f1);
blockMeshDict 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0.000000 0.000000 0.000000)
(0.000000 0.009239 0.003827)
(0.000000 0.009239 -0.003827)
(3.000000 0.000000 0.000000)
(3.000000 0.009239 0.003827)
(3.000000 0.009239 -0.003827)
);
blocks
(
hex (0 1 4 3 0 2 5 3) (20 500 1) simpleGrading (1 1 1)
);
edges
(
arc 2 1 (0.000000 0.010000 0.000000)
arc 5 4 (3.000000 0.010000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
fixedWalls
{
type wall;
faces
(
(1 4 5 2)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
( 0 2 5 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
To Run the Simulation:-
- After entering all the values for the geometry to run the simulation by entering the solver name 'icoFoam' to start the simulation.
- To check the uniform Mesh in Paraview by entering the command in terminal 'paraFoam'
Mesh Grid:

Result:
A. Validate velocity profile for fully developed flow:

- From the above graph, the velocity is plotted from the different lengths of the pipe ( 0.1m, 0.5m, 1m, 2m, 2.8m)
- The fully developed region is starting from 2.1m to 3m.
- The velocity profile in the fully developed region is parabolic. The above graph at 'x = 2.8 m' of the velocity curve is Parabolic. Hence, the flow is fully developed.
B. Validate Wall shear stress for fully developed flow:

- The Shear stress plot is linear in most of the regions. The shear stress is taken from the fully developed flow region of the pipe at 'x = 2.8m'.
- The wall shear stress remains constant in the hydrodynamically fully developed flow region.
- Therefore the flow is fully developed because the velocity profile is parabolic, and shear stress is proportional to the velocity gradient in the y-direction.
SYMMETRY BOUNDARY CONDITION:-
For the symmetry boundary condition the controlDict File, Pressure File, Velocity File, and transportProperties file are the same in all angles of (10°, 25°, 45°).
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 startTime;
startTime 0;
stopAt endTime;
endTime 50;
deltaT 0.01;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Pressure File(p):
/*--------------------------------*- 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;
}
axis
{
type empty;
}
fixedWalls
{
type zeroGradient;
}
front
{
type symmetryPlane;
}
back
{
type symmetryPlane;
}
}
// ************************************************************************* //
Velocity File(U):
/*--------------------------------*- 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 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (0.1057 0 0);
}
outlet
{
type zeroGradient;
}
axis
{
type empty;
}
fixedWalls
{
type fixedValue;
value uniform (0 0 0);
}
front
{
type symmetryPlane;
}
back
{
type symmetryPlane;
}
}
// ************************************************************************* //
transportProperties:-
/*--------------------------------*- 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] 0.000001002;
// ************************************************************************* //
1. Angle 10°
The angle is applied in the vertices of the blocks in the blockMeshDict File and the wedge boundary condition is applied in the pressure and velocity file
Matlab blockMeshDict File:
clear all
close all
clc
% Input Parameters
Re = 2100; % Reynolds number
D = 0.02; % Diameter of Pipe
R = D/2; % Radius of Pipe
theta = 10; % Wedge angle
rho = 998.2; % Denssity of water @ 20° in 'kg/m3'
mu = 1.005e-3; % Dynamic viscosity @ 20° in 'Pa*s'
nu = 1.002e-6; % Kinematic viscosity @ 20° in 'm2/s'
% Calculation of velocity, pressure and entrance length
Length_E = 0.05*Re*D;
Length_T = 3;
Velocity_avg = (Re*mu)/(rho*D);
% Vertices of blocks
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 = [Length_T 0 0];
v4 = [Length_T R*cosd(theta/2) R*sind(theta/2)];
v5 = [Length_T R*cosd(theta/2) -R*sind(theta/2)];
% BlockMeshDict File
f1 = fopen('blockMeshDict.txt','w');
fprintf(f1, '%s', '/*--------------------------------*- C++ -*----------------------------------*\');
fprintf(f1, '\n');
fprintf(f1, '%s',' ========= |');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / F ield | OpenFOAM: The Open Source CFD Toolbox');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / O peration | Website: https://openfoam.org');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / A nd | Version: 8');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\/ M anipulation |');
fprintf(f1, '\n');
fprintf(f1, '%s', '\*---------------------------------------------------------------------------*/');
fprintf(f1, '\nFoamFile\n');
fprintf(f1, '{\n');
fprintf(f1, ' version 2.0;\n');
fprintf(f1, ' format ascii;\n');
fprintf(f1, ' class dictionary;\n');
fprintf(f1, ' object blockMeshDict;\n');
fprintf(f1, '}\n');
fprintf(f1, '%s','// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //');
fprintf(f1, '\n\nconvertToMeters 1;\n\n');
fprintf(f1, 'vertices\n');
fprintf(f1, '(\n');
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v0(1),v0(2),v0(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v1(1),v1(2),v1(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v2(1),v2(2),v2(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v3(1),v3(2),v3(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v4(1),v4(2),v4(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v5(1),v5(2),v5(3));
fprintf(f1, ');\n\n');
fprintf(f1, 'blocks\n');
fprintf(f1, '(\n');
fprintf(f1, '%s', ' hex (0 1 4 3 0 2 5 3) (20 500 1) simpleGrading (1 1 1)');
fprintf(f1, '\n);\n');
fprintf(f1, '\nedges\n');
fprintf(f1, '(\n');
fprintf(f1, ' arc 2 1 (%f %f %f)\n',0,R,0);
fprintf(f1, ' arc 5 4 (%f %f %f)\n',Length_T,R,0);
fprintf(f1, ');\n\n');
fprintf(f1, 'boundary\n');
fprintf(f1, '(\n');
fprintf(f1, ' inlet\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type patch;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 1 2 0)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' outlet\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type patch;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (3 5 4 3)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' axis\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type empty;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 3 3 0)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' fixedWalls\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type wall;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (1 4 5 2)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' front\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type symmetryPlane;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 3 4 1)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' back\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type symmetryPlane;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' ( 0 2 5 3)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ');\n\n');
fprintf(f1, '%s', 'mergePatchPairs');
fprintf(f1, '\n(\n');
fprintf(f1, ');\n\n');
fprintf(f1, '%s', '// ************************************************************************* //');
fclose(f1);
blockMeshDict 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0.000000 0.000000 0.000000)
(0.000000 0.009962 0.000872)
(0.000000 0.009962 -0.000872)
(3.000000 0.000000 0.000000)
(3.000000 0.009962 0.000872)
(3.000000 0.009962 -0.000872)
);
blocks
(
hex (0 1 4 3 0 2 5 3) (20 500 1) simpleGrading (1 1 1)
);
edges
(
arc 2 1 (0.000000 0.010000 0.000000)
arc 5 4 (3.000000 0.010000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
fixedWalls
{
type wall;
faces
(
(1 4 5 2)
);
}
front
{
type symmetryPlane;
faces
(
(0 3 4 1)
);
}
back
{
type symmetryPlane;
faces
(
( 0 2 5 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
To Run the Simulation:-
- After entering all the values for the geometry to run the simulation by entering the solver name 'icoFoam' to start the simulation.
- To check the uniform Mesh in Paraview by entering the command in terminal 'paraFoam'
Mesh Grid:

Result:
A. Validate velocity profile for fully developed flow:

- From the above graph, the velocity is plotted from the different lengths of the pipe ( 0.1m, 0.5m, 1m, 2m, 2.8m)
- The fully developed region is starting from 2.1m to 3m.
- The velocity profile in the fully developed region is parabolic. The above graph at 'x = 2.8 m' of the velocity curve is Parabolic. Hence, the flow is fully developed.
B. Validate Wall shear stress for fully developed flow:

- The Shear stress plot is linear in most of the regions. The shear stress is taken from the fully developed flow region of the pipe at 'x = 2.8m'.
- The wall shear stress remains constant in the hydrodynamically fully developed flow region.
- Therefore the flow is fully developed because the velocity profile is parabolic, and shear stress is proportional to the velocity gradient in the y-direction.
2. Angle 25°
The angle is applied in the vertices of the blocks in the blockMeshDict File and the wedge boundary condition is applied in the pressure and velocity file
Matlab blockMeshDict File:
clear all
close all
clc
% Input Parameters
Re = 2100; % Reynolds number
D = 0.02; % Diameter of Pipe
R = D/2; % Radius of Pipe
theta = 25; % Wedge angle
rho = 998.2; % Denssity of water @ 20° in 'kg/m3'
mu = 1.005e-3; % Dynamic viscosity @ 20° in 'Pa*s'
nu = 1.002e-6; % Kinematic viscosity @ 20° in 'm2/s'
% Calculation of velocity, pressure and entrance length
Length_E = 0.05*Re*D;
Length_T = 3;
Velocity_avg = (Re*mu)/(rho*D);
% Vertices of blocks
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 = [Length_T 0 0];
v4 = [Length_T R*cosd(theta/2) R*sind(theta/2)];
v5 = [Length_T R*cosd(theta/2) -R*sind(theta/2)];
% BlockMeshDict File
f1 = fopen('blockMeshDict.txt','w');
fprintf(f1, '%s', '/*--------------------------------*- C++ -*----------------------------------*\');
fprintf(f1, '\n');
fprintf(f1, '%s',' ========= |');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / F ield | OpenFOAM: The Open Source CFD Toolbox');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / O peration | Website: https://openfoam.org');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / A nd | Version: 8');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\/ M anipulation |');
fprintf(f1, '\n');
fprintf(f1, '%s', '\*---------------------------------------------------------------------------*/');
fprintf(f1, '\nFoamFile\n');
fprintf(f1, '{\n');
fprintf(f1, ' version 2.0;\n');
fprintf(f1, ' format ascii;\n');
fprintf(f1, ' class dictionary;\n');
fprintf(f1, ' object blockMeshDict;\n');
fprintf(f1, '}\n');
fprintf(f1, '%s','// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //');
fprintf(f1, '\n\nconvertToMeters 1;\n\n');
fprintf(f1, 'vertices\n');
fprintf(f1, '(\n');
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v0(1),v0(2),v0(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v1(1),v1(2),v1(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v2(1),v2(2),v2(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v3(1),v3(2),v3(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v4(1),v4(2),v4(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v5(1),v5(2),v5(3));
fprintf(f1, ');\n\n');
fprintf(f1, 'blocks\n');
fprintf(f1, '(\n');
fprintf(f1, '%s', ' hex (0 1 4 3 0 2 5 3) (20 500 1) simpleGrading (1 1 1)');
fprintf(f1, '\n);\n');
fprintf(f1, '\nedges\n');
fprintf(f1, '(\n');
fprintf(f1, ' arc 2 1 (%f %f %f)\n',0,R,0);
fprintf(f1, ' arc 5 4 (%f %f %f)\n',Length_T,R,0);
fprintf(f1, ');\n\n');
fprintf(f1, 'boundary\n');
fprintf(f1, '(\n');
fprintf(f1, ' inlet\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type patch;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 1 2 0)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' outlet\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type patch;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (3 5 4 3)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' axis\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type empty;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 3 3 0)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' fixedWalls\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type wall;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (1 4 5 2)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' front\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type symmetryPlane;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 3 4 1)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' back\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type symmetryPlane;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' ( 0 2 5 3)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ');\n\n');
fprintf(f1, '%s', 'mergePatchPairs');
fprintf(f1, '\n(\n');
fprintf(f1, ');\n\n');
fprintf(f1, '%s', '// ************************************************************************* //');
fclose(f1);
blockMeshDict 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0.000000 0.000000 0.000000)
(0.000000 0.009763 0.002164)
(0.000000 0.009763 -0.002164)
(3.000000 0.000000 0.000000)
(3.000000 0.009763 0.002164)
(3.000000 0.009763 -0.002164)
);
blocks
(
hex (0 1 4 3 0 2 5 3) (20 500 1) simpleGrading (1 1 1)
);
edges
(
arc 2 1 (0.000000 0.010000 0.000000)
arc 5 4 (3.000000 0.010000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
fixedWalls
{
type wall;
faces
(
(1 4 5 2)
);
}
front
{
type symmetryPlane;
faces
(
(0 3 4 1)
);
}
back
{
type symmetryPlane;
faces
(
( 0 2 5 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
To Run the Simulation:-
- After entering all the values for the geometry to run the simulation by entering the solver name 'icoFoam' to start the simulation.
- To check the uniform Mesh in Paraview by entering the command in terminal 'paraFoam'
Mesh Grid:

Result:
A. Validate velocity profile for fully developed flow:

- From the above graph, the velocity is plotted from the different lengths of the pipe ( 0.1m, 0.5m, 1m, 2m, 2.8m)
- The fully developed region is starting from 2.1m to 3m.
- The velocity profile in the fully developed region is parabolic. The above graph at 'x = 2.8 m' of the velocity curve is Parabolic. Hence, the flow is fully developed.
B. Validate Wall shear stress for fully developed flow:

- The Shear stress plot is linear in most of the regions. The shear stress is taken from the fully developed flow region of the pipe at 'x = 2.8m'.
- The wall shear stress remains constant in the hydrodynamically fully developed flow region.
- Therefore the flow is fully developed because the velocity profile is parabolic, and shear stress is propotional to the velocity gradient in the y-direction.
3. Angle 45°
The angle is applied in the vertices of the blocks in the blockMeshDict File and the wedge boundary condition is applied in the pressure and velocity file
Matlab blockMeshDict File:
clear all
close all
clc
% Input Parameters
Re = 2100; % Reynolds number
D = 0.02; % Diameter of Pipe
R = D/2; % Radius of Pipe
theta = 45; % Wedge angle
rho = 998.2; % Denssity of water @ 20° in 'kg/m3'
mu = 1.005e-3; % Dynamic viscosity @ 20° in 'Pa*s'
nu = 1.002e-6; % Kinematic viscosity @ 20° in 'm2/s'
% Calculation of velocity, pressure and entrance length
Length_E = 0.05*Re*D;
Length_T = 3;
Velocity_avg = (Re*mu)/(rho*D);
% Vertices of blocks
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 = [Length_T 0 0];
v4 = [Length_T R*cosd(theta/2) R*sind(theta/2)];
v5 = [Length_T R*cosd(theta/2) -R*sind(theta/2)];
% BlockMeshDict File
f1 = fopen('blockMeshDict.txt','w');
fprintf(f1, '%s', '/*--------------------------------*- C++ -*----------------------------------*\');
fprintf(f1, '\n');
fprintf(f1, '%s',' ========= |');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / F ield | OpenFOAM: The Open Source CFD Toolbox');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / O peration | Website: https://openfoam.org');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\ / A nd | Version: 8');
fprintf(f1, '\n');
fprintf(f1, '%s',' \\/ M anipulation |');
fprintf(f1, '\n');
fprintf(f1, '%s', '\*---------------------------------------------------------------------------*/');
fprintf(f1, '\nFoamFile\n');
fprintf(f1, '{\n');
fprintf(f1, ' version 2.0;\n');
fprintf(f1, ' format ascii;\n');
fprintf(f1, ' class dictionary;\n');
fprintf(f1, ' object blockMeshDict;\n');
fprintf(f1, '}\n');
fprintf(f1, '%s','// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //');
fprintf(f1, '\n\nconvertToMeters 1;\n\n');
fprintf(f1, 'vertices\n');
fprintf(f1, '(\n');
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v0(1),v0(2),v0(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v1(1),v1(2),v1(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v2(1),v2(2),v2(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v3(1),v3(2),v3(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v4(1),v4(2),v4(3));
fprintf(f1,blanks(4));
fprintf(f1, '(%f %f %f)\n',v5(1),v5(2),v5(3));
fprintf(f1, ');\n\n');
fprintf(f1, 'blocks\n');
fprintf(f1, '(\n');
fprintf(f1, '%s', ' hex (0 1 4 3 0 2 5 3) (20 500 1) simpleGrading (1 1 1)');
fprintf(f1, '\n);\n');
fprintf(f1, '\nedges\n');
fprintf(f1, '(\n');
fprintf(f1, ' arc 2 1 (%f %f %f)\n',0,R,0);
fprintf(f1, ' arc 5 4 (%f %f %f)\n',Length_T,R,0);
fprintf(f1, ');\n\n');
fprintf(f1, 'boundary\n');
fprintf(f1, '(\n');
fprintf(f1, ' inlet\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type patch;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 1 2 0)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' outlet\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type patch;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (3 5 4 3)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' axis\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type empty;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 3 3 0)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' fixedWalls\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type wall;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (1 4 5 2)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' front\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type symmetryPlane;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' (0 3 4 1)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ' back\n');
fprintf(f1, ' {\n');
fprintf(f1, ' type symmetryPlane;\n');
fprintf(f1, ' faces\n');
fprintf(f1, ' (\n');
fprintf(f1, ' ( 0 2 5 3)\n');
fprintf(f1, ' );\n');
fprintf(f1, ' }\n');
fprintf(f1, ');\n\n');
fprintf(f1, '%s', 'mergePatchPairs');
fprintf(f1, '\n(\n');
fprintf(f1, ');\n\n');
fprintf(f1, '%s', '// ************************************************************************* //');
fclose(f1);
blockMeshDict 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0.000000 0.000000 0.000000)
(0.000000 0.009239 0.003827)
(0.000000 0.009239 -0.003827)
(3.000000 0.000000 0.000000)
(3.000000 0.009239 0.003827)
(3.000000 0.009239 -0.003827)
);
blocks
(
hex (0 1 4 3 0 2 5 3) (20 500 1) simpleGrading (1 1 1)
);
edges
(
arc 2 1 (0.000000 0.010000 0.000000)
arc 5 4 (3.000000 0.010000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
fixedWalls
{
type wall;
faces
(
(1 4 5 2)
);
}
front
{
type symmetryPlane;
faces
(
(0 3 4 1)
);
}
back
{
type symmetryPlane;
faces
(
( 0 2 5 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
To Run the Simulation:-
- After entering all the values for the geometry to run the simulation by entering the solver name 'icoFoam' to start the simulation.
- To check the uniform Mesh in Paraview by entering the command in terminal 'paraFoam'
Mesh Grid:

Result:
A. Validate velocity profile for fully developed flow:

- From the above graph, the velocity is plotted from the different lengths of the pipe ( 0.1m, 0.5m, 1m, 2m, 2.8m)
- The fully developed region is starting from 2.1m to 3m.
- The velocity profile in the fully developed region is parabolic. The above graph at 'x = 2.8 m' of the velocity curve is Parabolic. Hence, the flow is fully developed.
B. Validate Wall shear stress for fully developed flow:

- The Shear stress plot is linear in most of the regions. The shear stress is taken from the fully developed flow region of the pipe at 'x = 2.8m'.
- The wall shear stress remains constant in the hydrodynamically fully developed flow region.
- Therefore the flow is fully developed because the velocity profile is parabolic, and shear stress is proportional to the velocity gradient in the y-direction.
WEDGE BOUNDARY CONDITION USAGE AND APPLICATION:
- The wedge boundary condition (BC) is used in computational fluid dynamics to define an axisymmetry situation, for eg. Cylinder. The model and flow must be axisymmetry along a central line such that all physical variables of the flow have the same value and distribution at a given radius for all angles.
- This boundary condition is specified by two planes that must be selected on separate sides of the domain (referred to as front and back) on the surface running along the axis.
SYMMETRY BOUNDARY CONDITION USAGE AND APPLICATION:
- This boundary condition is used to apply mirror-symmetry conditions to a structure.
- It can be applied to the faces of a structure and no other user input is needed. If a symmetry plane condition is applied to a face, the displacement of this face is locked in a normal direction but free to slide in tangential directions.