Project

Symmetry vs Wedge vs HP equation

AIM: To write a program in Matlab that can generate the computational mesh automatically for any symmetry angle and grading schemes

THEORY:

Hydrodynamic Entrance Length

Many different entrance lengths exist to describe a variety of flow conditions.The Entrance length refers to the length of the entry region where effects from the pipe interior wall spread as an expanding boundary layer in to the flow. The Entrance length describes the distance travelled by the flow after entering the pipe before the flow becomes fully developed.

Hydrodynamic entrance length describes the formation of a velocity profile caused by viscous forces propagating from the pipe wall. Awareness of entrance length may be necessary for the effective placement of instrumentation, such as fluid flow meters. . After the flow becomes fully developed the flow characterstics no longer changes with the increased distance along the length of the pipe. Entrance length for the laminar flow is given as below

Entrance length = Le = 0.06 x Re x D

DATA:

Reynold\'s Number(Re) = 2100

Diameter of the pipe(D) = 0.02m

Radius of the pipe(R) - D/2 = 0.01m

Density(ρρ) = 997 kg/m^3

Kinematic Viscocity(νν) = 0.00089 N/m^2

Hagen-Poisselus Equation

Poiseuille equation, is a physical law that 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

blockMeshDict(For 10 degree)

/*--------------------------------*- 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) 	                    //1
    (0 9.9619e-03 8.7155e-04)       //2
    (0 9.9619e-03 -8.7155e-04)      //3	
    (2.82 0 0) 	                    //4
    (2.82 9.9619e-03 8.7155e-04)    //5
    (2.82 9.9619e-03 -8.7155e-04)   //6   
);

blocks
(
    hex (0 3 5 2 0 3 4 1) (500 25 1) simpleGrading (1 0.2 1) 
    
);

edges
(
        arc 1 2 (0 1e-02 0)
        arc 4 5 (2.82 1e-02 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)
    );
}
front
{
 type symmetry;
 faces
    (
         (0 3 4 1)
    );
}
back
{
 type symmetry;
 faces
    (
         (0 2 5 3)
    );
}
axis
{
 type empty;
 faces
    (
         (0 3 3 0)
    );
   }
);
mergePatchPairs
(
);

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

blockMeshDict(For 25 degree)

/*--------------------------------*- 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) 	                    //1
    (0 9.7629e-03 2.1643e-03)       //2
    (0 9.7629e-03 -2.1643e-03)      //3	
    (2.82 0 0) 	                    //4
    (2.82 9.7629e-03 2.1643e-03)    //5
    (2.82 9.7629e-03 -2.1643e-03)   //6   
);

blocks
(
    hex (0 3 5 2 0 3 4 1) (500 25 1) simpleGrading (1 0.2 1) 
    
);

edges
(
        arc 1 2 (0 1e-02 0)
        arc 4 5 (2.82 1e-02 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)
    );
}
front
{
 type symmetry;
 faces
    (
         (0 3 4 1)
    );
}
back
{
 type symmetry;
 faces
    (
         (0 2 5 3)
    );
}
axis
{
 type empty;
 faces
    (
         (0 3 3 0)
    );
   }
);
mergePatchPairs
(
);

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

blockMeshDict (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) 	                    //1
    (0 9.2387e-03 3.8268e-03)       //2
    (0 9.2387e-03 -3.8268e-03)      //3	
    (2.82 0 0) 	                    //4
    (2.82 9.2387e-03 3.8268e-03)    //5
    (2.82 9.2387e-03 -3.8268e-03)   //6   
);

blocks
(
    hex (0 3 5 2 0 3 4 1) (500 25 1) simpleGrading (1 0.2 1) 
    
);

edges
(
        arc 1 2 (0 1e-02 0)
        arc 4 5 (2.82 1e-02 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)
    );
}
front
{
 type symmetry;
 faces
    (
         (0 3 4 1)
    );
}
back
{
 type symmetry;
 faces
    (
         (0 2 5 3)
    );
}
axis
{
 type empty;
 faces
    (
         (0 3 3 0)
    );
   }
);
mergePatchPairs
(
);

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

ControlDict

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

deltaT          1e-2;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

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
{
    inlet
    {
        type            zeroGradient;
    }

    outlet
    {
        type            fixedValue;
        value           uniform 0;
    }

    axis
    {
        type            empty; 
    }

    top
    {
        type            zeroGradient;
    }  

    front
    {
        type            symmetry;
    }

    back
    {
        type            symmetry;
    } 
}

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

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

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

    outlet
    {
        type            zeroGradient;
    }

    axis
    {
        type            empty;
    }

    top
    {
        type            noSlip;  
    }

    front
    {
        type            symmetry;
    }

    back
    {
        type            symmetry;
    }
}


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

Transport Properties

/*--------------------------------*- 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    \"constant\";
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

nu              [0 2 -1 0 0 0 0] 8.9256e-07;


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

Matlab Code

clear all 
close all 
clc

% Reynolds Number
Re = 2100
% Diameter of Pipe 
D = 0.02
% Entry length of Pipe 
L = 0.06*Re*D
% Total length of pipe 
L_p = L + 0.3
% Radius of pipe 
r = D/2
% Angle of wedge 
theta = 10
%theta = 25
%theta = 45
% Dynamic Viscocity
mu = 0.89e-3
% Density
rho = 997

% Hagen Poissuel flow equation 
v_avg = (Re*mu)/(rho*D)
v_max = 2*(v_avg)
del_p = (8*mu*L_p*v_avg)/(r^2)
kinematic_p = del_p/rho

% calculating shear stress 
R = linspace(0,(D/2),1000)


for i = 1:length(R)
tau(i) = 2*mu*v_max*(abs(R(i)))/r^2

end


plot(R,tau)
xlabel(\'Radius\')
ylabel(\'Shear stress\')

grid on 
legend(\'Shear stress\')

header1=\'/*--------------------------------*- C++ -*----------------------------------*\\\'
header2=\' =========                 |                                                 \'
header3=\' \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           \'
header4=\'  \\\\    /   O peration     | Website:  https://openfoam.org                  \'
header5=\'   \\\\  /    A nd           | Version:  7                                     \'
header6=\'     \\\\/     M anipulation  |                                                \'
header7=\'\\*---------------------------------------------------------------------------*/\'

