Challenge

Week 8 - Simulation of a backward facing step in OpenFOAM

  • Considering a 2D laminar, incompressible and Newtonian fluid flow over the Backward-facing step with given kinamatic viscosity as `10^-5 m/s`.
  • Considering the 'No-slip boundary condition' on every wall under the domain.
  • For the results, we need to perform simulations for given grading factors.
  • We need to change the time step for different meshes such that satisfies our courant-Freidrichs-lewy condition.
  • the problem satement should be carried out with the aid of tututorial named cavity under the icoFoam solver with appropriate Geometry, Mesh , Boundary and initial conditions are created by modifying the script files from the respective solver.

MESH SPECIFICATION:

  • Number of cell in X direction = 200(for whole)
  • number of cell in Y direction =20 (for first region)
  • number of cell in Y direction = 40(for second region)

FOR GRADING FACTOR 1:

  • Copy the cavity folder to run folder
  • then open and edit the following files

1.GEOMETRY and MESH GENERATION

BlockMeshDict File:

System --> 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 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.1) //11
    (8 0 0.1) //12
    (8 0.5 0.1) //13
    (0 0.5 0.1) //14
    (8 1 0.1) //15
    (0 1 0.1) //16
    (20 1 0.1) //17
    (20 0.5 0.1) //18
    (20 0 0.1) //19
    (20 -1 0.1) //20
    (8 -1 0.1) //21
);

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

mergePatchPairs
(
);

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

ControlDict File:

System --> 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         0.5;

deltaT          0.0005;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

2.SPECIFYING PHYSICAL PROPERTIES:

Pressure and velocity profiles:

0 --> P&V

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

    frontAndBack
    {
        type            empty;
    }
    noslipwalls
    {
    	type		 zeroGradient;
    }
}

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

V:

/*--------------------------------*- 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 (1.5 0 0);
    }

    outlet
    {
        type            zeroGradient;
    }

    frontAndBack
    {
        type            empty;
    }
    noslipwalls
    {
    	type		 noSlip;
    }
}

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

TransportProperties:

constant --> TransportProperties

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

transportModel	Newtonian;
nu              [0 2 -1 0 0 0 0] 1e-5;


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

FOR  GRADING FACTOR 0.2:

blocks
(
    hex (0 1 2 3 11 12 13 14) (80 10 1) simpleGrading (1 5 1)
    hex (3 2 4 5 14 13 15 16) (80 10 1) simpleGrading (1 0.2 1)
    hex (1 8 7 2 12 19 18 13) (120 10 1) simpleGrading (5 5 1)
    hex (2 7 6 4 13 18 17 15) (120 10 1) simpleGrading (5 0.2 1)
    hex (10 9 8 1 21 20 19 12) (120 20 1) simpleGrading (5 1 1)
);
  • After setup all the files we need to create a BlockMesh
  • for post processing we need to solve the problem using icoFoam solver.
  • we can use paraFoam to view mesh and run simulation.

RESULTS:

For grading factor 1.

refined mesh.

 

 

For Grading factor 0.2

refined mesh

EFFECTS OF GRADED MESH:

  • with Grading , the wall boundary layer effects are captured well.
  • with Grading , the mesh is coarse in the middle region, which makes the velocity curve more detailed to see.
  • for better results we should have a finer mesh near the walls and the mesh with0.2 grading provides us the finest mesh generated .

CONCLUSIONS:

  • For finer mesh , we can visualize the accurate output.
  • After ploting the graphs at x = 0.085, it can be seen that the velocity at the walls is zero , whereas the velocity at the center is maximum. This is due to the No-Slip condition at the walls.
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.