All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
In this challenge we will be simulating incompressible laminar pipe flow , for this simulation we will be using the axisymmetrical geometry with angle theta and wedge and symmetry boundary conditions for both the front and back faces as given below also different values of theta will be 10 25 45 Also we have…
Amol Patel
updated on 17 Jul 2021
In this challenge we will be simulating incompressible laminar pipe flow , for this simulation we will be using the axisymmetrical geometry with angle theta and wedge and symmetry boundary conditions for both the front and back faces as given below
also different values of theta will be
10
25
45
Also we have written a code that gives us the blockMeshDict for the required boundary condition and angle theta as given below
clear all
close all
clc
%% inputs for the blockMeshDict
% diameter of pipe
D = input('enter the diameter of pipe ');
% radius = diameter/2
R = D/2;
% length of pipe
L = input('enter the length of pipe ');
% wedge angle
theta = input('enter the angle theta ');
% boundary condition
% 1 for wedge and 2 for symmetry
bc = input('enter boundary condition(1 for wedge and 2 for symmetry) ')
%% creating a blockMeahDict file
% filename = 'blockMeshDict';
f1 = blockMesh_generator(R, theta, L, bc);
% reynolds number - this value is specified in the question
Re = 2100;
% considering the following values for the properties of water
% density of water
rho = 1e+3;
% dynamic viscosity
eta = 0.001;
% kinematic viscosity of water
nu = eta/rho;
%%
% inlet velocity - this velocity will be given as the inlet velocity in the
% U file in the 0 folder.
% average velocity = (Reynold number * kinematic viscosity )/diameter
v_avg = (Re * nu)/D;
% maximum velocity - to validate with our simulation results when we
% observe our results in paraFoam in terms of plots and contours.
v_max = 2* v_avg;
% total time of simulation
t = L/v_max;
% length of developing flow region
% hydrodynamic length = 0.06* reynolds number * Diameter
Lh = 0.06*Re*D;
% Hagen Poiseuille flow equation - to validate the pressure drop through the pipe length
DeltaP = (32*eta*(L-Lh)*v_avg)/(D^2);
% the pressure in opoenfoam is kinematic pressure so we divide the static prssure with the density
and the supporting function is given below
function [f1] = blockMesh_generator(R, theta, L, bc)
if bc == 1
f1 = fopen('blockMeshDict','w');
fprintf(f1,'FoamFile\n');
fprintf(f1,'{\n\tversion\t\t2.0;\n\tformat\t\tascii;\n\tclass\t\tdictionary;\n\tobject\t\tblockMeshDict;\n}\n\n');
fprintf(f1,'convertToMeters 1;\n\n');
fprintf(f1,'vertices\n(\n\t(%f %f %f)\n',0,0,0);
fprintf(f1,'\t(%f %f %f)\n',R*sind(theta/2),R*cosd(theta/2),0);
fprintf(f1,'\t(%f %f %f)\n',-(R*sind(theta/2)),R*cosd(theta/2),0);
fprintf(f1,'\t(%f %f %f)\n',0,0,L);
fprintf(f1,'\t(%f %f %f)\n',R*sind(theta/2),R*cosd(theta/2),L);
fprintf(f1,'\t(%f %f %f)\n);\n\n',-(R*sind(theta/2)),R*cosd(theta/2),L);
fprintf(f1,'blocks\n(\n');
fprintf(f1,'\thex (0 3 4 1 0 3 5 2) (300 20 1) simpleGrading (1 0.2 1)\n);\n\n');
fprintf(f1,'edges\n(\n');
fprintf(f1,'\tarc 1 2 (0 %f 0)',R);
fprintf(f1,'\n\tarc 4 5 (0 %f %f)\n);\n\n',R,L);
fprintf(f1,'boundary\n(\n');
fprintf(f1,'\tinlet\n\t{\n\t\ttype patch;\n\t\tfaces\n\t\t(\n\t\t\t(0 1 2 0)\n\t\t);\n\t}\n');
fprintf(f1,'\toutlet\n\t{\n\t\ttype patch;\n\t\tfaces\n\t\t(\n\t\t\t(3 5 4 3)\n\t\t);\n\t}\n');
fprintf(f1,'\tnoSlipWall\n\t{\n\t\ttype wall;\n\t\tfaces\n\t\t(\n\t\t\t(1 4 5 2)\n\t\t);\n\t}\n');
fprintf(f1,'\tfront\n\t{\n\t\ttype wedge;\n\t\tfaces\n\t\t(\n\t\t\t(0 3 4 1)\n\t\t);\n\t}\n');
fprintf(f1,'\tback\n\t{\n\t\ttype wedge;\n\t\tfaces\n\t\t(\n\t\t\t(0 2 5 3)\n\t\t);\n\t}\n');
fprintf(f1,'\taxis\n\t{\n\t\ttype empty;\n\t\tfaces\n\t\t(\n\t\t\t(0 3 3 0)\n\t\t);\n\t}\n');
fprintf(f1,');\n\n');
fprintf(f1,'mergePatchPairs\n(\n);\n');
fclose(f1);
end
if bc == 2
f1 = fopen('blockMeshDict','w');
fprintf(f1,'FoamFile\n');
fprintf(f1,'{\n\tversion\t\t2.0;\n\tformat\t\tascii;\n\tclass\t\tdictionary;\n\tobject\t\tblockMeshDict;\n}\n\n');
fprintf(f1,'convertToMeters 1;\n\n');
fprintf(f1,'vertices\n(\n\t(%f %f %f)\n',0,0,0);
fprintf(f1,'\t(%f %f %f)\n',R*sind(theta/2),R*cosd(theta/2),0);
fprintf(f1,'\t(%f %f %f)\n',-(R*sind(theta/2)),R*cosd(theta/2),0);
fprintf(f1,'\t(%f %f %f)\n',0,0,L);
fprintf(f1,'\t(%f %f %f)\n',R*sind(theta/2),R*cosd(theta/2),L);
fprintf(f1,'\t(%f %f %f)\n);\n\n',-(R*sind(theta/2)),R*cosd(theta/2),L);
fprintf(f1,'blocks\n(\n');
fprintf(f1,'\thex (0 3 4 1 0 3 5 2) (300 20 1) simpleGrading (1 0.2 1)\n);\n\n');
fprintf(f1,'edges\n(\n');
fprintf(f1,'\tarc 1 2 (0 %f 0)',R);
fprintf(f1,'\n\tarc 4 5 (0 %f %f)\n);\n\n',R,L);
fprintf(f1,'boundary\n(\n');
fprintf(f1,'\tinlet\n\t{\n\t\ttype patch;\n\t\tfaces\n\t\t(\n\t\t\t(0 1 2 0)\n\t\t);\n\t}\n');
fprintf(f1,'\toutlet\n\t{\n\t\ttype patch;\n\t\tfaces\n\t\t(\n\t\t\t(3 5 4 3)\n\t\t);\n\t}\n');
fprintf(f1,'\tnoSlipWall\n\t{\n\t\ttype wall;\n\t\tfaces\n\t\t(\n\t\t\t(1 4 5 2)\n\t\t);\n\t}\n');
fprintf(f1,'\tfront\n\t{\n\t\ttype symmetry;\n\t\tfaces\n\t\t(\n\t\t\t(0 3 4 1)\n\t\t);\n\t}\n');
fprintf(f1,'\tback\n\t{\n\t\ttype symmetry;\n\t\tfaces\n\t\t(\n\t\t\t(0 2 5 3)\n\t\t);\n\t}\n');
fprintf(f1,'\taxis\n\t{\n\t\ttype empty;\n\t\tfaces\n\t\t(\n\t\t\t(0 3 3 0)\n\t\t);\n\t}\n');
fprintf(f1,');\n\n');
fprintf(f1,'mergePatchPairs\n(\n);\n');
fclose(f1);
end
end
we get the required blockMeshDict by running the above code.
Now we willbe setting the transportProperties file where we edit the value of nu as 1e-6.
then set the inital conditions in the U and p file that re inside the folder named '0'. we keep the inital velocity as 0.105 m/s with fixed value at the inlet and 0 gauge pressure with fixed value at the outlet. lastly we change the runtime to 14.5 seconds so that a stedy state is reached. all the calculation for the above value is done in the code given above.
RESULTS:
Wedge
Angle = 10:
we will first see the results of the wedge boundary condition with 10 degree as the value of angle theta.
the variation of the velocity with the length of pipe is given below
we can see that a flow is in developing state for the length of pipe upto 2.5m then the velocity remains constant and there the flow is fully developed.
here we see that the velocity stop increseing after 2.53 m so it is the hydrodynamic length. and the maximum velocity is 0.0205757m/s
now we will be seening the pressure drop for the region of fully developed flow
the presssure drop is 0.0040156 in the region of fully developed flow
according to our calculation the maximum velocity and pressure drop should be
now calculating the error in our values
for velocity
error in velocity=0.21−0.20580.21=0.020247
the error is 2% that is acceptable
for pressure drop
error in pressure=0.004−0.0401560.04=0.0039
the error for prrssure drop is 0.39% that is acceptable
Now to validate our flow profile we will plot the velocity over the diameter in a fully developed region
the velocity profile is parabolic that is correct.
Now to validate the shear stress and wall shear stress we willbe ploting tau(shear stress over the radius in a fully developed flow region
the maximum value of shear stress is 0.0407598 and the wall shear stress can be seen as the shear stress values reducing near the wall.
the error in the max shear is
error in shear stress=0.042−0.04080.042=0.0285
the error 2.85 % which is in acceptable range.
Also here we can see that we have compared the calculated maximum value at the wall with the value that is actually away from the wall in the numerical solution this is because of the meshing that is not fine enough to calculate the exact values at the wall.
Angle = 25:
we will first see the results of the wedge boundary condition with 25 degree as the value of angle theta.
the variation of the velocity with the length of pipe is given below
we can see that a flow is in developing state for the length of pipe upto 2.5m then the velocity remains constant and there the flow is fully developed.
here we see that the velocity stop increseing after 2.54 m so it is the hydrodynamic length. and the maximum velocity is 0.0206173m/s
now we will be seening the pressure drop for the region of fully developed flow
the presssure drop is 0.00408574 in the region of fully developed flow
according to our calculation the maximum velocity and pressure drop should be
now calculating the error in our values
for velocity
error in velocity=0.21−0.20610.21=0.0185
the error is 1.85% that is acceptable
for pressure drop
error in pressure=0.004−0.0040860.04=0.0215
the error for prrssure drop is 2.15% that is acceptable
Now to validate our flow profile we will plot the velocity over the diameter in a fully developed region
the velocity profile is parabolic that is correct.
Now to validate the shear stress and wall shear stress we willbe ploting tau(shear stress over the radius in a fully developed flow region
the maximum value of shear stress is 0.0415076 and the wall shear stress can be seen as the shear stress values reducing near the wall.
the error in the max shear is
error in shear stress=0.042−0.04150.042=0.0119
the error 1.19% which is in acceptable range.
Also here we can see that we have compared the calculated maximum value at the wall with the value that is actually away from the wall in the numerical solution this is because of the meshing that is not fine enough to calculate the exact values at the wall.
Angle = 45:
we will first see the results of the wedge boundary condition with 45 degree as the value of angle theta.
the variation of the velocity with the length of pipe is given below
we can see that a flow is in developing state for the length of pipe upto 2.5m then the velocity remains constant and there the flow is fully developed.
here we see that the velocity stop increseing after 2.455 m so it is the hydrodynamic length. and the maximum velocity is 0.207077 m/s
now we will be seening the pressure drop for the region of fully developed flow
the presssure drop is 0.00538 in the region of fully developed flow
according to our calculation the maximum velocity and pressure drop should be
now calculating the error in our values
for velocity
error in velocity=0.21−0.2070770.21=0.0139
the error is 1.39% that is acceptable
for pressure drop
error in pressure=0.004−0.005380.04=0.345
the error for prrssure drop is 34.5% that is not acceptable
Now to validate our flow profile we will plot the velocity over the diameter in a fully developed region
the velocity profile is parabolic that is correct.
Now to validate the shear stress and wall shear stress we willbe ploting tau(shear stress over the radius in a fully developed flow region
the maximum value of shear stress is 0.043650 and the wall shear stress can be seen as the shear stress values reducing near the wall.
the error in the max shear is
error in shear stress=0.042−0.043650.042=0.0393
the error 3.93% which is in acceptable range.
Also here we can see that we have compared the calculated maximum value at the wall with the value that is actually away from the wall in the numerical solution this is because of the meshing that is not fine enough to calculate the exact values at the wall.
Symmetry
Angle = 10:
we will first see the results of the symmetry boundary condition with 10 degree as the value of angle theta.
the variation of the velocity with the length of pipe is given below
we can see that a flow is in developing state for the length of pipe upto 2.5m then the velocity remains constant and there the flow is fully developed.
here we see that the velocity stop increseing after 2.45 m so it is the hydrodynamic length. and the maximum velocity is 0.0205607m/s
now we will be seening the pressure drop for the region of fully developed flow
the presssure drop is 0.00410286 in the region of fully developed flow
according to our calculation the maximum velocity and pressure drop should be
now calculating the error in our values
for velocity
error in velocity=0.21−0.20560.21=0.02095
the error is 2.095% that is acceptable
for pressure drop
error in pressure=0.004−0.04102860.04=0.0025
the error for prrssure drop is 2.5% that is acceptable
Now to validate our flow profile we will plot the velocity over the diameter in a fully developed region
the velocity profile is parabolic that is correct.
Now to validate the shear stress and wall shear stress we willbe ploting tau(shear stress over the radius in a fully developed flow region
the maximum value of shear stress is 0.0407221 and the wall shear stress can be seen as the shear stress values reducing near the wall.
the error in the max shear is
error in shear stress=0.042−0.04070.042=0.0309
the error 3.09% which is in acceptable range.
Also here we can see that we have compared the calculated maximum value at the wall with the value that is actually away from the wall in the numerical solution this is because of the meshing that is not fine enough to calculate the exact values at the wall.
Angle = 25:
we will first see the results of the symmetry boundary condition with 25 degree as the value of angle theta.
the variation of the velocity with the length of pipe is given below
we can see that a flow is in developing state for the length of pipe upto 2.5m then the velocity remains constant and there the flow is fully developed.
here we see that the velocity stop increseing after 2.5 m so it is the hydrodynamic length. and the maximum velocity is 0.0206161m/s
now we will be seening the pressure drop for the region of fully developed flow
the presssure drop is 0.00444112 in the region of fully developed flow
according to our calculation the maximum velocity and pressure drop should be
now calculating the error in our values
for velocity
error in velocity=0.21−0.2061610.21=0.0182
the error is 1.82% that is acceptable
for pressure drop
error in pressure=0.004−0.004440.04=0.11
the error for prrssure drop is 11% that is not acceptable
Now to validate our flow profile we will plot the velocity over the diameter in a fully developed region
the velocity profile is parabolic that is correct.
Now to validate the shear stress and wall shear stress we willbe ploting tau(shear stress over the radius in a fully developed flow region
the maximum value of shear stress is 0.041531 and the wall shear stress can be seen as the shear stress values reducing near the wall.
the error in the max shear is
error in shear stress=0.042−0.041530.042=0.01119
the error 1.11% which is in acceptable range.
Also here we can see that we have compared the calculated maximum value at the wall with the value that is actually away from the wall in the numerical solution this is because of the meshing that is not fine enough to calculate the exact values at the wall.
Angle = 45:
we will first see the results of the symmetry boundary condition with 45 degree as the value of angle theta.
the variation of the velocity with the length of pipe is given below
we can see that a flow is in developing state for the length of pipe upto 2.5m then the velocity remains constant and there the flow is fully developed.
here we see that the velocity stop increseing after 2.54 m so it is the hydrodynamic length. and the maximum velocity is 0.0206173m/s
now we will be seening the pressure drop for the region of fully developed flow
the presssure drop is 0.00474463 in the region of fully developed flow
according to our calculation the maximum velocity and pressure drop should be
now calculating the error in our values
for velocity
error in velocity=0.21−0.2061730.21=0.0182
the error is 1.82% that is acceptable
for pressure drop
error in pressure=0.004−0.0047440.04=0.186
the error for prrssure drop is 18.6% that is not acceptable
Now to validate our flow profile we will plot the velocity over the diameter in a fully developed region
the velocity profile is parabolic that is correct.
Now to validate the shear stress and wall shear stress we willbe ploting tau(shear stress over the radius in a fully developed flow region
the maximum value of shear stress is 0.0437005 and the wall shear stress can be seen as the shear stress values reducing near the wall.
the error in the max shear is
error in shear stress=0.042−0.04370.042=0.04047
the error 4.04% which is in acceptable range.
Also here we can see that we have compared the calculated maximum value at the wall with the value that is actually away from the wall in the numerical solution this is because of the meshing that is not fine enough to calculate the exact values at the wall.
From the above results we can see that the pressure drop value of our simulation with angles 45 degree is have a very large error that is not acceptable but as the angles decreases the error drops. also the error for the wedge is higher as compared to symmetry when the angle is 45. and for smaller angle 10 the error is less for wedge boundar than compared to symmetry boundary conditions.
So from here we can say that when we have to simulate for a smaller angles we will be using wedge and for larger angles we can use symmetry
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 6: Conjugate Heat Transfer Simulation
AIM- To simulate a Conjugate Heat Transfer flow through a pipe, while the inlet Reynolds number should be 7000. To run the grid independance test on 3 grids and show that the outlet temperature converges to a particular value To observe the effect of various supercycle stage interval on the total simulation time.…
09 Nov 2022 06:55 AM IST
Week 7: Shock tube simulation project
AIM - To set up a transient shock tube simulation Plot the pressure and temperature history in the entire domain Plot the cell count as a function of time SHOCK TUBE- The shock tube is an instrument used to replicate and direct blast waves at a sensor or a model in order to simulate actual explosions…
07 Nov 2022 09:18 PM IST
Week 5: Prandtl Meyer Shock problem
AIM - 1. To understand what is a shock wave. 2. To understand the what are the different boundary conditions used for a shock flow problems. 3. To understand the effect of SGS parameter on shock location. 4. To simulate Prandalt Meyer Shcok Wave. OBJECTIVE - Que 1. What is Shock Wave? A shock wave or shock,…
01 Nov 2022 06:36 PM IST
Week 4.2: Project - Transient simulation of flow over a throttle body
AIM - Transient simulation of flow over a throttle body. OBJECTIVE - Setup and run transient state simulation for flow over a throttle body. Post process the results and show pressure and velocity contours. Show the mesh (i.e surface with edges) Show the plots for pressure, velocity, mass flow rate and total…
12 Feb 2022 07:08 AM 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.