Challenge

Week 8 - Simulation of a backward facing step in OpenFOAM

PROJECT-

- Simulation of a backward facing step in OpenFOAM.

THEORY-

- We are using OpenFoam to stimulate an incompressible-laminar-viscous flow through the backward facing step geometry ,In cfd various numerical approces to stimulate fluid motion and heat transfer but in this case we are using OpenFoam .

-OpenFoam (for 'Open-source Field Operation And Manipulation') is a C++ toolbox for the development of customized numerical solvers and pre/post-processing utilities for the solution of continuum mechanics problems, most prominently including computational fluid dynamics.

OBJECTIVES-

- To simulate an incompressible-laminar-viscous flow through the backward facing step geometry and perform a transient simulation.

  • Case 1 - Simulate the flow without using any grading factor (i.e., GF = 1).
  • Case 2 - Simulate the flow with grading factor of 0.2. The cells should be finer near the walls (includig the step wall).

MESH SPECIFICATION

  • Number of cells along the x direction (longer dimension)
  • Number of cells along the longer y direction = 20;

BOUNDARY CONDITION SPECIFICATION-

- The figure below shows the boundary conditions.

Distribution of blocks

Indexing the vertices

EXPLANATION-

-First we chose a solver , in this case wee chose icoFoam (incompressible laminar navier strokes equation) , inside this we have cavity is using for this project. then we creat a geometry for cavity.

-In cavity we have to edit the blockMeshDict,controlDict , and initial condition(presure,velocity)as per the boundary conditions given.

Comands used for this problem-

  • tut - shortcut for tutorials
  • app - is for applications
  • sol - is for solvers
  • cp - to copy
  • ls - list
  • cd - to change directory
  • gedit- to edit the text
  • cd .. - is used for previous directory
  • $FOAM_RUN - openFoam run directory
  • paraFoam- to open the paraview

MAIN CODES-

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

convertToMeters 0.1;

vertices
(
    (0 0 0)
    (0.08 0 0)
    (0.08 0.005 0)
    (0 0.005 0)
    (0.08 0.01 0)
    (0 0.01 0)
    (0.20 0.01 0)
    (0.20 0.005 0)
    (0.20 0 0)
    (0.20 -0.01 0)
    (0.08 -0.01 0)
    (0 0 0.1)
    (0.08 0 0.1)
    (0.08 0.005 0.1)
    (0 0.005 0.1)
    (0.08 0.01 0.1)
    (0 0.01 0.1)
    (0.20 0.01 0.1)
    (0.20 0.005 0.1)
    (0.20 0 0.1)
    (0.20 -0.01 0.1)
    (0.08 -0.01 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 wall;
        faces
        (
            (0 11 14 3)
            (3 14 16 5)
        );
    }
    outlet
    {
        type wall;
        faces
        (
            (9 8 19 20)
            (8 7 18 19)
            (7 6 17 18)
        );
    }
    frontAndBack
    {
        type empty;
        faces
        (
            (11 12 13 14)
            (14 13 15 16)
            (13 18 17 15)
            (12 19 18 13)
            (21 20 19 12)
            (0 3 2 1)
            (3 5 4 2)
            (2 4 6 7)
            (1 2 7 8)
            (10 1 8 9)
        );
    }
    fixedWalls
    {
        type wall;
        faces
        (
            (5 16 15 4)
            (0 1 12 11)
            (4 15 17 6)
            (10 9 20 21)
            (10 21 12 1)
        );
    }
);

mergePatchPairs
(
);

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

EDITING THE BLOCKMESHFILE-

Here we edit the vertices and mesh grading as per the cinditions are given.

CONTROLDICTFILE-

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

deltaT          0.00001;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

INITIAL CONDITION-

-Initial condition are assigend as per boundary condition.

Presure initial condition 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;
    }

    fixedWalls
    {
        type            zeroGradient;
    }

    frontAndBack
    {
        type            empty;
    }
}

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

Velocity intial condition 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 (1 0 0);
    }
    
    outlet
    {
        type            zeroGradient;
        value           uniform (0 0 0);
    }

    fixedWalls
    {
        type            noSlip;
    }

    frontAndBack
    {
        type            empty;
    }

Now lets view the result is paraview using 'paraFoam' comand.

MeshGrid-

Pressure distribution along the domain-

Velocity distribution along the domain-

Velocity plot-

With Grading Factor 0.2(cell near fixed wall)-

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

convertToMeters 0.1;

vertices
(
    (0 0 0)
    (0.08 0 0)
    (0.08 0.005 0)
    (0 0.005 0)
    (0.08 0.01 0)
    (0 0.01 0)
    (0.20 0.01 0)
    (0.20 0.005 0)
    (0.20 0 0)
    (0.20 -0.01 0)
    (0.08 -0.01 0)
    (0 0 0.1)
    (0.08 0 0.1)
    (0.08 0.005 0.1)
    (0 0.005 0.1)
    (0.08 0.01 0.1)
    (0 0.01 0.1)
    (0.20 0.01 0.1)
    (0.20 0.005 0.1)
    (0.20 0 0.1)
    (0.20 -0.01 0.1)
    (0.08 -0.01 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 wall;
        faces
        (
            (0 11 14 3)
            (3 14 16 5)
        );
    }
    outlet
    {
        type wall;
        faces
        (
            (9 8 19 20)
            (8 7 18 19)
            (7 6 17 18)
        );
    }
    frontAndBack
    {
        type empty;
        faces
        (
            (11 12 13 14)
            (14 13 15 16)
            (13 18 17 15)
            (12 19 18 13)
            (21 20 19 12)
            (0 3 2 1)
            (3 5 4 2)
            (2 4 6 7)
            (1 2 7 8)
            (10 1 8 9)
        );
    }
    fixedWalls
    {
        type wall;
        faces
        (
            (5 16 15 4)
            (0 1 12 11)
            (4 15 17 6)
            (10 9 20 21)
            (10 21 12 1)
        );
    }
);

mergePatchPairs
(
);

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

OUTPUT MESH-

For graade 0.2-

Velocity distribution along the domain-

Pressure distribution allong the domain-

Velocity Plot -

CONCLUSION-

From the solution we knew the ,ther is not much difference in velocity magnitude both the cases,but to the accurate at the edge , we could see the flow affecteed on the corner of the region.

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.