Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
AIM:
The object of the report is to perform simulation of flow through a pipe in OpenFOAM by applying symmetry boundary conditions and validate the results.
PROCEDURE:
This report is the continuation of the project [1]. In OpenFOAM, different geometric boundary conditions are used to simulate the model so that the computational cost is reduced. Since, Haigen-Poiseuille flow is axi-symmetic flow, instead of simulating the entire pipe, a portion of the pipe is simulated so that it reduces the computational cost.
Types of Geometry boundary conditions in axi-symmetry flow-
1)Wedge boundary condition - This boundary condition is specified by two planes that must be selected on separate sides of the domain (i.e., front and back) on surfaces running along the axis. This boundary condition works for 2D simulations i.e, the wedge angle < 5degrees and single-cell thickness along the curvature.
2)Symmetry boundary condition - This boundary condition is used to apply mirror-symmetry conditions. It can be applied to both planar or non-planar faces/surfaces on the domain boundaries.
Case Setup -
In this report, 3 different sector angles are considered for analysis and results are compared. Sector angles are - 1) 10 degrees, 2) 25 degress, 3) 45 degrees.
Since the wedge angles > 5 degress, symmetry boundary conditions are used to simulate these cases.
STEP 1 - Writing blockMeshDict file in matlab
a) For 10 degrees
clc;
clear all;
close all;
D = 0.1; %%diameter of pipe in meters
R = D/2; %%radius in meters
L = 15; %%length of pipe
theta = 10; %%degrees
%%verices
v0 = [0 0 0];
v1 = [0 0 -L];
v2 = [R*sind(theta/2) R*cosd(theta/2) -L];
v3 = [R*sind(theta/2) R*cosd(theta/2) 0];
v4 = [-R*sind(theta/2) R*cosd(theta/2) -L];
v5 = [-R*sind(theta/2) R*cosd(theta/2) 0];
%grid descretization
n1 = 50;
n2 = 1;
n3 = 2000;
n = [50 1 2000];
%simple grading
s1 = 0.2;
s2 = 1;
s3 = 1;
s = [0.2 1 1];
f1 = fopen('blockMeshDict.txt','w')
fprintf(f1,'FoamFile\n{\n')
fprintf(f1,'\tformat \t ascii;\n')
fprintf(f1,'\tclass \t dictionary;\n')
fprintf(f1,'\tobject \t blockMeshDict;\n}\n')
fprintf(f1,'\n//*******************************//\n\n')
fprintf(f1,'convertToMeters 1')
fprintf(f1,'\n\n')
fprintf(f1,'vertices\n{')
fprintf(f1,'\n\t (%d %d %d)',v0)
fprintf(f1,'\n\t (%d %d %d)',v1)
fprintf(f1,'\n\t (%7.6d %7.6d %d)',v2)
fprintf(f1,'\n\t (%7.6d %7.6d %d)',v3)
fprintf(f1,'\n\t (%7.6d %7.6d %d)',v4)
fprintf(f1,'\n\t (%7.6d %7.6d %d) \n};',v5)
fprintf(f1,'\nblocks\n(')
fprintf(f1,'\t hex (0 5 3 0 1 4 2 1)')
fprintf(f1,' (%d %d %d) %s (%2d %d %d) \n);',n,'simpleGrading',s)
fprintf(f1,'\nedges \n(')
fprintf(f1,'\tarc 5 3 (%d %2.1d %d)\n',0,R,0)
fprintf(f1,'\tarc 4 2 (%d %2.1d %d)\n',0,R,-L)
fprintf(f1,'\nboundary \n(')
fprintf(f1,'\n\tinlet \n\t{ \n\t\ttype patch; \n\t\tfaces \n\t\t( \n\t\t\t(0 3 5 0) \n\t\t); \n\t}')
fprintf(f1,'\n\toutlet \n\t{ \n\t\ttype patch; \n\t\tfaces \n\t\t( \n\t\t\t(1 4 2 1) \n\t\t); \n\t}')
fprintf(f1,'\n\tfixedWalls \n\t{ \n\t\ttype wall; \n\t\tfaces \n\t\t( \n\t\t\t(3 2 4 5) \n\t\t); \n\t}')
fprintf(f1,'\n\tfront \n\t{ \n\t\ttype wedge; \n\t\tfaces \n\t\t( \n\t\t\t(0 1 2 3) \n\t\t); \n\t}')
fprintf(f1,'\n\tBack \n\t{ \n\t\ttype wedge; \n\t\tfaces \n\t\t( \n\t\t\t(0 5 4 1) \n\t\t); \n\t}')
fprintf(f1,'\n\taxis \n\t{ \n\t\ttype empty; \n\t\tfaces \n\t\t( \n\t\t\t(0 1 1 0) \n\t\t); \n\t}\n);')
fprintf(f1,'\nmergedPatchPairs \n( \n); \n\n// ************************************************//')
fclose(f1)
b) For 25 degrees
In matlab code input, theta = 25 and n2 = 1 (i.e one cell is inserted along radius curvature)
c) For 45 degrees
In matlab code input, theta = 45 and n2 = 1 (i.e one cell is inserted along radius curvature)
STEP 2 - Pre-processing in OpenFoam
1)Generating mesh -
The block mesh is generated in blockMeshDict file. Import the blockmesh file generated by using matlab.
Symmetry boundary conditions :
(a) 10 degrees



