Week 8 - Simulation of a backward facing step in OpenFOAM
Block:

Simulation: (Steps)
1. Open the terminal in the Linux Operating System
2. just type 'tutorials', and it takes you to the in-built tutorial files of the OpenFOAM software. Type 'ls' (list) to view the contents in the tutorials.
3. Type 'cd incompressible. And then 'Is. It takes into the incompressible directory file.
4. Type 'cd icoFoam', then 'Is. This step takes into the icoFoam directory file.
5. After that, we need to copy the cavity directory file located in icoFoam.
6. Type 'cp -r cavity/ $FOAM_RUN/**** This command copies the cavity file and pastes directly in the run folder. To check.... 7. Type 'cd'. Type 'run! It takes to the run folder which creates automatically by the software and we can file we copied.
8. ********* Never run your simulation directly in the tutorial file itself. It may corrupt the entire tutorial file if any mistakes or errors
took. To regain those files, we need to uninstall the software and install again which is a long-process.***
9. Open the files using the change directory 'cd' command. 10. In the file you copied, open cavity --> system. Type 'Is' to see the contents.
11. There we see blockMeshDict, controlDict, fvschemes and fvslutions are text files which we need to edit the file according to our conditions.
12. Type 'gedit blockMesh. Here we give a shape to the problem, applying the mesh grading, allocating the grid numbers to the respective
points we assumed and lastly don't forget to save the file.
13. Likewise, edit controlDict file also to give limits in words of time, like start time, end time, time interval and deltatt.
14. 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 software itself.
15. Come back to the cavity file using change directory command 'cd ...
16. In this file, we need to edit the velocity and pressure files according to the problem. for that, we need to go to 'O' file.
17. 'O' file represents us that the initial conditions of the problem. And these files are inbuilt files. Here at this step, we need to be careful
that no-slip conditions, etc.,
18. 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 it we need to check the mesh that it has any error in it or not. For that, 'checkMesh' command is used.
19. 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 only we copied and pasted the file for run..
20. After the completion of simulation, type 'paraFoam' for the post-processing.
21. 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 visulisation toolkit (VTK) libraries.
blockMeshDict code:
/*--------------------------------*- 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 0.1;
vertices
(
(0 0 0)
(8 0 0)
(8 0.5 0)
(0 0.5 0)
(0 1 0)
(8 1 0)
(20 1 0)
(20 0.5 0)
(20 0 0)
(20 -1 0)
(8 -1 0)
(8 0 0.1)
(0 0 0.1)
(0 0.5 0.1)
(8 0.5 0.1)
(8 1 0.1)
(0 1 0.1)
(20 1 0.1)
(20 0.5 0.1)
(20 0 0.1)
(20 -1 0.1)
(8 -1 0.1)
);
blocks
(
hex (0 1 2 3 12 11 14 13) (80 5 1) simpleGrading (0.2 1.2 1)
hex (3 2 5 4 13 14 15 16) (80 5 1) simpleGrading (0.2 0.2 1)
hex (2 7 6 5 14 18 17 15) (120 5 1) simpleGrading (1.2 0.2 1)
hex (1 8 7 2 11 19 18 14) (120 5 1) simpleGrading (1.2 1.2 1)
hex (10 9 8 1 21 20 19 11) (120 10 1) simpleGrading (1.2 0.2 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(13 12 0 3)
(16 13 3 4)
);
}
outlet
{
type patch;
faces
(
(6 17 18 7)
(7 18 19 8)
(8 19 20 9)
);
}
front
{
type empty;
faces
(
(3 0 1 2)
(4 3 2 5)
(5 2 7 6)
(2 1 8 7)
(1 10 9 8)
);
}
topandbottom
{
type wall;
faces
(
(0 12 11 1)
(11 10 21 1)
(10 21 20 9)
(16 4 5 15)
(15 5 6 17)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //
controlDict code:
/*--------------------------------*- 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 0.5;
deltaT 0.005;
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
Velocity code:
/*--------------------------------*- 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 (1 0 0);
}
outlet
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
topandbottom
{
type noSlip;
}
}
// ************************************************************************* //
Pressure code:
/*--------------------------------*- 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;
}
frontAndBack
{
type empty;
}
topandbottom
{
type zeroGradient;
}
}
// ************************************************************************* //
Results:
