Challenge

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

Objective: simulation of flow through pipe.

  1. To validate hydro-dynamic length with the numerical result.
  2. To validate the fully developed flow velocity profile with its analytical profile.
  3. To validate maximum velocity and pressure drop for fully developed flow.
  4. To post process shear stress and validate wall shear stress for fully developed flow.
  5. To highlight the difference in both boundary condition in terms of their usage and application.

MATLAB code to create blockMeshDict file

clear all
close all
clc
% input variables
d = 0.02;%pipe diameter
r = d/2;%pipe radius
theta = input('enter the wedge angle ');%wedge angle
Re = 2100;%reynolds number
rho = 997;%density of water
mu = 0.00089;%dynamic viscosity of water at 20 degree celcius in SI unit
nu = mu/rho; %kinematic viscosity of water at 20 degree celcius in SI unit
%%
%analyical calculation of velocity, pressure ad entrance length
L_h = 0.06*Re*d;%hydrodynamic length of pipe
L = L_h+1;%assumed length of pipe
v_avg = (Re*mu)/(rho*d);%velocity of water at inlet
v_max = 2*v_avg;%maximm velocity of water at centre
delta_p = (32*mu*v_avg)/d^2;%pressure drop
kin_P = delta_p/rho;%kinematic pressure
t = L/v_avg;%time
tau_max = (2*mu*v_max*r)/(r^2);%maximum shear stress

%%
% script to form blockMeshDict 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     | Version:  v2012                                 |')
fprintf(f1,'%s\n','|   \\  /    A nd           | Website:  www.openfoam.com                      |')
fprintf(f1,'%s\n','|    \\/     M anipulation  |                                                 |')
fprintf(f1,'%s\n','\*---------------------------------------------------------------------------*/')
fprintf(f1,'%s\n%c\n','FoamFile','{')
fprintf(f1,'%12s \t %0.1f%c\n','version',2,';')
fprintf(f1,'%11s \t %s\n','format','ascii;')
fprintf(f1,'%10s \t     %s\n','class','dictionary;')
fprintf(f1,'%11s \t %s\n%c\n','object','blockMeshDict;','}')
fprintf(f1,'%s\n','// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //')
fprintf(f1,'%s \t%i;\n', 'convertToMeters',1)
%vertices
fprintf(f1,'%s\n','vertices')
fprintf(f1,'(\n')
fprintf(f1,'\t\t\t(%d %d %d)',0,0,0)
fprintf(f1,'// %s %d %s//\n','at',theta,'degree')
fprintf(f1,'\t\t\t(%d %d %d)\n',r*cosd(theta/2),r*sind(theta/2),0)
fprintf(f1,'\t\t\t(%d %d %d)\n',r*cosd(theta/2),r*sind(theta/2),L)
fprintf(f1,'\t\t\t(%d %d %d)\n',0,0,L)
fprintf(f1,'\t\t\t(%d %d %d)\n',r*cosd(theta/2),-r*sind(theta/2),0)
fprintf(f1,'\t\t\t(%d %d %d)\n',r*cosd(theta/2),-r*sind(theta/2),L)
fprintf(f1,'%s\n',');')
%to create block
fprintf(f1,'%s\n','blocks')
fprintf(f1,'(\n')
%to create mesh
fprintf(f1,'%11s %c%i %i %i %i %i %i %i %i%c %c%i %i %i%c %s %c%i %i %i%c\n','hex','(',0,4,1,0,3,5,2,3,')','(',50,1,300,')','simpleGrading','(',0.2,1,1,')')

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

%to create edges
fprintf(f1,'%s\n','edges')
fprintf(f1,'%c\n\t%s %i %i %c%d %d %d%c','(','arc',1,4,'(',r,0,0,')')
fprintf(f1,'\n\t%s %i %i %c%d %d %d%c','arc',2,5,'(',r,0,L,')')
 fprintf(f1,'\n%s\n',');')
 
 %to apply boundary conditions
