Challenge

Week 8 - Simulation of a backward facing step in OpenFOAM

Aim:

  • Tosimulate an incompressible -lamainar flow throgh the backward facing step geometry.
  • To perform transient simulation and choosing solver based on the described physics of the flow in problem statement

To simulate the flow with out using any grading factor (GF=1) and with grading factor=0.2

Method

  • Open openFoam and find the tutorials and solver to solve the incompressible -laminar viscous problem
  • In the next step copy the required file in solver and paste it in openFoam run folder so that official file of openFoam untouched
  • Find out blockMesh script file to create domainspace and provide mesh specification
  • Find 'controlDict file to edit start and end time for simulation
  • In initial folder 'O' edit initial parameternfor velocity and pressure
  • Use blockmesh command to generate to mesh and checkMesh to varify the mesh quality
  • Open simulation file in paraView and plot the velocity profile at a perticular point from inlet
  • Repeat the above procedure for grading factor 0.2 to check the difference in the results

Problem Statement

Simulate an incompressible -laminar -viscous flow through the backward facing step geometry and perform two case studis

case1:Simulate the flow without using any grading factor GF=1

case2: simualte the folow with grading factor 0.2. The cells should be near the walla(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 given in the following picture

Grading Factor or Expansion ratio

Gading factor or expansion ratio improves the quality of mesh by refining the mesh in specified diirection

Expansion ratio =(size of end cell)/(size of starting cell)

Mesh Grid (GF=1)

velocity profile

Velocity Plot at distance 0.085

Blockmesh Dict. FOR GF=1

/*--------------------------------*- 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 5 1) simpleGrading (1 1 1) //block1
    hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (1 1 1) //block2
    hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (1 1 1) //block3
    hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (1 1 1) //block4
    hex (10 9 8 1 21 20 19 12) (120 10 1) simpleGrading (1 1 1) //block5
    
);

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
(
);

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

Control Dict.

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

deltaT          0.00001;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

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

    fixedWalls
    {
        type            zeroGradient;
    }
    
    frontAndBack
    {
    type                empty;
    }
}

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

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

    
    outlet
    {
        type            zeroGradient;
    }
    
    fixedWalls
    {
    	type            noSlip;
    	value           uniform (0 0 0);
    }
    
    
    frontAndBack
    {
    	type            empty;
    }
}

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

Mesh Grid with GF=0.2

Velocity Profile

Pressure Profile

Velocity Plot at 0.085

Blockmesh Dict for GF=0.2

/*--------------------------------*- 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 5 1) simpleGrading (0.2 5 1) //block1
    hex (3 2 4 5 14 13 15 16) (80 5 1) simpleGrading (0.2 0.2 1) //block2
    hex (2 7 6 4 13 18 17 15) (120 5 1) simpleGrading (5 0.2 1) //block3
    hex (1 8 7 2 12 19 18 13) (120 5 1) simpleGrading (5 5 1) //block4
    hex (10 9 8 1 21 20 19 12) (120 10 1) simpleGrading (5 5 1) //block5
    
);

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
(
);

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

Conclusion

  • By Changing the grading factor from the value 1 to 0.2 the mesh become finer and the solution become accurate.
  • The small change in sine of grading factor(mesh size) the results remains approximately same.
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.