Challenge

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

AIM: To compare the results using symmetry and wedge BC and also compare the values of pressure and velocity from analytical equations.

ALso compare the results of pressure and velocity for three different wedge angles 10, 25 and 45.

THEORY: The previous project using wedge boundary conditions for the pipe flow is given in the link below:

https://skill-lync.com/projects/week-11-simulation-of-flow-through-a-pipe-in-openfoam-85

While the initial conditions are same, only the type of boundary conditions are varied. In this case, the symmetry boundary conditons are used for front and back boundary conditions.

The pressure and velocity files are modified according to the symmetry BC as follows:

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

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

internalField   uniform 0;

boundaryField
{
         axis
	{
		 type empty;

	}
	 pipewall 
	{
		 type zeroGradient;

	}
	 	 
	 front
	{
		 type symmetry;

	}
	 back
	{
		 type symmetry;

	}
	 
	 inlet
	{
		 type zeroGradient;

	}
	 
	 outlet
	{
		 type fixedValue;
		 value uniform 10;


	 }
}

// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.1                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     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
{
         axis
	{
		 type empty;


	}
	 pipewall 
	{
		 type fixedValue;
		 value uniform (0 0 0);
	}
	 	 
	 front
	{
		 type symmetry;

	}
	 back
	{
		 type symmetry;

	}
	 
	 inlet
	{
		 type fixedValue;
		 value uniform (0.2107 0 0);

	}
	 
	 outlet
	{
		 type inletOutlet;
		 inletValue uniform (0.2107 0 0);
		 value uniform (0.2107 0 0);


	 }
}

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

The MATLAB program to modify the blockMeshDict file for a wedge angle of 10 degrees is given below:

clear all 
close all
clc

L = 2.1;
theta = 10;
r = 0.005;
a = 1
b = 0.2
c = 1
nx = 300
ny = 50
nz =1

line1='/*--------------------------------*- C++ -*----------------------------------*\';
line2='| =========                 |                                                 |';
line3='| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |';
line4='|  \\    /   O peration     | Version:  4.1                                   |';
line5='|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |';
line6='|    \\/     M anipulation  |                                                 |';
line7='\*---------------------------------------------------------------------------*/';

bmd = fopen('blockMeshDict','wt')
fprintf(bmd,'%s\n',line1);
fprintf(bmd,'%s\n',line2);
fprintf(bmd,'%s\n',line3);
fprintf(bmd,'%s\n',line4);
fprintf(bmd,'%s\n',line5);
fprintf(bmd,'%s\n',line6);
fprintf(bmd,'%s\n',line7);

