Challenge

Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation

DESCRIPTION:

In this project,we aim to simulate a section of the pipe, to understand the fluid flow through the pipe. The fluid chosen has to be laminar and incompressible.

Fluid velocity in a pipe changes from zero at the surface because of the no-slip boundary conditionximum at the pipe center.

The average velocity constant in an incompressible flow when the cross-section of the pipe is constant.

Hydrodynamic Length:

The region from the inlet (pipe) to the point at which the velocity boundary layer merges at the centreline is called the hydrodynamic entrance region in which the velocity profile is fully developed is called the fully developed region.

SPECIFICATIONS AND DIMENSIONS:

Diameter of the pipe=0.0001m

Reynods number=2100

Le=12.6m (Assuming Le=15)

Density=0.01kg/m^3

Formula for average velocity moving through the pipe

Vavg=2100*8.9*10^-7/0.01

=0.1869 m/s

Using haigen poisulles equation,

△P=32*8.4*10^-4*1.5*0.1869/0.01^2

=0.0789 m^2/s

MATLAB PROGRAMME FOR BLOCKMESH FILE:

clear all
close all
clc

%inputs
Re=2100;
D=0.02;
r=D/2;
theta=input('enter the wedge angle:');
mu=0.89e-3;
rho=997;
nu=mu/rho;

%computing analytical pressure and the velocity
%entrance length
Le=0.06*Re*D;
%total length
l=Le+0.3;
%average velocity
vavg=(Re*mu)/(rho*D);
%max velocity
vmax=2*vavg;
%drop in pressure
delP=(32*mu*vavg*l)/(D^2);
%kinematic pressure
Kp=delP/rho;

%finding the 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=[l 0 0];
v4=[l r*cosd(theta/2) -r*sind(theta/2)];
v5=[l r*cosd(theta/2) r*sind(theta/2)];

%creating the blockMesh file
f1=fopen('blockMeshDict.txt','w');

fprintf(f1,'%s\n','/*--------------------------------*- C++ -*----------------------------------*\');
fprintf(f1,'%s\n','  =========                 |');
fprintf(f1,'%s\n','  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox');
fprintf(f1,'%s\n','   \\    /   O peration     | Website:  https://openfoam.org');
fprintf(f1,'%s\n','    \\  /    A nd           | Version:  7');
fprintf(f1,'%s\n','     \\/     M anipulation  |');
fprintf(f1,'%s\n','\*---------------------------------------------------------------------------*/');
fprintf(f1,'%s\n','FoamFile');
fprintf(f1,'%s\n','{');
fprintf(f1,'%s\n','    version     2.0;');
fprintf(f1,'%s\n','    format      ascii;');
fprintf(f1,'%s\n','    class       dictionary;');
fprintf(f1,'%s\n','    object      blockMeshDict;');
fprintf(f1,'%s\n','}');
fprintf(f1,'%s\n','// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //');
fprintf(f1,'%s\n','');
fprintf(f1,'%s\n','convertToMeters 1;');

b1=blanks(5);
b2=blanks(8);
b3=blanks(6);
b4=blanks(4);
b10=blanks(10);

%finding veretices
fprintf(f1,'%s\n','vertices');
fprintf(f1,'%s\n','(');
fprintf(f1,b4,'%s\n','');
v_0=fprintf(f1,'(%f %f %f)\n',v0(1),v0(2),v0(3));
fprintf(f1,b4,'%s\n','');
v_1=fprintf(f1,'(%f %f %f)\n',v1(1),v1(2),v1(3));
fprintf(f1,b4,'%s\n','');
v_2=fprintf(f1,'(%f %f %f)\n',v2(1),v2(2),v2(3));
fprintf(f1,b4,'%s\n','');
v_3=fprintf(f1,'(%f %f %f)\n',v3(1),v3(2),v3(3));
fprintf(f1,b4,'%s\n','');
v_4=fprintf(f1,'(%f %f %f)\n',v4(1),v4(2),v4(3));
fprintf(f1,b4,'%s\n','');
v_5=fprintf(f1,'(%f %f %f)\n',v5(1),v5(2),v5(3));
fprintf(f1,'%s\n',')');

%creating the blocks
fprintf(f1,'%s','');
fprintf(f1,'%s\n','blocks');
fprintf(f1,'%s\n','(');
fprintf(f1,'%s\n','	hex (0 3 4 1 0 3 5 2) (200 50 1) simpleGrading (1 1 1)');
fprintf(f1,'%s\n',');');
fprintf(f1,'%s\n','edges');
fprintf(f1,'%s\n','	(');
fprintf(f1,'%s\n','		 arc 1 2 (0 1.270000e-02 0)');
fprintf(f1,'%s\n','		 arc 4 5 (3.500400e+00 1.270000e-02 0)');
fprintf(f1,'%s\n','	);');
fprintf(f1,'%s\n','boundary');
fprintf(f1,'%s\n','(');
fprintf(f1,'%s\n','	inlet');
fprintf(f1,'%s\n','	{');
fprintf(f1,'%s\n','		type patch;');
fprintf(f1,'%s\n','		faces');
fprintf(f1,'%s\n','		(');
fprintf(f1,'%s\n','			(0 2 1 0)');
fprintf(f1,'%s\n','		);');
fprintf(f1,'%s\n','	}');
fprintf(f1,'%s\n','	outlet');
fprintf(f1,'%s\n','	{');
fprintf(f1,'%s\n','		type patch;');
fprintf(f1,'%s\n','		faces');
fprintf(f1,'%s\n','		(');
fprintf(f1,'%s\n','			(3 4 5 3)');
fprintf(f1,'%s\n','		);');
fprintf(f1,'%s\n','	}');
fprintf(f1,'%s\n','	front');
fprintf(f1,'%s\n','	{');
fprintf(f1,'%s\n','		type symmetry;');
fprintf(f1,'%s\n','		faces');
fprintf(f1,'%s\n','		(');
fprintf(f1,'%s\n','			(0 3 5 2)');
fprintf(f1,'%s\n','		);');
fprintf(f1,'%s\n','	}');
fprintf(f1,'%s\n','	back');
fprintf(f1,'%s\n','	{');
fprintf(f1,'%s\n','		type symmetry;');
fprintf(f1,'%s\n','		faces');
fprintf(f1,'%s\n','		(');
fprintf(f1,'%s\n','			(0 1 4 3)');
fprintf(f1,'%s\n','		);');
fprintf(f1,'%s\n','	}');
fprintf(f1,'%s\n','	wall');
fprintf(f1,'%s\n','	{');
fprintf(f1,'%s\n','		type wall;');
fprintf(f1,'%s\n','		faces');
fprintf(f1,'%s\n','		(');
fprintf(f1,'%s\n','			(1 2 5 4)');
fprintf(f1,'%s\n','		);');
fprintf(f1,'%s\n','	}');
fprintf(f1,'%s\n','	axis');
fprintf(f1,'%s\n','	{');
fprintf(f1,'%s\n','		type empty;');
fprintf(f1,'%s\n','		faces');
fprintf(f1,'%s\n','		(');
fprintf(f1,'%s\n','			(0 3 3 0)');
fprintf(f1,'%s\n','		);');
fprintf(f1,'%s\n','	}');
fprintf(f1,'%s\n',');');
fprintf(f1,'%s\n','');
fprintf(f1,'%s\n','mergePatchPairs');
fprintf(f1,'%s\n','(');
fprintf(f1,'%s\n',');');
fprintf(f1,'%s\n','// ************************************************************************* //');

Using the matlab code we enter the wedge angle for:

  • 10 deg
  • 25 deg
  • 45 deg

BlockMeshDict for 10 deg:

/*--------------------------------*- 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.000000 0.000000 0.000000)
    (0.000000 0.009962 -0.000872)
    (0.000000 0.009962 0.000872)
    (2.820000 0.000000 0.000000)
    (2.820000 0.009962 -0.000872)
    (2.820000 0.009962 0.000872)
)
blocks
(
	hex (0 3 4 1 0 3 5 2) (1 20 100) simpleGrading (1 0.4 1)
);
edges
	(
		 arc 1 2 (0 1.270000e-02 0)
		 arc 4 5 (3.500400e+00 1.270000e-02 0)
	);
boundary
(
	inlet
	{
		type patch;
		faces
		(
			(0 2 1 0)
		);
	}
	outlet
	{
		type patch;
		faces
		(
			(3 4 5 3)
		);
	}
	front
	{
		type symmetry;
		faces
		(
			(0 3 5 2)
		);
	}
	back
	{
		type symmetry;
		faces
		(
			(0 1 4 3)
		);
	}
	wall
	{
		type wall;
		faces
		(
			(1 2 5 4)
		);
	}
	axis
	{
		type empty;
		faces
		(
			(0 3 3 0)
		);
	}
);

mergePatchPairs
(
);
// ************************************************************************* //

Transport Properties:

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

nu              [0 2 -1 0 0 0 0] 8.7e04;


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

Velocity:

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 (1e-100 0 0);

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform (3e-100 0 0);
    }

    outlet
    {
        type            zeroGradient;
    }
    
    front
    {
        type            symmetry;
    }
    
    back
    {
        type            symmetry;
    }
    
    wall
    {
        type            noSlip;
    }
    
    axis
    {
        type            empty;
    }
}

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

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


    
    front
    {
        type            symmetry;
    }
    
    back
    {
        type            symmetry;
    }
    
    wall
    {
        type            zeroGradient;
    }
    
    axis
    {
        type            empty;
    }
}

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

Similarly for 25 deg the blockMeshDict file will be:

/*--------------------------------*- 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.000000 0.000000 0.000000)
    (0.000000 0.009763 -0.002164)
    (0.000000 0.009763 0.002164)
    (2.820000 0.000000 0.000000)
    (2.820000 0.009763 -0.002164)
    (2.820000 0.009763 0.002164)
)
blocks
(
	hex (0 3 4 1 0 3 5 2) (1 20 100) simpleGrading (1 0.4 1)
);
edges
	(
		 arc 1 2 (0 1.270000e-02 0)
		 arc 4 5 (3.500400e+00 1.270000e-02 0)
	);
boundary
(
	inlet
	{
		type patch;
		faces
		(
			(0 2 1 0)
		);
	}
	outlet
	{
		type patch;
		faces
		(
			(3 4 5 3)
		);
	}
	front
	{
		type symmetry;
		faces
		(
			(0 3 5 2)
		);
	}
	back
	{
		type symmetry;
		faces
		(
			(0 1 4 3)
		);
	}
	wall
	{
		type wall;
		faces
		(
			(1 2 5 4)
		);
	}
	axis
	{
		type empty;
		faces
		(
			(0 3 3 0)
		);
	}
);

mergePatchPairs
(
);
// ************************************************************************* //

and 45 deg will be:

/*--------------------------------*- 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.000000 0.000000 0.000000)
    (0.000000 0.009239 -0.003827)
    (0.000000 0.009239 0.003827)
    (2.820000 0.000000 0.000000)
    (2.820000 0.009239 -0.003827)
    (2.820000 0.009239 0.003827)
)
blocks
(
	hex (0 3 4 1 0 3 5 2) (1 20 100) simpleGrading (1 0.4 1)
);
edges
	(
		 arc 1 2 (0 1.270000e-02 0)
		 arc 4 5 (3.500400e+00 1.270000e-02 0)
	);
boundary
(
	inlet
	{
		type patch;
		faces
		(
			(0 2 1 0)
		);
	}
	outlet
	{
		type patch;
		faces
		(
			(3 4 5 3)
		);
	}
	front
	{
		type symmetry;
		faces
		(
			(0 3 5 2)
		);
	}
	back
	{
		type symmetry;
		faces
		(
			(0 1 4 3)
		);
	}
	wall
	{
		type wall;
		faces
		(
			(1 2 5 4)
		);
	}
	axis
	{
		type empty;
		faces
		(
			(0 3 3 0)
		);
	}
);

mergePatchPairs
(
);
// ************************************************************************* //

OUTPUT:

for 10 deg wedge angle:

Velocity :

Pressure:

Velocity curve(Y axis):

Pressure curve:

shear stress:

For 45 deg:

Velocity:

Pressure:

Velocity curve(y axis):

Pressure curve (Y axis):

Shear stress curve:

For 25 deg:

Mesh file:

Velocity:

Pressure:

Velocity curve( y axis):

Pressure curve:

Shear Stress curve:

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.