fprintf(f1,'%s\n%c\n\t%s\n','boundary','(','front')
fprintf(f1,'\t\t%c\n','{')
fprintf(f1,'\t\t%s;\n','type symmetry')
fprintf(f1,'\t\t%s\n','faces')
fprintf(f1,'\t\t\t%c\n','(')
fprintf(f1,'\t\t\t\t%c%i %i %i %i%c\n%\t\t\t\n','(',0,4,5,3,')')
fprintf(f1,'\t\t\t%c%c\n',')',';')
fprintf(f1,'\t\t%c\n','}')
fprintf(f1,'\t%s\n','back')
fprintf(f1,'\t\t%c\n','{')
fprintf(f1,'\t\t%s;\n','type symmetry')
fprintf(f1,'\t\t%s\n','faces')
fprintf(f1,'\t\t\t%c\n','(')
fprintf(f1,'\t\t\t\t%c%i %i %i %i%c\n%\t\t\t\n','(',0,3,2,1,')')
fprintf(f1,'\t\t\t%c%c\n',')',';')
fprintf(f1,'\t\t%c\n','}')
fprintf(f1,'\t%s\n','fixedwall')
fprintf(f1,'\t\t%c\n','{')
fprintf(f1,'\t\t%s;\n','type wall')
fprintf(f1,'\t\t%s\n','faces')
fprintf(f1,'\t\t\t%c\n','(')
fprintf(f1,'\t\t\t\t%c%i %i %i %i%c\n%\t\t\t\n','(',1,2,5,4,')')
fprintf(f1,'\t\t\t%c%c\n',')',';')
fprintf(f1,'\t\t%c\n','}')
fprintf(f1,'\t%s\n','inlet')
fprintf(f1,'\t\t%c\n','{')
fprintf(f1,'\t\t%s;\n','type patch')
fprintf(f1,'\t\t%s\n','faces')
fprintf(f1,'\t\t\t%c\n','(')
fprintf(f1,'\t\t\t\t%c%i %i %i %i%c\n%\t\t\t\n','(',0,1,4,0,')')
fprintf(f1,'\t\t\t%c%c\n',')',';')
fprintf(f1,'\t\t%c\n','}')
fprintf(f1,'\t%s\n','outlet')
fprintf(f1,'\t\t%c\n','{')
fprintf(f1,'\t\t%s;\n','type patch')
fprintf(f1,'\t\t%s\n','faces')
fprintf(f1,'\t\t\t%c\n','(')
fprintf(f1,'\t\t\t\t%c%i %i %i %i%c\n%\t\t\t\n','(',3,5,2,3,')')
fprintf(f1,'\t\t\t%c%c\n',')',';')
fprintf(f1,'\t\t%c\n','}')
fprintf(f1,'\t%s\n','axis')
fprintf(f1,'\t\t%c\n','{')
fprintf(f1,'\t\t%s;\n','type empty')
fprintf(f1,'\t\t%s\n','faces')
fprintf(f1,'\t\t\t%c\n','(')
fprintf(f1,'\t\t\t\t%c%i %i %i %i%c\n%\t\t\t\n','(',0,3,3,0,')')
fprintf(f1,'\t\t\t%c%c\n',')',';')
fprintf(f1,'\t\t%c\n','}')
fprintf(f1,'%c%c\n',')',';')
fprintf(f1,'%s\n','mergepatchpairs')
fprintf(f1,'%c\n','(')
fprintf(f1,'%c%c\n',')',';')
fclose(f1)

blockMeshDict files

For `10^o` angle

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2012                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
     version 	 2.0;
     format 	 ascii;
     class 	 dictionary;
     object 	 blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 	1;
vertices
(
			(0 0 0) //at 10 degree//
			(9.990482e-03 4.361939e-04 0)
			(9.990482e-03 4.361939e-04 3.520000e+00)
			(0 0 3.520000e+00)
			(9.990482e-03 -4.361939e-04 0)
			(9.990482e-03 -4.361939e-04 3.520000e+00)
);
blocks
(
        hex (0 4 1 0 3 5 2 3) (50 1 300) simpleGrading (2.000000e-01 1 1)
);

edges
(
	arc 1 4 (1.000000e-02 0 0)
	arc 2 5 (1.000000e-02 0 3.520000e+00)
);
boundary
(
	front
		{
		type symmetry;
		faces
			(
				(0 4 5 3)
			);
		}
	back
		{
		type symmetry;
		faces
			(
				(0 3 2 1)
			);
		}
	fixedwall
		{
		type wall;
		faces
			(
				(1 2 5 4)
			);
		}
	inlet
		{
		type patch;
		faces
			(
				(0 1 4 0)
			);
		}
	outlet
		{
		type patch;
		faces
			(
				(3 5 2 3)
			);
		}
	axis
		{
		type empty;
		faces
			(
				(0 3 3 0)
			);
		}
);
mergepatchpairs
(
);

For `25^o` degree angle

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2012                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
     version 	 2.0;
     format 	 ascii;
     class 	     dictionary;
     object 	 blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 	1;
vertices
(
			(0 0 0)//at 25 degree//
			(9.762960e-03 2.164396e-03 0)
			(9.762960e-03 2.164396e-03 3.520000e+00)
			(0 0 3.520000e+00)
			(9.762960e-03 -2.164396e-03 0)
			(9.762960e-03 -2.164396e-03 3.520000e+00)
);
blocks
(
        hex (0 4 1 0 3 5 2 3) (50 1 300) simpleGrading (2.000000e-01 1 1)
);

edges
(
	arc 1 4 (1.000000e-02 0 0)
	arc 2 5 (1.000000e-02 0 3.520000e+00)
);
boundary
(
	front
		{
		type symmetry;
		faces
			(
				(0 4 5 3)
			);
		}
	back
		{
		type symmetry;
		faces
			(
				(0 3 2 1)
			);
		}
	fixedwall
		{
		type wall;
		faces
			(
				(1 2 5 4)
			);
		}
	inlet
		{
		type patch;
		faces
			(
				(0 1 4 0)
			);
		}
	outlet
		{
		type patch;
		faces
			(
				(3 5 2 3)
			);
		}
	axis
		{
		type empty;
		faces
			(
				(0 3 3 0)
			);
		}
);
mergepatchpairs
(
);

