All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
…
SHAIK SYDAVALI
updated on 02 Mar 2021
Date:- 01-03-2021
Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
Validation of velocity profiles: -
Fig(1)
Fig(2)
Fig(3)
Conclusion form above figures: -
Validation of hydrodynamic entry length: -
Fig(4) Fig(5)
Fig(6) Fig(7)
Fig(8)
Validation of maximum velocity:
Pressure drop:-
Note:- Note that hydrodynamic length and maximum velocity and sher stress are independent on wedge angels so for validating them we took one case on each validation.
Post processing of shear stress:
Fig(9): shear stress for wedge angle 10o with wedge boundary condition case
Differences in both boundary conditions: -
MATLAB CODE FOR AUTOMATION FOR BLOCKMESH :-
clc;
clear all;
close all;
%% Inputs
Re = 2100;
D =0.04;
mu =0.00089;
rho =997;
Lh = 0.05*Re*D;
L =Lh+0.8;
r = D/2;
theta=[10,25,45];
%% header text
h1 = '/*--------------------------------*- C++ -*----------------------------------*\';
h2 = '========= |';
h3 = '\\ / F ield | OpenFOAM: The Open Source CFD Toolbox';
h4 = ' \\ / O peration | Website: https://openfoam.org';
h5= '\\ / A nd | Version: 8';
h6 = ' \\/ M anipulation |';
h7 = '\*---------------------------------------------------------------------------*/';
h8 = 'FoamFile';
h9 = '{';
h10= 'version 2.0;';
h11 = 'format ascii;';
h12 = 'class dictionary;';
h13 = 'object blockMeshDict;';
h14 ='}';
h15 = '// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //';
%%
for i=1:length(theta)
if i==1
f1= fopen('blockMeshDict_10_symmetry.txt','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,'%s\n',h8);
fprintf(f1,'%s\n',h9);
fprintf(f1,'\t%s\n',h10);
fprintf(f1,'\t%s\n',h11);
fprintf(f1,'\t%s\n',h12);
fprintf(f1,'\t%s\n',h13);
fprintf(f1,'%s\n',h14);
fprintf(f1,'%s\n\n\n',h15);
fprintf(f1,'convertToMeters 1;\n\n');
fprintf(f1,'vertices\n');
fprintf(f1,'(\n');
fprintf(f1,'\t(%d %d %d)\n',0,0,0);
fprintf(f1,'\t(%d %f %f)\n',0,r*cosd(theta(i)/2),r*sind(theta(i)/2));
fprintf(f1,'\t(%d %f %f)\n',0,r*cosd(theta(i)/2),-r*sind(theta(i)/2));
fprintf(f1,'\t(%d %d %d)\n',L,0,0);
fprintf(f1,'\t(%d %f %f)\n',L,r*cosd(theta(i)/2),r*sind(theta(i)/2));
fprintf(f1,'\t(%d %f %f)\n',L,r*cosd(theta(i)/2),-r*sind(theta(i)/2));
fprintf(f1,');\n\n');
fprintf(f1,'blocks\n\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\thex (%d %d %d %d %d %d %d %d) (%d %d %d) simpleGrading (%d %d %d)\n\n',0,3,5,2,0,3,4,1,200,20,1,1,0.1,1);
fprintf(f1,');\n\n');
fprintf(f1,'edges\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\tarc %d %d (%d %d %d)\n',1,2,0,r,0);
fprintf(f1,'\tarc %d %d (%d %d %d)\n\n',4,5,L,r,0);
fprintf(f1,');\n\n');
fprintf(f1,'boundary\n\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\tinlet\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype patch;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,1,2,0);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n\n');
fprintf(f1,'\toutlet\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype patch;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',3,5,4,3);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n\n');
fprintf(f1,'\tfront\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype symmetry;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,3,4,1);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\tback\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype symmetry;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,2,5,3);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\taxis\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype empty;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,3,3,0);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\ttop\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype wall;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',1,4,5,2);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,');\n\n');
fprintf(f1,'mergePatchPairs\n');
fprintf(f1,'(\n');
fprintf(f1,');\n');
fprintf(f1,'// ************************************************************************* //');
fclose(f1);
%
f1= fopen('blockMeshDict_10_wedge.txt','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,'%s\n',h8);
fprintf(f1,'%s\n',h9);
fprintf(f1,'\t%s\n',h10);
fprintf(f1,'\t%s\n',h11);
fprintf(f1,'\t%s\n',h12);
fprintf(f1,'\t%s\n',h13);
fprintf(f1,'%s\n',h14);
fprintf(f1,'%s\n\n\n',h15);
fprintf(f1,'convertToMeters 1;\n\n');
fprintf(f1,'vertices\n');
fprintf(f1,'(\n');
fprintf(f1,'\t(%d %d %d)\n',0,0,0);
fprintf(f1,'\t(%d %f %f)\n',0,r*cosd(theta(i)/2),r*sind(theta(i)/2));
fprintf(f1,'\t(%d %f %f)\n',0,r*cosd(theta(i)/2),-r*sind(theta(i)/2));
fprintf(f1,'\t(%d %d %d)\n',L,0,0);
fprintf(f1,'\t(%d %f %f)\n',L,r*cosd(theta(i)/2),r*sind(theta(i)/2));
fprintf(f1,'\t(%d %f %f)\n',L,r*cosd(theta(i)/2),-r*sind(theta(i)/2));
fprintf(f1,');\n\n');
fprintf(f1,'blocks\n\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\thex (%d %d %d %d %d %d %d %d) (%d %d %d) simpleGrading (%d %d %d)\n\n',0,3,5,2,0,3,4,1,200,20,1,1,0.1,1);
fprintf(f1,');\n\n');
fprintf(f1,'edges\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\tarc %d %d (%d %d %d)\n',1,2,0,r,0);
fprintf(f1,'\tarc %d %d (%d %d %d)\n\n',4,5,L,r,0);
fprintf(f1,');\n\n');
fprintf(f1,'boundary\n\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\tinlet\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype patch;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,1,2,0);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n\n');
fprintf(f1,'\toutlet\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype patch;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',3,5,4,3);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n\n');
fprintf(f1,'\tfront\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype wedge;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,3,4,1);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\tback\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype wedge;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,2,5,3);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\taxis\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype empty;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,3,3,0);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\ttop\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype wall;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',1,4,5,2);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,');\n\n');
fprintf(f1,'mergePatchPairs\n');
fprintf(f1,'(\n');
fprintf(f1,');\n');
fprintf(f1,'// ************************************************************************* //');
fclose(f1);
%
elseif i == 2
f1= fopen('blockMeshDict_25_symmetry.txt','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,'%s\n',h8);
fprintf(f1,'%s\n',h9);
fprintf(f1,'\t%s\n',h10);
fprintf(f1,'\t%s\n',h11);
fprintf(f1,'\t%s\n',h12);
fprintf(f1,'\t%s\n',h13);
fprintf(f1,'%s\n',h14);
fprintf(f1,'%s\n\n\n',h15);
fprintf(f1,'convertToMeters 1;\n\n');
fprintf(f1,'vertices\n');
fprintf(f1,'(\n');
fprintf(f1,'\t(%d %d %d)\n',0,0,0);
fprintf(f1,'\t(%d %f %f)\n',0,r*cosd(theta(i)/2),r*sind(theta(i)/2));
fprintf(f1,'\t(%d %f %f)\n',0,r*cosd(theta(i)/2),-r*sind(theta(i)/2));
fprintf(f1,'\t(%d %d %d)\n',L,0,0);
fprintf(f1,'\t(%d %f %f)\n',L,r*cosd(theta(i)/2),r*sind(theta(i)/2));
fprintf(f1,'\t(%d %f %f)\n',L,r*cosd(theta(i)/2),-r*sind(theta(i)/2));
fprintf(f1,');\n\n');
fprintf(f1,'blocks\n\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\thex (%d %d %d %d %d %d %d %d) (%d %d %d) simpleGrading (%d %d %d)\n\n',0,3,5,2,0,3,4,1,200,20,1,1,0.1,1);
fprintf(f1,');\n\n');
fprintf(f1,'edges\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\tarc %d %d (%d %d %d)\n',1,2,0,r,0);
fprintf(f1,'\tarc %d %d (%d %d %d)\n\n',4,5,L,r,0);
fprintf(f1,');\n\n');
fprintf(f1,'boundary\n\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\tinlet\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype patch;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,1,2,0);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n\n');
fprintf(f1,'\toutlet\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype patch;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',3,5,4,3);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n\n');
fprintf(f1,'\tfront\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype symmetry;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,3,4,1);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\tback\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype symmetry;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,2,5,3);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\taxis\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype empty;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,3,3,0);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\ttop\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype wall;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',1,4,5,2);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,');\n\n');
fprintf(f1,'mergePatchPairs\n');
fprintf(f1,'(\n');
fprintf(f1,');\n');
fprintf(f1,'// ************************************************************************* //');
fclose(f1);
%
f1= fopen('blockMeshDict_25_wedge.txt','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,'%s\n',h8);
fprintf(f1,'%s\n',h9);
fprintf(f1,'\t%s\n',h10);
fprintf(f1,'\t%s\n',h11);
fprintf(f1,'\t%s\n',h12);
fprintf(f1,'\t%s\n',h13);
fprintf(f1,'%s\n',h14);
fprintf(f1,'%s\n\n\n',h15);
fprintf(f1,'convertToMeters 1;\n\n');
fprintf(f1,'vertices\n');
fprintf(f1,'(\n');
fprintf(f1,'\t(%d %d %d)\n',0,0,0);
fprintf(f1,'\t(%d %f %f)\n',0,r*cosd(theta(i)/2),r*sind(theta(i)/2));
fprintf(f1,'\t(%d %f %f)\n',0,r*cosd(theta(i)/2),-r*sind(theta(i)/2));
fprintf(f1,'\t(%d %d %d)\n',L,0,0);
fprintf(f1,'\t(%d %f %f)\n',L,r*cosd(theta(i)/2),r*sind(theta(i)/2));
fprintf(f1,'\t(%d %f %f)\n',L,r*cosd(theta(i)/2),-r*sind(theta(i)/2));
fprintf(f1,');\n\n');
fprintf(f1,'blocks\n\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\thex (%d %d %d %d %d %d %d %d) (%d %d %d) simpleGrading (%d %d %d)\n\n',0,3,5,2,0,3,4,1,200,20,1,1,0.1,1);
fprintf(f1,');\n\n');
fprintf(f1,'edges\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\tarc %d %d (%d %d %d)\n',1,2,0,r,0);
fprintf(f1,'\tarc %d %d (%d %d %d)\n\n',4,5,L,r,0);
fprintf(f1,');\n\n');
fprintf(f1,'boundary\n\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\tinlet\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype patch;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,1,2,0);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n\n');
fprintf(f1,'\toutlet\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype patch;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',3,5,4,3);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n\n');
fprintf(f1,'\tfront\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype wedge;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,3,4,1);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\tback\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype wedge;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,2,5,3);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\taxis\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype empty;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,3,3,0);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\ttop\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype wall;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',1,4,5,2);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,');\n\n');
fprintf(f1,'mergePatchPairs\n');
fprintf(f1,'(\n');
fprintf(f1,');\n');
fprintf(f1,'// ************************************************************************* //');
fclose(f1);
elseif i == 3
f1= fopen('blockMeshDict_45_symmetry.txt','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,'%s\n',h8);
fprintf(f1,'%s\n',h9);
fprintf(f1,'\t%s\n',h10);
fprintf(f1,'\t%s\n',h11);
fprintf(f1,'\t%s\n',h12);
fprintf(f1,'\t%s\n',h13);
fprintf(f1,'%s\n',h14);
fprintf(f1,'%s\n\n\n',h15);
fprintf(f1,'convertToMeters 1;\n\n');
fprintf(f1,'vertices\n');
fprintf(f1,'(\n');
fprintf(f1,'\t(%d %d %d)\n',0,0,0);
fprintf(f1,'\t(%d %f %f)\n',0,r*cosd(theta(i)/2),r*sind(theta(i)/2));
fprintf(f1,'\t(%d %f %f)\n',0,r*cosd(theta(i)/2),-r*sind(theta(i)/2));
fprintf(f1,'\t(%d %d %d)\n',L,0,0);
fprintf(f1,'\t(%d %f %f)\n',L,r*cosd(theta(i)/2),r*sind(theta(i)/2));
fprintf(f1,'\t(%d %f %f)\n',L,r*cosd(theta(i)/2),-r*sind(theta(i)/2));
fprintf(f1,');\n\n');
fprintf(f1,'blocks\n\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\thex (%d %d %d %d %d %d %d %d) (%d %d %d) simpleGrading (%d %d %d)\n\n',0,3,5,2,0,3,4,1,200,20,1,1,0.1,1);
fprintf(f1,');\n\n');
fprintf(f1,'edges\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\tarc %d %d (%d %d %d)\n',1,2,0,r,0);
fprintf(f1,'\tarc %d %d (%d %d %d)\n\n',4,5,L,r,0);
fprintf(f1,');\n\n');
fprintf(f1,'boundary\n\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\tinlet\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype patch;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,1,2,0);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n\n');
fprintf(f1,'\toutlet\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype patch;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',3,5,4,3);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n\n');
fprintf(f1,'\tfront\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype symmetry;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,3,4,1);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\tback\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype symmetry;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,2,5,3);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\taxis\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype empty;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,3,3,0);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\ttop\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype wall;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',1,4,5,2);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,');\n\n');
fprintf(f1,'mergePatchPairs\n');
fprintf(f1,'(\n');
fprintf(f1,');\n');
fprintf(f1,'// ************************************************************************* //');
fclose(f1);
%
f1= fopen('blockMeshDict_45_wedge.txt','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,'%s\n',h8);
fprintf(f1,'%s\n',h9);
fprintf(f1,'\t%s\n',h10);
fprintf(f1,'\t%s\n',h11);
fprintf(f1,'\t%s\n',h12);
fprintf(f1,'\t%s\n',h13);
fprintf(f1,'%s\n',h14);
fprintf(f1,'%s\n\n\n',h15);
fprintf(f1,'convertToMeters 1;\n\n');
fprintf(f1,'vertices\n');
fprintf(f1,'(\n');
fprintf(f1,'\t(%d %d %d)\n',0,0,0);
fprintf(f1,'\t(%d %f %f)\n',0,r*cosd(theta(i)/2),r*sind(theta(i)/2));
fprintf(f1,'\t(%d %f %f)\n',0,r*cosd(theta(i)/2),-r*sind(theta(i)/2));
fprintf(f1,'\t(%d %d %d)\n',L,0,0);
fprintf(f1,'\t(%d %f %f)\n',L,r*cosd(theta(i)/2),r*sind(theta(i)/2));
fprintf(f1,'\t(%d %f %f)\n',L,r*cosd(theta(i)/2),-r*sind(theta(i)/2));
fprintf(f1,');\n\n');
fprintf(f1,'blocks\n\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\thex (%d %d %d %d %d %d %d %d) (%d %d %d) simpleGrading (%d %d %d)\n\n',0,3,5,2,0,3,4,1,200,20,1,1,0.1,1);
fprintf(f1,');\n\n');
fprintf(f1,'edges\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\tarc %d %d (%d %d %d)\n',1,2,0,r,0);
fprintf(f1,'\tarc %d %d (%d %d %d)\n\n',4,5,L,r,0);
fprintf(f1,');\n\n');
fprintf(f1,'boundary\n\n');
fprintf(f1,'(\n\n');
fprintf(f1,'\tinlet\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype patch;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,1,2,0);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n\n');
fprintf(f1,'\toutlet\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype patch;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',3,5,4,3);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n\n');
fprintf(f1,'\tfront\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype wedge;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,3,4,1);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\tback\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype wedge;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,2,5,3);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\taxis\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype empty;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',0,3,3,0);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,'\ttop\n');
fprintf(f1,'\t{\n');
fprintf(f1,'\t\ttype wall;\n');
fprintf(f1,'\t\tfaces\n');
fprintf(f1,'\t\t(\n');
fprintf(f1,'\t\t\t(%d %d %d %d)\n',1,4,5,2);
fprintf(f1,'\t\t);\n');
fprintf(f1,'\t}\n');
fprintf(f1,');\n\n');
fprintf(f1,'mergePatchPairs\n');
fprintf(f1,'(\n');
fprintf(f1,');\n');
fprintf(f1,'// ************************************************************************* //');
fclose(f1);
end
end
%% Analyticl_solution
d = linspace(0,r,1000);
v_avg =(2100*(mu/rho))/D;
v_max = 2*v_avg;
v_anl = v_max*(1-((2*d./D).^2));
%%
For theta 10deg with symmetry boundary condition:-
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 0.019924 0.001743)
(0 0.019924 -0.001743)
(5 0 0)
(5 0.019924 0.001743)
(5 0.019924 -0.001743)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 20 1) simpleGrading (1 1.000000e-01 1)
);
edges
(
arc 1 2 (0 2.000000e-02 0)
arc 4 5 (5 2.000000e-02 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
back
{
type symmetry;
faces
(
(0 2 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
theta 10 deg for wedge b.c:-
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 0.019924 0.001743)
(0 0.019924 -0.001743)
(5 0 0)
(5 0.019924 0.001743)
(5 0.019924 -0.001743)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 20 1) simpleGrading (1 1.000000e-01 1)
);
edges
(
arc 1 2 (0 2.000000e-02 0)
arc 4 5 (5 2.000000e-02 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
(0 2 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Theta 25 deg for symmetry b.c:-
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 0.019526 0.004329)
(0 0.019526 -0.004329)
(5 0 0)
(5 0.019526 0.004329)
(5 0.019526 -0.004329)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 20 1) simpleGrading (1 1.000000e-01 1)
);
edges
(
arc 1 2 (0 2.000000e-02 0)
arc 4 5 (5 2.000000e-02 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
back
{
type symmetry;
faces
(
(0 2 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Theta 25 deg for wedge b.c :-
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 0.019526 0.004329)
(0 0.019526 -0.004329)
(5 0 0)
(5 0.019526 0.004329)
(5 0.019526 -0.004329)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 20 1) simpleGrading (1 1.000000e-01 1)
);
edges
(
arc 1 2 (0 2.000000e-02 0)
arc 4 5 (5 2.000000e-02 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
(0 2 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Theta 45 deg for symmetry b.c :-
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 0.018478 0.007654)
(0 0.018478 -0.007654)
(5 0 0)
(5 0.018478 0.007654)
(5 0.018478 -0.007654)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 20 1) simpleGrading (1 1.000000e-01 1)
);
edges
(
arc 1 2 (0 2.000000e-02 0)
arc 4 5 (5 2.000000e-02 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
back
{
type symmetry;
faces
(
(0 2 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Theta 45deg for wedge b.c -
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 0.018478 0.007654)
(0 0.018478 -0.007654)
(5 0 0)
(5 0.018478 0.007654)
(5 0.018478 -0.007654)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 20 1) simpleGrading (1 1.000000e-01 1)
);
edges
(
arc 1 2 (0 2.000000e-02 0)
arc 4 5 (5 2.000000e-02 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
back
{
type wedge;
faces
(
(0 2 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
TransportProperties:-
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 8.926780341e-7;
// ************************************************************************* //
pressure initial conditions for symmetry b.c:-
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ 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 4.1835892e-3;
}
top
{
type zeroGradient;
}
axis
{
type empty;
}
front
{
type symmetry;
}
back
{
type symmetry;
}
}
// ************************************************************************* //
pressure initial conditions for wedge b.c:-
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ 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 4.1835892e-3;
}
top
{
type zeroGradient;
}
axis
{
type empty;
}
front
{
type wedge;
}
back
{
type wedge;
}
}
// ************************************************************************* //
velocity initial conditions for symmetry b.c:-
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0.0468656 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (0.0468656 0 0);
}
outlet
{
type zeroGradient;
}
top
{
type fixedValue;
value uniform (0 0 0);
}
axis
{
type empty;
}
front
{
type symmetry;
}
back
{
type symmetry;
}
}
// ************************************************************************* //
velocity initial conditions for wedge b.c:-
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0.0468656 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform (0.0468656 0 0);
}
outlet
{
type zeroGradient;
}
top
{
type fixedValue;
value uniform (0 0 0);
}
axis
{
type empty;
}
front
{
type wedge;
}
back
{
type wedge;
}
}
// ************************************************************************* //
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Week 4 - CHT Analysis on Exhaust port
CHT ANALYSIS ON EXHAUST PORT About CHT analysis: - CHT means Conjugate Heat Transfer which can tell combination of heat transfer in solids and fluids. This numerical analysis will give brief idea about conduction, convection and radiation or coupling of anyone of these three. The CHT analysis is used in process…
21 Jun 2021 12:26 PM IST
Week 3 - External flow simulation over an Ahmed body.
EXTERNAL FLOW SIMULATION OVER AN AHMED BODY AHMED BODY: - Ahmed body is a simplified car, used in automotive industry to investigate the flow analysis and find the wake flow around the body. This is made up of round front part, a moveable slant plane in ear…
20 Jun 2021 03:05 PM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.