Simulation of Flow through a Pipe
Hagen-Poiseuille Equation
It 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. It can be successfully applied to air flow in lung alveoli, or the flow through a drinking straw or through a hypodermic needle. The assumptions of the equation are that the fluid is incompressible and Newtonian; the flow is laminar through a pipe of constant circular cross-section that is substantially longer than its diameter; and there is no acceleration of fluid in the pipe. For velocities and pipe diameters above a threshold, actual fluid flow is not laminar but turbulent, leading to larger pressure drops than calculated by the Hagen–Poiseuille equation.
Pressure difference between the two ends of the pipe is
`nablap= (8*mu*L*Q)/(pi. R^4`
where,
Δp is the pressure difference between the two ends,
L is the length of pipe,
μ is the dynamic viscosity,
Q is the volumetric flow rate,
R is the pipe radius,
A is the cross section of pipe.
Analytical Values
Diameter of Pipe, D=0.01m
Reynolds Number, Re=2100
Dynamic Viscosity of Water,`mu=8.9*10^-4`
Density of Water,`rho=998(kg)/m^3`
Velocity,`V=0.1869m/s`
Maximum Velocity,`V_max=2*V=0.3738 m/s`
Pressure Difference, Δp =55.89 Pa.
Kinematic Presure Difference, `nablap'=(nablap)/rho=55.89/998=0.056 pa`
Hydrodynamic Entrance Length
The hydrodynamic entrance region refers to the area of a pipe where fluid entering a pipe develops a velocity profile due to viscous forces propagating from the interior wall of a pipe. This region is characterized by a non-uniform flow. The fluid enters a pipe at a uniform velocity, then fluid particles in the layer in contact with the surface of the pipe come to a complete stop due to the no-slip condition. Due to viscous forces within the fluid, the layer in contact with the pipe surface resists the motion of adjacent layers and slows adjacent layers of fluid down gradually, forming a velocity profile. For the conservation of mass to hold true, the velocity of layers of the fluid in the center of the pipe increases to compensate for the reduced velocities of the layers of fluid near the pipe surface. This develops a velocity gradient across the cross section of the pipe.
It is a function of Reynolds number of the flow. In case of laminar flow, this length is given by,
`Le=0.05*Re*D`
Substituting values from above, `Le=1.05m`
Matlab Code for BlockMeshDict File
clc
clear all
close all
%Variable values
diameter=0.01;
r=diameter/2;
L=2.1;
theta=5;
% Specifying string for header part
h1='/*––––––––––––––––––––––––––––––--*- C++ -*–––––––––––––––––––––––––––––––––-*\ ';
h2=' ========= ';
h3=' \\ / F ield | OpenFOAM: The Open Source CFD Toolbox';
h4=' \\ / 0 peration | Website: www.OpenFOAM.org ';
h5=' \\ / A nd | Version: 4.0 ';
h6=' \\/ M anipulation | ';
h7='\*–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––*/ ';
h8=' FoamFile';
h9='{';
h10=' version 2.0;';
h11=' format ascii;';
h12=' class dictionary;';
h13=' object blockMeshDict;';
h14='}';
h15='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //';
conv='convertToMeters 1;';
s1=blanks(5);
s2=blanks(10);
s3=blanks(15);
v0=[0 0 0];
v1=[r*cosd(theta/2) -r*sind(theta/2) 0];
v2=[r*cosd(theta/2) r*sind(theta/2) 0];
v3=[0 0 L];
v4=[r*cosd(theta/2) -r*sin(theta/2) L];
v5=[r*cosd(theta/2) r*sind(theta/2) L];
block='hex (0 1 2 0 3 4 5 3) (20 1 300) simpleGrading (1 1 1)';
inlet='(0 0 2 1)';
outlet='(3 4 5 3)';
wedge1='(0 3 5 2)';
wedge2='(0 3 4 1)';
wall='(2 5 4 1)';
axis='(0 3 3 0)';
% Writing the blockMeshDict
f1=fopen('blockMeshDict.txt','w');
fprintf(f1,'%s \n',h1);
fprintf(f1,'%s \n',h2);
fprintf(f1,'%s \n',h3);
fprintf(f1,'%s \n',h4);
fprintf(f1,'%s \n',h5);
fprintf(f1,'%s \n',h6);
fprintf(f1,'%s \n',h7);
fprintf(f1,'%s \n',h8);
fprintf(f1,'%s \n',h9);
fprintf(f1,'%s \n',h10);
fprintf(f1,'%s \n',h11);
fprintf(f1,'%s \n',h12);
fprintf(f1,'%s \n',h13);
fprintf(f1,'%s \n',h14);
fprintf(f1,'%s \n',h15);
fprintf(f1,'\n');
fprintf(f1,'%s \n',conv);
fprintf(f1,'\n');
fprintf(f1,'%s \n','vertices');
fprintf(f1,'%s \n','(');
fprintf(f1,'%s (%f %f %f) \n',s1,v0(1),v0(2),v0(3));
fprintf(f1,'%s (%f %f %f) \n',s1,v1(1),v1(2),v1(3));
fprintf(f1,'%s (%f %f %f) \n',s1,v2(1),v2(2),v2(3));
fprintf(f1,'%s (%f %f %f) \n',s1,v3(1),v3(2),v3(3));
fprintf(f1,'%s (%f %f %f) \n',s1,v4(1),v4(2),v4(3));
fprintf(f1,'%s (%f %f %f) \n',s1,v5(1),v5(2),v5(3));
fprintf(f1,'%s \n',');');
fprintf(f1,'\n');
fprintf(f1,'%s \n','blocks');
fprintf(f1,'%s \n','(');
fprintf(f1,'%s %s \n',s1,block);
fprintf(f1,'%s \n',');');
fprintf(f1,'\n');
fprintf(f1,'%s \n','boundary');
fprintf(f1,'%s \n','(');
fprintf(f1,'%s %s \n',s1,'inlet');
fprintf(f1,'%s %s \n',s1,'{');
fprintf(f1,'%s %s \n',s2,'type patch;');
fprintf(f1,'%s %s \n',s2,'faces');
fprintf(f1,'%s %s \n',s2,'(');
fprintf(f1,'%s %s \n',s3,inlet);
fprintf(f1,'%s %s \n',s2,');');
fprintf(f1,'%s %s \n',s1,'}');
fprintf(f1,'%s %s \n',s1,'outlet');
fprintf(f1,'%s %s \n',s1,'{');
fprintf(f1,'%s %s \n',s2,'type patch;');
fprintf(f1,'%s %s \n',s2,'faces');
fprintf(f1,'%s %s \n',s2,'(');
fprintf(f1,'%s %s \n',s3,outlet);
fprintf(f1,'%s %s \n',s2,');');
fprintf(f1,'%s %s \n',s1,'}');
fprintf(f1,'%s %s \n',s1,'front');
fprintf(f1,'%s %s \n',s1,'{');
fprintf(f1,'%s %s \n',s2,'type wedge;');
fprintf(f1,'%s %s \n',s2,'faces');
fprintf(f1,'%s %s \n',s2,'(');
fprintf(f1,'%s %s \n',s3,wedge1);
fprintf(f1,'%s %s \n',s2,');');
fprintf(f1,'%s %s \n',s1,'}');
fprintf(f1,'%s %s \n',s1,'back');
fprintf(f1,'%s %s \n',s1,'{');
fprintf(f1,'%s %s \n',s2,'type wedge;');
fprintf(f1,'%s %s \n',s2,'faces');
fprintf(f1,'%s %s \n',s2,'(');
fprintf(f1,'%s %s \n',s3,wedge2);
fprintf(f1,'%s %s \n',s2,');');
fprintf(f1,'%s %s \n',s1,'}');
fprintf(f1,'%s %s \n',s1,'pipewall');
fprintf(f1,'%s %s \n',s1,'{');
fprintf(f1,'%s %s \n',s2,'type wall;');
fprintf(f1,'%s %s \n',s2,'faces');
fprintf(f1,'%s %s \n',s2,'(');
fprintf(f1,'%s %s \n',s3,wall);
fprintf(f1,'%s %s \n',s2,');');
fprintf(f1,'%s %s \n',s1,'}');
fprintf(f1,'%s %s \n',s1,'axis');
fprintf(f1,'%s %s \n',s1,'{');
fprintf(f1,'%s %s \n',s2,'type empty;');
fprintf(f1,'%s %s \n',s2,'faces');
fprintf(f1,'%s %s \n',s2,'(');
fprintf(f1,'%s %s \n',s3,axis);
fprintf(f1,'%s %s \n',s2,');');
fprintf(f1,'%s %s \n',s1,'}');
fprintf(f1,'%s \n',');');
fprintf(f1,'\n');
fprintf(f1,'%s \n','mergePatchPairs');
fprintf(f1,'%s \n','(');
fprintf(f1,'%s \n',');');
fprintf(f1,'\n');
fprintf(f1,'%s \n',h15);
fclose(f1);
- Pressure File
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 7
\\/ 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;
}
front
{
type wedge;
}
back
{
type wedge;
}
pipewall
{
type zeroGradient;
}
axis
{
type empty;
}
}
// ************************************************************************* //
- Velocity File
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 7
\\/ 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 0 0.1869);
}
outlet
{
type zeroGradient;
}
front
{
type wedge;
}
back
{
type wedge;
}
pipewall
{
type noSlip;
}
axis
{
type empty;
}
}
// ************************************************************************* //
Plots
- Variation of Velocity
- Velocity Profie at 0.5m from the inlet of the pipe
The maximum velocity of the profile is less than the analytical maximum value. So it has not reached the steady state.
- Velocity Profile at 1.05m.
- Velocity Profile at 2.1m.
The maximum velocity of the profile is approximately equal to the analytical maximum value. So it has reached the steady state.
From the above plots we can say that the fluid flow gains a stready state only after it crosses the hydrodynamic entrance length.
- Pressure Difference
Kinematic pressure difference from the plot is approximately equal to the analytical value.
- Shear Stress