Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
OBJECTIVE :
- Performing simulation for various sector angles that are 10∘,25∘, and 45∘.
- Performing the simulation of above angles with both Wedge and Symmetry Boundary conditions in OpenFOAM.
- Observe and compare the results of the simulation with respect Analytical simulation.
THEORY :
Wedge Boundry Condition -
The wedge boundary condition (BC) is used in computational fluid dynamics to define an axis-symmetry situation, for eg. Cylinder. The model and flow must be axis-symmetry along a central tine 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 he selected on separate sides of the domain (referred Sore front and back) on the surface running along the axis.
Symmetry Boundary Condition -
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.
PARAMETERS & SETUP METHODLOGY :

Selected Reynolds No. for the flow is Re = 2000.
Selected the diameter of the pipe is, D = 0.02
Now the Following formulas are used in order to calculate the important parameters, that satisfies the Hagen–Poiseuille Flow condition.
Hydrodynamic Entry length,
LE=0.058⋅Re⋅D
Average velocity,
Vavg=Re⋅μρ⋅D
Max Velocity,
Vmax=2⋅Vavg
Pressure difference,
ΔP=32⋅μ⋅L⋅VavgD2
where,
Re – Reynolds Number, μ – Dynamic viscosity, ρ – Density, L – Total Length of pipe,
Therefore,


We know taht in a CFD simulation the significance of the mesh grid. The finer the grid more the resolution and more accurate the result. Inorder to capture near-wall physics where the fulid and body interacts we need more finer grid, this done by making the use of Grading/Inflation Layers technique in meshing. But more refined the grid is, more computational power and time it takes.
Reduced the computional domain as shown below -

Now for the Reduced Model's C/S i.e. sector with angle θ . Simulating for the θ=4∘,10∘,25∘,45∘,
SIMULATION SETUP :
1. Choosing Solver Based on the Type of the Problem -
Using the same icoFoam solver used in the previous report linked above.
2. Geometry and Meshing
The given Geometry and Dimensions of the geometry, is shown below -

