Week 8 - Simulation of a backward facing step in OpenFOAM
Simulation of a backward-facing step in OpenFOAM
AIM:
- Transient simulation of incompressible-laminar-viscous flow through the backward-facing step geometry using OpenFOAM.
THEORY:
- Fluid is a substance that deforms continuously when subjected to tangential stress, it does not matter how small the tangential stress is.
- According to Newton's law, the shear stress on the fluid is directly proportional to the rate of shear strain.
- `tau = mu * frac{delu}{dely}`
- Dynamic viscosity ( `mu` ) is the resistance offered by the below fluid layer to the upper fluid layer in the fluid flow.
- Kinematic viscosity is the ratio of dynamic viscosity to the density of the fluid.
- In the incompressible flow of fluid, the density of the fluid does not change, it remains constant throughout the flow no matter what amount of pressure changes
Laminar Flow
- Fluid flows in the form of layers.
- Generally, this type of flow is due to low velocity and high viscosity.
- There is no mixing between the layers.
- For the internal flow, it occurs at the Reynolds number is below 2000.
- It obeys Newton's law of viscosity.
Turbulent Flow
- In turbulent flow, fluid flow in a disordered manner.
- Occurs due to high velocity and low viscosity.
- Due to fluctuating velocity components, a large amount of additional shear stress comes into play (Eddy shear stress).
- For the internal flows it occurs at Reynolds number greater than 4000.
- It does not follow Newton's law of viscosity.
No-Slip, and Boundary Layer
- No-slip is the boundary condition, which states that the relative velocity of fluid layers at the wall of duct/pipe is zero.
- It is due to the surface roughness of the wall and the adhesion effect between fluid and solid surfaces.
- This makes the velocity of the fluid at the wall zero and in the transverse direction of the flow, velocity varies.
- Velocity variation in the transverse direction is either parabolic or linear for laminar flow
- Velocity variation in the transverse direction is either logarithmic or follows the power law for turbulent flow.
- And due to No-slip, there is momentum disturbance in the transverse direction of the flow, which causes the formation of a boundary layer near the wall.
- Kinematic viscosity is the property of the fluid responsible for the momentum diffusivity, and the effect of viscosity is dominated in the flow.
- In solving viscous dominated flow only Navier-stokes equation is used.
OpenFOAM SETUP:
- "IcoFoam" is used to solve the incompressible laminar Navier-Stokes equations.
- The general form of Navier-stokes equation.

