All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
AIM- Write a program in Matlab that can generate the computational mesh automatically for any wedge angle and grading schemes For a baseline mesh, show that the velocity profile matches with the Hagen poiseuille's equation Show that the velocity profile is fully developed Post process velocity and shear stress…
Mainak Bhowmick
updated on 29 Oct 2020
AIM-
Hagen poiseuille's equation
The Hagen–Poiseuille Equation is a fluidic law to calculate flow pressure drop in a long cylindrical pipe.
ΔP=8⋅μ⋅L⋅Qπ⋅R4
Q=A⋅V
A=r2
ΔP=8⋅μ⋅L⋅Vπ⋅r2
Reynold's Number
it is the ratio of inertia force to viscous force.
Re=ρ⋅V⋅Dμ
Laminar Flow
Flow having a Reynolds number 1500-2000 is called a Laminar Flow.
Critical value for Reynolds number is approximately 2040 thus for the simulation 2040 is used.
Kinematic Pressure Difference
It is the ratio of normal pressure difference and the density of fluid.
ΔPke=ΔPρ
Shear Stress
Defined as the force per unit area.
τ=2⋅μ⋅Vmax⋅Rr2
Vmax=2⋅Vavg
Entrance Length
The hydrodynamic entrance region refers to the area of a pipe where fluid entering a pipe develops a velocity profile due to 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 massto 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.
image source:-Wikipedia
Entrance length=0.06*Re*D
OPEN FOAM BOUNDARIES USED
PATCH-The basic patch type for a patch condition that contains no geometric or topological information about the mesh (with the exception of wall), e.g. an inlet or an outlet.
Wedge-There are instances where a patch that coincides with a wall needs to be identifiable as such, particularly where specialist modelling is applied at wall boundaries. A good example is wall turbulence modelling where a wall must be specified with a wall patch type, so that the distance from the wall of the cell centres next to the wall are stored as part of the patch.
Empty-While OpenFOAM always generates geometries in 3 dimensions, it can be instructed to solve in 2 (or 1) dimensions by specifying a special empty condition on each patch whose plane is normal to the 3rd (and 2nd) dimension for which no solution is required.
Variables
Reynold's Number=2040
Density of water=1000 kgm3
Diameter =0.0005 m
L=1.3120 m
dynamic viscosity=9e-4
BLOCKMESH CODE:
clear all
close all
clc
%reynolds number
re=2040;
%density
rho=1000;
%Diameter
D=0.005;
%radius
r=D/2;
%entrance length
Le=0.06*re*D;
%length
L=0.7+Le;
%dynamic viscosity
mu=9e-4;
v=(re*9e-4)/(D*1000);
vmax=2*v;
theta=4;
y=r*cosd(theta/2);
z=r*sind(theta/2);
%Shear stress calculation
R=linspace(0,r,100);
for i=1:length(R)
shear(i)=2*vmax*mu*(R(i))/(r^2);
end
plot(shear,R);
xlabel('radius')
ylabel('shear stress')
bmd=fopen('blockMeshDict.txt','w');%w stands for write
fprintf(bmd,'%s','/*--------------------------------*- C++ -*----------------------------------*\');
fprintf(bmd,'\n ========= |\n');
fprintf(bmd,' \\ / F ield | OpenFOAM: The Open Source CFD Toolbox\n');
fprintf(bmd,' \\ / O peration | Website: https://openfoam.org\n');
fprintf(bmd,' \\ / A nd | Version: 8\n');
fprintf(bmd,' \\/ M anipulation |\n');
fprintf(bmd,'%s','\*---------------------------------------------------------------------------*/');
fprintf(bmd,'\nFoamFile\n');
fprintf(bmd,'{\n');
fprintf(bmd,'version 2.0;\n');
fprintf(bmd,' format ascii;\n');
fprintf(bmd,' class dictionary;\n');
fprintf(bmd,' object blockMeshDict;\n');
fprintf(bmd,'}\n');
fprintf(bmd,'// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //\n');
fprintf(bmd,'\n');
fprintf(bmd,'convertToMeters 1;');
%part of program to find the vertces
fprintf(bmd,'\nvertices\n');
fprintf(bmd,'(\n');
fprintf(bmd,'\t(0 0 0)//0\n');%0
fprintf(bmd,'\t(%d %d %d)//1\n',0, y, z);%1
fprintf(bmd,'\t(%d %d %d)//2\n',0, y, -z);%2
fprintf(bmd,'\t(%d %d %d)//3\n',L, 0, 0);%3
fprintf(bmd,'\t(%d %d %d)//4\n',L, y, z);%4
fprintf(bmd,'\t(%d %d %d)//5\n',L, y, -z);%5
fprintf(bmd,');');
%part of program to find the blocks
fprintf(bmd,'\nblocks');
fprintf(bmd,'\n(');
fprintf(bmd,'\n\thex (0 3 5 2 0 3 4 1) (20 20 1) simpleGrading (1 0.5 1)');
fprintf(bmd,'\n);');
fprintf(bmd,'\n\nedges');
fprintf(bmd,'\n(\n);');
fprintf(bmd,'\n');
%Boundary
fprintf(bmd,'\nboundary');
fprintf(bmd,'\n(');
%inlet
fprintf(bmd,' \n\tinlet');
fprintf(bmd,'\n\t{');
fprintf(bmd,'\n\t\ttype patch;');
fprintf(bmd,'\n\t\tfaces');
fprintf(bmd,'\n\t\t(');
fprintf(bmd,'\n\t\t\t(0 1 2 0)');
fprintf(bmd,'\n\t\t);');
fprintf(bmd,'\n\t\t}');
fprintf(bmd,'\n');
%outlet
fprintf(bmd,' \n\toutlet');
fprintf(bmd,'\n\t{');
fprintf(bmd,'\n\t\ttype patch;');
fprintf(bmd,'\n\t\tfaces');
fprintf(bmd,'\n\t\t(');
fprintf(bmd,'\n\t\t\t(3 5 4 3)');
fprintf(bmd,'\n\t\t);');
fprintf(bmd,'\n\t}');
fprintf(bmd,'\n');
%Top
fprintf(bmd,' \n\ttop');
fprintf(bmd,'\n\t{');
fprintf(bmd,'\n\t\ttype wall;');
fprintf(bmd,'\n\t\tfaces');
fprintf(bmd,'\n\t\t(');
fprintf(bmd,'\n\t\t\t(1 4 5 2)');
fprintf(bmd,'\n\t\t);');
fprintf(bmd,'\n\t}');
fprintf(bmd,'\n');
%Front
fprintf(bmd,' \n\tfront');
fprintf(bmd,'\n\t{');
fprintf(bmd,'\n\t\ttype wedge;');
fprintf(bmd,'\n\t\tfaces');
fprintf(bmd,'\n\t\t(');
fprintf(bmd,'\n\t\t\t(0 3 4 1)');
fprintf(bmd,'\n\t\t);');
fprintf(bmd,'\n\t}');
fprintf(bmd,'\n');
%back
fprintf(bmd,' \n\tback');
fprintf(bmd,'\n\t{');
fprintf(bmd,'\n\ttype wedge;');
fprintf(bmd,'\n\tfaces');
fprintf(bmd,'\n\t\t(');
fprintf(bmd,'\n\t\t\t(0 2 5 3)');
fprintf(bmd,'\n\t\t);');
fprintf(bmd,'\n\t}');
fprintf(bmd,'\n');
%axis
fprintf(bmd,' \n\taxis');
fprintf(bmd,'\n\t{');
fprintf(bmd,'\n\t\ttype empty;');
fprintf(bmd,'\n\t\tfaces');
fprintf(bmd,'\n\t\t(');
fprintf(bmd,'\n\t\t\t(0 3 3 0)');
fprintf(bmd,'\n\t\t);');
fprintf(bmd,'\n\t}');
fprintf(bmd,'\n);');
fprintf(bmd,'\nmergePatchPairs');
fprintf(bmd,'\n(\n);');
fprintf(bmd,'\n\t\t*--------------------------------**----------------------------------*');
TRANSPORT PROPERTIES
/*--------------------------------*- 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 0 0)//0
(0 2.498477e-03 8.724874e-05)//1
(0 2.498477e-03 -8.724874e-05)//2
(1.312000e+00 0 0)//3
(1.312000e+00 2.498477e-03 8.724874e-05)//4
(1.312000e+00 2.498477e-03 -8.724874e-05)//5
);
blocks
(
hex (0 3 5 2 0 3 4 1) (20 20 1) simpleGrading (1 0.5 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
(0 2 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
*--------------------------------**----------------------------------*
VELOCITY
/*--------------------------------*- 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.3672 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (0.3672 0 0);
}
outlet
{
type zeroGradient;
}
axis
{
type empty;
}
top
{
type fixedValue;
value uniform (0 0 0);
}
front
{
type wedge;
}
back
{
type wedge;
}
}
// ************************************************************************* //
PRESSURE
/*--------------------------------*- 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 1.72;
}
axis
{
type empty;
}
top
{
type zeroGradient;
}
back
{
type wedge;
}
front
{
type wedge;
}
}
// ************************************************************************* //
CONTROLDICT
/*--------------------------------*- 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 1;
deltaT 0.00001;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
CONTROLDICT
/*--------------------------------*- 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.01;
// ************************************************************************* //
SHEAR STRESS
MESH
at point = 0.01m from the initial point
at point = 0.5 m from the initial point
at point = 1m from the initial point
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Week 11 - Simulation of Flow through a pipe in OpenFoam
AIM- Write a program in Matlab that can generate the computational mesh automatically for any wedge angle and grading schemes For a baseline mesh, show that the velocity profile matches with the Hagen poiseuille's equation Show that the velocity profile is fully developed Post process velocity and shear stress…
29 Oct 2020 06:38 PM IST
Week 9 - FVM Literature Review
FINITE VOLUME METHOD - The finite volume is a discretisation method which is well suited for numerical simulations of various types namely hyperbolic, elliptic and parabolic for instance of conservation laws. It has been extensively used in several engineering fields, such as fluid mechanics, heat and mass transfer or…
20 Oct 2020 10:43 AM IST
Week 8 - BlockMesh Drill down challenge
AIM-to create a BlockMesh and to simulate it . OBJECTIVES:- How does the velocity magnitude profile change as a function of mesh grading factor. Use factors, 0.2, 0.5,0.8 Measure the velocity profile at 0.085 m from the inlet of the geometry Plot must be a line plot Compare velocity magnitude contours near the step region…
15 Oct 2020 09:58 AM IST
Week 7 - Simulation of a 1D Super-sonic nozzle flow simulation using Macormack Method
AIM- Simulation of 1D supersonic nozzle flow simulation using Macormack method OBJECTIVES- 1. Steady-state distribution of primitive variables inside the nozzle2. Time-wise variation of the primitive variables3. Variation of Mass flow rate distribution inside the nozzle at different time steps during the time-marching…
30 Sep 2020 08:16 PM IST
Related Courses
0 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.