Project

Backward Facing Step simulation using OpenFOAM

I. Introduction:

Studying the flow behavior through various structures is an important subject for a CFD engineer. When fluids flow through different geometries, they exhibit different velocity, pressure and flow properties. In this project, Simulation of a flow through backward facing step is done to study the flow of fluids through geometries that have sudden-changing shapes. The simulations are refined using multiple meshes - mesh grading factors inside the BlockMeshDict file of BlockMesh, which is also used to create the geometry to be solved in OpenFOAM.

II. Objective:

  1. Analyze and simulate flow through backward facing step.
  2. Creating multiple meshes - mesh grading factors : 0.2, 0.5, 0.8 and determining how the velocity magnitude profile changes.
  3. Measuring the velocity profile at 8.5 m from the inlet of geometry.
  4. Compare velocity magnitude contours near the step region for the above mentioned grading factors.
  5. To understand how different quantities like velocity,pressure behaves due to sudden step.

III. Steps to be done:

  • Choosing a solver.
  • Selecting a solver tutorial to create Geometry and Meshing.
  • Setting up Case.
    • Assigning Boundary conditions .
    • Assigning initial conditions.
  • Post-processing the results .
  • Plotting Results.

IV. Choosing a solver:

OpenFOAM software has been used for this project, hence choosing a solver as per our problem is the first essential step towards the study.

Assumptions for the problem :

  1. The fluid is Newtonian
  2. The flow is incompressible & laminar .
  3. Low renolds number.
  4. Zero frictional losses

The solver chosen considering above assumptions is icoFOAM.

It solves the incompressible laminar Navier-stokes equations (continuity and momentum) using PISO algorithm.

IV. A. Selecting Solver tutorial:

The solver tutorial from the incompressible icoFoam called cavity is chosen for the task and its geometry and initial conditions are modified as per the objective.

V. Creating Geometry:

Software file called BlockMeshDict in the tutorials system folder creates the Geometry and mesh, hence this is modified to create the backward facing step. Since blockmeshdict file can create geometries only in block format, we created the blocks and indexed the vertices as shown below.

  • OpenFoam geometry:

Note : (BlockMeshDict file at the end)

  • Mesh Specification:
  1. Number of cells along the x direction (longer dimension) = 200.
  2. Number of cells along the y direction = 10
  3. Use a graded mesh. Grading factor near all walls should be 0.2,0.5 & 0.8

wwe shall perform analysis over different grading factors and compare results.

VI. Setting up Case:

We now set up the case in blockMeshDict file by assigning Boundary & wall conditions, time step and end time in ControlDict file and initial conditions in the Velocity and pressure file.

VI. A. Boundary conditons:

Once the geometry is created, we assign different boundary conditons for the flow to take place within the geometry.

These faces are assigned in the blockMeshDict file as:

This can be simply represented in the picture below :

After this, we change the time step and end time in the controlDict file in the same folder

deltaT = 0.0003

endTime = 0.3 s

Rest of the conditions are kept default. (file at the end)

VI. B. Initial conditions:

Initial conditions are velocity and pressure, As-per the boundary conditions and the study we wish to perform, the initial conditions are as follows:

For velocity:

For Pressure:

VII. Post-Processing Results:

After running the simulations for every grading factor, we post process the results in ParaView software.

A. For grade factor 0.2

Mesh generated

The mesh is created with a grading factor 0.2 and the mesh specifications mentioned in section V.

The blocks image above are a part of blockmeshdict file and shows the mesh grading and grading factor set on the geometry. we can observe the mesh looks finer and once the mesh is created, we can now run results of simulation in paraview to observe how it looks visually and how the flow seperation takes place in it.

Velocity contour:

B. For grade factor 0.5

Mesh Generated

Velocity Contour:

C. For grade factor 0.8:

Mesh Generated

Velocity Contour :

From the simulations, we can see that at the step, the flow gets detached from the wall and is seperated. At the seperation point which we can observe through the different mesh grading factors results, there is slight variation in flow. Now at this seperation point, there is a low pressure region created which causes the flow to recirculate. This gives rise to something called as recirculation zone or wake region.

For a proper understanding, watch the video below, captured using glyph filter and vector U, necessary scaling and adjustments were made to make it more visually clear.

