Symmetry vs Wedge boundary conditions openFoam

Project Report


Assumptions (same as in previous challenge):

1. Reynolds Number = 1000 (For Laminar Flow)

2. Temperature= 20 degree Celsius

3. Length of pipe = 1 m

4. Diameter of pipe = 20 mm

5. At 20 Degrees Celsius (Ref: Saturated Water tables from Cengel and Cimbala) 

Kinematic Viscosity = 1.004008e-06 m2/s
Density = 998 kg/m3

6. Reynolds Number = (rho*V*D/mu)

Avg Velocity = 5.020040e-02 m/s      (After solving)

7. Hagen Poisuelle's Equation, Del_p=(32*mu*V*L/D2)


Results obtained from Solving Hagen Poisuelle's Equation :

After putting all values in Hagen Poisuelle's equation, we get:

Pressure Drop = 4.024064e+00 pa


So, we put the following boundary condition:

Kinematic Inlet pressure = 4.032128e-03 m2/s2

Kinematic Outlet pressure = 0 m2/s2

Velocity inlet: pressureInletVelocity

Velocity outlet: zeroGradient


Putting the above BC's, the simulation was run for both Symmetry and Wedge boundary conditions and results for velocity profile was verified. Analytical velocity Results:

Velocity Profile: Parabolic

Average Velocity: 5.020040e-02 m/s 

Maximum Velocity: 1.004008e-01 m/s 


2. Results obtained from simulating the pipe flow with Wedge BC (same as in previous challenge):

Wedge Angle Simulation time Maximum Velocity Percentage Error in Velocity
2 Degrees 1711 seconds 0.09912 m/s 1.27 %
3 Degrees 1828 seconds 0.09908 m/s 1.31 %
4 Degrees 2114 seconds 0.09903 m/s 1.36 %
5 Degrees 1609 seconds 0.09896 m/s 1.43 %

Google Drive link to all the velocity plots for wedge BC:



3. Results obtained from simulating the pipe flow with Symmetry BC (new results):

Wedge Angle Simulation time Maximum Velocity Percentage error in Velocity
10 Degrees 3448 seconds 0.09895 m/s 1.44 %
25 Degrees 8603 seconds 0.09895 m/s 1.44 %
45 Degrees 19870 seconds 0.09895 m/s 1.44 %

Google Drive link to all the velocity plots for symmetry BC:


MATLAB Program for producing blockMeshDict file with symmetry BC and wedge angle as input:

clear all
close all

theta=25;  %In degrees %Wedge angle
grading=0.25; %Grading factor along the walls of cylinder 

b1=400; %cells along the length of cylinder
b2=12; %cells along the radius of cylinder
b3=theta/5; %Taking one cell every 5 degrees

%vertices of the wedge
v0=[0 0 0];
v1=[length 0 0];
v2=[length radius*cosd(theta/2) -radius*sind(theta/2)];
v3=[0 radius*cosd(theta/2) -radius*sind(theta/2)];
v4=[0 radius*cosd(theta/2) radius*sind(theta/2)];
v5=[length radius*cosd(theta/2) radius*sind(theta/2)];

s1='/*--------------------------------*- C++ -*----------------------------------*\';
s2='| =========                 |                                                 |';
s3='| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |';
s4='|  \\    /   O peration     | Version:  4.1                                   |';
s5='|   \\  /    A nd           | Web:                      |';
s6='|    \\/     M anipulation  |                                                 |';

s8='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //';

%wedge block
% hex (0 1 2 3 0 1 5 4) (80 20 1) simpleGrading(1 1 1)



fprintf(f1,'%16s \t 2.0;\n','version');
fprintf(f1,'%16s \t ascii;\n','format');
fprintf(f1,'%16s \t dictionary;\n','class');
fprintf(f1,'%16s \t blockMeshDict;\n}\n','object');

fprintf(f1,'convertToMeters 0.001;\n\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);\n\n',v5(1),v5(2),v5(3));

fprintf(f1,'\t hex (0 1 2 3 0 1 5 4) (%d %d %d)\n',b1,b2,b3);
fprintf(f1,'\t simpleGrading\n\t (1 %d 1)\n);\n\n',grading);

fprintf(f1,'\t arc 2 5 (%d %d %d)\n',length,radius,0);
fprintf(f1,'\t arc 3 4 (%d %d %d)\n);\n\n',0,radius,0);

