Challenge

Week 12 - Symmetry vs Wedge vs HP equation

Pipe flow simulation in OpenFOAM - Wedge vs Symmetry vs HP equation.

Aim : To simulate the flow of water in a pipe for the symmetry conditions for three wedge angles - 10, 25 and 45.

Objectives : 1. To understand the symmetry boundary condition

2. Compare the Pressure gradient obtained through the Hagen poiseuliie's equation against the numerical results.

Theory :

Hagen Poiseullie's equation :

The Hagen–Poiseuille equation[1], also known as the Hagen–Poiseuille law, Poiseuille law or Poiseuille equation, gives the pressure drop in an incompressible and newtonian fluid in laminar flow flowing through a long cylindrical pipe of constant cross section.


Poiseuille's Equation describes the pressure drop due to the viscosity of the fluid :

Assumptions in the Hagen-Poiseulie Law :
1. The flow is Laminar
2. The fluid is an incompressible and newtonian fluid (a fluid that obeys Newton's law of
viscosity `tau = mu*((du)/dx)`)
3. There is no acceleration of the fluid in the pipe flow.

As per the Hagen Poiseullies equation the pressure drop in a pipe flow is given by the formula :

Pressure drop (`DeltaP`) = `(32*mu*L*V_(avg))/(d^2)`

Kinematic pressure drop (`Deltap`) = `(DeltaP)/(rho)`

The following parameters are used in the calculations :

Radius of the pipe (R) = 0.01 m

Reynolds number (Re) = 2100.

Fluid properties at 25 degree centigrade :

Density of water (`rho`) = 997 kg/m^3

Dynamic viscosity (`mu`) = 0.00089 N.s/m^2.

Calculation of entry length and total length of the pipe

Calculation of entrance length :
 
Entrance length (Le) = 0.06*Re*D
                     = 0.06*2100*0.02
                     = 2.52 m

This means the total length of the pipe for simulation should be greater than 2.52 m.

Say, the length of the pipe is 2.7 m. After 2.52 m the flow becomes fully developed and the velocity profile is parabolic.

Calculation of the pressure gradient as per the hagen Poiseullie's equation :

Pressure drop = 32*mu*L*V_avg/ d^2
              = 32*0.00089*0.18*0.1869/(0.02*0.02)
              = 2.39531 Pa
Kinematic pressure drop = Pressure drop/(density)
                        = (2.39531)/(1000)
                        = 0.002395 m

Generation of the Mesh using the blockMeshDict file :

clear; close; clc

d = 0.02;  % diameter of the pipe
r = d/2;
l = 2.7;
theta = input('Enter the wedge angle = ');
x = input('Enter the simple grading factor along X-axis:');
y = input('Enter the simple grading factor along Y-axis:');
z = input('Enter the simple grading factor along Z-axis:');

% A program to parse the data from the blockMeshDict file to another
% blockMeshDict file

fid = fopen('blockMeshDict.txt','w');

fprintf(fid,'/*--------------------------------*- \n');
fprintf(fid,'C++ -*----------------------------------*\ \n');
fprintf(fid,'  =========                 | \n');
fprintf(fid,'  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox \n');
fprintf(fid,'   \\    /   O peration     | Website:  https://openfoam.org \n');
fprintf(fid,'    \\  /    A nd           | Version:  7 \n');
fprintf(fid,'     \\/     M anipulation  | \n');
fprintf(fid,'\*-------------------------------------------------------------- \n');
fprintf(fid,'-------------*/ \n');
fprintf(fid,'FoamFile \n');
fprintf(fid,'{ \n');
fprintf(fid,'    version     2.0; \n');
fprintf(fid,'    format      ascii; \n');
fprintf(fid,'    class       dictionary; \n');
fprintf(fid,'    object      blockMeshDict; \n');
fprintf(fid,'} \n');
fprintf(fid,'// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n');
fprintf(fid,'* * * * * * // \n');
fprintf(fid,'convertToMeters 1; \n');
fprintf(fid,'\n');
fprintf(fid,'vertices \n');
fprintf(fid,'( \n');
fprintf(fid,'(%d %d %d)\n',0,0,0); %index 0
fprintf(fid,'(%d %d %d) \n', 0, r*cosd(theta/2), r*sind(theta/2)); %index 1
fprintf(fid,'(%d %d %d) \n', 0, r*cosd(theta/2), -r*sind(theta/2)); %index 2
fprintf(fid,'(%d %d %d) \n',l, 0 ,0); %index 3
fprintf(fid,'(%d %d %d) \n',l , r*cosd(theta/2), r*sind(theta/2)); % index 4
fprintf(fid,'(%d %d %d) \n', l, r*cosd(theta/2), -r*sind(theta/2)); % index 5
fprintf(fid,'); \n');