- In OpenFOAM, any solver folder usually contains an example, and each example contains, 0 folders, constant folder, and system folder.
- And the files are edited within the predefined algorithm of the OpenFOAM to set up our problem.
- In the system file, in the blockMeshDict file, the vertices section is edited to create the required geometry.
- Using vertices index number, blocks are defined and meshed (discretized), Grading factor is also specified at the same time according to the problem case.
- According to OpenFOAM algorithm the walls are edited into the inlet, outlet, no-slip walls, and frontAndBackwalls.Inlet and outlet walls are patch type, noslipwalls are wall type and frontAndBack walls are empty type.
- Faces are defined for the inlet, outlet, noslipwalls, and forntAndBackwalls.
- Grading factor(GF) is the ratio of (length of end cell/length of the first cell)
- First case GF=1 and second case GF=0.2.
- case 1: blockMeshDict
-
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object blockMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // convertToMeters 0.01; vertices ( (0 1 0) (8 1 0) (8 1.5 0) (0 1.5 0) (8 2 0) (0 2 0) (20 2 0) (20 1.5 0) (20 1 0) (20 0 0) (8 0 0) (0 1 0.01) (8 1 0.01) (8 1.5 0.01) (0 1.5 0.01) (8 2 0.01) (0 2 0.01) (20 2 0.01) (20 1.5 0.01) (20 1 0.01) (20 0 0.01) (8 0 0.01) ); blocks ( hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (1 1 1) hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (1 1 1) hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (1 1 1) hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (1 1 1) hex (10 9 8 1 21 20 19 12) (120 10 1) simpleGrading (1 1 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) ); } noslipwalls { type wall; faces ( (16 15 4 5) (15 17 6 4) (10 21 12 1) (11 0 1 12) (21 10 9 20) ); } frontAndBack { type empty; faces ( (11 12 13 14) (14 13 15 16) (21 20 19 12) (12 19 18 13) (13 18 17 15) (0 3 2 1) (10 1 8 9) (1 2 7 8) (2 4 6 7) ); } ); mergePatchPairs ( ); // *************************************************************************
- Case 2:blockMeshDict
-
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object blockMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // convertToMeters 0.01; vertices ( (0 1 0) (8 1 0) (8 1.5 0) (0 1.5 0) (8 2 0) (0 2 0) (20 2 0) (20 1.5 0) (20 1 0) (20 0 0) (8 0 0) (0 1 0.01) (8 1 0.01) (8 1.5 0.01) (0 1.5 0.01) (8 2 0.01) (0 2 0.01) (20 2 0.01) (20 1.5 0.01) (20 1 0.01) (20 0 0.01) (8 0 0.01) ); blocks ( hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (5 5.0 1) hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (5 0.2 1) hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (5 0.2 1) hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (5 5.0 1) hex (10 9 8 1 21 20 19 12) (120 10 1) simpleGrading (5 5.0 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) ); } noslipwalls { type wall; faces ( (16 15 4 5) (15 17 6 4) (10 21 12 1) (11 0 1 12) (21 10 9 20) ); } frontAndBack { type empty; faces ( (11 12 13 14) (14 13 15 16) (21 20 19 12) (12 19 18 13) (13 18 17 15) (0 3 2 1) (10 1 8 9) (1 2 7 8) (2 4 6 7) ); } ); mergePatchPairs ( ); // *************************************************************************
- In the same system folder, in the controlDict file, simulation time is set up to 1.5sec and timestep by 0.0001.
- controlDict
-
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object controlDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // application icoFoam; startFrom startTime; startTime 0; stopAt endTime; endTime 1.5; deltaT 0.0001; writeControl timeStep; writeInterval 20; purgeWrite 0; writeFormat ascii; writePrecision 6; writeCompression off; timeFormat general; timePrecision 6; runTimeModifiable true; // ************************************************************************* //
- In zero folder it contains, the initial conditions and boundary conditions of the flow variables to solve the problem
- In the pressure p File, only outlet pressure is edited as 0.
- P
-
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ 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; } noslipwalls { type zeroGradient; } frontAndBack { type empty; } } // *************************************************************************
- In the velocity u folder, inlet velocity is edited as 0.5m/sec in x-direction only, "noslipwalls" are edited as "noSlip" boundary condition.
- U
-
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ 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.5 0 0); } outlet { type zeroGradient; } noslipwalls { type noSlip; } frontAndBack { type empty; } } // ************************************************************************* //
- In the constant folder, it contains the transport properties file, in which the kinematic viscosity of water "0.0000008"is set to meter square/sec.
- transport properties
-
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "constant"; object transportProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // nu [0 2 -1 0 0 0 0] 0.0000008; // ************************************************************************* //
- To simulate, first we have to run 'blockMesh' to check the correctness of flow geometry.
- Paraview is used for postprocessing of the simulation, to visualise and manipulate the result in a required form.
- It is called using paraFoam.
RESULT:
- The simulation ran successfully.
- Near the inlet flow is fully developed laminar flow and in this region velocity profile along the length becomes the same and remains constant.
- Near the step, the flow starts to diverge due to sudden increase in area, hence fluid velocity drops, pressure increases, it creates a back pressure, due to which extreme layers of the fluid detached from the wall and starts flow in the reverse direction of the fluid flow.
- Due to which rapid mixing of the fluid layer takes place at the diverging region of fluid, due to which flow becomes unstable and becomes turbulent near the outlet.
| CASE 1: For GF =1 | CASE 2: For GF =0.2 near the walls and critical section. | |
|
Velocity variation
|
||
|
Pressure variation
|
||
|
Velocity profile
|
![]() |
![]() |
Conclusion
- The variation of pressure and velocity is captured well, at the near inlet, no-slip walls, and diverging section by case 2.
- Velocity profile obtained from GF=0.2 are accurate and smooth compared to the GF=1 cases.
THANK YOU

