Challenge

Simulation of a backward facing step in OpenFOAM

Aim:

To stimulate transiently incompressible-laminar-viscous flow through backward-facing step geometry.

Case 1 - Simulate the flow without using any grading factor (i.e., GF = 1)

Case 2 - Simulate the flow with a grading factor of 0.2. The cells should be finer near the walls (including the step wall).

Mesh specification:

  1. Number of cells along the x-direction (longer dimension) = 200
  2. Number of cells along the longer y-direction = 20;

Boundary condition specification:

The domain specifications are provided in the following figure.

Blockmesh:

Backward facing step:

A fully developed flow enters the domain from the left. When the flow reaches the step, because of the expansion of the flow channel, a pressure gradient exists, it detaches and a recirculation zone is formed. A turbulent boundary layer encounters a sudden back step, causing flow separation. Later the flow eventually reattaches to the bottom wall.

In this problem, we are considering transiently Laminar viscous flow.

Viscous flow: The flow of a fluid in which the velocity of the fluid is constant at a point or varies regularly.

Laminar flow: The movement of the fluid is without turbulence. that is the fluid flow is parallel.

Transient flow: The flow of fluid is transient or unsteady if its flow parameters (i.e. velocity and pressure) are dependent not only on the position in the coordinate system used to describe the field of flow but also on time.

In CFD, the codes work through three processes:

  • Pre-Processing.
  • Solving.
  • Post- Processing.

Pre-Processor:

  • It consists of the Input of a flow problem.
  • Definition of a geometry- Computational domain.
  • Grid generation
  • Selection of the physical and chemical phenomena.
  • Definition of fluid properties.
  • specification of appropriate boundary conditions at cells that coincide with or touch the domain boundary.

The solution to a flow problem is defined at nodes inside each cell. The accuracy of a CFD solution is governed by the number of cells in the grid.

Solver:

  • Finite difference method
  • Finite element method
  • Spectral methods
  • Finite Volume method

Post-Processor:

  • Domain geometry and grid display
  • Vector plots
  • Line and shaded contour plots
  • 2D and 3D surface plots
  • particle tracking
  • View manipulation
  • Colour postscript output

solvers in OpenFoam and its usage:

*basic:

laplacianFoam - laplace equation-thermal diffusion.

potentioaFoam - potential flow - initial field for simulations.

scalarTransportFoam - scalar transport -temperature diffusion and convection, species transport.

*heatTransfer

buoyantPimpleFoam - buoyant, turbulent flow of compressible fluids for ventilation and heat transfer

chtMultiRegionFoam - buoyant, turbulent fluid flow and solid heat conduction with conjugate heat transfer between solid and fluid regions.

thermoFoam - energy transport and thermodynamics on a frozen flow field

*incompressible

adjointShapeOptimizationFoam - optimisation of duct shape

boundaryFoam - incompressible,1D turbulent flow, typically to generate boundary layer conditions at an inlet, for use in a simulation.

icoFoam - Incompressible, laminar flow of Newtonian fluids

pimpleFoam - incompressible, turbulent flow, using the pimple algorithm - transient - large time -step

pisoFoam - Incompressible, turbulent flow, using the PISO algorithm - transient

simpleFoam - incompressible, turbulent flow, using the SIMPLE algorithm - steady state

From the above solvers, we can find a suitable solver for the given problem.

icoFoam is a suitable solver for the given problem.

Procedure:

Open Linux terminal ⇒ tutorial⇒incompressible⇒icoFoam⇒cavity⇒copying the original cavity folder to $FOAM_RUN (which will prevent the OpenFOAM from malfunction)⇒edit 0 (p, U), system (blockMeshDict, ControlDict), constant (transportProperties)⇒execute blockMesh command to create mesh⇒create .foam file(readable file for ParaView) to view in ParaView⇒execute Icofoam

Grading:

Without grading:

blockMeshDict

