Simulation using OpenFOAM in circular pipe Symmetry vs Wedge Boundary Condition
In this project, we will be comparing the results obtained from the following methods:
- The Hagen-Poiseuille Equation(analytical)
- Simulation of flow through a pipe with wedge boundary condition and,
- Simulation of flow through a pipe with symmetry boundary condition.
Results from the previous project:
For a laminar flow(`Re = 2100`) through a circular pipe with water as medium and considering Diameter, `D = 0.01m`, following are the key values:
`v_(avg) = 0.179 m/s`
`v_(max) = 2v_(avg) = 0.358m/s` (Analytical Values From HP equation)
`v_(max) = 0.355563m/s` (Wedge Boundary Condition)
symmetry boundary condition: The symmetry boundary condition defines a mirror face/surface. The symmetry condition should only be used if the physical object or geometry and the expected flow field pattern of the developed solutions are mirrored along that surface. This boundary condition helps to reduce the computational domain in size and enables the modelling of a sub-domain of the complete setup.
We will be using a MATLAB program for generating `blockMeshDict` file for various angles of the wedge. Here, for angles greater than `5^circ` `symmetry` boundary condition is used.
close all;
clear all;
clc;
d = 0.01;
L = 1.5;
alpha = input(\"Enter wedge angle: \");
y_dist = (d/2) * sin(0.5*alpha*pi/180);
x_dist = (d/2) * cos(0.5*alpha*pi/180);
g_x = input(\"Enter Grading factor for x-axis: \");
g_y = input(\"Enter Grading factor for y-axis: \");
g_z = input(\"Enter Grading factor for z-axis: \");
foamFileString = \"FoamFile {version 2.0;format ascii;class dictionary;object blockMeshDict;}\";
scaleString = \"convertToMeters 1;\";
verticesString = sprintf(\"vertices (\\
(0 0 0) \\
(%d %d 0) \\
(%d %d %d) \\
(0 0 %d) \\
(%d -%d 0) \\
(%d -%d %d));\",x_dist, y_dist,x_dist, y_dist, L, L,x_dist, y_dist, x_dist, y_dist, L);
blockString = sprintf(\"blocks (hex (0 4 1 0 3 5 2 3) (20 1 100) simpleGrading (%d %d %d) );\", g_x,g_y,g_z);
edgesString = \"edges ();\";
if alpha <= 5
conditionType = \"wedge\";
else
conditionType = \"symmetry\";
end
boundaryString = sprintf(\"boundary (front {type %s; faces ((0 1 2 3));} back {type %s; faces ((0 3 5 4));} tankWall {type wall;faces ((1 4 5 2));} inlet {type patch; faces ((0 4 1 0));} outlet {type patch;faces ((3 2 5 3));} axis {type empty;faces ((0 3 3 0));} );\", conditionType, conditionType);
mergeString = \"mergePatchPairs();\";
blockMeshDictString = strcat(foamFileString,\"\\n\", scaleString ,\"\\n\" , verticesString , \"\\n\" , blockString , \"\\n\" , edgesString , \"\\n\" , boundaryString , \"\\n\" , mergeString);
filename = \'blockMeshDict\';
fid = fopen(filename, \'w\');
fputs(fid, blockMeshDictString);
fclose(fid);
disp(\'Success!! blockMeshDict file generated\');
1. Wedge Angle `alpha = 10^circ`
a. Generated blockMeshDict files:
FoamFile {version 2.0;format ascii;class dictionary;object blockMeshDict;}
convertToMeters 1;
vertices (
(0 0 0)
(0.00498097 0.000435779 0)
(0.00498097 0.000435779 1.5)
(0 0 1.5)
(0.00498097 -0.000435779 0)
(0.00498097 -0.000435779 1.5));
blocks (hex (0 4 1 0 3 5 2 3) (20 1 100) simpleGrading (1 1 1) );
edges ();
boundary (
front {type symmetry; faces ((0 1 2 3));}
back {type symmetry; faces ((0 3 5 4));}
tankWall {type wall;faces ((1 4 5 2));}
inlet {type patch; faces ((0 4 1 0));}
outlet {type patch;faces ((3 2 5 3));}
axis {type empty;faces ((0 3 3 0));}
);
mergePatchPairs();
b. Mesh:
c. Flow development at inlet and outlet:
2. Wedge Angle `alpha = 25^circ`
a. Generated blockMeshDict files
FoamFile {version 2.0;format ascii;class dictionary;object blockMeshDict;}
convertToMeters 1;
vertices (
(0 0 0)
(0.00488148 0.0010822 0)
(0.00488148 0.0010822 1.5)
(0 0 1.5)
(0.00488148 -0.0010822 0)
(0.00488148 -0.0010822 1.5));
blocks (hex (0 4 1 0 3 5 2 3) (20 1 100) simpleGrading (1 1 1) );
edges ();
boundary (
front {type symmetry; faces ((0 1 2 3));}
back {type symmetry; faces ((0 3 5 4));}
tankWall {type wall;faces ((1 4 5 2));}
inlet {type patch; faces ((0 4 1 0));}
outlet {type patch;faces ((3 2 5 3));}
axis {type empty;faces ((0 3 3 0));}
);
mergePatchPairs();
b. Mesh:
c. Flow development at inlet and outlet:
3. Wedge Angle `alpha=45^circ`
a. Generated blockMeshDict files
FoamFile {version 2.0;format ascii;class dictionary;object blockMeshDict;}
convertToMeters 1;
vertices (
(0 0 0)
(0.0046194 0.00191342 0)
(0.0046194 0.00191342 1.5)
(0 0 1.5)
(0.0046194 -0.00191342 0)
(0.0046194 -0.00191342 1.5)
);
blocks (hex (0 4 1 0 3 5 2 3) (20 1 100) simpleGrading (1 1 1) );
edges ();
boundary (
front {type symmetry; faces ((0 1 2 3));}
back {type symmetry; faces ((0 3 5 4));}
tankWall {type wall;faces ((1 4 5 2));}
inlet {type patch; faces ((0 4 1 0));}
outlet {type patch;faces ((3 2 5 3));}
axis {type empty;faces ((0 3 3 0));}
);
mergePatchPairs();
b. Mesh:
c. Flow development at the inlet and outlet:
Comparison of Velocity at Outlet:
A MATLAB program helps us to compare the velocities near the outlet.
close all;
clear all;
clc;
#Reading values from csv
outlet_wedge10 = dlmread(\'outlet_wedge10.csv\', \',\' , 1,0);
outlet_wedge25 = dlmread(\'outlet_wedge25.csv\', \',\' , 1,0);
outlet_wedge45 = dlmread(\'outlet_wedge45.csv\', \',\' , 1,0);
# Assigning values to variables
radial_distance = outlet_wedge10(:, 1);
vel_outlet_wedge10 = outlet_wedge10(:, 2);
vel_outlet_wedge25 = outlet_wedge25(:, 2);
vel_outlet_wedge45 = outlet_wedge45(:, 2);
f1 = figure(1);
# Plotting values for +ve x-axis
plot(radial_distance, vel_outlet_wedge10,\'k\');hold on;
plot(radial_distance, vel_outlet_wedge25, \'r\');hold on;
plot(radial_distance, vel_outlet_wedge45,\'g\');hold on;
legend(\'Profile near outlet for wedge angle 10\', \'Profile near outlet for wedge angle 25\',\'Profile near outlet for wedge angle 45\');hold on;
# Plotting values for -ve x-axis
plot(-radial_distance, vel_outlet_wedge10,\'k\');hold on;
plot(-radial_distance, vel_outlet_wedge25,\'r\');hold on;
plot(-radial_distance, vel_outlet_wedge45,\'g\');hold on;
xlabel(\'Radial Distance\');
ylabel(\'Velocity\');
title(\'Velocity Profile for various wedge angles\');
#Saving the plots
saveas(f1, \'VelocityProfiles_WedgeAngles\',\'jpg\');
From the following velocity profile, it can be seen that the velocity at the outlet does not vary much.
Comparison of velocities at various wedge angles
| Wedge Angle | CFL (Mean) | CFL(Max) | Analytical `v_(max)` | Simulation based `v_(max)` | Absolute Error `v_(max)` |
| 4 | 0.0717792 | 0.149432 | 0.358 | 0.355563 | 0.680726257 |
| 10 | 0.0717794 | 0.149109 | 0.358 | 0.355602 | 0.669832402 |
| 25 | 0.0717803 | 0.15096 | 0.358 | 0.35581 | 0.611731844 |
| 45 | 0.0717822 | 0.155075 | 0.358 | 0.356241 | 0.491340782 |
Conclusion:
- With the increase in wedge angle the max CFL number increases while the mean CFL number remains constant.
- With the increase in wedge angle, the absolute error decreases i.e. the solution obtained from the simulation approaches the analytical solution.
- As seen from the decreasing value of absolute error it can be asserted that symmetry boundary condition is more stable and accurate than wedge boundary condition for larger wedge angles.
- The maximum velocity attained by the flow or development of the boundary layer in the circular pipe is independent of wedge angle used. With the use of wedge, results were obtained with the same accuracy but with less computational efforts.