f1 = fopen(\'blockMeshDict\',\'w\')
fprintf(f1, \'%s\\n\', header1)
fprintf(f1, \'%s\\n\', header2)
fprintf(f1, \'%s\\n\', header3)
fprintf(f1, \'%s\\n\', header4)
fprintf(f1, \'%s\\n\', header5)
fprintf(f1, \'%s\\n\', header6)
fprintf(f1, \'%s\\n\', header7)

fprintf(f1, \'FoamFile\\n{\\n\')
fprintf(f1, \'%s \\t 2.0;\\n\',\'version\')
fprintf(f1, \'%s \\t ascii;\\n\',\'format\')
fprintf(f1, \'%s \\t dictionary;\\n\',\'class\')
fprintf(f1, \'%s \\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),r*sind(theta/2))
fprintf(f1, \'\\t (%d %d %d)\\n\',0,r*cosd(theta/2),-r*sind(theta/2))
fprintf(f1, \'\\t (%d %d %d)\\n\',L_p,0,0)
fprintf(f1, \'\\t (%d %d %d)\\n\',L_p,r*cosd(theta/2),r*sind(theta/2))
fprintf(f1, \'\\t (%d %d %d)\\n\',L_p,r*cosd(theta/2),-r*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)\',500,25,1)
fprintf(f1, \' SimpleGrading (1 0.2 1)\\n\\n\')
fprintf(f1, \');\\n\\n\')


fprintf(f1,\'edges\\n\')
fprintf(f1, \'(\\n\')
fprintf(f1, \'\\t arc %d %d (%d %d %d)\\n\',1,2,0,r,0)
fprintf(f1, \'\\t arc %d %d (%d %d %d)\\n\',4,5,L_p,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 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 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 axis\\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\\n\')


fprintf(f1, \'mergePatchParis\\n\')
fprintf(f1, \'(\\n\')
fprintf(f1, \');\\n\')
header9 =\'//  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //\'

fprintf(f1, \'%s\\n\',header9)

fclose(f1)

Geometry for the wedge angle 10 degree

Mesh for the wedge angle 10 degree

Geometry for the wedge angle 25 degree

Mesh for the wedge angle 25 degree

Geometry for the wedge angle 45 degree

Mesh for the wedge angle 45 degree

Grapical Representation(velocity profiles)

The below plots are plotted for wedge angle 45 degree

Velocity profile at the inlet of the pipe

Velocity profile at 0.1m from the inlet of the pipe

Velocity profile at 0.3m from the inlet of the pipe

Velocity profile at 0.5m from the inlet of the pipe

Velocity profile at 1m from the inlet of the pipe

Velocity profile at 1.5m from the inlet of the pipe

Velocity profile at 2m from the inlet of the pipe

Velocity profile at 2.5m from the inlet of the pipe

Velocity profile at 2.82m from the inlet of the pipe

The below plot is plotted for wedge angle 25 degree

Velocity profile at 2.82m from the inlet of the pipe

The below plot is plotted for wedge angle 10 degree

Velocity profile at 2.82m from the inlet of the pipe

Shear Stress Graph

TABULATION:

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.