Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
Objective:-
To use the symmetry boundary condition to simulate a laminar flow through a pipe with a constant cross-sectional area. To simulate for the angles listed, which are 10, 25, and 45 degrees, using both symmetric and wedge boundary conditions and validate them with HP equations.
Length of entrance:-
The length of the entrance is how far fluid has to move after it goes into a pipe before the flow is at its fullest. The length of the entry region, where effects from the pipe's inner wall spread into the flow as an expanding boundary layer, is called the "entrance length." When the boundary layer fills the whole pipe, the flow becomes a fully developed flow where the flow characteristics don't change as far along the pipe you go. There are many different entrance lengths to describe different flow conditions.

Hydrodynamic entrance length:-
The hydrodynamic entrance region is the part of a pipe where viscous forces from the inside wall of the pipe cause fluid entering the pipe to develop a speed profile. This area doesn't have a steady flow. Fluid goes into a pipe at a constant speed. Because of the no-slip rule, fluid particles in the layer that touches the pipe's surface stop moving. Due to viscous forces in the fluid, the layer closest to the pipe wall doesn't move as fast as the layers around it. This makes a velocity profile. To keep the mass constant, the fluid layers in the middle of the pipe move faster to make up for the slower fluid layers near the pipe's surface. It makes the speed change across the pipe's cross-section.
Le = 0.006*Re*D for laminar flow.
In order to do the simulation, we need to use some variables to find the properties. Those are Hagen Poiseuille equations.
Variables:-
Diameter, D=0.004
Radius,r=0.002
Radial Distance,R=0 to r
Dynamic viscosity, mu= 0.00089 N/m^2
Density, rho=997 kg/m^3
Reynolds number, Re=2100
Hagen Poiseuille's Law:
In non ideal fluid dynamics, Hagen-poiseuille equation is a physical law that gives pressure drop in an incompressible and newtonian fluid in a laminar flow through a long cylinder pipe of constant cross section.
Formulas:-
Average velocity V_avg= (Re.mu)/(rho.D)
Maximum velocity V_max= 2*V_avg
Pressure Difference △P=(8*mu*L*V_avg)/r^2
Kinematic pressure difference △Pk= △P/rho
Shear stress =(2*mu*V_max*R)/r^2
Procedure:-
Will start by copying the cavity file from the tutorial to the FOAM RUN folder.
We will only simulate in the run folder, and any changes we want to make to the blockMeshDict, Pressure, Velocity, and ControlDict files will be made here.
Creating the block in OpenFoam: Here, we're making the wedge. After making the necessary changes to the blockMeshDict file, run the blockMesh command to check the geometry.
After making the wedge, set the boundary conditions, set the simulation end time and time-step so that the courant number is less than 0.5, and set the kinematic viscosity in the transport properties.
After figuring out how long it takes for the fluid to move from the inlet to the outlet, RUN the simulation using the icoFoam solver.
After the simulation, use paraFoam to look at the flow inside the wedge. Then, use the plot over line command to look at the changes in velocity and shear stress at a point after the hydrodynamic entry region. This lets us look at the fluid's fully developed region.
Use Matlab to parse the blockMeshDict so that the same file can be used for all wedge values.
MATLAB CODE:-
clear
close all
clc
Re = 2100;
Ld = 2;
nu = 8.917e-7;
rho = 997;
D = 0.01;
mu = nu*rho;
le = 0.06*Re*D;
l = le +Ld;
V_avg = mu*Re/(rho*D);
V_max = 2*V_avg;
r = D/2 ;
% Hagen Poisulle equation
delta_p = 8*mu*V_avg*(l/r^2);
kinematic_p = delta_p/rho;
% calculating shear stress
R = linspace(0,D/2,1000);
% Wedge angle
theta = 10;
for i = 1:length(R)
tau(i) = 2*mu*V_max*(abs(R(i)))/r^2;
end
% plot
plot(R,tau)
xlabel('Radius in m')
ylabel('shear stress')
title('variation of shear stress along radius cylinder')
grid on
hold on
% Defining the vertices of block
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)];
% header file
h1 ='/*--------------------------------*- C++ -*----------------------------------*\'
h2 ='| ========= | |'
h3 ='| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |'
h4 ='| \\ / O peration | Version: v2112 |'
h5 ='| \\ / A nd | Website: www.openfoam.com |'
h6 ='| \\/ M anipulation | |'
h7 ='\*---------------------------------------------------------------------------*/'
h8 ='FoamFile'
h9 ='{'
h10 =' version 2.0;'
h11 =' format ascii;'
h12 =' class dictionary;'
h13 =' object blockMeshDict;'
h14 ='}'
h15 =' // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //'
f1 = fopen('blockMeshDict','w')
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,'\n');
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');
fprintf(f1,'%2s \n','convertToMeters 1;');
fprintf(f1,'\n');
% Defining vertices
fprintf(f1,'%s \n','vertices');
fprintf(f1,'%s \n','(');
fprintf(f1,'\t(%d %d %d)\n',v0(1),v0(2),v0(3));
fprintf(f1,'\t(%d %d %d)\n',v1(1),v1(2),v1(3));
fprintf(f1,'\t(%d %d %d)\n',v2(1),v2(2),v2(3));
fprintf(f1,'\t(%d %d %d)\n',v3(1),v3(2),v3(3));
fprintf(f1,'\t(%d %d %d)\n',v4(1),v4(2),v4(3));
fprintf(f1,'\t(%d %d %d)\n',v5(1),v5(2),v5(3));
fprintf(f1,'%s \n',');');
% Defining blocks
fprintf(f1,'\n');
fprintf(f1,'%s \n','blocks');
fprintf(f1,'%s \n','(');
fprintf(f1,'\t hex (0 3 4 1 0 3 5 2) (%d %d %d) simpleGrading (1 1 1)\n',200,50,1);
fprintf(f1,'%s \n',');');
% Defining edges
fprintf(f1,'\n');
fprintf(f1,'%s \n','edges');
fprintf(f1,'%s \n','(');
fprintf(f1,' \t arc 1 2 (%d %d %d)\n',0,r,0);
fprintf(f1,' \t arc 4 5 (%d %d %d)\n',l,r,0);
fprintf(f1,'%s \n',');');
fprintf(f1, 'boundary\n')
fprintf(f1, '(\n')
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 (0 1 2 0)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
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 (3 5 4 3)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '\t top\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 (1 4 5 2)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '\t front\n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t type wedge;\n')
fprintf(f1, '\t\t faces\n')
fprintf(f1, '\t\t (\n')
fprintf(f1, '\t\t\t (0 3 4 1)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '\t back\n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t type wedge;\n')
fprintf(f1, '\t\t faces\n')
fprintf(f1, '\t\t (\n')
fprintf(f1, '\t\t\t (0 2 5 3)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
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 (0 3 3 0)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '); \n\n')
fprintf(f1, 'mergePatchPairs\n')
fprintf(f1, '(\n')
fprintf(f1, ');\n')
header9='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //'
fprintf(f1, '%s\n',header9)
fclose(f1)
blockMeshDict File Generated By Matlab :
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 4.980973e-03 -4.357787e-04)
(0 4.980973e-03 4.357787e-04)
(3.260000e+00 0 0)
(3.260000e+00 4.980973e-03 -4.357787e-04)
(3.260000e+00 4.980973e-03 4.357787e-04)
);
blocks
(
hex (0 3 4 1 0 3 5 2) (200 50 1) simpleGrading (1 1 1)
);
edges
(
arc 1 2 (0 5.000000e-03 0)
arc 4 5 (3.260000e+00 5.000000e-03 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
(0 2 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Matlab Code For Writing blockMeshDict File of theta- 25 degrees :
clear
close all
clc
Re = 2100;
Ld = 2;
nu = 8.917e-7;
rho = 997;
D = 0.01;
mu = nu*rho;
le = 0.06*Re*D;
l = le +Ld;
V_avg = mu*Re/(rho*D);
V_max = 2*V_avg;
r = D/2 ;
% Hagen Poisulle equation
delta_p = 8*mu*V_avg*(l/r^2);
kinematic_p = delta_p/rho;
% calculating shear stress
R = linspace(0,D/2,1000);
% Wedge angle
theta = 25;
for i = 1:length(R)
tau(i) = 2*mu*V_max*(abs(R(i)))/r^2;
end
% plot
plot(R,tau)
xlabel('Radius in m')
ylabel('shear stress')
title('variation of shear stress along radius cylinder')
grid on
hold on
% Defining the vertices of block
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)];
% header file
h1 ='/*--------------------------------*- C++ -*----------------------------------*\'
h2 ='| ========= | |'
h3 ='| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |'
h4 ='| \\ / O peration | Version: v2112 |'
h5 ='| \\ / A nd | Website: www.openfoam.com |'
h6 ='| \\/ M anipulation | |'
h7 ='\*---------------------------------------------------------------------------*/'
h8 ='FoamFile'
h9 ='{'
h10 =' version 2.0;'
h11 =' format ascii;'
h12 =' class dictionary;'
h13 =' object blockMeshDict;'
h14 ='}'
h15 =' // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //'
f1 = fopen('blockMeshDict','w')
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,'\n');
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');
fprintf(f1,'%2s \n','convertToMeters 1;');
fprintf(f1,'\n');
% Defining vertices
fprintf(f1,'%s \n','vertices');
fprintf(f1,'%s \n','(');
fprintf(f1,'\t(%d %d %d)\n',v0(1),v0(2),v0(3));
fprintf(f1,'\t(%d %d %d)\n',v1(1),v1(2),v1(3));
fprintf(f1,'\t(%d %d %d)\n',v2(1),v2(2),v2(3));
fprintf(f1,'\t(%d %d %d)\n',v3(1),v3(2),v3(3));
fprintf(f1,'\t(%d %d %d)\n',v4(1),v4(2),v4(3));
fprintf(f1,'\t(%d %d %d)\n',v5(1),v5(2),v5(3));
fprintf(f1,'%s \n',');');
% Defining blocks
fprintf(f1,'\n');
fprintf(f1,'%s \n','blocks');
fprintf(f1,'%s \n','(');
fprintf(f1,'\t hex (0 3 4 1 0 3 5 2) (%d %d %d) simpleGrading (1 1 1)\n',200,50,1);
fprintf(f1,'%s \n',');');
% Defining edges
fprintf(f1,'\n');
fprintf(f1,'%s \n','edges');
fprintf(f1,'%s \n','(');
fprintf(f1,' \t arc 1 2 (%d %d %d)\n',0,r,0);
fprintf(f1,' \t arc 4 5 (%d %d %d)\n',l,r,0);
fprintf(f1,'%s \n',');');
fprintf(f1, 'boundary\n')
fprintf(f1, '(\n')
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 (0 1 2 0)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
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 (3 5 4 3)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '\t top\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 (1 4 5 2)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '\t front\n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t type wedge;\n')
fprintf(f1, '\t\t faces\n')
fprintf(f1, '\t\t (\n')
fprintf(f1, '\t\t\t (0 3 4 1)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '\t back\n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t type wedge;\n')
fprintf(f1, '\t\t faces\n')
fprintf(f1, '\t\t (\n')
fprintf(f1, '\t\t\t (0 2 5 3)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
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 (0 3 3 0)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '); \n\n')
fprintf(f1, 'mergePatchPairs\n')
fprintf(f1, '(\n')
fprintf(f1, ');\n')
header9='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //'
fprintf(f1, '%s\n',header9)
fclose(f1)
blockMeshDict File Generated By Matlab :
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 4.881480e-03 -1.082198e-03)
(0 4.881480e-03 1.082198e-03)
(3.260000e+00 0 0)
(3.260000e+00 4.881480e-03 -1.082198e-03)
(3.260000e+00 4.881480e-03 1.082198e-03)
);
blocks
(
hex (0 3 4 1 0 3 5 2) (200 50 1) simpleGrading (1 1 1)
);
edges
(
arc 1 2 (0 5.000000e-03 0)
arc 4 5 (3.260000e+00 5.000000e-03 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
(0 2 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Matlab Code For Writing blockMeshDict File of theta- 45 degrees :
clear
close all
clc
Re = 2100;
Ld = 2;
nu = 8.917e-7;
rho = 997;
D = 0.01;
mu = nu*rho;
le = 0.06*Re*D;
l = le +Ld;
V_avg = mu*Re/(rho*D);
V_max = 2*V_avg;
r = D/2 ;
% Hagen Poisulle equation
delta_p = 8*mu*V_avg*(l/r^2);
kinematic_p = delta_p/rho;
% calculating shear stress
R = linspace(0,D/2,1000);
% Wedge angle
theta = 45;
for i = 1:length(R)
tau(i) = 2*mu*V_max*(abs(R(i)))/r^2;
end
% plot
plot(R,tau)
xlabel('Radius in m')
ylabel('shear stress')
title('variation of shear stress along radius cylinder')
grid on
hold on
% Defining the vertices of block
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)];
% header file
h1 ='/*--------------------------------*- C++ -*----------------------------------*\'
h2 ='| ========= | |'
h3 ='| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |'
h4 ='| \\ / O peration | Version: v2112 |'
h5 ='| \\ / A nd | Website: www.openfoam.com |'
h6 ='| \\/ M anipulation | |'
h7 ='\*---------------------------------------------------------------------------*/'
h8 ='FoamFile'
h9 ='{'
h10 =' version 2.0;'
h11 =' format ascii;'
h12 =' class dictionary;'
h13 =' object blockMeshDict;'
h14 ='}'
h15 =' // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //'
f1 = fopen('blockMeshDict','w')
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,'\n');
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');
fprintf(f1,'%2s \n','convertToMeters 1;');
fprintf(f1,'\n');
% Defining vertices
fprintf(f1,'%s \n','vertices');
fprintf(f1,'%s \n','(');
fprintf(f1,'\t(%d %d %d)\n',v0(1),v0(2),v0(3));
fprintf(f1,'\t(%d %d %d)\n',v1(1),v1(2),v1(3));
fprintf(f1,'\t(%d %d %d)\n',v2(1),v2(2),v2(3));
fprintf(f1,'\t(%d %d %d)\n',v3(1),v3(2),v3(3));
fprintf(f1,'\t(%d %d %d)\n',v4(1),v4(2),v4(3));
fprintf(f1,'\t(%d %d %d)\n',v5(1),v5(2),v5(3));
fprintf(f1,'%s \n',');');
% Defining blocks
fprintf(f1,'\n');
fprintf(f1,'%s \n','blocks');
fprintf(f1,'%s \n','(');
fprintf(f1,'\t hex (0 3 4 1 0 3 5 2) (%d %d %d) simpleGrading (1 1 1)\n',200,50,1);
fprintf(f1,'%s \n',');');
% Defining edges
fprintf(f1,'\n');
fprintf(f1,'%s \n','edges');
fprintf(f1,'%s \n','(');
fprintf(f1,' \t arc 1 2 (%d %d %d)\n',0,r,0);
fprintf(f1,' \t arc 4 5 (%d %d %d)\n',l,r,0);
fprintf(f1,'%s \n',');');
fprintf(f1, 'boundary\n')
fprintf(f1, '(\n')
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 (0 1 2 0)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
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 (3 5 4 3)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '\t top\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 (1 4 5 2)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '\t front\n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t type wedge;\n')
fprintf(f1, '\t\t faces\n')
fprintf(f1, '\t\t (\n')
fprintf(f1, '\t\t\t (0 3 4 1)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '\t back\n')
fprintf(f1, '\t {\n')
fprintf(f1, '\t\t type wedge;\n')
fprintf(f1, '\t\t faces\n')
fprintf(f1, '\t\t (\n')
fprintf(f1, '\t\t\t (0 2 5 3)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
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 (0 3 3 0)\n')
fprintf(f1, '\t\t );\n')
fprintf(f1, '\t }\n')
fprintf(f1, '); \n\n')
fprintf(f1, 'mergePatchPairs\n')
fprintf(f1, '(\n')
fprintf(f1, ');\n')
header9='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //'
fprintf(f1, '%s\n',header9)
fclose(f1)
blockMeshDict File Generated By Matlab :
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 4.619398e-03 -1.913417e-03)
(0 4.619398e-03 1.913417e-03)
(3.260000e+00 0 0)
(3.260000e+00 4.619398e-03 -1.913417e-03)
(3.260000e+00 4.619398e-03 1.913417e-03)
);
blocks
(
hex (0 3 4 1 0 3 5 2) (200 50 1) simpleGrading (1 1 1)
);
edges
(
arc 1 2 (0 5.000000e-03 0)
arc 4 5 (3.260000e+00 5.000000e-03 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
(0 2 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
controlDict File For theta- 10,25 and 45 degrees :
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 8;
deltaT 0.005;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
transportProperties File For theta -10,25 and 45 degrees :
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 8.9e-7;
// ************************************************************************* //
pressure File For theta -10,25 and 45 degrees :
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ 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;
}
top
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
front
{
type wedge;
}
back
{
type wedge;
}
}
// ************************************************************************* //
velocity File For theta- 10,25 and 45 degrees :
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ 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;
}
top
{
type noSlip;
}
inlet
{
type fixedValue;
value uniform (0.187 0 0);
}
outlet
{
type zeroGradient;
}
front
{
type wedge;
}
back
{
type wedge;
}
}
// ************************************************************************* //
Results:-
