Project

simulate the flow through pipe with wedge BC and icofoam solver for incompressible fluid

Instructions

  • Reynolds number based on the pipe diameter and inlet velocity should be 2100
  • Working fluid - water
  • You need to calculate the length of the pipe
    • Calculate the length of the pipe using the entry length formula for laminar flow through a pipe
    • Show that entry length is sufficient to produce a fully developed flow. You will have to compare velocity profiles at different positions along the length of the pipe.
  • Solver - icoFOAM

Solution:

1)Here Reynold number is assumed to be 2100 and diameter of duct to be 0.02 m and thus by entry length formula Le is as follows

Le=0.06*Re*D

Le=2.52 m

2) hereby Hagen poiseuille\'s equation:

Re=2100; % Reynold number
D=0.02; %diameter
Le=0.06*Re*D; %entry length for flow to develop
fprintf(\'entry length:%f\\n\',Le)
R=D/2;
mu=0.89e-3; % dynamic viscosity at25 degree
rho=997;%density
nu=mu/rho;

% here by hagen poiseuille theorem
v_avg=Re*mu/(D*rho);% average velocity

v_avg=velocity at inlet:0.093731 m/s

v_max=2*v_avg;
pressure_diff=(32*mu*v_avg*Le)/(D^2);
Kinematic_press_drop=pressure_diff/rho;
Kinematic_press_drop=pressure at exit:0.016868 m or 165.3762239389769 Pascal

% mesh parameter
n1=50;%along the length
n2=1;%radial
n3=300;% along curve
gradingfactor=0.2;

Here is MATLAB code to generate blockMeshDict file for given wedge angle, it is useful while putting vertices

clc;
close all;
clear all;


% Input

theta=input(\'enter the wedge angle in degree:\');
Re=2100; % Reynold number
D=0.02; %diameter
Le=0.06*Re*D; %entry length for flow to develop
fprintf(\'entry length:%f\\n\',Le)
R=D/2;
mu=0.89e-3; %  dynamic viscosity at25 degree
rho=997;%density
nu=mu/rho;

% here by hagen poiseuille theorem
v_avg=Re*mu/(D*rho);% average velocity
fprintf(\'velocity at inlet:%f\\n\',v_avg);
v_max=2*v_avg;
pressure_diff=(32*mu*v_avg*Le)/(D^2);
Kinematic_press_drop=pressure_diff/rho;
fprintf(\'pressure at exit:%f\\n\',Kinematic_press_drop)
% mesh parameter
n1=50;%along the length
n2=1;%radial
n3=300;% along curve
gradingfactor=0.2;

%vertices of the wedge

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=[Le 0 0];
v4=[Le R*cosd(theta/2) -R*sind(theta/2)];
v5=[Le R*cosd(theta/2) R*sind(theta/2)];

% printing the file

t1=\'/*-------------------------------*- C++ -*-------------------------------* OPENFOAM*/\';
% creating blockMeshDict file
f1=fopen(\'blockMeshDict.txt\',\'wt\');
fprintf(f1,\'%s\\n\',t1);
fprintf(f1,\'FoamFile\\n{\\n\');
fprintf(f1,\'%16s  2.0;\\n\',\'version\');
fprintf(f1,\'%16s  ascii;\\n\',\'format\');
fprintf(f1,\'%16s  dictionary;\\n\',\'class\');
fprintf(f1,\'%16s  blockMeshDict;\\n}\\n\',\'object\');

fprintf(f1,\'convertToMeters 1;\\n\\n\');
fprintf(f1,\'vertices\\n(\\n\');
fprintf(f1,\'         (%d %d %d)\\n\',v0(1),v0(2),v0(3));
fprintf(f1,\'         (%d %d %d)\\n\',v1(1),v1(2),v1(3));
fprintf(f1,\'         (%d %d %d)\\n\',v2(1),v2(2),v2(3));
fprintf(f1,\'         (%d %d %d)\\n\',v3(1),v3(2),v3(3));
fprintf(f1,\'         (%d %d %d)\\n\',v4(1),v4(2),v4(3));
fprintf(f1,\'         (%d %d %d)\\n);\\n\',v5(1),v5(2),v5(3));

fprintf(f1,\'blocks\\n(\\n\');
fprintf(f1,\'         hex(0 1 2 0 3 4 5 3) (%d %d %d) simpleGrading (%0.1f,1,1)\\n);\\n\\n\',n1,n2,n3,gradingfactor);
fprintf(f1,\'edges\\n(\\n        arc %d %d (%d %0.2f %d)\\n        arc %d %d (%0.2f %0.2f %d)\\n);\\n\\n\',1,2,0,R,0,4,5,Le,R,0);
fprintf(f1,\'boundary\\n(\\n\');
fprintf(f1,\'           %s\\n           {\\n           type %s;\\n             faces \\n           (\\n                 (%d %d %d %d) \\n               );\\n              }\\n\\n\',\'axis\',\'empty\',0,3,3,0);
fprintf(f1,\'           %s\\n           {\\n           type %s;\\n           faces \\n             (\\n                 (%d %d %d %d) \\n               );\\n              }\\n\\n\',\'inlet\',\'patch\',0,1,2,0);
fprintf(f1,\'           %s\\n           {\\n           type %s;\\n           faces \\n             (\\n                 (%d %d %d %d) \\n               );\\n              }\\n\\n\',\'pipe\',\'wall\',1,4,5,2);
fprintf(f1,\'           %s\\n           {\\n           type %s;\\n           faces \\n             (\\n                 (%d %d %d %d) \\n               );\\n              }\\n\\n\',\'outlet\',\'patch\',3,4,5,3);
fprintf(f1,\'           %s\\n           {\\n           type %s;\\n           faces \\n             (\\n                 (%d %d %d %d) \\n               );\\n              }\\n\\n\',\'front\',\'wedge\',0,3,5,2);
fprintf(f1,\'           %s\\n           {\\n           type %s;\\n           faces \\n             (\\n                 (%d %d %d %d) \\n               );\\n              }\\n\\n\',\'back\',\'wedge\',0,1,4,3);
fprintf(f1,\');\\n\\n\');

fprintf(f1,\'mergePatchPairs\\n(\\n);\\n\\n\');

fclose(f1);




here BlockMeshDict File is as follows

/*--------------------------------*- 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 dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices
(
(0 0 0)
(0 9.993908e-03 -3.489950e-04)
(0 9.993908e-03 3.489950e-04)
(2.52 0 0)
(2.52 9.993908e-03 -3.489950e-04)
(2.52 9.993908e-03 3.489950e-04)
);

blocks
(
hex (0 1 2 0 3 4 5 3) (50 1 300) simpleGrading (0.2 1 1)
);

edges
(
arc 1 2 (0 0.01 0)
arc 4 5 (2.52 0.01 0)
);

boundary
(
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
pipe
{
type wall;
faces
(
(1 4 5 2)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
front
{
type wedge;
faces
(
(0 3 5 2)
);
}
back
{
type wedge;
faces
(
(0 1 4 3)
);
}
);

mergePatchPairs
(
);

// ************************************************************************* //

control dict 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 dictionary;
location \"system\";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application icoFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 10;

deltaT 0.000001;

writeControl timeStep;

writeInterval 20;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable true;


// ************************************************************************* //

pressure BC

/*--------------------------------*- 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
{
axis
{
type empty;
}

pipe
{
type zeroGradient;
}

inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0.0168682;
}
front
{
type wedge;
}
back
{
type wedge;
}
}

// ************************************************************************* //

Velocity BC

/*--------------------------------*- 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.0937312 0 0);

boundaryField
{
axis
{
type empty;
}
inlet
{
type fixedValue;
value uniform (0.0937312 0 0);
}
pipe
{
type fixedValue;
value uniform (0 0 0);
}
outlet
{
type zeroGradient;
}
front
{
type wedge;
}
back
{
type wedge;
}
}

// ************************************************************************* //

Results:

Velocity contour wedge

\"\"

pressure contour wedge

\"\"

velocity profile in radial direction at

x=0m

\"\"

x=1.255 m

\"\"

x=2.51 m

\"\"

\"\"

Conclusion:

1) Here figure 1 justifies velocity variation along radius shown by Hagen poiseuille\'s equation with maximum velocity of 0.186 m/s being at center of pipe and zero at wall.

2) Figure 2 and Figure 6 shows that flow has been stabilizedn or devloped after initial formation period and pressure loss has occured along the length of pipe.

3) figure 3,4 and 5 show velocity profile along radius and those graphs proves that flow has been developed with parabolic profile at x=2.51 m .

4) here shear stress is given by shear stress=mu*(dU/dz) and it generally decreases radially towards center and it is maximum at surface of pipe.

5) here we have used wedge BC and in next assignment we will replace it by symmetry condition and analyse speed and accuracy.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.