The vectors represent how the flow recirculates and joins the above stream.

VIII. Comparing the plots and final Conclusion:

Comparing the velocity profile near the step region for all the grading factors.

As the fluid flows through a pipe, a boundary layer is created against the walls of the pipe and it builds perpendicular to it, the velocity is slow at the surface and goes on increasing as we move up from the wall.

From the contours above, we can see that before the step region the fluid has no obstructon or geometry changes. For x = 4 m the velocity behaves like :

The profile looks close to a parabolic shape with the end points as boundaries and mid-region where the flow speed is maximum.

Once the fluid passes through the step the velocity profile appears:

For Grade factor 0.2:

For Grade factor 0.5:

For Grade factor 0.8:

As the fluid crosses the step region, the area increases. Now looking at the region in graph from 0 to 1, the top part of the geometry after step, comparing to upstream region at x = 4 m, The velocity decreases at x= 8.5 m due to increased area. The fluid expands its area of flow and it also mixes with the flow from recirculation zone as it circles up as shown on video above.

For different grading factors, as the mesh becomes more finer at 0.2 we can see the velocity drop curve, its noticeably wider and clearer indication of the result we're anticipating. For grade factor 0.5 and 0.8 the mesh gets coarser yet its still observable what we concluded from above graph. But as the mesh gets coarser the results are slightly different from finer mesh.

For the region before the step, from -1 to 0, this is the recirculation zone, as shown in the video, so here the fluid circles back and mixes with the flow and increases with high variation due to crashing on the wall of step and some due to boundary layer and the generation of low pressure zone in that area.

Over all the velocity magnitude profile gives similar results in general but with a mesh grading factor its observed that finer results can be obtained with finer mesh and more accuracy can be aimed in ones solution.

Animation video:

Blockmesh & ControlDict files:

/*--------------------------------*- 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;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices
(
    (0 0 0)   // 0
    (8 0 0)   // 1
    (8 0.5 0) // 2
    (0 0.5 0) // 3
    (8 1 0) // 4
    (0 1 0) // 5
    (20 1 0) // 6
    (20 0.5 0) // 7
    (20 0 0) // 8
    (20 -1 0) // 9
    (8 -1 0) // 10
    (0 0 0.01) // 11
    (8 0 0.01) // 12
    (8 0.5 0.01) // 13
    (0 0.5 0.01) // 14
    (8 1 0.01) // 15
    (0 1 0.01) //16
    (20 1 0.01) // 17
    (20 0.5 0.01) // 18
    (20 0 0.01) // 19
    (20 -1 0.01) // 20 
    (8 -1 0.01) // 21
    
    
    
    
);

blocks
(
    hex (0 1 2 3 11 12 13 14) (80 3 1) simpleGrading (0.8 0.8 1)
    hex (3 2 4 5 14 13 15 16) (80 3 1) simpleGrading (0.8 0.8 1)
    hex (2 7 6 4 13 18 17 15) (120 3 1) simpleGrading (5 0.8 1)
    hex (1 8 7 2 12 19 18 13) (120 3 1) simpleGrading (5 0.8 1)
    hex (10 9 8 1 21 20 19 12) (120 4 1) simpleGrading (5 0.8 1)
);

edges
(
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 11 14 3)
            (3 14 16 5)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (9 8 19 20)
            (8 7 18 19)
            (7 6 17 18)
        );
    }
    frontAndBack
    {
        type empty;
        faces
        (
            (0 3 2 1)
            (3 5 4 2)
  	    (10 1 8 9)
	    (1 2 7 8)
	    (2 4 6 7) 
	    (11 12 13 14)
            (14 13 15 16)
  	    (21 20 19 12)
	    (12 19 18 13)
	    (13 18 17 15)		
        );
    }
    noslipwalls
    {
        type wall;
        faces
        (
            (15 4 5 16)
            (17 6 4 15)
            (1 10 21 12)
            (0 1 12 11)
            (10 9 20 21)
        );
    }
);

mergePatchPairs
(
);

// ************************************************************************* //
/*--------------------------------*- 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.3;

deltaT          0.0003;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


// ************************************************************************* //

-----------------------------------------------THE END ----------------------------------------------------

keywords - CFD, OPENFOAM, C++.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.