Week 12 - Symmetry vs Wedge vs HP equation
Aim: The objective of the given challenge is to find effect of symmetry boundary condition on the case that we have setup earlier with wedge boundary conditions. we are going to analyze the effect of symmetry boundary condition vs wedge boundary condition.
Approach: we have written a matlab program file to generate blockMeshdict file for given angle of 10,25 and 45 degree. The system directory and control directory remains same only change is in pressure(p),velocity(U) and blockMeshdict file i.e the wedge boundary condition at the front and back wall is changed to symmetry boundary condition.
Symmetry Boundary condition:
The symmetry boundary condition defines a mirror face/surface. It should only be used if the physical object or geometry and the expected flow field pattern of the developed solution are mirrored along that surface. By using this boundary condition, the domain can essentially be halved, reducing the time to achieve a solution.
The pressure and velocity files remains same only change is the boundary condition for front and back wall.
pressure Boundary conditions:
/*--------------------------------*- 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;
}
axis
{
type empty;
}
fixedWall
{
type zeroGradient;
}
frontWall
{
type symmetry;
}
backWall
{
type symmetry;
}
}
// ************************************************************************* //
Velocity Boundary condition:
/*--------------------------------*- 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.093 0 0);
}
outlet
{
type zeroGradient;
}
axis
{
type empty;
}
fixedWall
{
type noSlip;
}
frontWall
{
type symmetry;
}
backWall
{
type symmetry;
}
}
// ************************************************************************* //
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 40;
deltaT 0.01;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Transportdict 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 "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 0.89e-06; // Nu of water @ 30 degree celcius
// nu [0 2 -1 0 0 0 0] 1e-6; // Nu of water @ 20 degree celcius
// nu [0 2 -1 0 0 0 0] 1.3e-6; // Nu of water @ 10 degree celcius
// ************************************************************************* //
Matlab program for Generating blockMeshdict:
Below file is for theta=10 degree.
clear all
close all
clc
%considered values
theta=10;
d=0.02;%in meters
r=0.01;%in meters
Re=2100;% reynolds number
L_e=Re*d*0.06;%hydrodynamic length of pipe
L_t=L_e+0.5;%total length of pipe
f1=fopen('blockMeshDict','w')
fprintf(f1,'%s','/*--------------------------------*- C++ -*----------------------------------*\');
fprintf(f1,'\n========= |\n');
fprintf(f1, '\\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox\n');
fprintf(f1, ' \\\\ / O peration | Website: https://openfoam.org\n');
fprintf(f1, ' \\\\ / A nd | Version: 8\n');
fprintf(f1, ' \\\\/ M anipulation |\n');
fprintf(f1,'%s','\*---------------------------------------------------------------------------*/');
fprintf(f1,'\nFoamFile\n');
fprintf(f1,'\n{\n');
fprintf(f1,'version 2.0;\n');
fprintf(f1,'format ascii;\n');
fprintf(f1,'class dictionary;\n');
fprintf(f1,'object blockMeshDict;\n');
fprintf(f1,'\n}\n');
fprintf(f1,'%s','// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //');
fprintf(f1,'\n\n convertToMeters 1;\n\n');
%vertices
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_t,0,0);
fprintf(f1,'\t(%d %d %d)\n',L_t,r*cosd(theta/2),-r*sind(theta/2));
fprintf(f1,'\t(%d %d %d)\n',L_t,r*cosd(theta/2),r*sind(theta/2));
fprintf(f1,');\n');
%block
fprintf(f1,'\nblocks\n');
fprintf(f1,'(\n');
fprintf(f1,'\t hex (0 1 2 0 3 4 5 3) (50 1 300) simpleGrading (0.2 1 1)');
fprintf(f1,'\n\n);\n\n');
%edges
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_t,r,0);
fprintf(f1,'\n\n);\n\n')
%boundary
fprintf(f1,'boundary\n');
fprintf(f1,'(\n');
%inlet
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\t(%d %d %d %d)\n',0,2,1,0)
fprintf(f1,'\t\t );\n');
fprintf(f1,'\t}\n');
%outlet
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\t(%d %d %d %d)\n',3,4,5,3)
fprintf(f1,'\t\t );\n');
fprintf(f1,'\t}\n');
%axis
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\t(%d %d %d %d)\n',0,3,3,0)
fprintf(f1,'\t\t );\n');
fprintf(f1,'\t}\n');
%fixedWall
fprintf(f1,'\t fixedWall\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\t(%d %d %d %d)\n',1,2,5,4)
fprintf(f1,'\t\t );\n');
fprintf(f1,'\t}\n');
%frontWall
fprintf(f1,'\t frontWall\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\t type symmetry;\n');
fprintf(f1,'\t\t faces\n');
fprintf(f1,'\t\t (\n');
fprintf(f1,'\t\t\t\t(%d %d %d %d)\n',0,3,5,2)
fprintf(f1,'\t\t );\n');
fprintf(f1,'\t}\n');
%backWall
fprintf(f1,'\t backWall\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\t type symmetry;\n');
fprintf(f1,'\t\t faces\n');
fprintf(f1,'\t\t (\n');
fprintf(f1,'\t\t\t\t(%d %d %d %d)\n',0,1,4,3)
fprintf(f1,'\t\t );\n');
fprintf(f1,'\t}\n');
fprintf(f1,');\n');
fprintf(f1,'mergePatchPairs\n')
fprintf(f1,'(\n');
fprintf(f1,');\n');
fprintf(f1,'\n// ************************************************************************* //\n')
fclose(f1)
The above matlab file generates blockMeshdict file for angle 10 degree.
/*--------------------------------*- 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 0.00996195 -0.000871557)
(0 0.00996195 0.000871557)
(3.02 0 0)
(3.02 0.00996195 -0.000871557)
(3.02 0.00996195 0.000871557)
);
blocks
(
hex (0 1 2 0 3 4 5 3) (50 1 300) simpleGrading (0.2 1 1)
);
edges
(
arc 1 2 (0 0.01 0)
arc 4 5 (3.02 0.01 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
fixedWall
{
type wall;
faces
(
(1 2 5 4)
);
}
frontWall
{
type symmetry;
faces
(
(0 3 5 2)
);
}
backWall
{
type symmetry;
faces
(
(0 1 4 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Result:

Velocity=0.185142 m/s
blockMeshdict file for 25 degree :
/*--------------------------------*- 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 0.00976296 -0.0021644)
(0 0.00976296 0.0021644)
(3.02 0 0)
(3.02 0.00976296 -0.0021644)
(3.02 0.00976296 0.0021644)
);
blocks
(
hex (0 1 2 0 3 4 5 3) (50 1 300) simpleGrading (0.2 1 1)
);
edges
(
arc 1 2 (0 0.01 0)
arc 4 5 (3.02 0.01 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
fixedWall
{
type wall;
faces
(
(1 2 5 4)
);
}
frontWall
{
type symmetry;
faces
(
(0 3 5 2)
);
}
backWall
{
type symmetry;
faces
(
(0 1 4 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Result:

Velocity=0.18525 m/s
blockMeshdict file for 45 degree :
/*--------------------------------*- 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 0.0092388 -0.00382683)
(0 0.0092388 0.00382683)
(3.02 0 0)
(3.02 0.0092388 -0.00382683)
(3.02 0.0092388 0.00382683)
);
blocks
(
hex (0 1 2 0 3 4 5 3) (50 1 300) simpleGrading (0.2 1 1)
);
edges
(
arc 1 2 (0 0.01 0)
arc 4 5 (3.02 0.01 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
fixedWall
{
type wall;
faces
(
(1 2 5 4)
);
}
frontWall
{
type symmetry;
faces
(
(0 3 5 2)
);
}
backWall
{
type symmetry;
faces
(
(0 1 4 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Result:

Velocity=0.18547 m/s
Results:
| Boundary condition's | wedge B.C (4⁰) | symmetry B.C(10⁰) | symmetry B.C(25⁰) | symmetry B.C(45⁰) |
| Courant number | 0.424914 | 0.425437 | 0.429897 | 0.441784 |
| Execution time | 1582.14 | 1791.17 | 1820.6 | 1672.97 |
| Velocity (analytical) | 0.185143 | 0.185142 | 0.18525 | 0.18547 |
| Velocity (numerical) | 0.18746 | |||
| Error | 0.002317 | 0.002318 | 0.00221 | 0.00199 |
Conclusion:
1) Wedge boundary condition require minimum amount of execution time as it contains less amount of cells as compared to symmetric boundary condition.
2) With symmetry B.C the error in velocity value decreases eith increase in wedge angle as no of cells increses we get more accurate value but at the expense of time required for execution.
3) Courant number increases with increase in wedge angle.