Symmetry vs Wedge vs HP equation
AIM :- Result for the pipe flow with symmetry boundary condition.
Write MATLAB program for blockMeshDict file by anyone angle.
PROCEDURE :- For doing this assignment we required detailing about wedge file and symmetry file. Before creating MATLAB file we require to create blockMeshDict file for symmetry and wedge shape and three different angles. For creating these six files I adopted following points as-
- First off all describe the six vertices in blockMeshDict file because in wedge shape there have only sic points.
- For symmetry shape I just Changes FrontWedge and BackWedge into the symmetry and remaining faces are keep constant.
- Then I describe \'hex\' in eight points as same corner points as double.
- Describe faces in X, Y, Z direction by using \'Global co-ordinate system\' .
- Describe simpleGrading Factor by using \'Global co-ordinate system\'.
- Then I describe all boundary conditions by using \'loca co-ordinate system\' like inlet, outlet, TopWall, FrontWedge, BackWedge and axis by using respected types.
- Then I merge these pairs.
- Later on I describe \'p\' and \'U\' file by using respected boundary conditions.
- Like these I created three files for wedge shape and three files for symmetry shapes.\\
- Later on I created MATLAB program for any one angle.
- These overall procedure one things keep in mind that angle must be in degree and half of the total.
Given Task as-
In the previous part we looked into the simulation results for a laminar, incompressible flow through a pipe in OpenFoam. Now in this section, we would attempt the same problem with the symmetry boundary conditions.
MATLAB script to create blockMeshDict file :-
The program will be same like wedge blockMeshDict file but the only difference is the use of symmetry patch in it and the different symmetry angles.
MATLAB code :-
Symmetry shape :-
a) theta=10 :-
clear all
close all
clc
% MATLAB programm for automaticaly generated the blockMeshDIct file for wedge angle provided by the user-
% consider variable values
r=0.005;
L=2;
theta=10;
% specifying string for header part-
line1=\'|*- - - - - - - - - - - - - - * - C + + - * - - - - - - - - - - - - - - - - - - - - -*\';
line2=\'| ============= |\';
line3=\'| \\\\ / F ield | |\';
line4=\'| \\\\ / O peration | OpenFOAM : The Open Source CFD Toolbox |\';
line5=\'| \\\\ / A nd | Version : 4.0 |\';
line6=\'| \\\\ / M anipulaion | Web : www.OpenFOAM.org |\';
line7=\'\\ *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * /\';
line8=\' FoamFile\';
line9=\'{\';
line10=\' Version 2.0;\';
line11=\' format asscii;\';
line12=\' class dictionary;\';
line13=\' object blockMeshDict;\';
line14=\'}\';
line15=\'// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//\';
conv=\'ConverToMeters 1;\';
s1=blanks(5);
s2=blanks(10);
s3=blanks(15);
v0=[0 0 0];
v1=[0 r*cosd(5) r*sin(5)];
v2=[0 r*cosd(5) -r*sind(5)];
v3=[L 0 0];
v4=[L r*cosd(5) r*sind(5)];
v5=[L r*cosd(5) -r*sind(5)];
block= \'hex(0 2 1 0 3 5 4 3)(25 1 500) simpleGrading (0.2 1 1)\';
edge1=\'arc 1 2\';
edge2=\'arc 4 5\';
e1=[0 r 0];
e2=[L r 0];
Inlet=\'(0 2 1 0)\';
Outlet=\'(3 5 4 3)\';
TopWall=\'(5 2 1 4)\';
FrontWedge=\'(0 1 4 3)\';
BackWedge=\'(0 3 5 2)\';
Axis=\'(0 0 3 3)\';
final=\'// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //*\';
% writting the blockMeshDict file
f1=fopen(\'blockMeshDict.txt\',\'w\');
fprintf(f1,\'\\n\');
fprintf(f1,\'%s %s\\n\',line1);
fprintf(f1,\'%s %s\\n\',line2);
fprintf(f1,\'%s %s\\n\',line3);
fprintf(f1,\'%s %s\\n\',line4);
fprintf(f1,\'%s %s\\n\',line5);
fprintf(f1,\'%s %s\\n\',line6);
fprintf(f1,\'%s %s\\n\',line7);
fprintf(f1,\'%s %s\\n\',line8);
fprintf(f1,\'%s %s\\n\',line9);
fprintf(f1,\'%s %s\\n\',line10);
fprintf(f1,\'%s %s\\n\',line11);
fprintf(f1,\'%s %s\\n\',line12);
fprintf(f1,\'%s %s\\n\',line13);
fprintf(f1,\'%s %s\\n\',line14);
fprintf(f1,\'%s %s\\n\',line15);
fprintf(f1,\'%s\\n\');
fprintf(f1,\'%s %s\\n\',conv);
fprintf(f1,\'\\n\');
fprintf(f1,\'%s\\n\',\'vertices\');
fprintf(f1,\'%s\\n\',\');\');
fprintf(f1,\'%s (%f\\n %f\\n %f\\n)\',s1,v0(1),v0(2),v0(3),\'\\n\');
fprintf(f1,\'%s (%f %f %f)\\n\',s1,v1(1),v1(2),v1(3));
fprintf(f1,\'%s (%f %f %f)\\n\',s1,v2(1),v2(2),v2(3));
fprintf(f1,\'%s (%f %f %f)\\n\',s1,v3(1),v3(2),v3(3));
fprintf(f1,\'%s (%f %f %f)\\n\',s1,v4(1),v4(2),v4(3));
fprintf(f1,\'%s (%f %f %f)\\n\',s1,v5(1),v5(2),v5(3));
fprintf(f1,\'%s\\n\',\');\');
fprintf(f1,\'\\n\');
fprintf(f1,\'%s\\n\',\'blocks\');
fprintf(f1,\'%s\\n\',\'(\');
fprintf(f1,\'%s %s\\n\',s1,block);
fprintf(f1,\'%s\\n\',\');\');
fprintf(f1,\'\\n\');
fprintf(f1,\'%s\\n\',\'edges\');
fprintf(f1,\'%s\\n\',\'(\');
fprintf(f1,\'%s\\n\',\')\');
fprintf(f1,\'%s\\n\',\'boundary\');
fprintf(f1,\'%s\\n\',\'(\');
fprintf(f1,\'%s %s\\n\',s1,\'Inlet\');
fprintf(f1,\'%s %s\\n\',s1,\'{\');
fprintf(f1,\'%s %s\\n\',s2,\'type patch;\');
fprintf(f1,\'%s %s\\n\',s2,\'faces\');
fprintf(f1,\'%s %s\\n\',s3,\'(\');
fprintf(f1,\'%s %s\\n\',\'inlet\');
fprintf(f1,\'%s %s\\n\',\')\');
fprintf(f1,\'%s %s\\n\',\'}\');
fprintf(f1,\'%s %s\\n\',s1,\'Outlet\');
fprintf(f1,\'%s %s\\n\',s1,\'{\');
fprintf(f1,\'%s %s\\n\',s2,\'type patch;\');
fprintf(f1,\'%s %s\\n\',s2,\'faces\');
fprintf(f1,\'%s %s\\n\',s2,\'(\');
fprintf(f1,\'%s %s\\n\',s3,\'Outlet\');
fprintf(f1,\'%s %s\\n\',s2,\')\');
fprintf(f1,\'%s %s\\n\',s1,\'}\');
fprintf(f1,\'%s %s\\n\',s1,\'TopWall\');
fprintf(f1,\'%s %s\\n\',s1,\'{\');
fprintf(f1,\'%s %s\\n\',s2,\'type wall;\');
fprintf(f1,\'%s %s\\n\',s2,\'faces\');
fprintf(f1,\'%s %s\\n\',s2,\'(\');
fprintf(f1,\'%s %s\\n\',s3,\'TopWall\');
fprintf(f1,\'%s %s\\n\',s2,\')\');
fprintf(f1,\'%s %s\\n\',s1,\'}\');
fprintf(f1,\'%s %s\\n\',s1,\'FrontWedge\');
fprintf(f1,\'%s %s\\n\',s1,\'{\');
fprintf(f1,\'%s %s\\n\',s2,\'type symmetry;\');
fprintf(f1,\'%s %s\\n\',s2,\'faces\');
fprintf(f1,\'%s %s\\n\',s2,\'(\');
fprintf(f1,\'%s %s\\n\',s3,\'FrontWedge\');
fprintf(f1,\'%s %s\\n\',s2,\')\');
fprintf(f1,\'%s %s\\n\',s1,\'}\');
fprintf(f1,\'%s %s\\n\',s1,\'BackWedge\');
fprintf(f1,\'%s %s\\n\',s1,\'{\');
fprintf(f1,\'%s %s\\n\',s2,\'type symmetry;\');
fprintf(f1,\'%s %s\\n\',s2,\'faces\');
fprintf(f1,\'%s %s\\n\',s2,\'(\');
fprintf(f1,\'%s %s\\n\',s3,\'BackWedge\');
fprintf(f1,\'%s %s\\n\',s2,\')\');
fprintf(f1,\'%s %s\\n\',s1,\'}\');
fprintf(f1,\'%s %s\\n\',s1,\'Axis\');
fprintf(f1,\'%s %s\\n\',s1,\'{\');
fprintf(f1,\'%s %s\\n\',s2,\'type empty;\');
fprintf(f1,\'%s %s\\n\',s2,\'faces\');
fprintf(f1,\'%s %s\\n\',s2,\'(\');
fprintf(f1,\'%s %s\\n\',s3,\'Axis\');
fprintf(f1,\'%s %s\\n\',s2,\')\');
fprintf(f1,\'%s %s\\n\',s1,\'}\');
fprintf(f1,\'%s\\n\',\')\');
fprintf(f1,\'\\n\');
fprintf(f1,\'%s\\n\',\'mergePatchPairs\');
fprintf(f1,\'%s\\n\',\'(\');
fprintf(f1,\'%s\\n\',\')\');
fprintf(f1,\'\\n\');
fprintf(f1,\'%s\\n\',\'final\');
fclose(f1)
b) For theta=25 (only vertices changes) :-
v0=[0 0 0];
v1=[0 r*cosd(12.5) r*sin(12.5)];
v2=[0 r*cosd(12.5) -r*sind(12.5)];
v3=[L 0 0];
v4=[L r*cosd(12.5) r*sind(12.5)];
v5=[L r*cosd(12.5) -r*sind(12.5)];
c) For theta=45 (only vertices changes) :-
v0=[0 0 0];
v1=[0 r*cosd(22.5) r*sin(22.5)];
v2=[0 r*cosd(22.5) -r*sind(22.5)];
v3=[L 0 0];
v4=[L r*cosd(22.5) r*sind(22.5)];
v5=[L r*cosd(22.5) -r*sind(22.5)];
For wedge shape :-
a) For theta=10 :-
clear all
close all
clc
% MATLAB programm for automaticaly generated the blockMeshDIct file for wedge angle provided by the user-
% consider variable values
r=0.005;
L=2;
theta=10;
% specifying string for header part-
line1=\'|*- - - - - - - - - - - - - - * - C + + - * - - - - - - - - - - - - - - - - - - - - -*\';
line2=\'| ============= |\';
line3=\'| \\\\ / F ield | |\';
line4=\'| \\\\ / O peration | OpenFOAM : The Open Source CFD Toolbox |\';
line5=\'| \\\\ / A nd | Version : 4.0 |\';
line6=\'| \\\\ / M anipulaion | Web : www.OpenFOAM.org |\';
line7=\'\\ *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * /\';
line8=\' FoamFile\';
line9=\'{\';
line10=\' Version 2.0;\';
line11=\' format asscii;\';
line12=\' class dictionary;\';
line13=\' object blockMeshDict;\';
line14=\'}\';
line15=\'// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//\';
conv=\'ConverToMeters 1;\';
s1=blanks(5);
s2=blanks(10);
s3=blanks(15);
v0=[0 0 0];
v1=[0 r*cosd(5) r*sin(5)];
v2=[0 r*cosd(5) -r*sind(5)];
v3=[L 0 0];
v4=[L r*cosd(5) r*sind(5)];
v5=[L r*cosd(5) -r*sind(5)];
block= \'hex(0 2 1 0 3 5 4 3)(25 1 500) simpleGrading (0.2 1 1)\';
edge1=\'arc 1 2\';
edge2=\'arc 4 5\';
e1=[0 r 0];
e2=[L r 0];
Inlet=\'(0 2 1 0)\';
Outlet=\'(3 5 4 3)\';
TopWall=\'(5 2 1 4)\';
FrontWedge=\'(0 1 4 3)\';
BackWedge=\'(0 3 5 2)\';
Axis=\'(0 0 3 3)\';
final=\'// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //*\';
% writting the blockMeshDict file
f1=fopen(\'blockMeshDict.txt\',\'w\');
fprintf(f1,\'\\n\');
fprintf(f1,\'%s %s\\n\',line1);
fprintf(f1,\'%s %s\\n\',line2);
fprintf(f1,\'%s %s\\n\',line3);
fprintf(f1,\'%s %s\\n\',line4);
fprintf(f1,\'%s %s\\n\',line5);
fprintf(f1,\'%s %s\\n\',line6);
fprintf(f1,\'%s %s\\n\',line7);
fprintf(f1,\'%s %s\\n\',line8);
fprintf(f1,\'%s %s\\n\',line9);
fprintf(f1,\'%s %s\\n\',line10);
fprintf(f1,\'%s %s\\n\',line11);
fprintf(f1,\'%s %s\\n\',line12);
fprintf(f1,\'%s %s\\n\',line13);
fprintf(f1,\'%s %s\\n\',line14);
fprintf(f1,\'%s %s\\n\',line15);
fprintf(f1,\'%s\\n\');
fprintf(f1,\'%s %s\\n\',conv);
fprintf(f1,\'\\n\');
fprintf(f1,\'%s\\n\',\'vertices\');
fprintf(f1,\'%s\\n\',\');\');
fprintf(f1,\'%s (%f\\n %f\\n %f\\n)\',s1,v0(1),v0(2),v0(3),\'\\n\');
fprintf(f1,\'%s (%f %f %f)\\n\',s1,v1(1),v1(2),v1(3));
fprintf(f1,\'%s (%f %f %f)\\n\',s1,v2(1),v2(2),v2(3));
fprintf(f1,\'%s (%f %f %f)\\n\',s1,v3(1),v3(2),v3(3));
fprintf(f1,\'%s (%f %f %f)\\n\',s1,v4(1),v4(2),v4(3));
fprintf(f1,\'%s (%f %f %f)\\n\',s1,v5(1),v5(2),v5(3));
fprintf(f1,\'%s\\n\',\');\');
fprintf(f1,\'\\n\');
fprintf(f1,\'%s\\n\',\'blocks\');
fprintf(f1,\'%s\\n\',\'(\');
fprintf(f1,\'%s %s\\n\',s1,block);
fprintf(f1,\'%s\\n\',\');\');
fprintf(f1,\'\\n\');
fprintf(f1,\'%s\\n\',\'edges\');
fprintf(f1,\'%s\\n\',\'(\');
fprintf(f1,\'%s\\n\',\')\');
fprintf(f1,\'%s\\n\',\'boundary\');
fprintf(f1,\'%s\\n\',\'(\');
fprintf(f1,\'%s %s\\n\',s1,\'Inlet\');
fprintf(f1,\'%s %s\\n\',s1,\'{\');
fprintf(f1,\'%s %s\\n\',s2,\'type patch;\');
fprintf(f1,\'%s %s\\n\',s2,\'faces\');
fprintf(f1,\'%s %s\\n\',s3,\'(\');
fprintf(f1,\'%s %s\\n\',\'inlet\');
fprintf(f1,\'%s %s\\n\',\')\');
fprintf(f1,\'%s %s\\n\',\'}\');
fprintf(f1,\'%s %s\\n\',s1,\'Outlet\');
fprintf(f1,\'%s %s\\n\',s1,\'{\');
fprintf(f1,\'%s %s\\n\',s2,\'type patch;\');
fprintf(f1,\'%s %s\\n\',s2,\'faces\');
fprintf(f1,\'%s %s\\n\',s2,\'(\');
fprintf(f1,\'%s %s\\n\',s3,\'Outlet\');
fprintf(f1,\'%s %s\\n\',s2,\')\');
fprintf(f1,\'%s %s\\n\',s1,\'}\');
fprintf(f1,\'%s %s\\n\',s1,\'TopWall\');
fprintf(f1,\'%s %s\\n\',s1,\'{\');
fprintf(f1,\'%s %s\\n\',s2,\'type wall;\');
fprintf(f1,\'%s %s\\n\',s2,\'faces\');
fprintf(f1,\'%s %s\\n\',s2,\'(\');
fprintf(f1,\'%s %s\\n\',s3,\'TopWall\');
fprintf(f1,\'%s %s\\n\',s2,\')\');
fprintf(f1,\'%s %s\\n\',s1,\'}\');
fprintf(f1,\'%s %s\\n\',s1,\'FrontWedge\');
fprintf(f1,\'%s %s\\n\',s1,\'{\');
fprintf(f1,\'%s %s\\n\',s2,\'type wedge;\');
fprintf(f1,\'%s %s\\n\',s2,\'faces\');
fprintf(f1,\'%s %s\\n\',s2,\'(\');
fprintf(f1,\'%s %s\\n\',s3,\'FrontWedge\');
fprintf(f1,\'%s %s\\n\',s2,\')\');
fprintf(f1,\'%s %s\\n\',s1,\'}\');
fprintf(f1,\'%s %s\\n\',s1,\'BackWedge\');
fprintf(f1,\'%s %s\\n\',s1,\'{\');
fprintf(f1,\'%s %s\\n\',s2,\'type wedge;\');
fprintf(f1,\'%s %s\\n\',s2,\'faces\');
fprintf(f1,\'%s %s\\n\',s2,\'(\');
fprintf(f1,\'%s %s\\n\',s3,\'BackWedge\');
fprintf(f1,\'%s %s\\n\',s2,\')\');
fprintf(f1,\'%s %s\\n\',s1,\'}\');
fprintf(f1,\'%s %s\\n\',s1,\'Axis\');
fprintf(f1,\'%s %s\\n\',s1,\'{\');
fprintf(f1,\'%s %s\\n\',s2,\'type empty;\');
fprintf(f1,\'%s %s\\n\',s2,\'faces\');
fprintf(f1,\'%s %s\\n\',s2,\'(\');
fprintf(f1,\'%s %s\\n\',s3,\'Axis\');
fprintf(f1,\'%s %s\\n\',s2,\')\');
fprintf(f1,\'%s %s\\n\',s1,\'}\');
fprintf(f1,\'%s\\n\',\')\');
fprintf(f1,\'\\n\');
fprintf(f1,\'%s\\n\',\'mergePatchPairs\');
fprintf(f1,\'%s\\n\',\'(\');
fprintf(f1,\'%s\\n\',\')\');
fprintf(f1,\'\\n\');
fprintf(f1,\'%s\\n\',\'final\');
fclose(f1)
b) For theta=25 (only vertices changes) :-
v0=[0 0 0];
v1=[0 r*cosd(12.5) r*sin(12.5)];
v2=[0 r*cosd(12.5) -r*sind(12.5)];
v3=[L 0 0];
v4=[L r*cosd(12.5) r*sind(12.5)];
v5=[L r*cosd(12.5) -r*sind(12.5)];
c) For theta=45 (only vertices changes) :-
v0=[0 0 0];
v1=[0 r*cosd(22.5) r*sin(22.5)];
v2=[0 r*cosd(22.5) -r*sind(22.5)];
v3=[L 0 0];
v4=[L r*cosd(22.5) r*sind(22.5)];
v5=[L r*cosd(22.5) -r*sind(22.5)];
Once MATLAB file created for symmetry and wedge shape then we have to changes only vertices for other different angles as above.
Due to three different angles I created three blockMeshDict file for symmetry and three for wedge shape as follows-
For symmetry shape-
blockMeshDict-1 file :-
/*--------------------------------*- 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 0.00498 0.000436)
(0 0.00498 -0.000436)
(2 0 0)
(2 0.00498 0.000436)
(2 0.00498 -0.000436)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (25 1 200) simpleGrading (0.2 1 1)
);
edges
(
);
boundary
(
Inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
Outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
TopWall
{
type wall;
faces
(
(5 2 1 4)
);
}
FrontWedge
{
type symmetry;
faces
(
(0 1 4 3)
);
}
BackWedge
{
type symmetry;
faces
(
(0 3 5 2)
);
}
Axis
{
type empty;
faces
(
(0 3 0 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
blockMeshDict-2 file :-
/*--------------------------------*- 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 0.00488 0.001082)
(0 0.00488 -0.001082)
(2 0 0)
(2 0.00488 0.001082)
(2 0.00488 -0.001082)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (25 1 200) simpleGrading (0.2 1 1)
);
edges
(
);
boundary
(
Inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
Outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
TopWall
{
type wall;
faces
(
(5 2 1 4)
);
}
FrontWedge
{
type symmetry;
faces
(
(0 1 4 3)
);
}
BackWedge
{
type symmetry;
faces
(
(0 3 5 2)
);
}
Axis
{
type empty;
faces
(
(0 3 0 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
blockMeshDict-3 file :-
/*--------------------------------*- 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 0.00462 0.00191)
(0 0.00462 -0.00191)
(2 0 0)
(2 0.00462 0.00191)
(2 0.00462 -0.00191)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (25 1 200) simpleGrading (0.2 1 1)
);
edges
(
);
boundary
(
Inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
Outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
TopWall
{
type wall;
faces
(
(5 2 1 4)
);
}
FrontWedge
{
type symmetry;
faces
(
(0 1 4 3)
);
}
BackWedge
{
type symmetry;
faces
(
(0 3 5 2)
);
}
Axis
{
type empty;
faces
(
(0 3 0 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
For wedge shape-
blockMeshDict-4 file :-
/*--------------------------------*- 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 0.00498 0.000436)
(0 0.00498 -0.000436)
(2 0 0)
(2 0.00498 0.000436)
(2 0.00498 -0.000436)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (25 1 200) simpleGrading (0.2 1 1)
);
edges
(
);
boundary
(
Inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
Outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
TopWall
{
type wall;
faces
(
(5 2 1 4)
);
}
FrontWedge
{
type wedge;
faces
(
(0 1 4 3)
);
}
BackWedge
{
type wedge;
faces
(
(0 3 5 2)
);
}
Axis
{
type empty;
faces
(
(0 3 0 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
blockMeshDict-5 file :-
/*--------------------------------*- 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 0.00488 0.001082)
(0 0.00488 -0.001082)
(2 0 0)
(2 0.00488 0.001082)
(2 0.00488 -0.001082)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (25 1 200) simpleGrading (0.2 1 1)
);
edges
(
);
boundary
(
Inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
Outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
TopWall
{
type wall;
faces
(
(5 2 1 4)
);
}
FrontWedge
{
type wedge;
faces
(
(0 1 4 3)
);
}
BackWedge
{
type wedge;
faces
(
(0 3 5 2)
);
}
Axis
{
type empty;
faces
(
(0 3 0 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
blockMeshDict-6 file :-
/*--------------------------------*- 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 0.00462 0.00191)
(0 0.00462 -0.00191)
(2 0 0)
(2 0.00462 0.00191)
(2 0.00462 -0.00191)
);
blocks
(
hex (0 2 1 0 3 5 4 3) (25 1 200) simpleGrading (0.2 1 1)
);
edges
(
);
boundary
(
Inlet
{
type patch;
faces
(
(0 2 1 0)
);
}
Outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
TopWall
{
type wall;
faces
(
(5 2 1 4)
);
}
FrontWedge
{
type wedge;
faces
(
(0 1 4 3)
);
}
BackWedge
{
type wedge;
faces
(
(0 3 5 2)
);
}
Axis
{
type empty;
faces
(
(0 0 3 3)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
For symmetry shape only vertices are different and for wedge shape also vertices are different as shown in above files, the only difference is that in symmetry and wedge have different boundary conditions in FrontWedge and backWedge.
Pressure file :-
For symmetry and wedge shape only boundary conditions are different in case of \'p\' and \'U\' file. I put it here only one \'p\' and \'U\' file for symmetry and wedge shape as follows-
Pressure file for symmetry shape :-
/*--------------------------------*- 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;
}
FrontWedge
{
type symmetry;
}
BackWedge
{
type symmetry;
}
Axis
{
type empty;
}
}
// ************************************************************************* //
Pressure file for wedge shape :-
/*--------------------------------*- 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;
}
FrontWedge
{
type wedge;
}
BackWedge
{
type wedge;
}
Axis
{
type empty;
}
}
// ************************************************************************* //
Velocity files :-
Velocity file for symmetry shape :-
/*--------------------------------*- 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.168 0 0);
}
Outlet
{
type zeroGradient;
}
TopWall
{
type noSlip;
}
FrontWedge
{
type symmetry;
}
BackWedge
{
type symmetry;
}
Axis
{
type empty;
}
}
// ************************************************************************* //
Velocity file for wedge shape :-
/*--------------------------------*- 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.168 0 0);
}
Outlet
{
type zeroGradient;
}
TopWall
{
type noSlip;
}
FrontWedge
{
type wedge;
}
BackWedge
{
type wedge;
}
Axis
{
type empty;
}
}
// ************************************************************************* //
Pressure file and velocity file are different for symmetry and wedge shape in case of FrontWedge and BackWedge boundary conditions.
Transport file :-
/*--------------------------------*- 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 \"constant\";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 0.0000000801;
// ************************************************************************* //
Value of kinematic viscosity(Nu) is constant for water at 25 degree celcius or room temperature.
ContolDict file :-
/*--------------------------------*- 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 15;
deltaT 0.001;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Here, time start from zero second to 15 seconds and change in time (i.e. delta t) is 0.001 second.
Simulation results :-
Mesh file :-
The velocity profile near the entrance shows three distinct region as folows-
A. Viscous Sublayer :- The effect of velocity boundary layer is seen in formation in this region of the pipe.
B. Transitional Buffer layer :- This layer gradually decreases with the viscous sublayer merges with the turbulent core with increasing distance from the entrance.
C. Turbulent Core :- The velocity profile is almost flat in this region and is comprised of the turbulent component of the flow.
a) For symmetry shape :-
Velocity profile at x=1m for developed flow :-
At points are (1, 0, 0) and (1, 0.005, 0).
Velocity Profile at x=2m for fully developed flow :-
At points are (2, 0, 0) and (2, 0.005, 0).
Pressure profile at x=1.3m and 2m :-
At points are (1.3, 0.0025, 0) and (2, 0.0025, 0).
b) For wedge shape :-
velocity profile at x=1m for developed flow :-
At points at
At points are (1, 0, 0) and (1, 0.005, 0).
velocity profile at x=2m for fully developed flow :-
At points are (2, 0, 0) and (2, 0.005, 0).
Pressure profile at x=1.3 and 2m for fully developed flow :-
At points are (1.3, 0.0025, 0) and (2, 0.0025, 0).
I also attached the blockMesh and icoFoam command snapshots as follows-
blockMesh command is same for all files only icoFoam cammands are different.
blockMesh command snapshot snapshot :-
For symmetry-
icoFoam command snapshot for theta=10 :-
icoFoam command snapshot for theta=25 :-
icoFoam command snapshot for theta=45 :-
For wedge shape-
icoFoam command snapshot for theta=10 :-
icoFoam command snapshot for theta=25 :-
icoFoam command snapshot for theta=45 :-
icoFoam command results for all files as-
a) For symmetry shape :-
Angle=10 :-
Mean courant number = 0.017057
Maximum courant number =0.0326749
Execution time (sec)=908.72
Clock time (sec)= 921
Angle=25 :-
Mean courant Number =0.0288596
Maximum Courant Number =0.10114
Execution time (sec)=628.92
clock time (sec)=644
Angle=45 :-
Mean courant number =0.0219792
Maximum courant number =0.0434353
Execution time (sec)=823.84
Clock time (sec)=840
b) For wedge shape :-
Angle=10 :-
Mean courant number =0.017058
Maximum courant number =0.0328577
Execution time (sec)=925.46
Clock time (sec)=941
Angle=25 :-
Mean courant time =0.0170566
maximum courant number =0.0326274
Execution time (sec)=919.08
Clock time (sec)=945
Angle=45 :-
Mean courant number =0.0170845
Maximum courant number =0.0381503
Execution time(sec) =874.63
Clock time (sec)=899
Results :-
Some basic calculations :-
Actual length(L) = 2m
Dynamic viscosity of water(mu) = 0.89 *10^(-3) ........for 25 degree
Kinematic viscosity of water(nu) = 0.801*10^(-6) ..........for 25 degree
Diameter of pipe(D) = 0.005m
Hydrodynamic entrance length(Le) =0.06*Re*D =1.26m
Area of pipe(A) = L*pi*D = 0.0628m^2
Discharge of flow(Q) = U*A =0.0105m^3/s
Average velocity(Vavg) = Q/A = 0.168 m/s
Maximum velocity(Umax) = 2*Vavg = 0.336 m/s
By Hagan Poissuille\'s equation-
Pressure drop(deltaP) = 0.5*rho*Umax^2 = 56.448 N/m^2
Here, if compare deltaP=Umax
then we clearly conclude that pressure drop value is much more than the maximum velocity.
Also, Le < L,
then we clearly conclude that hydrodynamic entrance length is smaller than the actual lenths which is the fully developed flow length.
By comparing analytical pressure and theorotical pressure drop i.e.
theorotical pressure drop =56.448 N/m^2 .........by Hagan Poissoille equations
Analytical pressure drop =0.3 - 0 = 0.3 N/m^2 ........by graph
It means theorotical pressure drop means actual pressure drop, by which ideal value for comparison.
CONCLUSIONS :-
1. Symmetry boundary condition is more accurate than wedge boundary condition.
2. Execution time is greater for symmetry boundary condition than wedge boundary condition for the same computational Mesh.
3. Courant number for simulation increases with increasing wedge angles.
In this way I compare the symmetry shape and wedge shape through various angle and analytical method also. So, due to symmetry boundary conditions are more accurable we have to first preference that one also, symmetry means parallel to each other and one face is clear it means other face must be clear and we take easily vertices. So, I write detailed procedure, results and conclusions as well and I clear the picture among symmetry and wedge shape.