fprintf(f1,'\t%s\n\t{\n\t\t type %s;\n\t\t faces \n\t\t (\n\t\t\t (%d %d %d %d) \n\t\t );\n\t}\n\n','inlet','patch',0,4,3,0);
fprintf(f1,'\t%s\n\t{\n\t\t type %s;\n\t\t faces \n\t\t (\n\t\t\t (%d %d %d %d) \n\t\t );\n\t}\n\n','outlet','patch',1,2,5,1);
fprintf(f1,'\t%s\n\t{\n\t\t type %s;\n\t\t faces \n\t\t (\n\t\t\t (%d %d %d %d) \n\t\t );\n\t}\n\n','Wall','wall',2,3,4,5);
fprintf(f1,'\t%s\n\t{\n\t\t type %s;\n\t\t faces \n\t\t (\n\t\t\t (%d %d %d %d) \n\t\t );\n\t}\n\n','axis','empty',0,1,1,0);
fprintf(f1,'\t%s\n\t{\n\t\t type %s;\n\t\t faces \n\t\t (\n\t\t\t (%d %d %d %d) \n\t\t );\n\t}\n\n','wedgeFront','symmetry',0,1,2,3);
fprintf(f1,'\t%s\n\t{\n\t\t type %s;\n\t\t faces \n\t\t (\n\t\t\t (%d %d %d %d) \n\t\t );\n\t}\n\n','wedgeBack','symmetry',0,1,5,4);




4. Comparison and Discussion:

1. Simulation time: It is seen that the simulation time decreases as we reduce the wedge angle in Symmetry BC which is evident because the number of cells decreases as we decrease the wedge angle. Whereas with Wedge BC, the simulation time increases as we decrease the wedge angle despite the number of cells remaining the same. This can be justified as the skewness of the cells increases as we decrease the wedge angle and so does the simulation time required.


2. Percentage Error in Maximum Velocity: Since, we have used a mesh which produces a single cell for every 5 degrees of wedge angle, so we see that the Maximum Velocity obtained in each case with Symmetry BC is same and so the Percentage Error. While this is not the case with Wedge BC which uses uses a single cell across the angle despite the value of angle. With Wedge BC we see the Percentage Error reduces as we decrease the Wedge Angle from 5 Degrees - 2 Degrees. It is justified as the size of the cells decreases as we reduce the wedge angle, so does the truncation errors.


3. Other Findings: Rest we see that the velocity profiles obtained in each and every case were parabolic resembling the Hagen Poisuelle's Velocity Profile for Pipe flow and the pressure drops linearly with the length of pipe. Also it is seen that as we allow the velocity values to float, so we get a fully developed velocity profile at the inlet as well as the centre and the outlet.


4. Initial and Boundary Conditions Files:


5. blockMeshDict files for various wedge angles and MATLAB program:


Projects by Utkarsh Garg

The backward facing step flow project was performed as a part of skill lync challenge. The simulation was performed on three base grid sizes: 1. 3e-4m 2. 2.5e-4m 3. 2e-4m The above grid sizes were chosen due to lack of computation power.   The Results a Read more

The simulation was run by refining the grid size successively in three steps as follows: Grid Size 1. 2e-4 m 2. 1.5e-4 m 3. 1.2e-4 m   The post-processing results of the three cases are as follows: 1. 2e-4 m Velocity Magnitude Mass Flow Rate Spec Read more

CENTRIFUGAL PUMP DESIGN AND PERFORMANCE ANALYSIS   1. Geometry: PUMP   IMPELLER      2. Performance Analysis of the Centrifugal Pump Performance Analysis of a Centrifugal Pump Velocity normal to face (Outlet Velocity) [m/ Read more

1. Geometry: All dimensions in mm.   2. Boundary Conditions: Total pressure inlet = 4 bar Static pressure outlet = 1 bar Real wall = all inner surfaces of the cylinder, valve, and intake.   3. Grid dependence study: Goal (Value) Design Point Read more

Google Drive Link for all sorce code files and functions files   Outputs: 1. Jacobi Method The program also showed the following output in the command window \"The Jacobi Solver could not co Read more

Google drive link to all the contours and plot: The link contains all the plots for various angles of attack and the pressure and velocity distribution for all cases.   The airfoil used was NACA Read more

Hagen Poiseuille s Flow
Utkarsh Garg · 2018-06-15 20:28:52

Google drive link to all the blockMeshDict file for various angles: Google drive link to all the plots and source code:   Assu Read more

Google drive link containing source code for both functions and all the plots   Observations and Conclusions: 1. Normalized Mass flow rate We see that in case of conservative form of governing Read more


The End