Challenge

Week 8 - Simulation of a backward facing step in OpenFOAM

Project Objective:

  • To simulate the fluid flow through a backward facing step in openFoam using icoFoam solver.

  • To predict the magnitude of velocity at a distance of 0.085 m from the inlet section of the geometry & grid dependency is also tested for this prediction by imposing various mesh grading (0.2 & 0.5) with respect to the wall respectively.

Scope of the Project:

The work is carried out with the aid of tutorial named cavity under the icoFoam solver and the appropriate Geometry, Mesh, Boundary and initial conditions are created by modifying the script files from the respective solver.

Modelling Information:

The solver here is used is icoFoam which solves for a combination of transient, laminar, incompressible and Newtonian fluid flow problems.

Since this is a mere flow problem, energy equations are not required and it solves for only the mass balance (continuity eqn) and Force balance (Momentum balance) respectively.

The flow is assumed to be incompressible (water is used as a working fluid) and the flow is assumed to be a two dimensional flow (i.e.) not a function of z axis.

Boundary conditions:

The inlet velocity is set to be 1m/s and boundary condition at the outlet is pressure outlet.

Initial conditions:

The initial conditions for the above flow problem is defined in accordance with the velocity and size of the mesh.

Keeping the velocity constant (m/s), for the ungraded mesh, size of the mesh is 0.001m. So to keep the CFL number less than 1 (here we fixed as 0.5), the time step should be 5e-04. Similarly, for the grading factor of 0.2, the minimum size of the mesh is 0.0002m (20% of the ungraded), so the time step for this case setup is 1e-04. In this fashion, the time step is to be fixed for the next case.

  • For grading = 0.5, the least size of the mesh is 0.0005 (50%), so del t = 2.5e-04


blockMeshDict file

=========                 |
  \\      /  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 1;

vertices
(
    (0 0 0)
    (0.08 0 0)
    (0.08 0.005 0)
    (0 0.005 0)
    (0 0.01 0)
    (0.08 0.01 0)
    (0.2 0.01 0)
    (0.2 0.005 0)
    (0.2 0 0)
    (0.2 -0.01 0)
    (0.08 -0.01 0)
    (0 0 0.001)
    (0.08 0 0.001)
    (0.08 0.005 0.001)
    (0 0.005 0.001)
    (0 0.01 0.001)
    (0.08 0.01 0.001)
    (0.2 0.01 0.001)
    (0.2 0.005 0.001)
    (0.2 0 0.001)
    (0.2 -0.01 0.001)
    (0.08 -0.01 0.001)
    
    
    
);

blocks
(
    hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (1 1 1)
    hex (3 2 5 4 14 13 16 15) (80 5 1) simpleGrading (1 1 1)
    hex (2 7 6 5 13 18 17 16) (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
(
frontAndBack
    {
        type empty;
        faces
        (
            (0 3 2 1)
            (11 12 13 14)
            (3 4 5 2)
            (14 13 16 15)
            (2 5 6 7)
            (13 18 17 16)
            (1 2 7 8)
            (12 19 18 13)
            (10 1 8 9)  
            (21 20 19 12)
        );
    }
    noSlipWall
    {
        type wall;
        faces
        (
            (15 16 5 4)
            (16 17 6 5)
            (0 1 12 11)
            (10 21 12 1)
            (10 9 20 21)
            
        );
    }
    inlet
    {
        type patch;
        faces
        (
            (0 11 14 3)
            (3 14 15 4)
            
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (9 8 19 20)
            (8 7 18 19)
            (7 6 17 18)
            
      	 );
    }
);

mergePatchPairs
(
);

controlDict file

/*--------------------------------*- 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         10;

deltaT          0.01;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

fvSchemes

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

ddtSchemes
{
    default         Euler;
}

gradSchemes
{
    default         Gauss linear;
    grad(p)         Gauss linear;
}

divSchemes
{
    default         none;
    div(phi,U)      Gauss linear;
}

laplacianSchemes
{
    default         Gauss linear orthogonal;
}

interpolationSchemes
{
    default         linear;
}

snGradSchemes
{
    default         orthogonal;
}


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

fvsolution

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

solvers
{
    p
    {
        solver          PCG;
        preconditioner  DIC;
        tolerance       1e-06;
        relTol          0.05;
    }

    pFinal
    {
        $p;
        relTol          0;
    }

    U
    {
        solver          smoothSolver;
        smoother        symGaussSeidel;
        tolerance       1e-05;
        relTol          0;
    }
}

PISO
{
    nCorrectors     2;
    nNonOrthogonalCorrectors 0;
    pRefCell        0;
    pRefValue       0;
}


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

p file

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

    noSlipWall
    {
        type            zeroGradient;
    }

    frontAndBack
    {
        type            empty;
    }
}

U file

/*--------------------------------*- 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 (0.02 0 0);
    }
    outlet
    {
        type            zeroGradient;
        
    }

    noSlipWall
    {
        type            noSlip;
        
    }

    frontAndBack
    {
        type            empty;
    }
}

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

OUTPUT

UNGRADED

hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (1 1 1)
    hex (3 2 5 4 14 13 16 15) (80 5 1) simpleGrading (1 1 1)
    hex (2 7 6 5 13 18 17 16) (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)

GRADED 0.2

hex (0 1 2 3 11 12 13 14) (80 5 1) simpleGrading (1 5 1)
    hex (3 2 5 4 14 13 16 15) (80 5 1) simpleGrading (1 0.2 1)
    hex (2 7 6 5 13 18 17 16) (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)  

GRADED 0.5

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

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.