Comparison of Symmetry Wedge and Hagen Poiseulli Flow Results
Aim : To simulate flow through pipe using symmetry boundary condition
Objective :
- To use symmetry as the boundary conditon for the element under consideration
- To obtain results for different subtended angles by the element viz 10,25 and 45 degrees
- To compare the results obtained at different angles with wedge boundary condition and Hagen Poiseulli results
Problem setup:
Same setup is used as used with the axisymmetry condition with only chnage in the boundary conditon for the wedge faces which are taken as symmetry in this case from previously defined wedge type.
Angle subtended at the centre by the wedges are taken as 10 , 25 and 45 degrees.
Matlab Code for generating the blockMeshDict file
%% Pipe Flow Symmetry boundary condition
clc
clear
% Variables
mu=0.798e-3; % Dynamic viscosity of water at 30* C
nu=0.801e-6; % Kinematic viscosity of water at 30* C
rho=995.65; % Density of water at 30*C
D=0.025; % Diameter of the pipe
Re=2100; % Reynolds number for the flow
% Input of angles 10 25 and 45 degrees
theta = input(\'Input the angles for the element (10,25 or 45) \');
% coordinates
x=D/2*sind(theta/2);
y=D/2*cosd(theta/2);
%% Calculation of hydraulic entry length, velocity, pressure drop and kinematic pressure
Le=0.06*Re*D; % Entry length for laminar flow
v= nu*Re/D; % Average velocity of flow through the pipe
dp=32*mu*v*Le/(D^2); % Presuure drop
p=dp/rho; % Kinematic pressure
f1=fopen(\'blockMeshDict\',\'w\');
fprintf(f1,\'/*--------------------------------*- C++ -*---------------------------------*\\\\\');
fprintf(f1,\'\\n ========= |\');
fprintf(f1,\'\\n \\\\\\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox\');
fprintf(f1,\'\\n \\\\\\\\ / O peration | Website: https://openfoam.org\');
fprintf(f1,\'\\n \\\\\\\\ / A nd | Version: 7\');
fprintf(f1,\'\\n \\\\\\\\/ M anipulation |\');
fprintf(f1,\'\\n\\\\*---------------------------------------------------------------------------*/\');
fprintf(f1,\'\\nFoamFile\');
fprintf(f1,\'\\n{\');
fprintf(f1,\'\\n version 2.0;\');
fprintf(f1,\'\\n format ascii;\');
fprintf(f1,\'\\n class dictionary;\');
fprintf(f1,\'\\n object blockMeshDict;\');
fprintf(f1,\'\\n}\');
fprintf(f1,\'\\n// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //\');
fprintf(f1,\'\\n\\nconvertToMeters 1;\');
fprintf(f1,\'\\n\\nvertices\');
fprintf(f1,\'\\n(\');
fprintf(f1,\'\\n\\t(%d %d %d) // vertex 0\',0,0,0);
fprintf(f1,\'\\n\\t(%f %f %d) // 1\',x,y,0);
fprintf(f1,\'\\n\\t(%f %f %d) // 2\',-x,y,0);
fprintf(f1,\'\\n\\t(%d %d %0.2f) // 3\',0,0,Le);
fprintf(f1,\'\\n\\t(%f %f %0.2f) // 4\',x,y,Le);
fprintf(f1,\'\\n\\t(%f %f %0.2f) // 5\',-x,y,Le);
fprintf(f1,\'\\n\\n);\');
fprintf(f1,\'\\n\\nblocks\\n(\');
fprintf(f1,\'\\n\\thex (%d %d %d %d %d %d %d %d) (%d %d %d) simpleGrading (%d %d %d)\',0,0,1,2,3,3,4,5,...
1,30,200,1,1,1);
fprintf(f1,\'\\n\\n);\');
fprintf(f1,\'\\n\\nedges\\n(\');
fprintf(f1,\'\\n\\tarc %d %d (%d %0.4f %d)\',1,2,0,D/2,0);
fprintf(f1,\'\\n\\tarc %d %d (%d %0.4f %0.2f)\',4,5,0,D/2,Le);
fprintf(f1,\'\\n);\');
fprintf(f1,\'\\n\\nboundary\\n(\');
fprintf(f1,\'\\n\\tInlet\\n\\t{\');
fprintf(f1,\'\\n\\t type patch;\');
fprintf(f1,\'\\n\\t faces\');
fprintf(f1,\'\\n\\t (\');
fprintf(f1,\'\\n\\t\\t(%d %d %d %d)\',0,0,2,1);
fprintf(f1,\'\\n\\t );\');
fprintf(f1,\'\\n\\t}\');
fprintf(f1,\'\\n\\n\\tOutlet\\n\\t{\');
fprintf(f1,\'\\n\\t type patch;\');
fprintf(f1,\'\\n\\t faces\');
fprintf(f1,\'\\n\\t (\');
fprintf(f1,\'\\n\\t\\t(%d %d %d %d)\',3,4,5,3);
fprintf(f1,\'\\n\\t );\');
fprintf(f1,\'\\n\\t}\');
fprintf(f1,\'\\n\\n\\tWedge1\\n\\t{\');
fprintf(f1,\'\\n\\t type symmetry;\');
fprintf(f1,\'\\n\\t faces\');
fprintf(f1,\'\\n\\t (\');
fprintf(f1,\'\\n\\t\\t(%d %d %d %d)\',0,1,4,3);
fprintf(f1,\'\\n\\t );\');
fprintf(f1,\'\\n\\t}\');
fprintf(f1,\'\\n\\n\\tWedge2\\n\\t{\');
fprintf(f1,\'\\n\\t type symmetry;\');
fprintf(f1,\'\\n\\t faces\');
fprintf(f1,\'\\n\\t (\');
fprintf(f1,\'\\n\\t\\t(%d %d %d %d)\',3,5,2,0);
fprintf(f1,\'\\n\\t );\');
fprintf(f1,\'\\n\\t}\');
fprintf(f1,\'\\n\\n\\tTopwall\\n\\t{\');
fprintf(f1,\'\\n\\t type wall;\');
fprintf(f1,\'\\n\\t faces\');
fprintf(f1,\'\\n\\t (\');
fprintf(f1,\'\\n\\t\\t(%d %d %d %d)\',4,1,2,5);
fprintf(f1,\'\\n\\t );\');
fprintf(f1,\'\\n\\t}\');
fprintf(f1,\'\\n\\n\\taxis\\n\\t{\');
fprintf(f1,\'\\n\\t type empty;\');
fprintf(f1,\'\\n\\t faces\');
fprintf(f1,\'\\n\\t (\');
fprintf(f1,\'\\n\\t\\t(%d %d %d %d)\',0,3,3,0);
fprintf(f1,\'\\n\\t );\');
fprintf(f1,\'\\n\\t}\');
fprintf(f1,\'\\n\\n);\');
fprintf(f1,\'\\nmergePatchPairs\');
fprintf(f1,\'\\n(\\n);\');
fprintf(f1,\'\\n\\n// ************************************************************************* //\');
fclose(f1);
%% Analytical shear stress and maximum velocity
v_max=2*v;
tau_max= dp*0.5*D/(2*Le);
Pressure condition taken as:
/*--------------------------------*- 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 volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
Inlet
{
type zeroGradient;
}
Outlet
{
type fixedValue;
value uniform 0;
}
Topwall
{
type zeroGradient;
}
Wedge1
{
type symmetry;
}
Wedge2
{
type symmetry;
}
axis
{
type empty;
}
}
// ************************************************************************* //
Velocity Condition is taken as:
/*--------------------------------*- 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 volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
Inlet
{
type fixedValue;
value uniform (0 0 0.0673);
}
Outlet
{
type zeroGradient;
}
Topwall
{
type fixedValue;
value uniform (0 0 0);
}
Wedge1
{
type symmetry;
}
Wedge2
{
type symmetry;
}
axis
{
type empty;
}
}
// ************************************************************************* //
Control Dict Code is :
/*--------------------------------*- 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;
location \"system\";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 40;
deltaT 1e-2;
writeControl timeStep;
writeInterval 100;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Plot Results
a) For 10 degree Wedge element
Velocity Contour
The maximum velocity is found to be 0.1334 m/s from the above contour and maximum shear stress as 0.0165 N/m^2 approximately. The trend of the profile is same as the wedge boundary condition previously obtained.
b) For 25 degree Wedge element
Velocity Contour
The maximum velocity is found to be 0.1336 m/s and maximum shear as 0.017 N/m^2 from the above figures.
c) For 45 degree Wedge element
Velocity Contour
Maximum velocity is found to be 0.1339 m/s and shear stress approximately 0.018 N/m^2.
Comparison table is as follows
From the table it can be seen that the execution time, courant number mean and courant number max are least for wedge condition compared to other symmetry boundary conditions.
The maximum velocity is obtained from 45 degree symmetry condition is closest to the analytical solution given by HP equation but shear stress given by 25 degree symmetry condition is closest to analytical solution. The overall deviation from the analytical solution is not much for all boundary conditions. So wedge boundary condition can be taken as good solution for the flow problem among others because its execution time and courant number are least which is useful if flow domain becomes more complex and mesh becomes finer. Generally a numerical solution is desired which solves the problem taking less execution time.