Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
In this challenge we are going to simulate the flow over the pipe with different wedge angles (`10^0,25^0,45^0`) using both symmetry and wedge boundary. As the prevoius case we need to write a code by MATLAB to make the 'blockMeshDict' file. All parameters are same as the previous case.
From the previous challenge, w.k.t (wedge angle = `3^0`)
Diameter of the pipe = 0.02 m
Length of the pipe = 2.3 m
Hydrodynamic entrance length = 2.1 m
Reynold's number = 2100
Average velocity = 0.0935 m/s
Maximum velocity = 0.187 m/s
Pressure drop = 1.3314 Pa
Shear stress = 0.03182 Pa
The general procedures are same as the previous case. All we need to do is compare the results with different cases of simulation
1.Write the MATLAB codes for 'blockMeshDict' files for each case
2.Change necessary details in the other files too. (controlDict,fvSolution etc)
3.Run the simulation
4.Plot the graphs
MATLAB code for writing blockMeshDict file for the case with wedge angle = `45^0` and wedge boundary condition
clear all
close all
clc
%FINDING HYDRADYNAMIC ENTRANCE LENGTH,MAXIMUM VELOCITY,PRESSURE DROP and
%SHEAR STRESS
%Assuming diameter of the pipe,
D=0.02;
%Reynolds number
Re=2100;
%Density of water
rho=1000;
%Dynamic Viscosity
mu=0.00089;
%radius of pipe
r=0.01;
%distance from centre of the pipe to the wall
r_h=0.01;
%wedge angle
theta=45;
%Length of the pipe
L=2.3;
%Average velocity,
v_avg = (Re*mu)/(rho*D);
% 1.HYDRODYNAMIC ENTRANCE LENGTH
L_h = 0.05*Re*D; % L = L_h+0.2
%Total length of pipe - hydrodynamic entrance length
L_p = L-L_h;
% 2.MAXIMUM VELOCITY
u_max = 2*v_avg;
% 3.PRESSURE DROP
p_d = (32*mu*L_p*v_avg)/(D^2);
% 4.SHEAR STRESS
t_w = (2*mu*u_max*r)/(r_h^2);
%CREATING blockMeshDict File
%creating file
f1=fopen('blockMeshDict','w');
%opening part
h1='/*--------------------------------*- C++ -*----------------------------------*\';
h2=' ========= |';
h3=' \\ / F ield | OpenFOAM: The Open Source CFD Toolbox';
h4=' \\ / O peration | Website: https://openfoam.org';
h5=' \\ / A nd | Version: 8';
h6=' \\/ M anipulation |';
h7='\*---------------------------------------------------------------------------*/';
h8='FoamFile';
h9='{';
h10=' version 2.0;';
h11=' format ascii;';
h12=' class dictionary;';
h13=' object blockMeshDict;';
h14='}';
h15='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //';
fprintf(f1,'%s\n',h1)
fprintf(f1,'%s\n',h2)
fprintf(f1,'%s\n',h3)
fprintf(f1,'%s\n',h4)
fprintf(f1,'%s\n',h5)
fprintf(f1,'%s\n',h6)
fprintf(f1,'%s\n',h7)
fprintf(f1,'%s\n',h8)
fprintf(f1,'%s\n',h9)
fprintf(f1,'%s\n',h10)
fprintf(f1,'%s\n',h11)
fprintf(f1,'%s\n',h12)
fprintf(f1,'%s\n',h13)
fprintf(f1,'%s\n',h14)
fprintf(f1,'%s\n',h15)
fprintf(f1,'\n')
h16='convertToMeters 1;';
fprintf(f1,'%s\n',h16)
fprintf(f1,'\n')
%writing vertices
h17='vertices';
fprintf(f1,'%s\n',h17)
h18='(';
fprintf(f1,'%s\n',h18)
v0=[0 0 0];
v1=[0 r*cosd(theta/2) r*sind(theta/2)];
v2=[0 r*cosd(theta/2) -r*sind(theta/2)];
v3=[L 0 0];
v4=[L r*cosd(theta/2) r*sind(theta/2)];
v5=[L r*cosd(theta/2) -r*sind(theta/2)];
fprintf(f1,' (%d %d %d)\n',v0)
fprintf(f1,' (%d %d %d)\n',v1)
fprintf(f1,' (%d %d %d)\n',v2)
fprintf(f1,' (%d %d %d)\n',v3)
fprintf(f1,' (%d %d %d)\n',v4)
fprintf(f1,' (%d %d %d)\n',v5)
h19=');';
fprintf(f1,'%s\n',h19)
fprintf(f1,'\n')
%writing blocks
h20='blocks';
h21=' hex (0 3 5 2 0 3 4 1) (200 10 1) simpleGrading (1 0.1 1)';
h22=');';
fprintf(f1,'%s\n',h20)
fprintf(f1,'(\n')
fprintf(f1,'%s\n',h21)
fprintf(f1,'%s\n',h22)
fprintf(f1,'\n')
%writing edges
h23='edges';
h24='(';
h25=' arc 2 1';
h26=' arc 5 4';
h27=');';
fprintf(f1,'%s\n',h23)
fprintf(f1,'%s\n',h24)
fprintf(f1,'%s (%d %d %d)\n',h25,0,r,0)
fprintf(f1,'%s (%d %d %d)\n',h26,L,r,0)
fprintf(f1,'%s\n',h27)
fprintf(f1,'\n')
%writing boundary
h28='boundary';
h29='(';
%inlet
h30=' Inlet';
h31=' {';
h32=' type patch;';
h33=' faces';
h34=' (';
h35=' (0 1 2 0)';
fprintf(f1,'%s\n',h28)
fprintf(f1,'%s\n',h29)
fprintf(f1,'%s\n',h30)
fprintf(f1,'%s\n',h31)
fprintf(f1,'%s\n',h32)
fprintf(f1,'%s\n',h33)
fprintf(f1,'%s\n',h34)
fprintf(f1,'%s\n',h35)
h36=' );';
h37=' }';
fprintf(f1,'%s\n',h36)
fprintf(f1,'%s\n',h37)
%outlet
h38=' Outlet';
h39=' {';
h40=' type patch;';
h41=' faces';
h42=' (';
h43=' (3 5 4 3)';
h44=' );';
h45=' }';
fprintf(f1,'%s\n',h38)
fprintf(f1,'%s\n',h39)
fprintf(f1,'%s\n',h40)
fprintf(f1,'%s\n',h41)
fprintf(f1,'%s\n',h42)
fprintf(f1,'%s\n',h43)
fprintf(f1,'%s\n',h44)
fprintf(f1,'%s\n',h45)
%surface
h46=' surface';
h47=' {';
h48=' type wall;';
h49=' faces';
h50=' (';
h51=' (2 1 4 5)';
h52=' );';
h53=' }';
fprintf(f1,'%s\n',h46)
fprintf(f1,'%s\n',h47)
fprintf(f1,'%s\n',h48)
fprintf(f1,'%s\n',h49)
fprintf(f1,'%s\n',h50)
fprintf(f1,'%s\n',h51)
fprintf(f1,'%s\n',h52)
fprintf(f1,'%s\n',h53)
%axis
h54=' axis';
h55=' {';
h56=' type empty;';
h57=' faces';
h58=' (';
h59=' (0 3 3 0)';
h60=' );';
h61=' }';
fprintf(f1,'%s\n',h54)
fprintf(f1,'%s\n',h55)
fprintf(f1,'%s\n',h56)
fprintf(f1,'%s\n',h57)
fprintf(f1,'%s\n',h58)
fprintf(f1,'%s\n',h59)
fprintf(f1,'%s\n',h60)
fprintf(f1,'%s\n',h61)
%front
h62=' front';
h63=' {';
h64=' type wedge;';
h65=' faces';
h66=' (';
h67=' (0 3 4 1)';
h68=' );';
h69=' }';
fprintf(f1,'%s\n',h62)
fprintf(f1,'%s\n',h63)
fprintf(f1,'%s\n',h64)
fprintf(f1,'%s\n',h65)
fprintf(f1,'%s\n',h66)
fprintf(f1,'%s\n',h67)
fprintf(f1,'%s\n',h68)
fprintf(f1,'%s\n',h69)
%back
h70=' back';
h71=' {';
h72=' type wedge;';
h73=' faces';
h74=' (';
h75=' (0 2 5 3)';
h76=' );';
h77=' }';
fprintf(f1,'%s\n',h70)
fprintf(f1,'%s\n',h71)
fprintf(f1,'%s\n',h72)
fprintf(f1,'%s\n',h73)
fprintf(f1,'%s\n',h74)
fprintf(f1,'%s\n',h75)
fprintf(f1,'%s\n',h76)
fprintf(f1,'%s\n',h77)
fprintf(f1,')\n')
fprintf(f1,'\n')
%Final part
h78='mergePatchPairs';
h79='(';
h80=');';
h81='// ************************************************************************* //';
fprintf(f1,'%s\n',h78)
fprintf(f1,'%s\n',h79)
fprintf(f1,'%s\n',h80)
fprintf(f1,'\n')
fprintf(f1,'%s\n',h81)
In the same way we can write codes for other cases. All we need to change the 'wedge angle' variable in this code. In order change the boundary condition change the type from 'wedge' to 'symmetry' in the code.
CASE 1 - WEDGE BOUNDARY CONDITION
- 'blockMeshDict' file for 10 deg
/*--------------------------------*- 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.300000e+00 0 0)
(2.300000e+00 9.961947e-03 8.715574e-04)
(2.300000e+00 9.961947e-03 -8.715574e-04)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 10 1) simpleGrading (1 0.1 1)
);
edges
(
arc 2 1 (0 1.000000e-02 0)
arc 5 4 (2.300000e+00 1.000000e-02 0)
);
boundary
(
Inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
Outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
surface
{
type wall;
faces
(
(2 1 4 5)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
(0 2 5 3)
);
}
)
mergePatchPairs
(
);
// ************************************************************************* //
- 'blockMeshDict' file for 25 deg
/*--------------------------------*- 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.762960e-03 2.164396e-03)
(0 9.762960e-03 -2.164396e-03)
(2.300000e+00 0 0)
(2.300000e+00 9.762960e-03 2.164396e-03)
(2.300000e+00 9.762960e-03 -2.164396e-03)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 10 1) simpleGrading (1 0.1 1)
);
edges
(
arc 2 1 (0 1.000000e-02 0)
arc 5 4 (2.300000e+00 1.000000e-02 0)
);
boundary
(
Inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
Outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
surface
{
type wall;
faces
(
(2 1 4 5)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
(0 2 5 3)
);
}
)
mergePatchPairs
(
);
// ************************************************************************* //
- 'blockMeshDict' file for 45 deg
/*--------------------------------*- 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.238795e-03 3.826834e-03)
(0 9.238795e-03 -3.826834e-03)
(2.300000e+00 0 0)
(2.300000e+00 9.238795e-03 3.826834e-03)
(2.300000e+00 9.238795e-03 -3.826834e-03)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 10 1) simpleGrading (1 0.1 1)
);
edges
(
arc 2 1 (0 1.000000e-02 0)
arc 5 4 (2.300000e+00 1.000000e-02 0)
);
boundary
(
Inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
Outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
surface
{
type wall;
faces
(
(2 1 4 5)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
(0 2 5 3)
);
}
)
mergePatchPairs
(
);
// ************************************************************************* //
- 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;
}
surface
{
type zeroGradient;
}
axis
{
type empty;
}
front
{
type wedge;
}
back
{
type wedge;
}
}
// ************************************************************************* //
- 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.0935 0 0);
}
Outlet
{
type zeroGradient;
}
surface
{
type noSlip;
}
axis
{
type empty;
}
front
{
type wedge;
}
back
{
type wedge;
}
}
// ************************************************************************* //
- controlDict
/*--------------------------------*- 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 25;
deltaT 0.01;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
- fvSchemes
/*--------------------------------*- 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 fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(p) Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss linear;
}
laplacianSchemes
{
default Gauss linear orthogonal;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default orthogonal;
}
// ************************************************************************* //
- fvSolution
/*--------------------------------*- 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 fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0.05;
}
pFinal
{
$p;
relTol 0;
}
U
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-05;
relTol 0;
}
}
PISO
{
nCorrectors 2;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
// ************************************************************************* //
- transportProperties
/*--------------------------------*- 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] 8.9e-07;
// ************************************************************************* //
CASE 1 - SYMMETRY BOUNDARY CONDITION
- 'blockMeshDict' file for 10 deg
/*--------------------------------*- 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.300000e+00 0 0)
(2.300000e+00 9.961947e-03 8.715574e-04)
(2.300000e+00 9.961947e-03 -8.715574e-04)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 10 1) simpleGrading (1 0.1 1)
);
edges
(
arc 2 1 (0 1.000000e-02 0)
arc 5 4 (2.300000e+00 1.000000e-02 0)
);
boundary
(
Inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
Outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
surface
{
type wall;
faces
(
(2 1 4 5)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
back
{
type symmetry;
faces
(
(0 2 5 3)
);
}
)
mergePatchPairs
(
);
// ************************************************************************* //
- 'blockMeshDict' file for 25 deg
/*--------------------------------*- 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.762960e-03 2.164396e-03)
(0 9.762960e-03 -2.164396e-03)
(2.300000e+00 0 0)
(2.300000e+00 9.762960e-03 2.164396e-03)
(2.300000e+00 9.762960e-03 -2.164396e-03)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 10 1) simpleGrading (1 0.1 1)
);
edges
(
arc 2 1 (0 1.000000e-02 0)
arc 5 4 (2.300000e+00 1.000000e-02 0)
);
boundary
(
Inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
Outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
surface
{
type wall;
faces
(
(2 1 4 5)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
back
{
type symmetry;
faces
(
(0 2 5 3)
);
}
)
mergePatchPairs
(
);
// ************************************************************************* //
- 'blockMeshDict' file for 45 deg
/*--------------------------------*- 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.238795e-03 3.826834e-03)
(0 9.238795e-03 -3.826834e-03)
(2.300000e+00 0 0)
(2.300000e+00 9.238795e-03 3.826834e-03)
(2.300000e+00 9.238795e-03 -3.826834e-03)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 10 1) simpleGrading (1 0.1 1)
);
edges
(
arc 2 1 (0 1.000000e-02 0)
arc 5 4 (2.300000e+00 1.000000e-02 0)
);
boundary
(
Inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
Outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
surface
{
type wall;
faces
(
(2 1 4 5)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
back
{
type symmetry;
faces
(
(0 2 5 3)
);
}
)
mergePatchPairs
(
);
// ************************************************************************* //
- 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;
}
surface
{
type zeroGradient;
}
axis
{
type empty;
}
front
{
type symmetry;
}
back
{
type symmetry;
}
}
// ************************************************************************* //
- 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.0935 0 0);
}
Outlet
{
type zeroGradient;
}
surface
{
type noSlip;
}
axis
{
type empty;
}
front
{
type symmetry;
}
back
{
type symmetry;
}
}
// ************************************************************************* //
- controlDict
/*--------------------------------*- 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 25;
deltaT 0.01;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
- fvSchemes
/*--------------------------------*- 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 fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(p) Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss linear;
}
laplacianSchemes
{
default Gauss linear orthogonal;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default orthogonal;
}
// ************************************************************************* //
- fvSolution
/*--------------------------------*- 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 fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0.05;
}
pFinal
{
$p;
relTol 0;
}
U
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-05;
relTol 0;
}
}
PISO
{
nCorrectors 2;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
// ************************************************************************* //
- transportProperties
/*--------------------------------*- 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] 8.9e-07;
// ************************************************************************* //
RESULTS
1.Geometry of wedge angle 10 deg
- Meshed Geometry

- Velocity distribution over the geometry

- Pressure distribution over the geometry

2.Geometry of wedge angle 25 deg
- Meshed geometry

- Velocity distribution over the geometry

- Pressure distribution over the geometry

3.Geometry of wedge angle 45 deg
- Meshed geometry

- Velocity distribution over the geometry

- Pressure distribution over the geometry

PLOTS
1.Velocity variation with respect to radial distance
- Geometry of wedge angle 10 deg


- Geometry of wedge angle 25 deg


- Geometry of wedge angle 45 deg


2.Pressure variation with respect to axial distance
- Geometry of wedge angle 10 deg


- Geometry of wedge angle 25 deg


- Geometry of wedge angle 45 deg


1.Shear stress variation with respect to radial distance
- Geometry of wedge angle 10 deg


- Geometry of wedge angle 25 deg


- Geometry of wedge angle 45 deg


CONCLUSION
- Validation of Maximum velocity
From the velocity variation graphs (both cases of wedge and symmetry BCs) mentioned above, we can see that the maximum velocity of flow is, 0.18 m/s
When we calculate maximum velocity theoretically using the formula,
`u_max=2v_(avg)`
From the previous challenge we find out the average velocity, which is 0.0935 m/s.
Therefore we get
`u_max`=0.187 m/s
So the numerical result matches with the analytical result.
- Validation of Shear stress
From the shear stress variation graphs (both cases of wedge and symmetry BCs) mentioned above, we getting the shear stress nearly as,
- 0.032 Pa for geometry with wedge angle `10^0`
- 0.033 Pa for geometry with wedge angle `25^0`
- 0.034 Pa for geometry with wedge angle `45^0`
When we calculate shear stress theoretically by using formula,
`tau=(2muv_max)/r`
Where, `mu=0.00089 Pas`
'r' is the distance from centre of the pipe to the wall a.k.a radius at hydrodynamic entrance region
So, `r=0.01m`
Therefore we get shear stress as,
`tau=`0.0.33 Pa
So here also the numerical result matches with the analytical result.
- Difference between wedge boundary condition and symmetry boundary condition
The wedge boundary condition is used in computational fluid dynamics to define an axisymmetric situation, for eg. cylinder. This boundary condition is specified by two planes that must be selected on separate sides of the domain (referred to as front and back) on surfaces running along the axis.
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. The fluxes across the symmetry are zero. The normal components of all variables are set to zero.
The main difference between the two conditions is that the wedge boundary condition can be applied to very small angles and the symmetry condition can be applied to larger angles. During the wedge boundary condition simulation, the simulation across the arc is not done. But in the case of symmetry boundary condition, the calculation across the arc is done, hence the simulation time is higher in this case. The courant number is slightly increasing in the case of wedge boundary condition than symmetry boundary condition. So the symmetry boundary condition will be slightly more accurate.