/*--------------------------------*- C++ -*----------------------------------*
| =========                 |                                                 |
| \      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \    /   O peration     | Version:  v2012                                 |
|   \  /    A nd           | Website:  www.openfoam.com                      |
|    \/     M anipulation  |                                                 |
*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

scale   0.01;

vertices
(
    (0 0 0)
    (8 0 0)
    (8 0.5 0)
    (0 0.5 0)
    (8 1 0)
    (0 1 0)
    (20 1 0)
    (20 0.5 0)
    (20 0 0)
    (20 -1 0)
    (8 -1 0)
    (0 0 0.1)
    (8 0 0.1)
    (8 0.5 0.1)
    (0 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 11 12 13 14) (80 20 1) simpleGrading (1 1 1)
    hex (3 2 4 5 14 13 15 16) (80 20 1) simpleGrading (1 1 1)
    hex (2 7 6 4 13 18 17 15) (120 20 1) simpleGrading (1 1 1)
    hex (1 8 7 2 12 19 18 13) (120 20 1) simpleGrading (1 1 1)
    hex (10 9 8 1 21 20 19 12) (120 20 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)
        );
    }
    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
(
);

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

controlDict

/*--------------------------------*- C++ -*----------------------------------*
| =========                 |                                                 |
| \      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \    /   O peration     | Version:  v2012                                 |
|   \  /    A nd           | Website:  www.openfoam.com                      |
|    \/     M anipulation  |                                                 |
*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     icoFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         3;

deltaT          1e-3;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

transportProperties

/*--------------------------------*- C++ -*----------------------------------*
| =========                 |                                                 |
| \      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \    /   O peration     | Version:  v2012                                 |
|   \  /    A nd           | Website:  www.openfoam.com                      |
|    \/     M anipulation  |                                                 |
*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

nu             1e-6;


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

Pressure:

/*--------------------------------*- C++ -*----------------------------------*
| =========                 |                                                 |
| \      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \    /   O peration     | Version:  v2012                                 |
|   \  /    A nd           | Website:  www.openfoam.com                      |
|    \/     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;
    }

    frontAndBack
    {
        type            empty;
    }
    Noslipwalls
    {
        type            zeroGradient;
    }
}

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

Velocity:

/*--------------------------------*- C++ -*----------------------------------*
| =========                 |                                                 |
| \      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \    /   O peration     | Version:  v2012                                 |
|   \  /    A nd           | Website:  www.openfoam.com                      |
|    \/     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.02 0 0);
    }

    outlet
    {
        type            zeroGradient;
    }

    frontAndBack
    {
        type            empty;
    }
   Noslipwalls 
    {
        type            noSlip;
    }
}

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

With grading near the walls including Step wall:

/*--------------------------------*- C++ -*----------------------------------*
| =========                 |                                                 |
| \      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \    /   O peration     | Version:  v2012                                 |
|   \  /    A nd           | Website:  www.openfoam.com                      |
|    \/     M anipulation  |                                                 |
*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

scale   0.01;

vertices
(
    (0 0 0)
    (8 0 0)
    (8 0.5 0)
    (0 0.5 0)
    (8 1 0)
    (0 1 0)
    (20 1 0)
    (20 0.5 0)
    (20 0 0)
    (20 -1 0)
    (8 -1 0)
    (0 0 0.1)
    (8 0 0.1)
    (8 0.5 0.1)
    (0 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 11 12 13 14) (80 5 1) simpleGrading (0.2 5 1)
    hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (0.2 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 1)
    hex (10 9 8 1 21 20 19 12) (120 10 1) simpleGrading (5 5 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
(
);

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

The velocity with Grading:

Velocity profile without grading:

We have plotted Velocity from a distance of 0.085m from the inlet, with a simple grading factor and 0.2 grading factor.

Conclusion:

* Grading helps us determine the fluids' properties in a specified/Desired area of the domain.

* From the graded graph, we can see that it has a sharp region at 0.015 m due to coarse mesh.

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.