D = 0.02 m, R = 0.01 m, L =2.5 m,
θ=4∘,10∘,25∘,45∘,
Meshing -
For the current simulation problem we are gonna create a blockMeshDict File using MATLAB, in such a way that we can easily generate multiple blockMeshDict file for the
MATLAB Program to create blockMeshDict File -
clear all
close all
clc
% Input parameters
% Reynold's Number
Re = 2000;
% Total Length of pipe(m)
L = 2.5;
% Diameter of pipe in meters
D = 0.02;
% Wedge Angle in degrees
theta = input('n Wedge/Sector Angle (in degrees) - ');
% Density (kg/m^3)
rho = 997;
% Dynamic Viscosity (Pa.sec)
mu = 8.90e-4;
% Radius of pipe(m)
R = D/2;
% Entrance Length
Le = 0.058*Re*D;
% Number of cells in x,y,z Directions
nx = 500;
ny = 30;
nz = 1;
%------------------------------------------------------------------------
% BlockMeshDict file writting
%------------------------------------------------------------------------
f1 = fopen('blockMeshDict','w');
fprintf(f1,'%s n','/*--------------------------------*- C++ -*----------------------------------*');
fprintf(f1,'%s n',' ========= |');
fprintf(f1,'%s n',' / F ield | OpenFOAM: The Open Source CFD Toolbox');
fprintf(f1,'%s n',' / O peration | Website: https://openfoam.org');
fprintf(f1,'%s n',' / A nd | Version: 9');
fprintf(f1,'%s n',' / M anipulation |');
fprintf(f1,'%s n','*---------------------------------------------------------------------------*/');
fprintf(f1,'FoamFile n');
fprintf(f1,'{ n');
fprintf(f1,' format ascii;n');
fprintf(f1,' class dictionary;n');
fprintf(f1,' object blockMeshDict;n');
fprintf(f1,'} n');
fprintf(f1,'%s nn','// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ');
fprintf(f1,'convertToMeters 1; nn');
fprintf(f1,'verticesn( n');
fprintf(f1, ' /* 0 */ (0 0 0) n');
fprintf(f1,(' /* 1 */ (0 %f %f) n'),R*cosd(theta/2),R*sind(theta/2));
fprintf(f1,(' /* 2 */ (0 %f %f)n'),R*cosd(theta/2),-R*sind(theta/2));
fprintf(f1,(' /* 3 */ (%f 0 0)n'),L);
fprintf(f1,(' /* 4 */ (%f %f %f)n'),L,R*cosd(theta/2),R*sind(theta/2));
fprintf(f1,(' /* 5 */ (%f %f %f)n);nn'),L,R*cosd(theta/2),-R*sind(theta/2));
fprintf(f1,'blocksn(n');
fprintf(f1,('hex (0 2 1 0 3 5 4 3) (%d %d %d) simpleGrading (0.2 1 1)n);nn'),ny,nz,nx);
fprintf(f1,'edgesn(n');
fprintf(f1,' arc 2 1 (0 %f 0)n',R);
fprintf(f1,' arc 5 4 (%f %f 0)n);nn',L,R);
fprintf(f1,'boundaryn(n');
fprintf(f1,' inletn');
fprintf(f1,' {n');
fprintf(f1,' type patch;n');
fprintf(f1,' facesn');
fprintf(f1,' (n');
fprintf(f1,' (0 1 2 0)n');
fprintf(f1,' );n');
fprintf(f1,' }n');
fprintf(f1,' outletn');
fprintf(f1,' {n');
fprintf(f1,' type patch;n');
fprintf(f1,' facesn');
fprintf(f1,' (n');
fprintf(f1,' (3 5 4 3)n');
fprintf(f1,' );n');
fprintf(f1,' }n');
fprintf(f1,' frontn');
fprintf(f1,' {n');
fprintf(f1,' type wedge;n');
fprintf(f1,' facesn');
fprintf(f1,' (n');
fprintf(f1,' (0 3 4 1)n');
fprintf(f1,' );n');
fprintf(f1,' }n');
fprintf(f1,' backn');
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,' pipewalln');
fprintf(f1,' {n');
fprintf(f1,' type wall;n');
fprintf(f1,' facesn');
fprintf(f1,' (n');
fprintf(f1,' (1 4 5 2)n');
fprintf(f1,' );n');
fprintf(f1,' }n');
fprintf(f1,' axisn');
fprintf(f1,' {n');
fprintf(f1,' type empty;n');
fprintf(f1,' facesn');
fprintf(f1,' (n');
fprintf(f1,' (0 3 3 0)n');
fprintf(f1,' );n');
fprintf(f1,' }n');
fprintf(f1,');nn');
fprintf(f1,'mergePatchPairsn');
fprintf(f1,'(n');
fprintf(f1,');nn');
fprintf(f1,'// ************************************************************************* // n');
fclose(f1);
a) blockMeshDict File 4∘ Wedge -
/*--------------------------------*- 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
/* 0 */ (0 0 0)
/* 1 */ (0 0.009994 0.000349)
/* 2 */ (0 0.009994 -0.000349)
/* 3 */ (2.500000 0 0)
/* 4 */ (2.500000 0.009994 0.000349)
/* 5 */ (2.500000 0.009994 -0.000349)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (30 1 500) simpleGrading (0.2 1 1)
);
edges
(
arc 2 1 (0 0.010000 0)
arc 5 4 (2.500000 0.010000 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
(0 2 5 3)
);
}
pipewall
{
type wall;
faces
(
(1 4 5 2)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
b) blockMeshDict File 10∘ Wedge -
/*--------------------------------*- 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
/* 0 */ (0 0 0)
/* 1 */ (0 0.009962 0.000872)
/* 2 */ (0 0.009962 -0.000872)
/* 3 */ (2.500000 0 0)
/* 4 */ (2.500000 0.009962 0.000872)
/* 5 */ (2.500000 0.009962 -0.000872)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (30 1 500) simpleGrading (0.2 1 1)
);
edges
(
arc 2 1 (0 0.010000 0)
arc 5 4 (2.500000 0.010000 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
(0 2 5 3)
);
}
pipewall
{
type wall;
faces
(
(1 4 5 2)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
c) blockMeshDict File 10∘ Symmetry -
/*--------------------------------*- 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
/* 0 */ (0 0 0)
/* 1 */ (0 0.009962 0.000872)
/* 2 */ (0 0.009962 -0.000872)
/* 3 */ (2.500000 0 0)
/* 4 */ (2.500000 0.009962 0.000872)
/* 5 */ (2.500000 0.009962 -0.000872)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (30 1 500) simpleGrading (0.2 1 1)
);
edges
(
arc 2 1 (0 0.010000 0)
arc 5 4 (2.500000 0.010000 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
back
{
type symmetry;
faces
(
(0 2 5 3)
);
}
pipewall
{
type wall;
faces
(
(1 4 5 2)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
d) blockMeshDict File 25∘ Wedge -
/*--------------------------------*- 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
/* 0 */ (0 0 0)
/* 1 */ (0 0.009763 0.002164)
/* 2 */ (0 0.009763 -0.002164)
/* 3 */ (2.500000 0 0)
/* 4 */ (2.500000 0.009763 0.002164)
/* 5 */ (2.500000 0.009763 -0.002164)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (30 1 500) simpleGrading (0.2 1 1)
);
edges
(
arc 2 1 (0 0.010000 0)
arc 5 4 (2.500000 0.010000 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
(0 2 5 3)
);
}
pipewall
{
type wall;
faces
(
(1 4 5 2)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
e) blockMeshDict File 25∘ Symmetry -
/*--------------------------------*- 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
/* 0 */ (0 0 0)
/* 1 */ (0 0.009763 0.002164)
/* 2 */ (0 0.009763 -0.002164)
/* 3 */ (2.500000 0 0)
/* 4 */ (2.500000 0.009763 0.002164)
/* 5 */ (2.500000 0.009763 -0.002164)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (30 1 500) simpleGrading (0.2 1 1)
);
edges
(
arc 2 1 (0 0.010000 0)
arc 5 4 (2.500000 0.010000 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
back
{
type symmetry;
faces
(
(0 2 5 3)
);
}
pipewall
{
type wall;
faces
(
(1 4 5 2)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
f) blockMeshDict File 45∘ Wedge -
/*--------------------------------*- 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
/* 0 */ (0 0 0)
/* 1 */ (0 0.009239 0.003827)
/* 2 */ (0 0.009239 -0.003827)
/* 3 */ (2.500000 0 0)
/* 4 */ (2.500000 0.009239 0.003827)
/* 5 */ (2.500000 0.009239 -0.003827)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (30 1 500) simpleGrading (0.2 1 1)
);
edges
(
arc 2 1 (0 0.010000 0)
arc 5 4 (2.500000 0.010000 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
(0 2 5 3)
);
}
pipewall
{
type wall;
faces
(
(1 4 5 2)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
g) blockMeshDict File 45∘ Symmetry -
/*--------------------------------*- 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
/* 0 */ (0 0 0)
/* 1 */ (0 0.009239 0.003827)
/* 2 */ (0 0.009239 -0.003827)
/* 3 */ (2.500000 0 0)
/* 4 */ (2.500000 0.009239 0.003827)
/* 5 */ (2.500000 0.009239 -0.003827)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (30 1 500) simpleGrading (0.2 1 1)
);
edges
(
arc 2 1 (0 0.010000 0)
arc 5 4 (2.500000 0.010000 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
back
{
type symmetry;
faces
(
(0 2 5 3)
);
}
pipewall
{
type wall;
faces
(
(1 4 5 2)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Simulation Setup -
controlDict File, Initial and Boundary Conditions, transportProperties File, FVSchemes & FVSolution
are same as shown in the previous report linked above.
POST-POSTPROCESSING & RESULTS -
1. Geometry, Mesh Generated and Quality of the Mesh -





2. Validation of the Analysis by matching the Numerical results with Analytical Values -
Following is the MATLAB Code inorder to read the analysis data from the generated .csv files for the 4∘ Wedge, 10∘ Wedge, 10∘ Symmetry, 25∘ Wedge, 25∘ Symmetry, 45∘ Wedge, 45∘ Symmetry, at the Hydrodynamic Length( i.e. 2.32 m) and comparing with the analytical values -
clear all;
close all;
clc;
% Input parameters
% Reynold's Number
Re = 2000;
% Total Length of pipe(m)
L = 2.5;
% Diameter of pipe in meters
D = 0.02;
% Density (kg/m^3)
rho = 997;
% Dynamic Viscosity (Pa.sec)
mu = 8.90e-4;
% Radius of pipe(m)
R = D/2;
% Entrance Length
Le = 0.058*Re*D;
%--------------------------------------------------------------------------
% Calculations for Analytical methods
%--------------------------------------------------------------------------
% Average Velcity
Vavg = (Re*mu)/(rho*D);
% Velocity Profile at c/s from center to te wall of the pipe in fully developed region
r = linspace(0,R,1000);
Vr=2*Vavg*(1-(r.^2/R^2));
% Velocity at center
Vmax = 2*Vavg;
% Pressure Drop in across the length of pipe
L_an = linspace(0,L,1000);
P_drop = (32*mu.*L_an.*Vavg)/D^2;
P_drop = fliplr(P_drop);
% Wall Shear Stress
% Darcy Friction Factor
f = 64/Re;
% Shear stress
tau_m = (f/4)*((rho*Vavg^2)/2);
%--------------------------------------------------------------------------
% Retriving OpenFOAM Analysis Data from CSV Files
%--------------------------------------------------------------------------
%-------------------------- For 4 degree Wedge--------------------------
% Reading Velocity File Extracted from paraView
vp4 = fopen('Velocity_Profile_of_Fully_Developed_Flow_at_Entry_Length.csv','r');
fgetl(vp4);
for i = 1:1000
C = fgetl(vp4);
D = strsplit(C,',');
Vn4(i) = D(1);
Lr4(i) = D(6);
end
Vn4 = str2double(Vn4);
Lr4 = str2double(Lr4);
% Reading Pressure File Extracted from paraView
pd4 = fopen('Pressure_Drop_across_the_Pipe.csv','r');
fgetl(pd4);
for i = 1:31685
C = fgetl(pd4);
D = strsplit(C,',');
Pn4(i) = D(1);
Lp4(i) = D(5);
end
Pn4 = str2double(Pn4);
Lp4 = str2double(Lp4);
% Reading Shear Stress File Extracted from paraView
ss4 = fopen('Shear_Stress_at_entry_length.csv','r');
fgetl(ss4);
for i = 1:1000
C = fgetl(ss4);
D = strsplit(C,',');
Sn4(i) = D(14);
Ls4(i) = D(19);
end
Sn4 = str2double(Sn4);
Ls4 = str2double(Ls4);
%-------------------------- For 10 degree wedge --------------------------
% Reading Velocity
vp10w = fopen('VP_10W.csv','r');
fgetl(vp10w);
for i = 1:1000
C = fgetl(vp10w);
D = strsplit(C,',');
Vn10w(i) = D(1);
Lr10w(i) = D(6);
end
Vn10w = str2double(Vn10w);
Lr10w = str2double(Lr10w);
% Reading Pressure
pd10w = fopen('PD_10W.csv','r');
fgetl(pd10w);
for i = 1:31685
C = fgetl(pd10w);
D = strsplit(C,',');
Pn10w(i) = D(1);
Lp10w(i) = D(5);
end
Pn10w = str2double(Pn10w);
Lp10w = str2double(Lp10w);
% Reading Shear Stress
ss10w = fopen('SS_10W.csv','r');
fgetl(ss10w);
for i = 1:1000
C = fgetl(ss10w);
D = strsplit(C,',');
Sn10w(i) = D(14);
Ls10w(i) = D(19);
end
Sn10w = str2double(Sn10w);
Ls10w = str2double(Ls10w);
%-------------------------- For 10 degree Symmetry --------------------------
% Reading Velocity
vp10s = fopen('VP_10S.csv','r');
fgetl(vp10s);
for i = 1:1000
C = fgetl(vp10s);
D = strsplit(C,',');
Vn10s(i) = D(1);
Lr10s(i) = D(6);
end
Vn10s = str2double(Vn10s);
Lr10s = str2double(Lr10s);
% Reading Pressure
pd10s = fopen('PD_10S.csv','r');
fgetl(pd10s);
for i = 1:31685
C = fgetl(pd10s);
D = strsplit(C,',');
Pn10s(i) = D(1);
Lp10s(i) = D(5);
end
Pn10s = str2double(Pn10s);
Lp10s = str2double(Lp10s);
% Reading Shear Stress
ss10s = fopen('SS_10S.csv','r');
fgetl(ss10s);
for i = 1:1000
C = fgetl(ss10s);
D = strsplit(C,',');
Sn10s(i) = D(14);
Ls10s(i) = D(19);
end
Sn10s = str2double(Sn10s);
Ls10s = str2double(Ls10s);
%-------------------------- For 25 degree wedge --------------------------
% Reading Velocity
vp25w = fopen('VP_25W.csv','r');
fgetl(vp25w);
for i = 1:1000
C = fgetl(vp25w);
D = strsplit(C,',');
Vn25w(i) = D(1);
Lr25w(i) = D(6);
end
Vn25w = str2double(Vn25w);
Lr25w = str2double(Lr25w);
% Reading Pressure
pd25w = fopen('PD_25W.csv','r');
fgetl(pd25w);
for i = 1:31685
C = fgetl(pd25w);
D = strsplit(C,',');
Pn25w(i) = D(1);
Lp25w(i) = D(5);
end
Pn25w = str2double(Pn25w);
Lp25w = str2double(Lp25w);
% Reading Shear Stress
ss25w = fopen('SS_25W.csv','r');
fgetl(ss25w);
for i = 1:1000
C = fgetl(ss25w);
D = strsplit(C,',');
Sn25w(i) = D(14);
Ls25w(i) = D(19);
end
Sn25w = str2double(Sn25w);
Ls25w = str2double(Ls25w);
%-------------------------- For 25 degree Symmetry --------------------------
% Reading Velocity
vp25s = fopen('VP_25S.csv','r');
fgetl(vp10s);
for i = 1:1000
C = fgetl(vp25s);
D = strsplit(C,',');
Vn25s(i) = D(1);
Lr25s(i) = D(6);
end
Vn25s = str2double(Vn25s);
Lr25s = str2double(Lr25s);
% Reading Pressure
pd25s = fopen('PD_25S.csv','r');
fgetl(pd25s);
for i = 1:31685
C = fgetl(pd25s);
D = strsplit(C,',');
Pn25s(i) = D(1);
Lp25s(i) = D(5);
end
Pn25s = str2double(Pn25s);
Lp25s = str2double(Lp25s);
% Reading Shear Stress
ss25s = fopen('SS_25S.csv','r');
fgetl(ss25s);
for i = 1:1000
C = fgetl(ss25s);
D = strsplit(C,',');
Sn25s(i) = D(14);
Ls25s(i) = D(19);
end
Sn25s = str2double(Sn25s);
Ls25s = str2double(Ls25s);
%-------------------------- For 45 degree wedge --------------------------
% Reading Velocity
vp45w = fopen('VP_45W.csv','r');
fgetl(vp45w);
for i = 1:1000
C = fgetl(vp45w);
D = strsplit(C,',');
Vn45w(i) = D(1);
Lr45w(i) = D(6);
end
Vn45w = str2double(Vn45w);
Lr45w = str2double(Lr45w);
% Reading Pressure
pd45w = fopen('PD_45W.csv','r');
fgetl(pd45w);
for i = 1:31685
C = fgetl(pd45w);
D = strsplit(C,',');
Pn45w(i) = D(1);
Lp45w(i) = D(5);
end
Pn45w = str2double(Pn45w);
Lp45w = str2double(Lp45w);
% Reading Shear Stress
ss45w = fopen('SS_45W.csv','r');
fgetl(ss45w);
for i = 1:1000
C = fgetl(ss45w);
D = strsplit(C,',');
Sn45w(i) = D(20);
Ls45w(i) = D(15);
end
Sn45w = str2double(Sn45w);
Ls45w = str2double(Ls45w);
%-------------------------- For 45 degree Symmetry --------------------------
% Reading Velocity
vp45s = fopen('VP_45S.csv','r');
fgetl(vp45s);
for i = 1:1000
C = fgetl(vp45s);
D = strsplit(C,',');
Vn45s(i) = D(1);
Lr45s(i) = D(6);
end
Vn45s = str2double(Vn45s);
Lr45s = str2double(Lr45s);
% Reading Pressure
pd45s = fopen('PD_45S.csv','r');
fgetl(pd45s);
for i = 1:31685
C = fgetl(pd45s);
D = strsplit(C,',');
Pn45s(i) = D(1);
Lp45s(i) = D(5);
end
Pn45s = str2double(Pn45s);
Lp45s = str2double(Lp45s);
% Reading Shear Stress
ss45s = fopen('SS_45S.csv','r');
fgetl(ss45s);
for i = 1:1000
C = fgetl(ss45s);
D = strsplit(C,',');
Sn45s(i) = D(14);
Ls45s(i) = D(19);
end
Sn45s = str2double(Sn45s);
Ls45s = str2double(Ls45s);
%--------------------------------------------------------------------------
% Plotting the comparison
%--------------------------------------------------------------------------
% ------------------- For 4 Degree
figure(1) % Velocity Profile
set(gcf, 'Position', [100, 200, 800, 600]);
plot(r,Vr,'color','r','linewidth',2);
hold on; grid on;
plot(Lr4,Vn4,'--','color',[0 0.1 0.8],'linewidth',2);
xlabel(' Location or Radial Dist. from the center to wall of pipe (in m)','fontweight','bold','fontsize',12);
ylabel(' Velocity (in m/s)','fontweight','bold','fontsize',12);
title(' Velocity Profile comparison of analytical and numerical values','fontsize',14);
legend(' Analytical method',' Numerical Method');
figure(2) % Pressure Drop
set(gcf, 'Position', [905, 200, 800, 600]);
plot(L_an,P_drop,'color','r','linewidth',2.5);
hold on; grid on;
plot(Lp4,Pn4,'--','color',[0 0.1 0.8],'linewidth',1);
xlabel(' Length of Pipe (in m)','fontweight','bold','fontsize',12);;
ylabel(' Pressure (in Pa)','fontweight','bold','fontsize',12);
title('Pressure Drop Across the Length of Pipe','fontsize',14);
legend(' Analytical method',' Numerical Method');
% ------------------- For 10 Degree
figure(3) % Velocity Profile
set(gcf, 'Position', [100, 200, 800, 600]);
plot(r,Vr,'color','r','linewidth',2);
hold on; grid on;
plot(Lr10w,Vn10w,'--','color',[0 0.1 0.8],'linewidth',2);
plot(Lr10s,Vn10s,':','color',[0 0.8 0.1],'linewidth',2);
xlabel(' Location or Radial Dist. from the center to wall of pipe (in m)','fontweight','bold','fontsize',12);
ylabel(' Velocity (in m/s)','fontweight','bold','fontsize',12);
title(' Velocity Profile comparison of analytical and numerical values','fontsize',14);
legend(' Analytical method',' Analysis with Wedge BC',' Analysis with Symmetry BC');
figure(4) % Pressure Drop
set(gcf, 'Position', [905, 200, 800, 600]);
plot(L_an,P_drop,'color','r','linewidth',2.5);
hold on; grid on;
plot(Lp10w,Pn10w,'--','color',[0 0.1 0.8],'linewidth',2);
plot(Lp10s,Pn10s,':','color',[0 0.8 0.1],'linewidth',2);
xlabel(' Length of Pipe (in m)','fontweight','bold','fontsize',12);
ylabel(' Pressure (in Pa)','fontweight','bold','fontsize',12);
title('Pressure Drop Across the Length of Pipe','fontsize',14);
legend(' Analytical method',' Analysis with Wedge BC',' Analysis with Symmetry BC');
% ------------------- For 25 Degree
figure(5) % Velocity Profile
set(gcf, 'Position', [100, 200, 800, 600]);
plot(r,Vr,'color','r','linewidth',2);
hold on; grid on;
plot(Lr25w,Vn25w,'--','color',[0 0.1 0.8],'linewidth',2);
plot(Lr25s,Vn25s,':','color',[0 0.8 0.1],'linewidth',2);
xlabel(' Location or Radial Dist. from the center to wall of pipe (in m)','fontweight','bold','fontsize',12);
ylabel(' Velocity (in m/s)','fontweight','bold','fontsize',12);
title(' Velocity Profile comparison of analytical and numerical values','fontsize',14);
legend(' Analytical method',' Analysis with Wedge BC',' Analysis with Symmetry BC');
figure(6) % Pressure Drop
set(gcf, 'Position', [905, 200, 800, 600]);
plot(L_an,P_drop,'color','r','linewidth',2.5);
hold on; grid on;
plot(Lp25w,Pn25w,'--','color',[0 0.1 0.8],'linewidth',2);
plot(Lp25s,Pn25s,':','color',[0 0.8 0.1],'linewidth',2);
xlabel(' Length of Pipe (in m)','fontweight','bold','fontsize',12);
ylabel(' Pressure (in Pa)','fontweight','bold','fontsize',12);
title('Pressure Drop Across the Length of Pipe','fontsize',14);
legend(' Analytical method',' Analysis with Wedge BC',' Analysis with Symmetry BC');
% ------------------- For 45 Degree
figure(7) % Velocity Profile
set(gcf, 'Position', [100, 200, 800, 600]);
plot(r,Vr,'color','r','linewidth',2);
hold on; grid on;
plot(Lr45w,Vn45w,'--','color',[0 0.1 0.8],'linewidth',2);
plot(Lr45s,Vn45s,':','color',[0 0.8 0.1],'linewidth',2);
xlabel(' Location or Radial Dist. from the center to wall of pipe (in m)','fontweight','bold','fontsize',12);
ylabel(' Velocity (in m/s)','fontweight','bold','fontsize',12);
title(' Velocity Profile comparison of analytical and numerical values','fontsize',14);
legend(' Analytical method',' Analysis with Wedge BC',' Analysis with Symmetry BC');
figure(8) % Pressure Drop
set(gcf, 'Position', [905, 200, 800, 600])
plot(L_an,P_drop,'color','r','linewidth',2.5);
hold on; grid on;
plot(Lp45w,Pn45w,'--','color',[0 0.1 0.8],'linewidth',2);
plot(Lp45s,Pn45s,':','color',[0 0.8 0.1],'linewidth',2);
xlabel(' Length of Pipe (in m)','fontweight','bold','fontsize',12);
ylabel(' Pressure (in Pa)','fontweight','bold','fontsize',12);
title('Pressure Drop Across the Length of Pipe','fontsize',14);
legend(' Analytical method',' Analysis with Wedge BC',' Analysis with Symmetry BC');
% ------------- ALL OF THEM TOGEATHER ---------------
figure(9)
set(gcf, 'Position', [100, 200, 800, 600]);
plot(r,Vr,'color','r','linewidth',2);
hold on; grid on;
plot(Lr4,Vn4,'--','linewidth',2);
plot(Lr10w,Vn10w,'--','linewidth',2);
plot(Lr10s,Vn10s,':','linewidth',2);
plot(Lr25w,Vn25w,'--','linewidth',2);
plot(Lr25s,Vn25s,':','linewidth',2);
plot(Lr45w,Vn45w,'--','linewidth',2);
plot(Lr45s,Vn45s,':','linewidth',2);
xlabel(' Location or Radial Dist. from the center to wall of pipe (in m)','fontweight','bold','fontsize',12);
ylabel(' Velocity (in m/s)','fontweight','bold','fontsize',12);
title(' Velocity Profile Comparison of Analytical and Numerical Values','fontsize',14);
legend(' Analytical Solution','For 4 Deg Wedge','For 10 Deg Wedge','For 10 Deg Symmetry',...
' For 25 Deg Wedge','For 25 Deg Symmetry','For 45 Deg Wedge','For 45 Deg Symmetry');
figure(10)
set(gcf, 'Position', [905, 200, 800, 600]);
plot(L_an,P_drop,'color','r','linewidth',2.5);
hold on; grid on;
plot(Lp4,Pn4,'--','linewidth',2);
plot(Lp10w,Pn10w,'--','linewidth',2);
plot(Lp10s,Pn10s,':','linewidth',2);
plot(Lp25w,Pn25w,'--','linewidth',2);
plot(Lp25s,Pn25s,':','linewidth',2);
plot(Lp45w,Pn45w,'--','linewidth',2);
plot(Lp45s,Pn45s,':','linewidth',2);
xlabel(' Length of Pipe (in m)','fontweight','bold','fontsize',12);
ylabel(' Pressure (in Pa)','fontweight','bold','fontsize',12);
title('Pressure Drop Across the Length of Pipe','fontsize',14);
legend(' Analytical Solution','For 4 Deg Wedge','For 10 Deg Wedge','For 10 Deg Symmetry',...
' For 25 Deg Wedge','For 25 Deg Symmetry','For 45 Deg Wedge','For 45 Deg Symmetry');
figure(11)
set(gcf, 'Position', [100, 200, 800, 600]);
plot([0 R],[0 tau_m],'color','r','linewidth',2);
hold on; grid on;
plot(Ls4,Sn4,'linewidth',2);
plot(Ls10w,Sn10w,'--','linewidth',2);
plot(Ls10s,Sn10s,':','linewidth',2);
plot(Ls25w,Sn25w,'--','linewidth',2);
plot(Ls25s,Sn25s,':','linewidth',2);
plot(Ls45w,Sn45w,'--','linewidth',2);
plot(Ls45s,Sn45s,':','linewidth',2);
xlabel(' Location or Radial Dist. from the center to wall of pipe (in m)','fontweight','bold','fontsize',12);
ylabel(' Shear Stress (in Pa)','fontweight','bold','fontsize',12);
title(' Shear Stress Profile Comparison of Analytical and Numerical Values','fontsize',14);
legend(' Analytical Solution','For 4 Deg Wedge','For 10 Deg Wedge','For 10 Deg Symmetry',...
' For 25 Deg Wedge','For 25 Deg Symmetry','For 45 Deg Wedge','For 45 Deg Symmetry','location','northwest');
i) Analytical Solution and Numerical Results of 4∘ Wedge Analysis -


ii) Analytical Solution and Numerical Results of 10∘ Analysis -


iii) Analytical Solution and Numerical Results of 25∘ Analysis -


iv) Analytical Solution and Numerical Results of 45∘ Analysis -


V) Analytical Solution and Numerical Results, all of them togeather -



RESULTS & CONCLUSION :
- Following are the Results from Analyitical calculation and Simulation,


- We can see from the plots that, the fully developed flow at the Hydrodynamic Entrance Length is validated.
- The Velocity Profile, Pressure Drop and Shear stress profile is successfully validated as shown in above plots.
- With the results shown above, we can see that the values with the Wedge Boundary condition is slightly accurate than the Symmetry boundary condition.
- We can see that there is gradual decrease in accuracy when increasing angle, due to the decrease in the Quality of the mesh Especially at the Near-wall Region.
- However, from the above table we can notice that the accuracy difference between the Wedge and Symmetry boundary condition gets lower as the sector angle increases, therefore it is optimum to use Wedge boundary condition with sector angle less the 5∘ Degree.