(b) 25 degrees

(c) 45 degress

Wedge boundary conditions:
It is already discussed from the above, that wedge boundary conditions are generally recommended for wedge angle < 5 degrees. Let's create block mesh for wedge angle 10 degrees and check the quality of mesh. The only difference in wedge boundary conditions compared to symmetry boundary conditionsis type wedge should be mentioned for front and back faces.
After creating the blockMeshDict file, create block mesh by using command blockMesh in terminal window.
Next check the quality of mesh by checkMesh command.

From the fig, it is cleared that the quality of mesh generated is not good. So it is not recommended to run the simulation with this type of mesh as it leads to false results or sometimes the solution gets blownup.
2) Initial and Boundary conditions -
The initial and boundary conditions are present in the '0' folder. Input the values of velocity and pressure as per the requirements.


3) Control Dict -
The ControlDict file present in the system folder. The controlDict file contains the necessary time inputs for the simulation.
NOTE- The time step (dt) should satisfy CFL criteria.

STEP 3 - Solving
After generating the mesh, simulate the model. Since, it is icofoam solver, type icoFoam in the terminal to perform simulation.
Symmetry boundary conditions -
(a) 10 degrees

(b) 25 degrees

(c) 45 degrees

Wedge boundary conditions -
The following fig shows that running the simulation for wedge angle 10 degrees results in max courant number 115.689, which leads to unstable solutions or in other words the solution blowsup.

STEP 3 - Post processing
Hagen-Poiseuille's equation -
Hydrodynamic entry length (Lh,laminar) = 0.0575*Re*D = 12.075 m.
(a) 10 degrees





(b) 25 degrees





(c) 45 degrees





ANALYTICAL SOLUTION:

The analytical max velocity is 0.042 m/s.
| S.No | Angle (degrees) | Wall shear stress(Pa) | Max velocity(m/s) |
| 1 | 10 | 0.00329389 | 0.0406178 |
| 2 | 25 | 0.00374156 | 0.0405831 |
| 3 | 45 | 0.00416758 | 0.0412509 |
From the table, it is observed that for sector angle 45 degrees shows more accurate results compared to other cases. For angle 10,25 degrees there is no much change in the results.
So, from the results it is concluded that as the sector angle decreases, roundoff error comes into picture which decreases the accuracy.
CONCLUSION:
It can be concluded that for axi-symmetry flow, wedge boundary conditions are used for wedge angle < 5degrees. For wedge angle 10,25,45 degress the solution blows up. For symmetry boundary conditions, 45degrees sector angle shows accurate results.
REFERENCE -
1 - https://skill-lync.com/student-projects/week-11-simulation-of-flow-through-a-pipe-in-openfoam-234