Solving Backstep problem using BlockMesh in icoFoam solver
AIM:
To use the icoFOAM solver to simulate the flow through a backward facing step and creating multiple meshes and comparing the results obtained from each mesh.
GIVEN:
Number of cells along the x direction (longer dimension) = 200
Number of cells along the y direction = 10
Use a graded mesh. Grading factor near all walls should be 0.2
REQUIRED RESULT:
- How does the velocity magnitude profile change as a function of mesh grading factor. Use factors, 0.2, 0.5, 0.8
- Measure the velocity profile at 0.085 m from the inlet of the geometry
- Plot must be a line plot
- Compare velocity magnitude contours near the step region for the above mentioned grading factors.
PROCEDURE:
- Create the geometry
- Create the mesh
- Take initial and boundary conditions
- Pre Processing
- Post Processing
BlockMesh file:
The geometry provided is divided into 5 blocks and the vertices are designed as required from the divisions made. The vertices are inputted and then comes the blocks which are made using the hex command where 8 vertices are inserted and followed by the number of cells along the X, Y and Z axes.
The simpleGrading command is used to allot the grading to the mesh of the geometry. Each axis has its own grading factor, the grading factor is the ratio of the size of the cell at the end by the size of the cell at the start. The 3 grading factors (0.2, 0.5, 0.8) are allotted at each axis when a wall is present.
The boundaries are allotted by the vertices of the face. The boundaries are:
Inlet, outlet, top face, bottom face, side step, front and back face.
The conditions for each face are mentioned in the problem statement.
There are no merge pairs in the geometry.
Once the blockMeshDict file is ready set the timestep, endtime and other properties in the controlDict file. The changes have to be made in the initial P and U file in the 0 folder as the labelling of the boundaries and requirements vary. Use the blockMesh command to get the polyMesh folder and then call the icoFoam command to run the simulation.
Once the simulation is completed call the paraFoam command to use paraview and obtain the plots.
Set a suitable colour scale and then run the animation for p and U.
After running the animation, select plot over the line command and plot the velocity over x=0.085 metre.
Repeat the procedure for grading factor 0.2, 0.5, 0.8.
FILES:
BLOCKMESHDICT:
/*--------------------------------*- 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 1000;
vertices
(
(0 0 -0.5)
(0.08 0 -0.5)
(0.08 0.005 -0.5)
(0 0.005 -0.5)
(0.08 0.01 -0.5)
(0 0.01 -0.5)
(0.2 0.01 -0.5)
(0.2 0.005 -0.5)
(0.2 0 -0.5)
(0.2 -0.01 -0.5)
(0.08 -0.01 -0.5)
(0 0 0.5)
(0.08 0 0.5)
(0.08 0.005 0.5)
(0 0.005 0.5)
(0.08 0.01 0.5)
(0 0.01 0.5)
(0.2 0.01 0.5)
(0.2 0.005 0.5)
(0.2 0 0.5)
(0.2 -0.01 0.5)
(0.08 -0.01 0.5)
);
blocks
(
hex (0 1 2 3 11 12 13 14) (200 10 1) simpleGrading (0.5 0.5 1)
hex (3 2 4 5 14 13 15 16) (200 10 1) simpleGrading (0.5 0.5 1)
hex (2 7 6 4 13 18 17 15) (200 10 1) simpleGrading (1.5 0.5 1)
hex (1 8 7 2 12 19 18 13) (200 10 1) simpleGrading (1.5 0.5 1)
hex (10 9 8 1 21 20 19 12) (200 10 1) simpleGrading (1.5 0.5 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(11 14 3 0)
(14 16 5 3)
);
}
outlet
{
type patch;
faces
(
(18 7 6 17)
(19 8 7 18)
(20 9 8 19)
);
}
top
{
type wall;
faces
(
(15 4 5 16)
(17 6 4 15)
);
}
bottom
{
type wall;
faces
(
(11 0 1 12)
(21 10 9 20)
);
}
sidestep
{
type wall;
faces
(
(21 12 1 10)
);
}
frontAndBack
{
type empty;
faces
(
(1 0 3 2)
(2 3 5 4)
(9 10 1 8)
(8 1 2 7)
(7 2 4 6)
(12 13 14 11)
(14 13 15 16)
(21 20 19 12)
(19 18 13 12)
(18 17 15 13)
);
}
);
// ************************************************************************* //
CONTROLDICT:
/*--------------------------------*- 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 latestTime;
startTime 0;
stopAt endTime;
endTime 10;
deltaT 1e-2;
writeControl timeStep;
writeInterval 100;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
PRESSURE 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 volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
bottom
{
type zeroGradient;
}
top
{
type zeroGradient;
}
sidestep
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
VELOCITY 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 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;
}
top
{
type noSlip;
}
bottom
{
type noSlip;
}
sidestep
{
type noSlip;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
TRANSPORT PROPERTIES:
/*--------------------------------*- 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] 10;
// ************************************************************************* //
IMAGES:
GRADING FACTOR = 0.2
MESHING:
PRESSURE PLOT:
VELOCITY PLOT:
VELOCITY PLOT ON X = 0.085M
GRADING FACTOR = 0.5
GRADING FACTOR = 0.5:
MESHING:
PRESSURE PLOT:
VELOCITY PLOT:
VELOCITY PLOT ON X = 0.085 METRE
GRADING FACTOR = 0.8
MESHING:
PRESSURE PLOT:
VELOCITY PLOT:
VELOCITY PLOT FOR X = 85 MM
All simulations are performed for a time step of 1e-2 till 10 seconds. The viscosity is changed to 10 in transportProperties file in constant folder
RESULTS:
We observe a steady increase in the velocity near the side step region and is observed in all velocity plots.
While comparing the velocity at x = 0.085 metre, there isn\'t much difference across the 3 grading factors we have tested for but the velocity for grading factor 0.2 is less compared to the other 2 grading factors. This shows that a finer mesh captures the results more accurately.