For `45^o` degree angle

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2012                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
     version 	 2.0;
     format 	 ascii;
     class 	     dictionary;
     object 	 blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 	1;
vertices
(
			(0 0 0)
			(9.238795e-03 3.826834e-03 0)//at 45 degree//
			(9.238795e-03 3.826834e-03 3.520000e+00)
			(0 0 3.520000e+00)
			(9.238795e-03 -3.826834e-03 0)
			(9.238795e-03 -3.826834e-03 3.520000e+00)
);
blocks
(
        hex (0 4 1 0 3 5 2 3) (50 1 300) simpleGrading (2.000000e-01 1 1)
);

edges
(
	arc 1 4 (1.000000e-02 0 0)
	arc 2 5 (1.000000e-02 0 3.520000e+00)
);
boundary
(
	front
		{
		type symmetry;
		faces
			(
				(0 4 5 3)
			);
		}
	back
		{
		type symmetry;
		faces
			(
				(0 3 2 1)
			);
		}
	fixedwall
		{
		type wall;
		faces
			(
				(1 2 5 4)
			);
		}
	inlet
		{
		type patch;
		faces
			(
				(0 1 4 0)
			);
		}
	outlet
		{
		type patch;
		faces
			(
				(3 5 2 3)
			);
		}
	axis
		{
		type empty;
		faces
			(
				(0 3 3 0)
			);
		}
);
mergepatchpairs
(
);

Note:- All other files like controlDict, transportProperties, U and p will be same for every angle which is given below.

ControlDict file

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version	2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     icoFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         50;

deltaT          0.01;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

transportProperties

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2012                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

nu              8.9268e-7;


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

U

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     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
{
  front
	{
	   type 	symmetry;
	}
	
	back
	{
	   type 	symmetry;	
	}
	
	fixedwall
	{
	   type 	noSlip;
	}
	
	inlet
	{
	   type 	fixedValue;
	   value	uniform (0 0 0.0937);		
	}
	
	outlet
	{
	   type 	zeroGradient;		
	}
	
	axis
	{
	   type 	empty;		
	}
}

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

p

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    front
    {
        type     	symmetry;
    }

    back
    {
        type            symmetry;
    }

    fixedwall
    {
        type            zeroGradient;
    }

    inlet
    {
        type            zeroGradient;
    }

    outlet    
    {
        type            fixedValue;
	value		uniform 0;
    }
    axis
    {
        type            empty;
    }
}

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

Mesh generated using different angle will be almost same except wedge angle

mesh generated for `45^o`

Output plots for different angle

`velocity_(max)`

at `10^o` angle

at `25^o` angle

at`45^o` angle

Pressure drop

at `10^o` angle

at `25^o` angle

at `45^o` angle

shear stress

at `10^o` angle

at `25^o` angle

at `45^o` angle

Validation of result

For `theta=10^o`

Parameter Analytical value Computed value % error
`V_(max)` 0.1875 0.186778 0.38
`Delta P` 0.0067 0.00673928 0.58
`tau` 0.0334 0.032951 1.3
`L_h` 2.52 2.50 0.79

For `theta=25^o`

Parameter Analytical value Computed value % error
`V_(max)` 0.1875 0.186924 0.3
`Delta P` 0.0067 0.00704865 5.2
`tau` 0.0334 0.0336145 0.6
`L_h` 2.52 2.5 0.79

For `theta=45^o`

Parameter Analytical value Computed value % error
`V_(max)` 0.1875 0.187034 0.24
`Delta P` 0.0067 0.00785404 17.2
`tau` 0.0334 0.035505 6.3
`L_h` 2.52 2.5 0.79

Wedge boundary condition

the wedge boundary condition is used in computational fluid dynamics to define an axisymmetric situation, e.g., cylinder. The flow must be axisymmetric along the central axis.
One big advantage of wedge is that it allows for the rotational flow around the axis and this is possible only because the fluxes and normal components are not assumed as zero.

Symmetric boundary condition

The symmetry boundary condition defines a mirror face. It should only be used if the Physical object or geometry and the expected flow field pattern of the developed solutions are mirrored along the surface. By using this BC, the domain cen essentially be halved, reducing the time to achieve the solution.
The conditions at symmetry boundary are:
1. No flow across the boundary.
2. No scaler flux across the boundary.

Conclusion

From the above date we have calculated we can conclude that there is no difference in wedge boundary condition and smmetry boundary condition for the given problem. because we are getting almost similar result in both BC's. and in case of symmetry boundary condition, we can see that. as the wedge angle increases, there is increase in pressure drop and percentage error in pressure drop. so it should be used for small angles.

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.