Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
Introduction:-
Symmetry BC:-Symmetry means ' balanced and proportionate similarity to found two halves of an object', intermediate there is a axis.for example look like this...
Wedge BC:-Wedge means ' taking small portion of entire object, like 'isosceles triangle'.
Analytical H.P equation:- It means that 'calculations take place base on the Hagen Poiseuille's equation'.
Simulation Procedure:-
- Explain the entire simulation procedure in Open FOAM tutorial?
1.'Open in terminal' in the Linux Operating System.
2.Type the 'cd $FOAM_TUTORIALS or tut ( short -cut), and directly into the in-built tutorial files of the Open Foam Software, then type ls(list) to view the contents in the tutorials folders.
3. Type 'cd incompressible'. and then 'ls', it takes into the incompressible directory file.
4. Type 'cd icoFoam' ( solver), then 'ls', this step forward into icoFoam directory file.
5. Type 'cd cavity' and then 'ls' to list the contents.
6.copy cavity folder by type 'cp -r cavity/ $FOAM_RUN/ , this command copeis the cavity file and paste directly into the run folder.
7. To check , whether it (paste or not) check the Openfoam folder in that run folder' by using the manually or command based.
8. Important thing keep in the mind that , Never run the 'simulation cases' directly in the tutorials folder because it may corrupt or errors took place. It is difficult , to restore files again, it takes time process.
9. Open the files using the change directoy 'cd' command.
10. In the cavity folder, we have 'system folder' in that 'blockMeshDict, controlDict, fvSchemes and fv solution 'are text files, what we required file , choose it and edit the command "gedit editor".
11. Type " gedit blockMeshDict " , here ' we edit default Geometry, mesh grading , grid numbers and boundary names ' and finally the 'save ' the text file.
12.Type "gedit controlDict" , here ' we edit ' start time, end time, deltat', deltat is depend upon the Courant Number, Always C<1 ( stable), C>1 ( 'unstable ' forcibly stopped the software).
13. using 'cd ..' one step back, and go to '0 folder' in that ' velocity and pressure' text files, edit the 'velocity and pressure 'text file using 'gedit editor'.
14. After editing the four files ,come to the cavity directory.There we need to give a 'blockMesh' command to get mesh structured. then after 'checkMesh' command , it tells 'mesh is ok'.
15. Completing both command, we can confirm that our mesh is stable and good. Now type 'icoFoam' solver to simulate.
16. Here, we need to check the Courant Number always <1 . therefore , it is stable . Otherwise modified the ' parameter text files'.
17. if it is stable, then type 'paraFoam' for the post-processing.
18.'ParaView' is an open source multilple platform application 'to view the 'how simulation going on' and also the ' related parameter graphs' .
- Matlab Code:-
Symmetry BC
clear all
close all
clc
% Problem slove for 'Angle 10'
% Find out the 'Kinematic viscosity'
Re =2100; %Reynolds Number is given
rho=1000; %density of water @ 25 C in kg/m3
mu=0.89e-3; % dynamic viscosity of water Pa.s
nu=mu/rho; % kinematic viscosity m2/s
% input parameters for Haigen Poiseuille eqn
D=0.02; % Assume diameter of pipe in 'metre'
A_c=(pi/4)*D^2; % cross sectional area of pipe in 'm'
p=pi*D; % wetted perimeter
D_h=4*A_c/p; % hydraulic diameter of pipe in'm'
r_h=D_h/2; % fully developed V max in 'm'
v_avg =(Re*mu)/(rho*D_h); %Avg velocity 'm/s'
v_max=2*v_avg; % Fully developed V max in 'm/s'
tau_max=2*mu*v_max/r_h; % maximum shear stress 'n/m2'
% from 'Cengel Fluid Dynamics textbook' conditions for 'L_e'
if Re < 2300
L_e=0.06*Re*D_h;
elseif Re == 2300 % Cengel Fluid Dynamics
L_e=115*D_h;
elseif Re >4000
L_e=1.359*D_h*Re^(1/4); % Ref Bhatti & shah & zhi
end
L=L_e+0.18; % length of the pipe in 'm'
% pressure loss
f=65/Re; % Daracy Friction Factory
% Haigen Poiseuille eqn
P=(32*mu*(L-L_e)*v_avg)/(D^2);
g=9.81;
h_loss=P/(rho*g); %head loss
P_kinematic_press=P/rho;
theta=10 ; % given wedge 10 deg
r=r_h;
% string for header
h1='/*-------------------------------------------*- C++ -*-----------------------------------------------------*';
h2=' ========== |';
h3=' \ / F ield | OpenFOAM: The Open Source CFD Toolbox';
h4=' \ / O peration | Website: https://openfoam.org';
h5=' \ / A nd | Version: 9.0 ';
h6=' \ / M anipulation | Date: 07 March 2022';
h7=' | Author : Rudi Roy S ';
h8='*-----------------------------------------------------------------------------------------------------------*';
h9='FoamFile';
h10='{';
h11=' version 2.0;';
h12=' format ascii;';
h13=' class dictionary;';
h14=' object blockMeshDict;';
h15='}';
h16='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //';
f1=fopen('blockMeshDict.txt','wt');
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,'%s \n',h10);
fprintf(f1,'%s \n',h11);
fprintf(f1,'%s \n',h12);
fprintf(f1,'%s \n',h13);
fprintf(f1,'%s \n',h14);
fprintf(f1,'%s \n',h15);
fprintf(f1,'%s \n',h16);
% Vertices
v0=[0 0 0];
v1 =[0 r*cosd(theta/2) r*sind(theta/2)];
v2 =[0 r*cosd(theta/2) -r*sind(theta/2)];
v3=[L 0 0];
v4 =[0 r*cosd(theta/2) r*sind(theta/2)];
v5 =[0 r*cosd(theta/2) -r*sind(theta/2)];
mid1=[0 r 0];
mid2=[L r 0];
% write vertices
h17='convertToMeters 1;';
fprintf(f1, '%s \n',h17);
h18 ='vertices';
h19='(';
fprintf(f1,'%s \n',h19);
fprintf(f1,'(%d %d %d) \n',v0);
fprintf(f1,'(%d %d %d) \n',v1);
fprintf(f1,'(%d %d %d) \n',v2);
fprintf(f1,'(%d %d %d) \n',v3);
fprintf(f1,'(%d %d %d) \n',v4);
fprintf(f1,'(%d %d %d) \n',v5);
h20=')';
fprintf(f1,'%s \n \n',h20);
% writing Blocks
h21='blocks';
h22='(';
h23=' hex (0 3 5 2 0 3 4 1) (200 50 1) simpleGrading (1 0.2 1)';
h24=');';
fprintf(f1, '%s \n',h21);
fprintf(f1, '%s \n',h22);
fprintf(f1, '%s \n',h23);
fprintf(f1, '%s \n \n',h24);
% write edges
h25='edges';
h26='(';
h27=' arc 2 1';
h28=' arc 5 4';
h29=');';
fprintf(f1, '%s \n',h25);
fprintf(f1, '%s \n',h26);
fprintf(f1,h27);
fprintf(f1,' (%d %d %d) \n', 0,r,0);
fprintf(f1,h28);
fprintf(f1,' (%d %d %d) \n', 0,r,0);
fprintf(f1, '%s \n \n',h29);
% write boundary
inlet = [0 1 2 0];
outlet=[3 5 4 3];
wall=[2 1 4 5];
axis=[0 3 3 0];
front=[1 0 3 4];
back=[0 2 5 3];
fprintf(f1, '%s \n','boundary');
fprintf(f1,'%s \n','(');
%inlet patch
fprintf(f1,' %s \n','inlet');
fprintf(f1,' %s \n','{');
fprintf(f1,' %s \n','type patch;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',inlet);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%outlet patch
fprintf(f1,'%s \n','outlet');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type patch;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',outlet);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%wall
fprintf(f1,'%s \n','wall');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wall;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',wall);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%axis
fprintf(f1,'%s \n','axis');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type empty;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',axis);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%front
fprintf(f1,'%s \n','front');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wedge;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',front);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%back
fprintf(f1,'%s \n','back');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wedge;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',back);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','mergePatchPairs');
fprintf(f1,'%s \n','(;');
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','//*****************************************************************************//');
fclose(f1);
clear all
close all
clc
% Problem slove for 'Angle 25'
% Find out the 'Kinematic viscosity'
Re =2100; %Reynolds Number is given
rho=1000; %density of water @ 25 C in kg/m3
mu=0.89e-3; % dynamic viscosity of water Pa.s
nu=mu/rho; % kinematic viscosity m2/s
% input parameters for Haigen Poiseuille eqn
D=0.02; % Assume diameter of pipe in 'metre'
A_c=(pi/4)*D^2; % cross sectional area of pipe in 'm'
p=pi*D; % wetted perimeter
D_h=4*A_c/p; % hydraulic diameter of pipe in'm'
r_h=D_h/2; % fully developed V max in 'm'
v_avg =(Re*mu)/(rho*D_h); %Avg velocity 'm/s'
v_max=2*v_avg; % Fully developed V max in 'm/s'
tau_max=2*mu*v_max/r_h; % maximum shear stress 'n/m2'
% from 'Cengel Fluid Dynamics textbook' conditions for 'L_e'
if Re < 2300
L_e=0.06*Re*D_h;
elseif Re == 2300 % Cengel Fluid Dynamics
L_e=115*D_h;
elseif Re >4000
L_e=1.359*D_h*Re^(1/4); % Ref Bhatti & shah & zhi
end
L=L_e+0.18; % length of the pipe in 'm'
% pressure loss
f=65/Re; % Daracy Friction Factory
% Haigen Poiseuille eqn
P=(32*mu*(L-L_e)*v_avg)/(D^2);
g=9.81;
h_loss=P/(rho*g); %head loss
P_kinematic_press=P/rho;
theta=25; % given wedge 25 deg
r=r_h;
% string for header
h1='/*-------------------------------------------*- C++ -*-----------------------------------------------------*';
h2=' ========== |';
h3=' \ / F ield | OpenFOAM: The Open Source CFD Toolbox';
h4=' \ / O peration | Website: https://openfoam.org';
h5=' \ / A nd | Version: 9.0 ';
h6=' \ / M anipulation | Date: 07 March 2022';
h7=' | Author : Rudi Roy S ';
h8='*-----------------------------------------------------------------------------------------------------------*';
h9='FoamFile';
h10='{';
h11=' version 2.0;';
h12=' format ascii;';
h13=' class dictionary;';
h14=' object blockMeshDict;';
h15='}';
h16='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //';
f1=fopen('blockMeshDict.txt','wt');
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,'%s \n',h10);
fprintf(f1,'%s \n',h11);
fprintf(f1,'%s \n',h12);
fprintf(f1,'%s \n',h13);
fprintf(f1,'%s \n',h14);
fprintf(f1,'%s \n',h15);
fprintf(f1,'%s \n',h16);
% Vertices
v0=[0 0 0];
v1 =[0 r*cosd(theta/2) r*sind(theta/2)];
v2 =[0 r*cosd(theta/2) -r*sind(theta/2)];
v3=[L 0 0];
v4 =[0 r*cosd(theta/2) r*sind(theta/2)];
v5 =[0 r*cosd(theta/2) -r*sind(theta/2)];
mid1=[0 r 0];
mid2=[L r 0];
% write vertices
h17='convertToMeters 1;';
fprintf(f1, '%s \n',h17);
h18 ='vertices';
h19='(';
fprintf(f1,'%s \n',h19);
fprintf(f1,'(%d %d %d) \n',v0);
fprintf(f1,'(%d %d %d) \n',v1);
fprintf(f1,'(%d %d %d) \n',v2);
fprintf(f1,'(%d %d %d) \n',v3);
fprintf(f1,'(%d %d %d) \n',v4);
fprintf(f1,'(%d %d %d) \n',v5);
h20=')';
fprintf(f1,'%s \n \n',h20);
% writing Blocks
h21='blocks';
h22='(';
h23=' hex (0 3 5 2 0 3 4 1) (200 50 1) simpleGrading (1 0.2 1)';
h24=');';
fprintf(f1, '%s \n',h21);
fprintf(f1, '%s \n',h22);
fprintf(f1, '%s \n',h23);
fprintf(f1, '%s \n \n',h24);
% write edges
h25='edges';
h26='(';
h27=' arc 2 1';
h28=' arc 5 4';
h29=');';
fprintf(f1, '%s \n',h25);
fprintf(f1, '%s \n',h26);
fprintf(f1,h27);
fprintf(f1,' (%d %d %d) \n', 0,r,0);
fprintf(f1,h28);
fprintf(f1,' (%d %d %d) \n', 0,r,0);
fprintf(f1, '%s \n \n',h29);
% write boundary
inlet = [0 1 2 0];
outlet=[3 5 4 3];
wall=[2 1 4 5];
axis=[0 3 3 0];
front=[1 0 3 4];
back=[0 2 5 3];
fprintf(f1, '%s \n','boundary');
fprintf(f1,'%s \n','(');
%inlet patch
fprintf(f1,' %s \n','inlet');
fprintf(f1,' %s \n','{');
fprintf(f1,' %s \n','type patch;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',inlet);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%outlet patch
fprintf(f1,'%s \n','outlet');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type patch;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',outlet);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%wall
fprintf(f1,'%s \n','wall');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wall;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',wall);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%axis
fprintf(f1,'%s \n','axis');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type empty;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',axis);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%front
fprintf(f1,'%s \n','front');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wedge;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',front);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%back
fprintf(f1,'%s \n','back');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wedge;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',back);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','mergePatchPairs');
fprintf(f1,'%s \n','(;');
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','//*****************************************************************************//');
fclose(f1);
clear all
close all
clc
% Problem slove for 'Angle 45'
% Find out the 'Kinematic viscosity'
Re =2100; %Reynolds Number is given
rho=1000; %density of water @ 25 C in kg/m3
mu=0.89e-3; % dynamic viscosity of water Pa.s
nu=mu/rho; % kinematic viscosity m2/s
% input parameters for Haigen Poiseuille eqn
D=0.02; % Assume diameter of pipe in 'metre'
A_c=(pi/4)*D^2; % cross sectional area of pipe in 'm'
p=pi*D; % wetted perimeter
D_h=4*A_c/p; % hydraulic diameter of pipe in'm'
r_h=D_h/2; % fully developed V max in 'm'
v_avg =(Re*mu)/(rho*D_h); %Avg velocity 'm/s'
v_max=2*v_avg; % Fully developed V max in 'm/s'
tau_max=2*mu*v_max/r_h; % maximum shear stress 'n/m2'
% from 'Cengel Fluid Dynamics textbook' conditions for 'L_e'
if Re < 2300
L_e=0.06*Re*D_h;
elseif Re == 2300 % Cengel Fluid Dynamics
L_e=115*D_h;
elseif Re >4000
L_e=1.359*D_h*Re^(1/4); % Ref Bhatti & shah & zhi
end
L=L_e+0.18; % length of the pipe in 'm'
% pressure loss
f=65/Re; % Daracy Friction Factory
% Haigen Poiseuille eqn
P=(32*mu*(L-L_e)*v_avg)/(D^2);
g=9.81;
h_loss=P/(rho*g); %head loss
P_kinematic_press=P/rho;
theta=45; % given wedge 45 deg
r=r_h;
% string for header
h1='/*-------------------------------------------*- C++ -*-----------------------------------------------------*';
h2=' ========== |';
h3=' \ / F ield | OpenFOAM: The Open Source CFD Toolbox';
h4=' \ / O peration | Website: https://openfoam.org';
h5=' \ / A nd | Version: 9.0 ';
h6=' \ / M anipulation | Date: 07 March 2022';
h7=' | Author : Rudi Roy S ';
h8='*-----------------------------------------------------------------------------------------------------------*';
h9='FoamFile';
h10='{';
h11=' version 2.0;';
h12=' format ascii;';
h13=' class dictionary;';
h14=' object blockMeshDict;';
h15='}';
h16='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //';
f1=fopen('blockMeshDict.txt','wt');
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,'%s \n',h10);
fprintf(f1,'%s \n',h11);
fprintf(f1,'%s \n',h12);
fprintf(f1,'%s \n',h13);
fprintf(f1,'%s \n',h14);
fprintf(f1,'%s \n',h15);
fprintf(f1,'%s \n',h16);
% Vertices
v0=[0 0 0];
v1 =[0 r*cosd(theta/2) r*sind(theta/2)];
v2 =[0 r*cosd(theta/2) -r*sind(theta/2)];
v3=[L 0 0];
v4 =[0 r*cosd(theta/2) r*sind(theta/2)];
v5 =[0 r*cosd(theta/2) -r*sind(theta/2)];
mid1=[0 r 0];
mid2=[L r 0];
% write vertices
h17='convertToMeters 1;';
fprintf(f1, '%s \n',h17);
h18 ='vertices';
h19='(';
fprintf(f1,'%s \n',h19);
fprintf(f1,'(%d %d %d) \n',v0);
fprintf(f1,'(%d %d %d) \n',v1);
fprintf(f1,'(%d %d %d) \n',v2);
fprintf(f1,'(%d %d %d) \n',v3);
fprintf(f1,'(%d %d %d) \n',v4);
fprintf(f1,'(%d %d %d) \n',v5);
h20=')';
fprintf(f1,'%s \n \n',h20);
% writing Blocks
h21='blocks';
h22='(';
h23=' hex (0 3 5 2 0 3 4 1) (200 50 1) simpleGrading (1 0.2 1)';
h24=');';
fprintf(f1, '%s \n',h21);
fprintf(f1, '%s \n',h22);
fprintf(f1, '%s \n',h23);
fprintf(f1, '%s \n \n',h24);
% write edges
h25='edges';
h26='(';
h27=' arc 2 1';
h28=' arc 5 4';
h29=');';
fprintf(f1, '%s \n',h25);
fprintf(f1, '%s \n',h26);
fprintf(f1,h27);
fprintf(f1,' (%d %d %d) \n', 0,r,0);
fprintf(f1,h28);
fprintf(f1,' (%d %d %d) \n', 0,r,0);
fprintf(f1, '%s \n \n',h29);
% write boundary
inlet = [0 1 2 0];
outlet=[3 5 4 3];
wall=[2 1 4 5];
axis=[0 3 3 0];
front=[1 0 3 4];
back=[0 2 5 3];
fprintf(f1, '%s \n','boundary');
fprintf(f1,'%s \n','(');
%inlet patch
fprintf(f1,' %s \n','inlet');
fprintf(f1,' %s \n','{');
fprintf(f1,' %s \n','type patch;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',inlet);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%outlet patch
fprintf(f1,'%s \n','outlet');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type patch;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',outlet);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%wall
fprintf(f1,'%s \n','wall');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wall;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',wall);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%axis
fprintf(f1,'%s \n','axis');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type empty;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',axis);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%front
fprintf(f1,'%s \n','front');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wedge;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',front);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%back
fprintf(f1,'%s \n','back');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wedge;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',back);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','mergePatchPairs');
fprintf(f1,'%s \n','(;');
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','//*****************************************************************************//');
fclose(f1);
Wedge BC
clear all
close all
clc
% Problem slove for 'Angle 10'
% Find out the 'Kinematic viscosity'
Re =2100; %Reynolds Number is given
rho=1000; %density of water @ 25 C in kg/m3
mu=0.89e-3; % dynamic viscosity of water Pa.s
nu=mu/rho; % kinematic viscosity m2/s
% input parameters for Haigen Poiseuille eqn
D=0.02; % Assume diameter of pipe in 'metre'
A_c=(pi/4)*D^2; % cross sectional area of pipe in 'm'
p=pi*D; % wetted perimeter
D_h=4*A_c/p; % hydraulic diameter of pipe in'm'
r_h=D_h/2; % fully developed V max in 'm'
v_avg =(Re*mu)/(rho*D_h); %Avg velocity 'm/s'
v_max=2*v_avg; % Fully developed V max in 'm/s'
tau_max=2*mu*v_max/r_h; % maximum shear stress 'n/m2'
% from 'Cengel Fluid Dynamics textbook' conditions for 'L_e'
if Re < 2300
L_e=0.06*Re*D_h;
elseif Re == 2300 % Cengel Fluid Dynamics
L_e=115*D_h;
elseif Re >4000
L_e=1.359*D_h*Re^(1/4); % Ref Bhatti & shah & zhi
end
L=L_e+0.18; % length of the pipe in 'm'
% pressure loss
f=65/Re; % Daracy Friction Factory
% Haigen Poiseuille eqn
P=(32*mu*(L-L_e)*v_avg)/(D^2);
g=9.81;
h_loss=P/(rho*g); %head loss
P_kinematic_press=P/rho;
theta=10; % given wedge 10 deg
r=r_h;
% string for header
h1='/*-------------------------------------------*- C++ -*-----------------------------------------------------*';
h2=' ========== |';
h3=' \ / F ield | OpenFOAM: The Open Source CFD Toolbox';
h4=' \ / O peration | Website: https://openfoam.org';
h5=' \ / A nd | Version: 9.0 ';
h6=' \ / M anipulation | Date: 07 March 2022';
h7=' | Author : Rudi Roy S ';
h8='*-----------------------------------------------------------------------------------------------------------*';
h9='FoamFile';
h10='{';
h11=' version 2.0;';
h12=' format ascii;';
h13=' class dictionary;';
h14=' object blockMeshDict;';
h15='}';
h16='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //';
f1=fopen('blockMeshDict.txt','wt');
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,'%s \n',h10);
fprintf(f1,'%s \n',h11);
fprintf(f1,'%s \n',h12);
fprintf(f1,'%s \n',h13);
fprintf(f1,'%s \n',h14);
fprintf(f1,'%s \n',h15);
fprintf(f1,'%s \n',h16);
% Vertices
v0=[0 0 0];
v1 =[0 r*cosd(theta) r*sind(theta)];
v2 =[0 r*cosd(theta) -r*sind(theta)];
v3=[L 0 0];
v4 =[0 r*cosd(theta) r*sind(theta)];
v5 =[0 r*cosd(theta) -r*sind(theta)];
mid1=[0 r 0];
mid2=[L r 0];
% write vertices
h17='convertToMeters 1;';
fprintf(f1, '%s \n',h17);
h18 ='vertices';
h19='(';
fprintf(f1,'%s \n',h19);
fprintf(f1,'(%d %d %d) \n',v0);
fprintf(f1,'(%d %d %d) \n',v1);
fprintf(f1,'(%d %d %d) \n',v2);
fprintf(f1,'(%d %d %d) \n',v3);
fprintf(f1,'(%d %d %d) \n',v4);
fprintf(f1,'(%d %d %d) \n',v5);
h20=')';
fprintf(f1,'%s \n \n',h20);
% writing Blocks
h21='blocks';
h22='(';
h23=' hex (0 3 5 2 0 3 4 1) (200 50 1) simpleGrading (1 0.2 1)';
h24=');';
fprintf(f1, '%s \n',h21);
fprintf(f1, '%s \n',h22);
fprintf(f1, '%s \n',h23);
fprintf(f1, '%s \n \n',h24);
% write edges
h25='edges';
h26='(';
h27=' arc 2 1';
h28=' arc 5 4';
h29=');';
fprintf(f1, '%s \n',h25);
fprintf(f1, '%s \n',h26);
fprintf(f1,h27);
fprintf(f1,' (%d %d %d) \n', 0,r,0);
fprintf(f1,h28);
fprintf(f1,' (%d %d %d) \n', 0,r,0);
fprintf(f1, '%s \n \n',h29);
% write boundary
inlet = [0 1 2 0];
outlet=[3 5 4 3];
wall=[2 1 4 5];
axis=[0 3 3 0];
front=[1 0 3 4];
back=[0 2 5 3];
fprintf(f1, '%s \n','boundary');
fprintf(f1,'%s \n','(');
%inlet patch
fprintf(f1,' %s \n','inlet');
fprintf(f1,' %s \n','{');
fprintf(f1,' %s \n','type patch;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',inlet);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%outlet patch
fprintf(f1,'%s \n','outlet');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type patch;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',outlet);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%wall
fprintf(f1,'%s \n','wall');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wall;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',wall);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%axis
fprintf(f1,'%s \n','axis');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type empty;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',axis);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%front
fprintf(f1,'%s \n','front');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wedge;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',front);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%back
fprintf(f1,'%s \n','back');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wedge;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',back);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','mergePatchPairs');
fprintf(f1,'%s \n','(;');
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','//*****************************************************************************//');
fclose(f1);
clear all
close all
clc
% Problem slove for 'Angle 25'
% Find out the 'Kinematic viscosity'
Re =2100; %Reynolds Number is given
rho=1000; %density of water @ 25 C in kg/m3
mu=0.89e-3; % dynamic viscosity of water Pa.s
nu=mu/rho; % kinematic viscosity m2/s
% input parameters for Haigen Poiseuille eqn
D=0.02; % Assume diameter of pipe in 'metre'
A_c=(pi/4)*D^2; % cross sectional area of pipe in 'm'
p=pi*D; % wetted perimeter
D_h=4*A_c/p; % hydraulic diameter of pipe in'm'
r_h=D_h/2; % fully developed V max in 'm'
v_avg =(Re*mu)/(rho*D_h); %Avg velocity 'm/s'
v_max=2*v_avg; % Fully developed V max in 'm/s'
tau_max=2*mu*v_max/r_h; % maximum shear stress 'n/m2'
% from 'Cengel Fluid Dynamics textbook' conditions for 'L_e'
if Re < 2300
L_e=0.06*Re*D_h;
elseif Re == 2300 % Cengel Fluid Dynamics
L_e=115*D_h;
elseif Re >4000
L_e=1.359*D_h*Re^(1/4); % Ref Bhatti & shah & zhi
end
L=L_e+0.18; % length of the pipe in 'm'
% pressure loss
f=65/Re; % Daracy Friction Factory
% Haigen Poiseuille eqn
P=(32*mu*(L-L_e)*v_avg)/(D^2);
g=9.81;
h_loss=P/(rho*g); %head loss
P_kinematic_press=P/rho;
theta=25; % given wedge 25 deg
r=r_h;
% string for header
h1='/*-------------------------------------------*- C++ -*-----------------------------------------------------*';
h2=' ========== |';
h3=' \ / F ield | OpenFOAM: The Open Source CFD Toolbox';
h4=' \ / O peration | Website: https://openfoam.org';
h5=' \ / A nd | Version: 9.0 ';
h6=' \ / M anipulation | Date: 07 March 2022';
h7=' | Author : Rudi Roy S ';
h8='*-----------------------------------------------------------------------------------------------------------*';
h9='FoamFile';
h10='{';
h11=' version 2.0;';
h12=' format ascii;';
h13=' class dictionary;';
h14=' object blockMeshDict;';
h15='}';
h16='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //';
f1=fopen('blockMeshDict.txt','wt');
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,'%s \n',h10);
fprintf(f1,'%s \n',h11);
fprintf(f1,'%s \n',h12);
fprintf(f1,'%s \n',h13);
fprintf(f1,'%s \n',h14);
fprintf(f1,'%s \n',h15);
fprintf(f1,'%s \n',h16);
% Vertices
v0=[0 0 0];
v1 =[0 r*cosd(theta) r*sind(theta)];
v2 =[0 r*cosd(theta) -r*sind(theta)];
v3=[L 0 0];
v4 =[0 r*cosd(theta) r*sind(theta)];
v5 =[0 r*cosd(theta) -r*sind(theta)];
mid1=[0 r 0];
mid2=[L r 0];
% write vertices
h17='convertToMeters 1;';
fprintf(f1, '%s \n',h17);
h18 ='vertices';
h19='(';
fprintf(f1,'%s \n',h19);
fprintf(f1,'(%d %d %d) \n',v0);
fprintf(f1,'(%d %d %d) \n',v1);
fprintf(f1,'(%d %d %d) \n',v2);
fprintf(f1,'(%d %d %d) \n',v3);
fprintf(f1,'(%d %d %d) \n',v4);
fprintf(f1,'(%d %d %d) \n',v5);
h20=')';
fprintf(f1,'%s \n \n',h20);
% writing Blocks
h21='blocks';
h22='(';
h23=' hex (0 3 5 2 0 3 4 1) (200 50 1) simpleGrading (1 0.2 1)';
h24=');';
fprintf(f1, '%s \n',h21);
fprintf(f1, '%s \n',h22);
fprintf(f1, '%s \n',h23);
fprintf(f1, '%s \n \n',h24);
% write edges
h25='edges';
h26='(';
h27=' arc 2 1';
h28=' arc 5 4';
h29=');';
fprintf(f1, '%s \n',h25);
fprintf(f1, '%s \n',h26);
fprintf(f1,h27);
fprintf(f1,' (%d %d %d) \n', 0,r,0);
fprintf(f1,h28);
fprintf(f1,' (%d %d %d) \n', 0,r,0);
fprintf(f1, '%s \n \n',h29);
% write boundary
inlet = [0 1 2 0];
outlet=[3 5 4 3];
wall=[2 1 4 5];
axis=[0 3 3 0];
front=[1 0 3 4];
back=[0 2 5 3];
fprintf(f1, '%s \n','boundary');
fprintf(f1,'%s \n','(');
%inlet patch
fprintf(f1,' %s \n','inlet');
fprintf(f1,' %s \n','{');
fprintf(f1,' %s \n','type patch;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',inlet);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%outlet patch
fprintf(f1,'%s \n','outlet');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type patch;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',outlet);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%wall
fprintf(f1,'%s \n','wall');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wall;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',wall);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%axis
fprintf(f1,'%s \n','axis');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type empty;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',axis);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%front
fprintf(f1,'%s \n','front');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wedge;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',front);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%back
fprintf(f1,'%s \n','back');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wedge;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',back);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','mergePatchPairs');
fprintf(f1,'%s \n','(;');
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','//*****************************************************************************//');
fclose(f1);
clear all
close all
clc
% Problem slove for 'Angle 45'
% Find out the 'Kinematic viscosity'
Re =2100; %Reynolds Number is given
rho=1000; %density of water @ 25 C in kg/m3
mu=0.89e-3; % dynamic viscosity of water Pa.s
nu=mu/rho; % kinematic viscosity m2/s
% input parameters for Haigen Poiseuille eqn
D=0.02; % Assume diameter of pipe in 'metre'
A_c=(pi/4)*D^2; % cross sectional area of pipe in 'm'
p=pi*D; % wetted perimeter
D_h=4*A_c/p; % hydraulic diameter of pipe in'm'
r_h=D_h/2; % fully developed V max in 'm'
v_avg =(Re*mu)/(rho*D_h); %Avg velocity 'm/s'
v_max=2*v_avg; % Fully developed V max in 'm/s'
tau_max=2*mu*v_max/r_h; % maximum shear stress 'n/m2'
% from 'Cengel Fluid Dynamics textbook' conditions for 'L_e'
if Re < 2300
L_e=0.06*Re*D_h;
elseif Re == 2300 % Cengel Fluid Dynamics
L_e=115*D_h;
elseif Re >4000
L_e=1.359*D_h*Re^(1/4); % Ref Bhatti & shah & zhi
end
L=L_e+0.18; % length of the pipe in 'm'
% pressure loss
f=65/Re; % Daracy Friction Factory
% Haigen Poiseuille eqn
P=(32*mu*(L-L_e)*v_avg)/(D^2);
g=9.81;
h_loss=P/(rho*g); %head loss
P_kinematic_press=P/rho;
theta=45; % given wedge 45 deg
r=r_h;
% string for header
h1='/*-------------------------------------------*- C++ -*-----------------------------------------------------*';
h2=' ========== |';
h3=' \ / F ield | OpenFOAM: The Open Source CFD Toolbox';
h4=' \ / O peration | Website: https://openfoam.org';
h5=' \ / A nd | Version: 9.0 ';
h6=' \ / M anipulation | Date: 07 March 2022';
h7=' | Author : Rudi Roy S ';
h8='*-----------------------------------------------------------------------------------------------------------*';
h9='FoamFile';
h10='{';
h11=' version 2.0;';
h12=' format ascii;';
h13=' class dictionary;';
h14=' object blockMeshDict;';
h15='}';
h16='// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //';
f1=fopen('blockMeshDict.txt','wt');
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,'%s \n',h10);
fprintf(f1,'%s \n',h11);
fprintf(f1,'%s \n',h12);
fprintf(f1,'%s \n',h13);
fprintf(f1,'%s \n',h14);
fprintf(f1,'%s \n',h15);
fprintf(f1,'%s \n',h16);
% Vertices
v0=[0 0 0];
v1 =[0 r*cosd(theta) r*sind(theta)];
v2 =[0 r*cosd(theta) -r*sind(theta)];
v3=[L 0 0];
v4 =[0 r*cosd(theta) r*sind(theta)];
v5 =[0 r*cosd(theta) -r*sind(theta)];
mid1=[0 r 0];
mid2=[L r 0];
% write vertices
h17='convertToMeters 1;';
fprintf(f1, '%s \n',h17);
h18 ='vertices';
h19='(';
fprintf(f1,'%s \n',h19);
fprintf(f1,'(%d %d %d) \n',v0);
fprintf(f1,'(%d %d %d) \n',v1);
fprintf(f1,'(%d %d %d) \n',v2);
fprintf(f1,'(%d %d %d) \n',v3);
fprintf(f1,'(%d %d %d) \n',v4);
fprintf(f1,'(%d %d %d) \n',v5);
h20=')';
fprintf(f1,'%s \n \n',h20);
% writing Blocks
h21='blocks';
h22='(';
h23=' hex (0 3 5 2 0 3 4 1) (200 50 1) simpleGrading (1 0.2 1)';
h24=');';
fprintf(f1, '%s \n',h21);
fprintf(f1, '%s \n',h22);
fprintf(f1, '%s \n',h23);
fprintf(f1, '%s \n \n',h24);
% write edges
h25='edges';
h26='(';
h27=' arc 2 1';
h28=' arc 5 4';
h29=');';
fprintf(f1, '%s \n',h25);
fprintf(f1, '%s \n',h26);
fprintf(f1,h27);
fprintf(f1,' (%d %d %d) \n', 0,r,0);
fprintf(f1,h28);
fprintf(f1,' (%d %d %d) \n', 0,r,0);
fprintf(f1, '%s \n \n',h29);
% write boundary
inlet = [0 1 2 0];
outlet=[3 5 4 3];
wall=[2 1 4 5];
axis=[0 3 3 0];
front=[1 0 3 4];
back=[0 2 5 3];
fprintf(f1, '%s \n','boundary');
fprintf(f1,'%s \n','(');
%inlet patch
fprintf(f1,' %s \n','inlet');
fprintf(f1,' %s \n','{');
fprintf(f1,' %s \n','type patch;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',inlet);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%outlet patch
fprintf(f1,'%s \n','outlet');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type patch;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',outlet);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%wall
fprintf(f1,'%s \n','wall');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wall;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',wall);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%axis
fprintf(f1,'%s \n','axis');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type empty;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',axis);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%front
fprintf(f1,'%s \n','front');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wedge;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',front);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
%back
fprintf(f1,'%s \n','back');
fprintf(f1,'%s \n','{');
fprintf(f1,'%s \n','type wedge;');
fprintf(f1,'%s \n','faces');
fprintf(f1,'%s \n','(');
fprintf(f1,'(%d %d %d %d) \n',back);
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','}');
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','mergePatchPairs');
fprintf(f1,'%s \n','(;');
fprintf(f1,'%s \n',');');
fprintf(f1,'%s \n','//*****************************************************************************//');
fclose(f1);
- BlockMeshDict File:-
Symmetry BC
Angle of 10 deg
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 9.996573e-3 8.715574e-04)
(0 9.996573e-3 -8.715574e-04)
(2.7 0 0)
(2.7 9.996573e-3 8.715574e-04)
(2.7 9.996573e-3 -8.715574e-04)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 50 1) simpleGrading (1 0.2 1)
);
edges
(
arc 1 2 (0 1e-02 0)
arc 4 5 (2.7 1e-02 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
wall
{
type wall;
faces
(
(2 1 4 5)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
back
{
type wedge;//symmetry;
faces
(
(0 2 5 3)
);
}
front
{
type wedge;//symmetry;
faces
(
(0 3 4 1)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Angle of 25 deg
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 9.996573e-3 2.164396e-03)
(0 9.996573e-3 -2.164396e-03)
(2.7 0 0)
(2.7 9.996573e-3 2.164396e-03)
(2.7 9.996573e-3 -2.164396e-03)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 50 1) simpleGrading (1 0.2 1)
);
edges
(
arc 1 2 (0 1e-02 0)
arc 4 5 (2.7 1e-02 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
wall
{
type wall;
faces
(
(2 1 4 5)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
back
{
type wedge;//symmetry;
faces
(
(0 2 5 3)
);
}
front
{
type wedge;//symmetry;
faces
(
(0 3 4 1)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Angle of 45 deg
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 9.996573e-3 3.826834e-03)
(0 9.996573e-3 -3.826834e-03)
(2.7 0 0)
(2.7 9.996573e-3 3.826834e-03)
(2.7 9.996573e-3 -3.826834e-03)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 50 1) simpleGrading (1 0.2 1)
);
edges
(
arc 1 2 (0 1e-02 0)
arc 4 5 (2.7 1e-02 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
wall
{
type wall;
faces
(
(2 1 4 5)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
back
{
type wedge;//symmetry;
faces
(
(0 2 5 3)
);
}
front
{
type wedge;//symmetry;
faces
(
(0 3 4 1)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Wedge BC
Angle of 10 deg
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 9.996573e-3 1.736482e-03)
(0 9.996573e-3 -1.736482e-03)
(2.7 0 0)
(2.7 9.996573e-3 1.736482e-03)
(2.7 9.996573e-3 -1.736482e-03)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 50 1) simpleGrading (1 0.2 1)
);
edges
(
arc 1 2 (0 1e-02 0)
arc 4 5 (2.7 1e-02 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
wall
{
type wall;
faces
(
(2 1 4 5)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
back
{
type wedge;//symmetry;
faces
(
(0 2 5 3)
);
}
front
{
type wedge;//symmetry;
faces
(
(0 3 4 1)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Angle of 25 deg
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 9.996573e-3 4.226183e-03)
(0 9.996573e-3 -4.226183e-03)
(2.7 0 0)
(2.7 9.996573e-3 4.226183e-03)
(2.7 9.996573e-3 -4.226183e-03)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 50 1) simpleGrading (1 0.2 1)
);
edges
(
arc 1 2 (0 1e-02 0)
arc 4 5 (2.7 1e-02 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
wall
{
type wall;
faces
(
(2 1 4 5)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
back
{
type wedge;//symmetry;
faces
(
(0 2 5 3)
);
}
front
{
type wedge;//symmetry;
faces
(
(0 3 4 1)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
Angle of 45 deg
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0 9.996573e-3 3.826834e-03)
(0 9.996573e-3 -3.826834e-03)
(2.7 0 0)
(2.7 9.996573e-3 3.826834e-03)
(2.7 9.996573e-3 -3.826834e-03)
);
blocks
(
hex (0 3 5 2 0 3 4 1) (200 50 1) simpleGrading (1 0.2 1)
);
edges
(
arc 1 2 (0 1e-02 0)
arc 4 5 (2.7 1e-02 0)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 4 5 3)
);
}
wall
{
type wall;
faces
(
(2 1 4 5)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
back
{
type wedge;//symmetry;
faces
(
(0 2 5 3)
);
}
front
{
type wedge;//symmetry;
faces
(
(0 3 4 1)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
- controlDict File:- constant for all tests.
Symmetry BC & Wedge BC
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 30;
deltaT 0.01;
writeControl timeStep;
writeInterval 200;
purgeWrite 0;
writeFormat ascii;
writePrecision 4;
writeCompression off;
timeFormat general;
timePrecision 4;
runTimeModifiable true;
// ************************************************************************* //
- Pressure File:- constant for all tests.
Symmetry BC & Wedge BC
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
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.05;
}
wall
{
type zeroGradient;
}
axis
{
type empty;
}
front
{
type wedge;
}
back
{
type wedge;
}
}
// ************************************************************************* //
- Velocity File:-constant for all tests.
Symmetry BC & Wedge BC
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
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.0935 0 0);
}
outlet
{
type zeroGradient;
}
wall
{
type noSlip;
//type fixedValue;
//value uniform(0 0 0);
}
axis
{
type empty;
}
front
{
type wedge;
}
back
{
type wedge;
}
}
// ************************************************************************* //
- Transport Properties:- constant for all tests.
Symmetry BC & Wedge BC
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 8.9e-07;
// ************************************************************************* //
Expected Results:-
1.Validate Hydro-dynamic length with the numerical result

2. pressure & velocity contours
Symmetry BC
Angle of Test 10 deg


Angle of Test 25 deg


Angle of Test 45 deg


Wedge BC
Angle of Test 10 deg


Angle of Test 25 deg


Angle of Test 45 deg


3.Validate maximum velocity and pressured drop for fully developed flow
Symmetry BC
Angle of Test 10 deg

Angle of Test 25 deg

Angle of Test 45 deg

Wedge BC
Angle of Test 10 deg

Angle of Test 25 deg

Angle of Test 45 deg

4.Post-process Shear stress and validate wall shear stress for fully developed flow
Symmetry BC
Angle of Test 10 deg

Angle of Test 25 deg

Angle of Test 45 deg

Wedge BC
Angle of Test 10 deg

Angle of Test 25 deg

Angle of Test 45 deg

5.Highlight the differences in both boundary conditions in terms of their usage and aplication
1. In above line plots, 'pressure' maintain constant at 0.06 pa in all cases. where as 'U_magnitude (velocity) at starting length 0.18 m/s (max) along the length increases velocity drop gradually, at end 0 m/s , same for all cases.
2. Wall shear stress varies all cases because 'it depends upon the flow direction of velocity'. only 'symmetry at angle 10 deg' lies along inclined line, remaining all cases shear at between 0 to 0.009 m with 0 to 0.035 N/m2' .
3. Always take 'wedge angle < 10 deg' for better results & also simulation time reduce. No need to take 'Bigger angle', if you take small angle gives same results for taking 'bigger angle or entire model'.
4. while seeing the contours ( pressure & velocity), the scales are not reduced.
5.'Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation' has done.
**********
- Rudi SSpecify the Reason ' Krishna.