All Courses
All Courses
Abstract:- The work is focused on simulating fluid flow through a backward-facing step channel that would be subjected to a sudden increase in the cross-sectional area, this would result in flow separation & reattachment zones. The geometry will be designed by creating vertices & then joining them to form blocks.…
Pratik Ghosh
updated on 19 Jan 2021
Abstract:- The work is focused on simulating fluid flow through a backward-facing step channel that would be subjected to a sudden increase in the cross-sectional area, this would result in flow separation & reattachment zones. The geometry will be designed by creating vertices & then joining them to form blocks. Air is considered as the working fluid. We will be also making use of boundary flagging techniques for assigning each side of the geometry to a particular boundary. Next, we set up the distinct mesh parameters for each case. Through this simulation, we will be able to observe flow separation at different locations of the channel, variations in mass flow rate, pressure, velocity & number of cells generated for 3 distinct mesh grid sizes.
To create the geometry as shown in the above figure, we need to modify the vertice parameters according to our geometric requirement inside the "blockMeshDict" file that is pre-existing in the "$FOAM_TUTORIALS" system folder of the case setup. Since we will be making use of the "blockMeshDict" file, we need to make the assumption that our geometry using 5 blocks as shown in the figure below. An isometric view of the geometry is shown below with proper indexing of the vertices for each of the 5 blocks.
[NOTE: We have demonstrated the geometry creation using 5 blocks and have indexed the vertices in a particular way. This can be varied, according to one's comfort & requirement.]
Finally, we need to define the blocks, we need to specify the right order of vertex indices for each of the 5 cubes. One such cube has been taken as an example to demonstrate the vertice naming in OpenFOAM.
hex(0 1 2 3 11 12 13 14) (1 1 1) simplegrading(1 1 1)
Similarly, we need to proceed by defining the vertices of the other 4 blocks in the Geometry. To view, the geometry that we have created, clear out all the entries inside the boundary section of the "blockMeshDict" file and execute the blockMesh command in the terminal. Now we can open ParaView and view the geometry that's been created.
Now to mesh the geometry, inside the "blockMeshdDict" file we fill in the number of cells in x, y, and z-direction inside the second parenthesis of the Hex command,
i.e., hex(0 1 2 3 11 12 13 14) (10 10 1) simplegrading(1 1 1).
since this is a 2D problem, increasing the number of cells in the z-direction, doesn’t make sense. To view the mesh in paraFoam, select the surface with the edges option, and view the mesh. Similarly to refine the mesh near the walls of the geometry we need to play around with the numbers in the third parenthesis.
Block Mesh Grading Factor
f = (size of end cell) / (size of starting cell)
To run the simulations, we need to specify the initial and boundary conditions. From the figure, we know our given boundary conditions are, inlet, outlet, front, back, no-slip walls.
For the inlet (Type patch), the faces that contribute to the inlet boundary are shown below. If we are looking at these faces from the outside, the definition of inlet boundary will be in the counter-clockwise direction, (0 11 14 3) (3 14 16 5).
Similarly, we have 3 faces contributing to the outlet boundary condition. Since we are viewing the faces from outside, hence the definition of the outlet boundary will be in the counter-clockwise direction, (9 8 19 20) (8 7 18 19) (7 6 17 18).
For Front & Back, we assign them as (Type empty). All the remaining walls will be assigned as no-slip wall conditions (Type wall).
Step 1: We start by opening the command line interface of the Linux Operating System (OS) which is known as the "Terminal".
Step 2: Next we type the command 'cd $FOAM_TUTORIALS' that takes us to the in-built tutorial files of the OpenFOAM software. Type 'ls' (list) to view the contents in the tutorials.
Step 3: We navigate to the incompressible file by 'cd incompressible' & then inside the incompressible file directory by 'ls'.
Step 4: Inside the incompressible file directory we navigate to 'cd icoFoam' & then 'ls'. This step takes inside the icoFoam directory file.
Step 5: Type 'cd cavity' and 'ls' to list all the available contents.
Step 6: We copy the cavity file using the command 'cp -r cavity/ $FOAM_RUN/'. This command copies the cavity file and pastes it directly inside the run folder. To check, type 'cd $FOAM_RUN'. It takes to the run folder which creates automatically by the software and we can see the file that we copied.
Step 7: In the file you copied, open the cavity -> system. Type 'ls' to see the contents.
Step 8: Here we see the blockMeshDict, controlDict, fvschemes, and fvslutions are text files that need to be edited for creating our geometry, generating the required mesh type & boundary conditions.
Step 9: To open these text files we need to type 'gedit'. To open the blockMeshDict file we have to type 'gedit blockMeshDict'. Here we give a shape to the problem, apply the mesh grading, allocating the grid numbers to the respective points we assumed & lastly save the file.
Step 10: Likewise, we need to edit the 'controlDict' file also to give time limits like start time, end time, time interval, and delta(t).
Step 11: While selecting the 'delta t' value, be aware of the courant number. It should be less than one (< 1). Otherwise, the solution may diverge and stopped forcibly by the software itself.
Step 12: We return back to the 'cavity' file using the change directory command 'cd ..'.
Step 13: In this file, we need to edit the velocity and pressure files according to our problem requirements, for that, we need to go to navigate inside the '0' file. The '0' file represents the initial conditions of the problem. And these files are inbuilt files.
Step 14: After editing the four files, come to the 'cavity' directory. There we need to give a command 'blockMesh' to get mesh structured, and other mesh calculations are done here. After completing the above we need to check the mesh for any errors. For that, the 'checkMesh' command is used.
Step 15: After completing both the steps, we can confirm that our mesh is stable and good. Now type 'icoFoam' to calculate simulation or problem. Because in the icoFoam file we copied and pasted the file for the run.
Step 16: After the completion of the simulation, type 'paraFoam' for the post-processing. ParaView is an open-source multiple-platform application for interactive, scientific- visualization. It has a client-server architecture to facilitate remote visualization of datasets and generates level-of-detail (LOD) models to maintain interactive frame rates for large datasets. It is an application built on top of the visualization toolkit (VTK) libraries.
blockMeshDict 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;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.1;
vertices
(
(0 0 0)
(8 0 0)
(8 0.5 0)
(0 0.5 0)
(0 0 0.1)
(8 0 0.1)
(8 0.5 0.1)
(0 0.5 0.1)
(8 1 0)
(0 1 0)
(8 1 0.1)
(0 1 0.1)
(20 0.5 0)
(20 1 0)
(20 0.5 0.1)
(20 1 0.1)
(20 0 0)
(20 0 0.1)
(20 -1 0)
(8 -1 0)
(20 -1 0.1)
(8 -1 0.1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (200 10 1) simpleGrading (1 5 1)
hex (3 2 8 9 7 6 10 11) (200 10 1) simpleGrading (1 0.2 1)
hex (2 12 13 8 6 14 15 10) (200 10 1) simpleGrading (5 0.2 1)
hex (1 16 12 2 5 17 14 6) (200 10 1) simpleGrading (5 5 1)
hex (19 18 16 1 21 20 17 5) (200 10 1) simpleGrading (5 5 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(3 7 11 9)
(0 4 7 3)
);
}
outlet
{
type patch;
faces
(
(14 12 13 15)
(20 16 12 14)
(20 18 16 17)
);
}
frontAndBack
{
type empty;
faces
(
(2 3 9 8)
(7 6 10 11)
(12 2 8 13)
(14 15 10 6)
(1 0 3 2)
(5 6 7 4)
(16 1 2 12)
(17 14 6 5)
(18 19 1 16)
(20 17 5 21)
);
}
fixedwalls
{
type wall;
faces
(
(10 8 9 11)
(15 13 8 10)
(1 5 4 0)
(18 20 21 19)
(19 21 5 1)
);
}
);
mergePatchPairs
(
);
// ************************* //
controlDict File
/*--------------------------------*- C++ -*----------------------------------*
========= |
/ F ield | OpenFOAM: The Open Source CFD Toolbox
/ O peration | Website: https://openfoam.org
/ A nd | Version: 7
/ M anipulation |
*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application icoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.6;
deltaT 0.00001;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
volVectorField File
/*--------------------------------*- C++ -*----------------------------------*
========= |
/ F ield | OpenFOAM: The Open Source CFD Toolbox
/ O peration | Website: https://openfoam.org
/ A nd | Version: 7
/ 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 (1 0 0);
}
outlet
{
type zeroGradient;
}
fixedWalls
{
type noSlip;
value uniform (0 0 0);
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
volScalarField File
/*--------------------------------*- C++ -*----------------------------------*
========= |
/ F ield | OpenFOAM: The Open Source CFD Toolbox
/ O peration | Website: https://openfoam.org
/ A nd | Version: 7
/ 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;
}
fixedWalls
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
Case 1: Contours of Velocity & Pressure for a Mesh with Grading factor of 0.2
blocks
(
hex (0 1 2 3 4 5 6 7) (200 10 1) simpleGrading (1 5 1)
hex (3 2 8 9 7 6 10 11) (200 10 1) simpleGrading (1 0.2 1)
hex (2 12 13 8 6 14 15 10) (200 10 1) simpleGrading (5 0.2 1)
hex (1 16 12 2 5 17 14 6) (200 10 1) simpleGrading (5 5 1)
hex (19 18 16 1 21 20 17 5) (200 10 1) simpleGrading (5 5 1)
);
Case 2: Contours of Velocity & Pressure for a Mesh with Grading factor of 0.5
blocks
(
hex (0 1 2 3 4 5 6 7) (200 10 1) simpleGrading (1 2 1)
hex (3 2 8 9 7 6 10 11) (200 10 1) simpleGrading (1 0.5 1)
hex (2 12 13 8 6 14 15 10) (200 10 1) simpleGrading (2 0.5 1)
hex (1 16 12 2 5 17 14 6) (200 10 1) simpleGrading (2 2 1)
hex (19 18 16 1 21 20 17 5) (200 10 1) simpleGrading (2 2 1)
);
Case 3: Contours of Velocity & Pressure for a Mesh with Grading factor of 0.8
blocks
(
hex (0 1 2 3 4 5 6 7) (200 10 1) simpleGrading (1 1.25 1)
hex (3 2 8 9 7 6 10 11) (200 10 1) simpleGrading (1 0.8 1)
hex (2 12 13 8 6 14 15 10) (200 10 1) simpleGrading (1.25 0.8 1)
hex (1 16 12 2 5 17 14 6) (200 10 1) simpleGrading (1.25 1.25 1)
hex (19 18 16 1 21 20 17 5) (200 10 1) simpleGrading (1.25 1.25 1)
);
We successfully performed 3 simulations for the backward-facing step with varying mesh gradients of 0.2, 0.5, and 0.8. As we improved the mesh we observed that the time required to solve the problem started increasing & the final simulation with a mesh gradient of 0.8 required maximum simulation time. Though the plots for all 3 cases look similar, they are quite distinct when observed closely, as we improved the mesh quality the results tend to get more accurate. If we had kept improving the mesh further, the accuracy of the solution would have also increased accordingly, but at the same time would have required more computational power.
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...
Visualize 2D Flow Simulation Through A Backward Facing Step For 3 Distinct Mesh Grid Size Using openFOAM & ParaView
Abstract:- The work is focused on simulating fluid flow through a backward-facing step channel that would be subjected to a sudden increase in the cross-sectional area, this would result in flow separation & reattachment zones. The geometry will be designed by creating vertices & then joining them to form blocks.…
19 Jan 2021 06:26 AM IST
Week 12 - Symmetry vs Wedge vs HP equation
Objective:- The work is focused on performing a CFD simulation for a flow through a cylindrical pipe with reference to Hagen Poiseuille's principle that refers to the laminar flow formation inside a smooth cylindrical tube. Since the computation will be carried out on a laptop, we will not be able to consider the entire…
19 Jan 2021 06:26 AM IST
Writing A MATLAB/Octave Code To Perform A 1D Super-Sonic Nozzle Flow Simulation Using Macormack Method.
Abstract:- The work is focused on writing a MATLAB/Octave code to simulate the isentropic flow through a quasi 1D supersonic nozzle using both the conservation and non-conservation forms of the governing equations and solving them using MacCormack's technique and compare their solutions by performing a grid dependency…
19 Jan 2021 06:24 AM IST
Writing A MATLAB/Octave Program To Solve the 2D Heat Conduction Equation For Both Steady & Transient State Using Jacobi, Gauss-Seidel & Successive Over Relaxation (SOR) Schemes.
Problem Statement:- 1. Steady-state analysis & Transient State Analysis Solve the 2D heat conduction equation by using the point iterative techniques that were taught in the class. The Boundary conditions for the problem are as follows; Top Boundary = 600 K Bottom Boundary = 900 K Left Boundary = 400 K Right Boundary…
19 Jan 2021 06:23 AM IST
Related Courses