fprintf(bmd,'FoamFile\n{\n');
fprintf(bmd,'%12s \t 2.0;\n','version');
fprintf(bmd,'%11s \t ascii;\n','format');
fprintf(bmd,'%10s \t dictionary;\n','class');
fprintf(bmd,'%11s \t blockMeshDict;\n','object');
fprintf(bmd,'}\n');
line8='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //';
fprintf(bmd,'%s\n\n',line8);
fprintf(bmd,'convertToMeters 1;\n\n');
fprintf(bmd,'vertices\n');
fprintf(bmd,'(\n');
fprintf(bmd,'\t (%d %d %d)\n',0,0,0); % point 0
fprintf(bmd,'\t (%d %d %d)\n',L,0,0);  % Pont 1
fprintf(bmd,'\t (%d %d %d)\n',L,r*cosd(theta/2),r*sind(theta/2)); % point 2
fprintf(bmd,'\t (%d %d %d)\n',0,r*cosd(theta/2),r*sind(theta/2)); % point 3
fprintf(bmd,'\t (%d %d %d)\n',0,r*cosd(theta/2),-r*sind(theta/2)); % point 4
fprintf(bmd,'\t (%d %d %d)\n',L,(r*cosd(theta/2)),(-r*sind(theta/2))); % point 5
fprintf(bmd,');\n\n');
fprintf(bmd,'blocks\n');
fprintf(bmd,'(\n');
fprintf(bmd,'     hex ( 0 1 5 4 0 1 2 3) (%d %d %d)',nx,ny,nz);
fprintf(bmd, ' SimpleGrading (%d %d %d)\n\n',a,b,c);
fprintf(bmd,');\n\n');
fprintf(bmd,'edges\n(\n\tarc %d %d (%d %d %d)\n',4,3,0,r,0);
fprintf(bmd,'\tarc %d %d (%d %d %d)\n',5,2,L,r,0);
fprintf(bmd,');\n\n');
fprintf(bmd,'boundary\n(\n');
fprintf(bmd,'\t inlet\n');
fprintf(bmd,'\t{\n');
fprintf(bmd,'\t\t type patch;\n');
fprintf(bmd,'\t\t faces\n');
fprintf(bmd,'\t\t (\n');
fprintf(bmd,'\t\t\t (%d %d %d %d)\n',0,0,3,4);
fprintf(bmd,'\t\t );\n');
fprintf(bmd,'\t}\n');
fprintf(bmd,'\t outlet\n');
fprintf(bmd,'\t{\n');
fprintf(bmd,'\t\t type patch;\n');
fprintf(bmd,'\t\t faces\n');
fprintf(bmd,'\t\t (\n');
fprintf(bmd,'\t\t\t (%d %d %d %d)\n',1,5,2,1);
fprintf(bmd,'\t\t );\n');
fprintf(bmd,'\t}\n');
fprintf(bmd,'\t back\n');
fprintf(bmd,'\t{\n');
fprintf(bmd,'\t\t type symmetry;\n');
fprintf(bmd,'\t\t faces\n');
fprintf(bmd,'\t\t (\n');
fprintf(bmd,'\t\t\t (%d %d %d %d)\n',0,4,5,1);
fprintf(bmd,'\t\t );\n');
fprintf(bmd,'\t}\n');
fprintf(bmd,'\t front\n');
fprintf(bmd,'\t{\n');
fprintf(bmd,'\t\t type symmetry;\n');
fprintf(bmd,'\t\t faces\n');
fprintf(bmd,'\t\t (\n');
fprintf(bmd,'\t\t\t (%d %d %d %d)\n',0,1,2,3);
fprintf(bmd,'\t\t );\n');
fprintf(bmd,'\t}\n');
fprintf(bmd,'\t axis\n');
fprintf(bmd,'\t{\n');
fprintf(bmd,'\t\t type empty;\n');
fprintf(bmd,'\t\t faces\n');
fprintf(bmd,'\t\t (\n');
fprintf(bmd,'\t\t\t (%d %d %d %d)\n',0,1,1,0);
fprintf(bmd,'\t\t );\n');
fprintf(bmd,'\t}\n');
fprintf(bmd,'\t pipewall \n');
fprintf(bmd,'\t{\n');
fprintf(bmd,'\t\t type wall;\n');
fprintf(bmd,'\t\t faces\n');
fprintf(bmd,'\t\t (\n');
fprintf(bmd,'\t\t\t (%d %d %d %d)\n',3,2,5,4);
fprintf(bmd,'\t\t );\n');
fprintf(bmd,'\t}\n');
fprintf(bmd,');\n\n');
fprintf(bmd,'mergePatchPairs\n(\n');
fprintf(bmd,');\n');
line9='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //';
fprintf(bmd,'%s\n',line9);
fclose(bmd)

The above program will generate the following blockMeshDict file for simulation.

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.1                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
     version 	 2.0;
     format 	 ascii;
     class 	 dictionary;
     object 	 blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices
(
	 (0 0 0)
	 (2.100000e+00 0 0)
	 (2.100000e+00 4.980973e-03 4.357787e-04)
	 (0 4.980973e-03 4.357787e-04)
	 (0 4.980973e-03 -4.357787e-04)
	 (2.100000e+00 4.980973e-03 -4.357787e-04)
);

blocks
(
     hex ( 0 1 5 4 0 1 2 3) (300 50 1) SimpleGrading (1 2.000000e-01 1)

);

edges
(
	arc 4 3 (0 5.000000e-03 0)
	arc 5 2 (2.100000e+00 5.000000e-03 0)
);

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

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

Similar code is used to generate the blockMeshDict file for other wedge angles as well.

RESULTS AND DISCUSSION:

The mesh file for a wedge angle of 10 degree is shown below:

Comparision of final results of pressure and velcooty for different wedge angles:

10 degree 25 degree 45 degree

Velocity (m/s) : 0.4153 0.4158 0.4174

Pressure (Pa) : 0.0722 0.075 0.0836

The values of pressure and velocity calculated using Hagen Poisuelle's equation are given below:

Velocity: 0.4214 m/s

Pressure: 0.07107 (Kinematic Pressure)

It is observed that with increase in wedge angle, the velocity and pressure near the exact solution.

The computational time for the symmetric BC is more than that of wedge BC

The velocity dipped to 0 at the boundary walls testifies the no slip BC for all the cases.

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.