fprintf(fid,'blocks \n');
fprintf(fid,'( \n');
fprintf(fid,'hex (0 3 5 2 0 3 4 1) (600 40 1) simpleGrading (%d %d %d)\n',x,y,z');
fprintf(fid,');\n');
fprintf(fid,'edges \n');
fprintf(fid,'( \n');
fprintf(fid,'arc %d %d (%d %d %d)\n',1,2,0,r,0);
fprintf(fid,'arc %d %d (%d %d %d)\n',4,5,l,r,0);
fprintf(fid,'); \n');
fprintf(fid,'\n');

fprintf(fid,'boundary \n');
fprintf(fid,'( \n');

fprintf(fid,'inlet \n'); %Defining the inlet faces
fprintf(fid,'{ \n');
fprintf(fid,'type patch;\n');
fprintf(fid,'faces \n');
fprintf(fid,'( \n');
fprintf(fid,'(0 1 2 0)\n');
fprintf(fid,'); \n');
fprintf(fid,'}\n');

fprintf(fid,'outlet \n'); % Defining the outlet faces
fprintf(fid,'{ \n');
fprintf(fid,'type patch ;\n');
fprintf(fid,' faces \n');
fprintf(fid,'( \n');
fprintf(fid,'(3 4 5 3)\n');
fprintf(fid,'); \n');
fprintf(fid,'}\n');

fprintf(fid,'top\n'); %Defining the top wall
fprintf(fid,'{\n');
fprintf(fid,'type wall;\n');
fprintf(fid,'faces\n');
fprintf(fid,'( \n');
fprintf(fid,'(1 4 5 2)\n');
fprintf(fid,'); \n');
fprintf(fid,'} \n');

fprintf(fid,'back \n'); % Defining the back wall
fprintf(fid,'{\n');
fprintf(fid,'type wedge; \n');
fprintf(fid,'faces \n');
fprintf(fid,'( \n');
fprintf(fid,'(0 3 5 2)\n');
fprintf(fid,');\n');
fprintf(fid,'}\n');

fprintf(fid,'front \n'); %Defining the front wall
fprintf(fid,'{ \n');
fprintf(fid,'type wedge;\n');
fprintf(fid,'faces \n');
fprintf(fid,'( \n');
fprintf(fid,'(0 3 4 1)\n');
fprintf(fid,');\n');
fprintf(fid,'} \n');

fprintf(fid,'axis\n'); %Defining the axis line (symmetry line)
fprintf(fid,'{ \n');
fprintf(fid,'(');
fprintf(fid,'type empty;\n');
fprintf(fid,'( \n');
fprintf(fid,'(0 3 3 0)\n');
fprintf(fid,');\n');
fprintf(fid,'} \n');

fprintf(fid,'); \n'); % closing the boundary bracket

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

fprintf(fid,'//  \n');
fprintf(fid,'// ****************************************************************\n');
fprintf(fid,' // ********* // \n');


BlockMeshDict file for 10 degrees :

/*--------------------------------*- 
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 0.009961947 0.0008715574) 
(0 0.009961947 -0.0008715574) 
(2.700000e+00 0 0) 
(2.700000e+00 0.009961947 0.0008715574) 
(2.700000e+00 0.009961947 -0.0008715574)
); 
blocks 
( 
hex (0 3 5 2 0 3 4 1) (600 40 1) simpleGrading (1 0.1 1)
);
edges 
( 
arc 1 2 (0 1.000000e-02 0)
arc 4 5 (2.700000e+00 1.000000e-02 0)
); 

boundary 
( 
inlet 
{ 
type patch;
faces 
( 
(0 1 2 0)
); 
}
outlet 
{ 
type patch ;
 faces 
( 
(3 4 5 3)
); 
}
top
{
type wall;
faces
( 
(1 4 5 2)
); 
} 
back 
{
type symmetry; 
faces 
( 
(0 3 5 2)
);
}
front 
{ 
type symmetry;
faces 
( 
(0 3 4 1)
);
} 
axis
{ 
type empty;
faces
( 
(0 3 3 0)
);
} 
); 
mergePatchPairs 
( 
); 
//  
//****************************************************************
//********* // 

BlockMeshDict for 25 degrees :

/*--------------------------------*- 
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 0.00976296 0.00216439) 
(0 0.00976296 -0.00216439) 
(2.700000e+00 0 0) 
(2.700000e+00 0.00976296 0.00216439) 
(2.700000e+00 0.00976296 -0.00216439)
); 
blocks 
( 
hex (0 3 5 2 0 3 4 1) (600 40 1) simpleGrading (1 0.1 1)
);
edges 
( 
arc 1 2 (0 1.000000e-02 0)
arc 4 5 (2.700000e+00 1.000000e-02 0)
); 

boundary 
( 
inlet 
{ 
type patch;
faces 
( 
(0 1 2 0)
); 
}
outlet 
{ 
type patch ;
 faces 
( 
(3 4 5 3)
); 
}
top
{
type wall;
faces
( 
(1 4 5 2)
); 
} 
back 
{
type symmetry; 
faces 
( 
(0 3 5 2)
);
}
front 
{ 
type symmetry;
faces 
( 
(0 3 4 1)
);
} 
axis
{ 
type empty;
faces
( 
(0 3 3 0)
);
} 
); 
mergePatchPairs 
( 
); 
//  
//****************************************************************
//********* // 

BlockMeshDict file for 45 degrees:

/*--------------------------------*- 
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 0.00923879532 0.0038268343) 
(0 0.00923879532 -0.0038268343) 
(2.700000e+00 0 0) 
(2.700000e+00 0.00923879532 0.0038268343) 
(2.700000e+00 0.00923879532 -0.0038268343)
); 
blocks 
( 
hex (0 3 5 2 0 3 4 1) (600 40 1) simpleGrading (1 0.1 1)
);
edges 
( 
arc 1 2 (0 1.000000e-02 0)
arc 4 5 (2.700000e+00 1.000000e-02 0)
); 

boundary 
( 
inlet 
{ 
type patch;
faces 
( 
(0 1 2 0)
); 
}
outlet 
{ 
type patch ;
 faces 
( 
(3 4 5 3)
); 
}
top
{
type wall;
faces
( 
(1 4 5 2)
); 
} 
back 
{
type symmetry; 
faces 
( 
(0 3 5 2)
);
}
front 
{ 
type symmetry;
faces 
( 
(0 3 4 1)
);
} 
axis
{ 
type empty;
faces
( 
(0 3 3 0)
);
} 
); 
mergePatchPairs 
( 
); 
//  
//****************************************************************
//********* // 

Inlet conditions for the simulation :

1. Pressure :

/*--------------------------------*- 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
{
    top
    {
        type            zeroGradient;
    }

    front
    {
        type            symmetry;
    }
    
     back
    {
        type            symmetry;
    }
    bottomwall
    {
        type            empty;
    }
   inlet
    {
         type            zeroGradient;
        
        
    }
   outlet
    {
       type       	  fixedValue;
       value 	          uniform 0.01807;
    }
}

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

Velocity :

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

    front
    {
        type            symmetry;
    }
    back
    {
        type           symmetry;
    }
 bottomwall
    {
        type           empty;
    }
   top
    {
        type            noSlip;
    }
    outlet
    {
        type            zeroGradient;
       
    }
}

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

Results :

Velocity profiles :

1. Velocity profile for 10 degree wedge angle at x = 2.6 m:

2. Velocity profile for 25 degree wedge angle at x = 2.6 m :

3. Velocity profile for 45 degree wedge angle at x = 2.6 m

In all the three velocity profiles above, the curve is a parabola which is an indication that the flow is fully developed.

Shear stress profiles :

1. For 10 degree wedge angle at x = 2.6 m

2. for 25 degree wedge angle at x = 2.6 m

3. For 45 degree wedge angle at x = 2.6m

Tabulation of the calculated Pressure drop values :

Hagen Poiseullie

result

Wedge Symmetry - 10 degree angle Symmetry - 25 degree angle Symmetry - 45 degree angle
Pressure difference 0.00240 m 0.00236 0.002590 0.002686 0.0029618
Error in the value 0 % 1.666 % 7.91% 11.91% 23.4%

Analysis :

It can be analysed that the error in the value of the pressure difference increases as the value of the wedge angle increases. Also the symmetry condition is beneficial for simulation of geometry where the wedge angle is greater than 5 degrees.

Conclusion :

A simulation on the Pipeflow for different values of the wedge angle is performed and the obtained pressure difference values are compared against the value obtained from the Hagen Poiseullie equation.

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.