Challenge

Week 11 - Simulation of Flow through a pipe in OpenFoam

objectives- To simulate an axi-symmetric flow by applying the wedge boundary condition for laminar flow at inlet of the pipe. and to valdate the results using Hagen- Poiseuille's equations for the fully developed flow.

Theroy-

The layer in the fluid which is significant in viscous shearing is called boundary layer. At inlet of the pipe the thickness of the boundary layer increases from zero and reaches to the center of the pipe and fills the entire pipe.The distance from the point zero to the point where the boundary layer fills the entire pipe is known as Hydrodyanmic Entrance region. In this region the velocity profile develops and thus the flow is called the hydrodynamically developing flow. After this region, the velocity profile is fully developed and continues and remains unchanged.

parameters-

Diameter of pipe D=0.006M

r=0.003

Reynold's number = 2100

Dynamic Viscocity=8.90e-04(N-sec/m^2)

Density of water=1000( kg/m^3)

we assume theta of the wegde be 3degree.

The formula to calculate the HydroDynamic entrance length is

L=0.05*Re*D

L=0.05*2100*0.006=0.63 m

v=re*dynamic viscocity/(density*D)=0.3115 m

kinematic pressure p=32*dynamic viscocity*L*v/(1000*D^2)=0.1552416 N/m^2

next we will create the blockMesh Dict using matlab

L=1
theta=3
D=0.006
r=D/2
line1='/* --------------------------------------------------------------- C++  -----/'                                                   
line2='|= = = = =                      |                                                  line3='| \\  /    F ield               |    openFoam: The opensource CFD Toolbox               
line4='| \\  /     O  peration         |     Version:   4.0                                                                                                          line5'|  \\ /       A  nd              |       web:     www.openFoam.org                                                                                    
line6=|  \\ /       M  anipulation     |                            
line7='\*-------------------------------------------------------------------------------            

f1=fopen('blockMeshDict'  , 'w')
fprintf(f1,'%s\n', line1)
 fprintf(f1,'%s\n', line2)
 fprintf(f1,'%s\n', line3)
fprintf(f1,'%s\n', line4)
 fprintf(f1,'%s\n', line5)
fprintf(f1,'%s\n', line6)
fprintf(f1,'%s\n', line7)
fprintf(f1 ,'FoamFile\n{\n')
 fprintf(f1, '%12s  \t  2.0; \n' ,'version')
fprintf(f1, '%12s  \t  ascii; \n' ,'format')
fprintf(f1, '%12s  \t  dictionary; \n' ,'class')
fprintf(f1, '%12s  \t  blockMeshDict; \n' ,'object')
fprintf(f1, '}\n')
header8 ='// * * * * * * ****//'
fprintf(f1,'%s\n\n',header8)
fprintf(f1, 'convertToMeters   1 ;\n\n')
fprintf(f1 , 'vertices\n')
fprintf(f1,'(\n')
fprintf(f1, '\t   (%d %d %d)\n', 0 ,0,0) 
fprintf(f1, '\t   (%d %d %d)\n', 0 ,r*cosd(theta/2),sind(theta/2))
fprintf(f1, '\t   (%d %d %d)\n', 0 ,r*cosd(theta/2),-sind(theta/2))
fprintf(f1, '\t   (%d %d %d)\n', L,0,0)
fprintf(f1, '\t   (%d %d %d)\n', L ,r*cosd(theta/2),sind(theta/2))
fprintf(f1, '/t   (%d %d %d)\n', L ,r*cosd(theta/2),-sind(theta/2))
fprintf(f1, '); \n\n')
fprintf(f1,' blocks\n')
fprintf(f1,' (\n')
fprintf(f1, '\t hex  (0 3 5 2 0 3 4 1) (%d %d %d)',300,30,1)
fprintf(f1,' SimpleGrading  (1  0.1  1)\n\n')
fprintf(f1,');\n')
fprintf(f1, 'edges\n(\n\tarc %d %d  (%d %d %d)\n',1,2,0 ,r,0)



