All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Objectives :- Write a Matlab program that takes an angle as input and generates a blockMesh file for the given angle. Angles to test 10,25,45 Show that the velocity profile is fully developed. Compare the above results and discuss. Given Inputs :- Reynolds number(Re) = 2100 Working fluid = Water Solver = icoFoam Density…
Aman Kumar
updated on 19 Jul 2019
Objectives :-
Given Inputs :-
Note :- We are already calculated all the flow variable in previous project at an angle 2 degree \"OpenFOAM pipe flow challenge - part 1\"
Calculated result from above input :-
Assumption :-
Matlab code that can generate the computational mesh for any wedge angle and grading factor for symmetry boundary condition :-
% Code to create blockMeshDict file
clear all
close all
clc
L = 5.5; % Length of the pipe
theta = input(\'Wedge angle = \'); % Angle
D = 0.05; % Diameter of the pipe
r = D/2; % Radius of the pipe
nx = 200; % grid point along x-axis
ny = 30; % grid point along y-axis
nz = 1; % grid point along z-axis
% Creating blockMesh file
l1 = \'/*--------------------------------*- C++ -*----------------------------------*\\\';
l2 = \'| ========= | |\';
l3 = \'| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |\';
l4 = \'| \\\\ / O peration | Version: 4.1 |\';
l5 = \'| \\\\ / A nd | Web: www.OpenFOAM.org |\';
l6 = \'| \\\\/ M anipulation | |\';
l7 = \'\\*---------------------------------------------------------------------------*/\';
Block = fopen(\'blockMeshDict\',\'w\');
fprintf(Block,\'%s\\n\',l1);
fprintf(Block,\'%s\\n\',l2);
fprintf(Block,\'%s\\n\',l3);
fprintf(Block,\'%s\\n\',l4);
fprintf(Block,\'%s\\n\',l5);
fprintf(Block,\'%s\\n\',l6);
fprintf(Block,\'%s\\n\',l7);
fprintf(Block,\'FoamFile\\n{\\n\');
fprintf(Block,\'%12s \\t 2.0;\\n\',\'version\');
fprintf(Block,\'%11s \\t ascii;\\n\',\'format\');
fprintf(Block,\'%10s \\t dictionary;\\n\',\'class\');
fprintf(Block,\'%11s \\t blockMeshDict;\\n\',\'object\');
fprintf(Block,\'}\\n\');
l8=\'// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //\';
fprintf(Block,\'%s\\n\\n\',l8);
fprintf(Block,\'convertToMeters 1;\\n\\n\');
fprintf(Block,\'vertices\\n\');
fprintf(Block,\'(\\n\');
fprintf(Block,\'\\t (%f %f %f)\\n\',0,0,0); % point 0
fprintf(Block,\'\\t (%f %f %f)\\n\',0,r*cosd(theta/2),r*sind(theta/2)); % point 1
fprintf(Block,\'\\t (%f %f %f)\\n\',0,r*cosd(theta/2),-r*sind(theta/2)); % point 2
fprintf(Block,\'\\t (%f %f %f)\\n\',L,0,0); % Pont 3
fprintf(Block,\'\\t (%f %f %f)\\n\',L,r*cosd(theta/2),r*sind(theta/2)); % point 4
fprintf(Block,\'\\t (%f %f %f)\\n\',L,(r*cosd(theta/2)),-r*sind(theta/2)); % point 5
fprintf(Block,\');\\n\\n\');
fprintf(Block,\'blocks\\n\');
fprintf(Block,\'(\\n\');
fprintf(Block,\'\\t hex ( 0 3 5 2 0 3 4 1) (%d %d %d)\',nx,ny,nz);
fprintf(Block, \' SimpleGrading (1 0.1 1)\\n\\n\');
fprintf(Block,\');\\n\\n\');
fprintf(Block,\'edges\\n(\\n\\t arc %d %d (%f %f %f)\\n\',1,2,0,r,0);
fprintf(Block,\'\\t arc %d %d (%f %f %f)\\n\',4,5,L,r,0);
fprintf(Block,\');\\n\\n\');
fprintf(Block,\'boundary\\n(\\n\');
fprintf(Block,\'\\t inlet\\n\');
fprintf(Block,\'\\t{\\n\');
fprintf(Block,\'\\t\\t type patch;\\n\');
fprintf(Block,\'\\t\\t faces\\n\');
fprintf(Block,\'\\t\\t (\\n\');
fprintf(Block,\'\\t\\t\\t (0 1 2 0)\\n\');
fprintf(Block,\'\\t\\t );\\n\');
fprintf(Block,\'\\t}\\n\');
fprintf(Block,\'\\t outlet\\n\');
fprintf(Block,\'\\t{\\n\');
fprintf(Block,\'\\t\\t type patch;\\n\');
fprintf(Block,\'\\t\\t faces\\n\');
fprintf(Block,\'\\t\\t (\\n\');
fprintf(Block,\'\\t\\t\\t (3 5 4 3)\\n\');
fprintf(Block,\'\\t\\t );\\n\');
fprintf(Block,\'\\t}\\n\');
fprintf(Block,\'\\t top \\n\');
fprintf(Block,\'\\t{\\n\');
fprintf(Block,\'\\t\\t type wall;\\n\');
fprintf(Block,\'\\t\\t faces\\n\');
fprintf(Block,\'\\t\\t (\\n\');
fprintf(Block,\'\\t\\t\\t (1 4 5 2)\\n\');
fprintf(Block,\'\\t\\t );\\n\');
fprintf(Block,\'\\t}\\n\');
fprintf(Block,\'\\t back\\n\');
fprintf(Block,\'\\t{\\n\');
fprintf(Block,\'\\t\\t type symmetry;\\n\');
fprintf(Block,\'\\t\\t faces\\n\');
fprintf(Block,\'\\t\\t (\\n\');
fprintf(Block,\'\\t\\t\\t (0 2 5 3)\\n\');
fprintf(Block,\'\\t\\t );\\n\');
fprintf(Block,\'\\t}\\n\');
fprintf(Block,\'\\t front\\n\');
fprintf(Block,\'\\t{\\n\');
fprintf(Block,\'\\t\\t type symmetry;\\n\');
fprintf(Block,\'\\t\\t faces\\n\');
fprintf(Block,\'\\t\\t (\\n\');
fprintf(Block,\'\\t\\t\\t (0 3 4 1)\\n\');
fprintf(Block,\'\\t\\t );\\n\');
fprintf(Block,\'\\t}\\n\');
fprintf(Block,\'\\t axis\\n\');
fprintf(Block,\'\\t{\\n\');
fprintf(Block,\'\\t\\t type empty;\\n\');
fprintf(Block,\'\\t\\t faces\\n\');
fprintf(Block,\'\\t\\t (\\n\');
fprintf(Block,\'\\t\\t\\t (0 3 3 0)\\n\');
fprintf(Block,\'\\t\\t );\\n\');
fprintf(Block,\'\\t}\\n\');
fprintf(Block,\');\\n\\n\');
fprintf(Block,\'mergePatchPairs\\n(\\n\');
fprintf(Block,\');\\n\');
line9=\'// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //\';
fprintf(Block,\'%s\\n\',line9);
fclose(Block);
blockMeshDict file generated by Matlab for an angle 2 degree with wedge BC:-
/*--------------------------------*- C++ -*----------------------------------*\\
| ========= | |
| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\\\ / O peration | Version: 4.1 |
| \\\\ / A nd | Web: www.OpenFOAM.org |
| \\\\/ M anipulation | |
\\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0.000000 0.000000 0.000000)
(0.000000 0.024996 0.000436)
(0.000000 0.024996 -0.000436)
(5.250000 0.000000 0.000000)
(5.250000 0.024996 0.000436)
(5.250000 0.024996 -0.000436)
);
blocks
(
hex ( 0 3 5 2 0 3 4 1) (200 30 1) SimpleGrading (1 0.1 1)
);
edges
(
arc 1 2 (0.000000 0.025000 0.000000)
arc 4 5 (5.250000 0.025000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
back
{
type wedge;
faces
(
(0 2 5 3)
);
}
front
{
type wedge;
faces
(
(0 3 4 1)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
blockMeshDict file generated by Matlab for an angle 10 degree with symmetry BC:-
/*--------------------------------*- C++ -*----------------------------------*\\
| ========= | |
| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\\\ / O peration | Version: 4.1 |
| \\\\ / A nd | Web: www.OpenFOAM.org |
| \\\\/ M anipulation | |
\\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0.000000 0.000000 0.000000)
(0.000000 0.024905 0.002179)
(0.000000 0.024905 -0.002179)
(5.500000 0.000000 0.000000)
(5.500000 0.024905 0.002179)
(5.500000 0.024905 -0.002179)
);
blocks
(
hex ( 0 3 5 2 0 3 4 1) (200 30 1) SimpleGrading (1 0.1 1)
);
edges
(
arc 1 2 (0.000000 0.025000 0.000000)
arc 4 5 (5.500000 0.025000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
back
{
type symmetry;
faces
(
(0 2 5 3)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
blockMeshDict file generated by Matlab for an angle 25 degree with symmetry BC:-
/*--------------------------------*- C++ -*----------------------------------*\\
| ========= | |
| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\\\ / O peration | Version: 4.1 |
| \\\\ / A nd | Web: www.OpenFOAM.org |
| \\\\/ M anipulation | |
\\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0.000000 0.000000 0.000000)
(0.000000 0.024407 0.005411)
(0.000000 0.024407 -0.005411)
(5.500000 0.000000 0.000000)
(5.500000 0.024407 0.005411)
(5.500000 0.024407 -0.005411)
);
blocks
(
hex ( 0 3 5 2 0 3 4 1) (200 30 1) SimpleGrading (1 0.1 1)
);
edges
(
arc 1 2 (0.000000 0.025000 0.000000)
arc 4 5 (5.500000 0.025000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
back
{
type symmetry;
faces
(
(0 2 5 3)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
blockMeshDict file generated by Matlab for an angle 45 degree with symmetry BC:-
/*--------------------------------*- C++ -*----------------------------------*\\
| ========= | |
| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\\\ / O peration | Version: 4.1 |
| \\\\ / A nd | Web: www.OpenFOAM.org |
| \\\\/ M anipulation | |
\\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0.000000 0.000000 0.000000)
(0.000000 0.023097 0.009567)
(0.000000 0.023097 -0.009567)
(5.500000 0.000000 0.000000)
(5.500000 0.023097 0.009567)
(5.500000 0.023097 -0.009567)
);
blocks
(
hex ( 0 3 5 2 0 3 4 1) (200 30 1) SimpleGrading (1 0.1 1)
);
edges
(
arc 1 2 (0.000000 0.025000 0.000000)
arc 4 5 (5.500000 0.025000 0.000000)
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 0)
);
}
outlet
{
type patch;
faces
(
(3 5 4 3)
);
}
top
{
type wall;
faces
(
(1 4 5 2)
);
}
back
{
type symmetry;
faces
(
(0 2 5 3)
);
}
front
{
type symmetry;
faces
(
(0 3 4 1)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
);
mergePatchPairs
(
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Velocity Boundary condition :-
/*--------------------------------*- C++ -*----------------------------------*\\
========= |
\\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\\\ / O peration | Website: https://openfoam.org
\\\\ / A nd | Version: 6
\\\\/ M anipulation |
\\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
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.042168 0 0);
}
outlet
{
type zeroGradient;
}
top
{
type fixedValue;
value uniform (0 0 0);
}
front
{
type symmetry;
}
back
{
type symmetry;
}
axis
{
type empty;
}
}
// ************************************************************************* //
Pressure Boundary condition :-
/*--------------------------------*- C++ -*----------------------------------*\\
========= |
\\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\\\ / O peration | Website: https://openfoam.org
\\\\ / A nd | Version: 6
\\\\/ 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 0.0028393;
}
top
{
type zeroGradient;
}
front
{
type symmetry;
}
back
{
type symmetry;
}
axis
{
type empty;
}
}
// ************************************************************************* //
For the simulation purpose we have to edit controlDict file accordingly that courant number less than 1. So the solution is converge.
Total time for simulation is 50 sec.
controlDict file :-
/*--------------------------------*- C++ -*----------------------------------*\\
========= |
\\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\\\ / O peration | Website: https://openfoam.org
\\\\ / A nd | Version: 6
\\\\/ M anipulation |
\\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location \"system\";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 50;
deltaT 0.01;
writeControl timeStep;
writeInterval 100;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Transport properties - Kinematic viscosity :-
/*--------------------------------*- C++ -*----------------------------------*\\
========= |
\\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\\\ / O peration | Website: https://openfoam.org
\\\\ / A nd | Version: 6
\\\\/ M anipulation |
\\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location \"constant\";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu [0 2 -1 0 0 0 0] 1.004e-6;
// ************************************************************************* //
Note :- All the fluid properties are same as the previous challenges \"OpenFOAM pipe flow challenge - part 1\". In this challenge we are comparing our result on different wedge angle.
Result and plot of velocity profile at different wedge angle :-
Fig1 : Mesh generation on the profile with grading 0.1.
Fig2 : Velocity distribution profile at starting of the pipe.
Fig3 : Velocity distribution profile at end of the pipe.
Fig4 : Pipe flow model with an angle 2 degree.
Fig5 : Pipe flow model with an angle 10 degree.
Fig6 : Pipe flow model with an angle 25 degree.
Fig7 : Pipe flow model with an angle 45 degree.
Fig8 : Fully developed velocity profile for an angle 2 degree.
Fig9 : Fully developed velocity profile for an angle 10 degree.
Fig10 : Fully developed velocity profile for an angle 25 degree.
Fig11 : Fully developed velocity profile for an angle 45 degree.
Table : Comparision the result between the different wedge angle.
Note :- In this table wedge angle 2 degree is with wedge BC and rest of all 10,25 and 45 degree with symmetry BC.
From the above table it shown that as the wedge angle increases the error and the difference between theoritical and simulation result will decreases but the problem in greater angle is that it decreases the radial distance of the profile.
Conclusion :-
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...
MBD Simulation on IC Engine Valve Train
Objectives :- To create a model of the CAM and its associated parts for the IC Engine valve train then run an MBD simulation on that. Run the simulation using the below parameters Obtain the plot of Valve Lift. The contact force between Cam and Push Rod Pushrod and…
06 May 2020 12:43 AM IST
Meshing a interior plastic component of a side door
Objective :- To perform geometry clean up for Side-door plastic component model. Extract the FE structure or mid-surface by all the three method discussed below Take the mid-surface manually. Take the mid-surface using auto mid-surface. Use the mid-surface using combination of both auto mid-surface and manuall mid-surface.…
02 Dec 2019 05:07 AM IST
Combustion simulation on a combustor model using FLUENT
Objective :- Explain about the possible types of combustion simulations in FLUENT. To perform a combustion simulation on the combustor model. Plot the variation of the mass fraction of the different species (CO2, H2O, CH4, N2, O2 and NOx emissions). Introduction :- Combustion models for CFD refers to combustion models…
23 Nov 2019 04:40 AM IST
Parametric Study on Gate Valve
Objective :- To perform a parametric study on the gate valve simulation by setting 5 design points starting from the initial condition of lift with the least value of mass flow rate. Obtain the mass flow rates at the outlet for each design point. Show the cut section view for all the design points. Show the velocity contour…
12 Nov 2019 11:19 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.