Week 10 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
Aim:
To simulate an axis-symmetric laminar flow through the constant cross-sectional of the pipe by applying the symmetry boundary condition.
To simulating for the mentioned angles i.e for 10, 25, 45 degrees using both symmetry and wedge boundary conditions and validate them with HP equations.
Hagen-Poiseuille's law:
In nonideal fluid dynamics, the Hagen–Poiseuille equation, also known as the Hagen–Poiseuille law, is a physical law that gives the pressure drop in an incompressible and Newtonian fluid in laminar flow flowing through a long cylindrical pipe of constant cross-section. The pressure drop is given by
where,
ΔPΔP is the pressure drop.
μμ is the dynamic viscosity.
L is the length of the pipe.
V is the velocity.

At the entrance, the flow is said to be in the hydrodynamic entrance region where the velocity profile gradually takes the shape of a parabola from a straight line. As soon as the parabolic velocity profile becomes steady the flow is said to be in its fully developed state. Normally Hagen Poiseuille's Equation is applicable for a fully developed flow which helps us to calculate the pressure loss.
Assumptions made:
Geometry: Axisymmetric.
Reynolds number: 2100.
Working fluid: Water.
Diameter of the pipe: 0.02 m.
Dynamic viscosity=0.89x10^-3 Pas
Kinematic viscosity=0.8927x10^-6 m^2/s
theta=10, 25, 45
EQUATIONS USED.
Average velocity
Vavg=ReμρDVavg=ReμρD m/s
Maximum velocity
Vmax=2⋅VavgVmax=2⋅Vavg m/s
Pressure drop
PROCEDURE.
Will start with copying the cavity file from the tutorial to the FOAM_RUN folder.
In the run folder only we are going to simulate and whatever we want to do the changes in the blockMeshDict file and pressure and velocity files and controlDict files we will be doing here.
creating the block in the OpenFoam here we are creating the wedge after making the required changes in the blockMeshDict file to check the geometry run the blockMesh command.
After creating the wedge assign the boundary conditions, and also sitting the simulation end time and time-step in such a way that the courant number should be less than 0.5 and also in the transportProperties enter the kinematic viscosity.
Run the simulation using the icoFoam solver after calculating the time needed for the fluid to travel from inlet to outlet
After the simulation, use paraFoam to view the flow inside the wedge and use plot over line command to plot the velocity and shear stress changes at a point after the hydrodynamical entry region so that we analyse the fully developed region of the fluid.
Use Matlab to parse the blockMeshDict so that the same file can be used for any wedge values.
MATLAB CODE TO GENERATE blockMeshDict FILE for wedge boundary condition.
clear all
close all
clc
% inputs
% assumptions made the fluid is assumed as water
Re=2100; % given reynolds number
rho=997; % density of the water
D=0.02; % diiameter of the pipe
r=D/2; % radius of the pipe
mu=0.89*10^-3; % dynamic viscosity of the water at 25 degree celcius
v=0.88927*10^-6; % kinematic viscosity of the water at 25 degree celcius
theta=input('Enter the value of the wedge angle= ')
L_h=0.06*Re*D; % hydrodynamic lenght
L=L_h+0.5;
% Analytical solutions
V_avg=(Re*mu)/(rho*D); % average velocity
V_max=2*V_avg; % maximum velocity
P_drop=(32*mu*L*V_avg)/D^2; % pressure drop
P_kinematic=(P_drop)/rho; % kinematic pressure drop
% vertices
v0=[0 0 0]
v1=[0 r*cosd(theta/2) r*sind(theta/2)]
v2=[0 r*cosd(theta/2) -r*sind(theta/2)]
v3=[L 0 0]
v4=[L r*cosd(theta/2) r*sind(theta/2)]
v5=[L r*cosd(theta/2) -r*sind(theta/2)]
% PRINTING THE blockMeshDict FILE
H8='FoamFile';
H9='{'
H10=' version 2.0;';
H11=' format ascii;';
H12=' class dictionary;';
H13=' object blockMeshDict;';
fclose(f1);
MATLAB CODE TO GENERATE blockMeshDict FILE for symmetry boundary condition.
clear all
close all
clc
% inputs
% assumptions made the fluid is assumed as water
Re=2100; % given reynolds number
rho=997; % density of the water
D=0.02; % diiameter of the pipe
r=D/2; % radius of the pipe
mu=0.89*10^-3; % dynamic viscosity of the water at 25 degree celcius
v=0.88927*10^-6; % kinematic viscosity of the water at 25 degree celcius
theta=input('Enter the value of the wedge angle= ')
L_h=0.06*Re*D; % hydrodynamic lenght
L=L_h+0.5;
% Analytical solutions
V_avg=(Re*mu)/(rho*D); % average velocity
V_max=2*V_avg; % maximum velocity
P_drop=(32*mu*L*V_avg)/D^2; % pressure drop
P_kinematic=(P_drop)/rho; % kinematic pressure drop
% vertices
v0=[0 0 0]
v1=[0 r*cosd(theta/2) r*sind(theta/2)]
v2=[0 r*cosd(theta/2) -r*sind(theta/2)]
v3=[L 0 0]
v4=[L r*cosd(theta/2) r*sind(theta/2)]
v5=[L r*cosd(theta/2) -r*sind(theta/2)]
% PRINTING THE blockMeshDict FILE
H8='FoamFile';
H9='{'
H10=' version 2.0;';
H11=' format ascii;';
H12=' class dictionary;';
H13=' object blockMeshDict;';
fprintf(f1,'%s \n','convertToMeters 1;');
fprintf(f1,'%s \n','vertices');
fprintf(f1,'%s \n','(');
fprintf(f1,'%s (%f %f %f) \n',blanks(5),v0(1),v0(2),v0(3));
fprintf(f1,'%s (%f %f %f) \n',blanks(5),v1(1),v1(2),v1(3));
fprintf(f1,'%s (%f %f %f) \n',blanks(5),v2(1),v2(2),v2(3));
fprintf(f1,'%s (%f %f %f) \n',blanks(5),v3(1),v3(2),v3(3));
fprintf(f1,'%s (%f %f %f) \n',blanks(5),v4(1),v4(2),v4(3));
fprintf(f1,'%s (%f %f %f) \n',blanks(5),v5(1),v5(2),v5(3));
fclose(f1);
For symmetry boundary conditions
For angle 25 degrees the blockMeshDict file
{
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.020000 0.000000 0.000000)
(3.020000 0.009763 0.002164)
(3.020000 0.009763 -0.002164)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (40 1 500) simpleGrading (1 1 1)
);
edges
(
arc 1 2 (0.000000 0.010000 0.000000)
arc 4 5 (3.020000 0.010000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
wedge_front
{
type symmetry;
faces
(
(2 5 3 0)
);
}
wedge_back
{
type symmetry;
faces
(
(0 3 4 1)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
application icoFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 30;
deltaT 0.005;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
FinternalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
wedge_front
{
type symmetry;
}
wedge_back
{
type symmetry;
}
top
{
type zeroGradient;
}
axis
{
type empty;
}
{
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.09373 0 0);
}
outlet
{
type zeroGradient;
}
top
{
type noSlip;
}
wedge_front
{
type symmetry;
}
wedge_back
{
type symmetry;
}
axis
{
type empty;
}
}
Results:
Blockmesh

Velocity profile

Pressure profile



For symmetry boundary conditions
For angle 10 degrees the blockMeshDict file
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.020000 0.000000 0.000000)
(3.020000 0.009962 0.000872)
(3.020000 0.009962 -0.000872)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (40 1 500) simpleGrading
);
edges
(
arc 1 2 (0.000000 0.010000 0.000000)
arc 4 5 (3.020000 0.010000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
wedge_front
{
type symmetry;
faces
(
(2 5 3 0)
);
}
wedge_back
{
type symmetry;
faces
(
(0 3 4 1)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
Results:
Blockmesh

Velocity profile

Pressure profile


For wedge boundary conditions.
For the angle 45 degrees the blockMeshDict file.
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.020000 0.000000 0.000000)
(3.020000 0.009239 0.003827)
(3.020000 0.009239 -0.003827)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (40 1 500) simpleGrading (1 1 1)
);
edges
(
arc 1 2 (0.000000 0.010000 0.000000)
arc 4 5 (3.020000 0.010000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
wedge_front
{
type wedge;
faces
(
(2 5 3 0)
);
}
wedge_back
{
type wedge;
faces
(
(0 3 4 1)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
Results:
Blockmesh

Pressure profile

Velocity profile


CONCLUSION.
We can observe there is no much change in the maximum velocities. The only difference observed is execution time a little high than type-wedge. While the angle increases the error in the maximum velocity is decreased. Though there is not much difference between analytical and numerical results and also with increasing the angle of the wedge, The Courant number is slightly increasing. we can say that the symmetric boundary condition plays an important role in terms of accuracy in the result