fprintf(f1, '\tarc %d %d  (%d %d %d)\n',4,5,L ,r,0)
fprintf(f1, ');\n\n')
fprintf(f1, 'boundary\n')
fprintf(f1,'(\n')
fprintf(f1, '\t  inlet   \n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t  type  patch  ;\n')
fprintf(f1, '\t \t faces\n')
fprintf(f1,'\t\t  (\n')
fprintf(f1, ' \t \t \t (0 1 2 0)\n')
fprintf(f1,'\t\t   );\n')
fprintf(f1,  '\t  }\n')
fprintf(f1, '\t  outlet   \n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t  type  patch  ;\n')
fprintf(f1, '\t \t faces\n')
fprintf(f1,'\t\t  (\n')
fprintf(f1, ' \t \t \t (3 5 4 3)\n')
fprintf(f1,'\t\t   );\n')
fprintf(f1,  '\t  }\n')
fprintf(f1, '\t  top   \n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t  type  wall  ;\n')
fprintf(f1, '\t \t faces\n')
fprintf(f1,'\t\t  (\n')
fprintf(f1, ' \t \t \t (1 4 5 2)\n')
fprintf(f1,'\t\t   );\n')
fprintf(f1,  '\t  }\n')
fprintf(f1, '\t  back \n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t  type  wedge ;\n')
fprintf(f1, '\t \t faces\n')
fprintf(f1,'\t\t  (\n')
fprintf(f1, ' \t \t \t (0 2 5 3)\n')
fprintf(f1,'\t\t   );\n')
fprintf(f1,  '\t  }\n')
fprintf(f1, '\t  front \n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t  type  wedge ;\n')
fprintf(f1, '\t \t faces\n')
fprintf(f1,'\t\t  (\n')
fprintf(f1, ' \t \t \t (0 3 4 1)\n')
fprintf(f1,'\t\t   );\n')
fprintf(f1,  '\t  }\n')

fprintf(f1, '\t  axist \n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t  type  empty ;\n')
fprintf(f1, '\t \t faces\n')
fprintf(f1,'\t\t  (\n')
fprintf(f1, ' \t \t \t (0 3 3 0)\n')
fprintf(f1,'\t\t   );\n')
fprintf(f1,  '\t  }\n')
fprintf(f1,');\n')
fprintf(f1,'mergePatchPairs\n(\n')
fprintf(f1, ');\n')
fprintf(f1, '%s\n',header8)
fclose(f1)

blockmeshDict

/*--------------------------------*- 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 2.998972e-03 2.617695e-02)
	   (0 2.998972e-03 -2.617695e-02)
	   (1 0 0)
	   (1 2.998972e-03 2.617695e-02)
   (1 2.998972e-03 -2.617695e-02)
); 

 blocks
 (
	 hex  (0 3 5 2 0 3 4 1) (300 30 1) SimpleGrading  (1  0.1  1)

);
edges
(
	arc 1 2  (0 3.000000e-03 0)
	arc 4 5  (1 3.000000e-03 0)
);

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)
		   );
	  }
	  back 
	 {
		  type  wedge ;
	 	 faces
		  (
 	 	 	 (0 2 5 3)
		   );
	  }
	  front 
	 {
		  type  wedge ;
	 	 faces
		  (
 	 	 	 (0 3 4 1)
		   );
	  }
	  axis 
	 {
		  type  empty ;
	 	 faces
		  (
 	 	 	 (0 3 3 0)
		   );
	  }
	  );
mergePatchPairs
(
);
// * * * * * * ****//

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 0.1552516;
    }

    top
    {
        type            zeroGradient;
        
    }
    back
    {
        type            wedge;
        
    }
    front
    {
        type            wedge;
        
    }
     axis
    {
        type            empty;
        
    }
}

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

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 0 0);

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform (0.3115 0 0);
    }

    outlet
    {
        type            zeroGradient;
    }

   top
    {
        type            noSlip;
    }
    back
    {
        type            wedge;
    }
     front
    {
        type            wedge;
    }
     axis
    {
        type            empty;
    }
}

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

controlDict file

/*--------------------------------*- 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         6;

deltaT          1e-3;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

we have results for velocity at distance 0.01m

as we see that from the graph due to significant of the shear stress at inlet of the pipe the thickness of the boundary is very low hence there is no much variation of the velocity at the inlet.

we have velocity for 0.65 m as

as we can see that th boundary layer thickness fills entire pipe at lengthof 0.63 m which is hydroDynamic length from hydrodynamic length there is no change in the velocity which is called fully developed layer for which we have parabollic curve for the velocity foir laminar flow for fullydeveloped hence we have fully developed layer after 0.63m.

as we can see that there is preesure dro throught the pipe.

sdr

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.