Week 12 - Symmetry vs Wedge vs HP equation
This challange is the continuition of the Simulation of the flow through pipe in openFoam but the difference in this challange is that we have used the angle as 10deg, 25deg and 45deg for the wedge, and on the above of it the front and back face are of the type wedge and symmetry. So there are total 6 cases in this challange to solve.
The initial conditions are as similar to the previous one-
Diameter of pipe = 0.02m;
Length of Piper = 2.5m;
Density of Fluid = 997 `kg//m^3`;
Dynamic Viscosity of Fluid = 0.00089 Pa*sec
The whole problem is solved using icoFoam solver in Openfoam and the Blockmesh file is made automated in Matlab such that the user can have have ease to get results at different angles.
In this challange the velocity and pressure initials condoation are same for all cases of 3 wedge angles with symmetry condition and for all cases of 3 wedge angles with wedge condition.
- Symmetry:
- Matlab code for 10 deg:
clear all
close all
clc
f1 = fopen('blockMeshDict.txt','w');
scale = 1;
theta = 10;
Re = 2100;
r = 0.01;
D=2*r;
l = 2.5;
nx = 25;
ny = 1;
nz =200;
fprintf(f1,'/*--------------------------------*-');
fprintf(f1,'C++ -*----------------------------------');
fprintf(f1,'\n');
fprintf(f1,' ========= |\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,'---------------------------------------------------------------------------*/')
fprintf(f1,'\n');
fprintf(f1,'FoamFile\n');
fprintf(f1,'{\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');
fprintf(f1,'// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ');
fprintf(f1,'* * * * * * * //\n');
fprintf(f1,'\n');
fprintf(f1,'convertToMeters %d;\n',scale);
fprintf(f1,'\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,0,0);
fprintf(f1,'\t(%d %d %d)\n',l,r*cosd(theta/2),r*sind(theta/2));
fprintf(f1,'\t(%d %d %d)\n',l,r*cosd(theta/2),-r*sind(theta/2));
fprintf(f1,');\n');
fprintf(f1,'\n');
fprintf(f1,'blocks\n');
fprintf(f1,'(\n');
fprintf(f1,'\thex (0 2 1 0 3 5 4 3) (%d %d %d) simpleGrading (1 1 1)\n',nx,ny,nz);
fprintf(f1,');\n');
fprintf(f1,'\n');
fprintf(f1,'edges\n')
fprintf(f1,'(\n');
fprintf(f1,' arc 2 1 (%d %d %d)\n',0,r,0);
fprintf(f1,' arc 5 4 (%d %d %d)\n',l,r,0);
fprintf(f1,');\n');
fprintf(f1,'\n');
fprintf(f1,'boundary\n');
fprintf(f1,'(\n');
fprintf(f1,' inlet\n');
fprintf(f1,' {\n');
fprintf(f1,' type patch;\n');
fprintf(f1,' faces\n');
fprintf(f1,' (\n');
fprintf(f1,' (0 2 1 0)\n');
fprintf(f1,' );\n');
fprintf(f1,' }\n');
fprintf(f1,' outlet\n');
fprintf(f1,' {\n');
fprintf(f1,' type patch;\n');
fprintf(f1,' faces\n');
fprintf(f1,' (\n');
fprintf(f1,' (3 4 5 3)\n');
fprintf(f1,' );\n');
fprintf(f1,' }\n');
fprintf(f1,' top\n');
fprintf(f1,' {\n');
fprintf(f1,' type wall;\n');
fprintf(f1,' faces\n');
fprintf(f1,' (\n');
fprintf(f1,' (1 2 5 4)\n');
fprintf(f1,' );\n');
fprintf(f1,' }\n');
fprintf(f1,' front\n');
fprintf(f1,' {\n');
fprintf(f1,' type symmetry;\n');
fprintf(f1,' faces\n');
fprintf(f1,' (\n');
fprintf(f1,' (0 1 4 3)\n');
fprintf(f1,' );\n');
fprintf(f1,' }\n');
fprintf(f1,' back\n');
fprintf(f1,' {\n');
fprintf(f1,' type symmetry;\n');
fprintf(f1,' faces\n');
fprintf(f1,' (\n');
fprintf(f1,' (0 3 5 2)\n');
fprintf(f1,' );\n');
fprintf(f1,' }\n');
fprintf(f1,');\n');
fprintf(f1,'\n');
fprintf(f1,'mergePatchPairs\n');
fprintf(f1,'(\n');
fprintf(f1,');\n');
fprintf(f1,'\n');
fprintf(f1,'//\n');
fprintf(f1,'**************************************************************');
fprintf(f1,'*********** //\n');
fclose(f1)
Output is:
/*--------------------------------*-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 9.961947e-03 8.715574e-04)
(0 9.961947e-03 -8.715574e-04)
(2.500000e+00 0 0)
(2.500000e+00 9.961947e-03 8.715574e-04)
(2.500000e+00 9.961947e-03 -8.715574e-04)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (25 1 200) simpleGrading (1 1 1)
);
edges
(
arc 2 1 (0 1.000000e-02 0)
arc 5 4 (2.500000e+00 1.000000e-02 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
top
{
type wall;
faces
(
(1 2 5 4)
);
}
front
{
type symmetry;
faces
(
(0 1 4 3)
);
}
back
{
type symmetry;
faces
(
(0 3 5 2)
);
}
);
mergePatchPairs
(
);
//
************************************************************************* //
2. 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;
}
top
{
type zeroGradient;
}
front
{
type symmetry;
}
back
{
type symmetry;
}
}
// ************************************************************************* //
3. 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 (0 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (0.09373 0 0);
}
outlet
{
type zeroGradient;
}
top
{
type noSlip;
}
front
{
type symmetry;
}
back
{
type symmetry;
}
}
// ************************************************************************* //
- Wedge condition for 10 deg:
- Matlab code:
clear all
close all
clc
f1 = fopen('blockMeshDict.txt','w');
scale = 1;
theta = 10;
Re = 2100;
r = 0.01;
D=2*r;
l = 2.5;
nx = 25;
ny = 1;
nz =200;
fprintf(f1,'/*--------------------------------*-');
fprintf(f1,'C++ -*----------------------------------');
fprintf(f1,'\n');
fprintf(f1,' ========= |\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,'---------------------------------------------------------------------------*/')
fprintf(f1,'\n');
fprintf(f1,'FoamFile\n');
fprintf(f1,'{\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');
fprintf(f1,'// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ');
fprintf(f1,'* * * * * * * //\n');
fprintf(f1,'\n');
fprintf(f1,'convertToMeters %d;\n',scale);
fprintf(f1,'\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,0,0);
fprintf(f1,'\t(%d %d %d)\n',l,r*cosd(theta/2),r*sind(theta/2));
fprintf(f1,'\t(%d %d %d)\n',l,r*cosd(theta/2),-r*sind(theta/2));
fprintf(f1,');\n');
fprintf(f1,'\n');
fprintf(f1,'blocks\n');
fprintf(f1,'(\n');
fprintf(f1,'\thex (0 2 1 0 3 5 4 3) (%d %d %d) simpleGrading (1 1 1)\n',nx,ny,nz);
fprintf(f1,');\n');
fprintf(f1,'\n');
fprintf(f1,'edges\n')
fprintf(f1,'(\n');
fprintf(f1,' arc 2 1 (%d %d %d)\n',0,r,0);
fprintf(f1,' arc 5 4 (%d %d %d)\n',l,r,0);
fprintf(f1,');\n');
fprintf(f1,'\n');
fprintf(f1,'boundary\n');
fprintf(f1,'(\n');
fprintf(f1,' inlet\n');
fprintf(f1,' {\n');
fprintf(f1,' type patch;\n');
fprintf(f1,' faces\n');
fprintf(f1,' (\n');
fprintf(f1,' (0 2 1 0)\n');
fprintf(f1,' );\n');
fprintf(f1,' }\n');
fprintf(f1,' outlet\n');
fprintf(f1,' {\n');
fprintf(f1,' type patch;\n');
fprintf(f1,' faces\n');
fprintf(f1,' (\n');
fprintf(f1,' (3 4 5 3)\n');
fprintf(f1,' );\n');
fprintf(f1,' }\n');
fprintf(f1,' top\n');
fprintf(f1,' {\n');
fprintf(f1,' type wall;\n');
fprintf(f1,' faces\n');
fprintf(f1,' (\n');
fprintf(f1,' (1 2 5 4)\n');
fprintf(f1,' );\n');
fprintf(f1,' }\n');
fprintf(f1,' front\n');
fprintf(f1,' {\n');
fprintf(f1,' type wedge;\n');
fprintf(f1,' faces\n');
fprintf(f1,' (\n');
fprintf(f1,' (0 1 4 3)\n');
fprintf(f1,' );\n');
fprintf(f1,' }\n');
fprintf(f1,' back\n');
fprintf(f1,' {\n');
fprintf(f1,' type wedge;\n');
fprintf(f1,' faces\n');
fprintf(f1,' (\n');
fprintf(f1,' (0 3 5 2)\n');
fprintf(f1,' );\n');
fprintf(f1,' }\n');
fprintf(f1,');\n');
fprintf(f1,'\n');
fprintf(f1,'mergePatchPairs\n');
fprintf(f1,'(\n');
fprintf(f1,');\n');
fprintf(f1,'\n');
fprintf(f1,'//\n');
fprintf(f1,'**************************************************************');
fprintf(f1,'*********** //\n');
fclose(f1)
Output is:
/*--------------------------------*-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 9.961947e-03 8.715574e-04)
(0 9.961947e-03 -8.715574e-04)
(2.500000e+00 0 0)
(2.500000e+00 9.961947e-03 8.715574e-04)
(2.500000e+00 9.961947e-03 -8.715574e-04)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (25 1 200) simpleGrading (1 1 1)
);
edges
(
arc 2 1 (0 1.000000e-02 0)
arc 5 4 (2.500000e+00 1.000000e-02 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
top
{
type wall;
faces
(
(1 2 5 4)
);
}
front
{
type wedge;
faces
(
(0 1 4 3)
);
}
back
{
type wedge;
faces
(
(0 3 5 2)
);
}
);
mergePatchPairs
(
);
//
************************************************************************* //
2. 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;
}
top
{
type zeroGradient;
}
front
{
type wedge;
}
back
{
type wedge;
}
}
// ************************************************************************* //
3. 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 (0 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (0.09373 0 0);
}
outlet
{
type zeroGradient;
}
top
{
type noSlip;
}
front
{
type wedge;
}
back
{
type wedge;
}
}
// ************************************************************************* //
So now the values were used for 10 degree, 25 degree, 45 degree wedge and the results are:
- 10 deg
- Velocity along the length:

Velocity profile at 0.3 m

Velocity profile at 1.8 m

- 25 degVelocity along the length:

Velocity profile at 0.3 m

Velocity profile at 1.8 m

- 45 deg wedge
- Velocity along the length:

Velocity profile at 0.3 m

Velocity profile at 1.8 m

Also the following observation table can be drawn:
| 10 deg | 10 deg | 25 deg | 25 deg | 45 deg | 45 deg | |
| Symmetric | Wedge | Symmetric | Wedge | Symmetric | Wedge | |
| U at 0.3 m | 0.14115 | 0.14112 | 0.14207 | 0.14112 | 0.1447 | 0.14206 |
| U at 1.8 m | 0.17581 | 0.17581 | 0.17683 | 0.17581 | 0.17935 | 0.17683 |
| Execution time(sec) | 324.48 | 394.15 | 330.89 | 378.49 | 340.74 | 364.2 |
Following Observations can be drawn from the above results-
1. For all of the angles of geometry, The execution time is minimum for symmetry case.
2. The values in symmetry case are much closer to the actual ones.