Challenge

Week 8 - Simulation of a backward facing step in OpenFOAM

Aim : In this challenge, you are going to simulate an incompressible-laminar-viscous flow through the backward facing step geometry. You should perform a transient simulation. The solver can be chosen based on the described physics of the flow. You need to explain the entire simulation procedure (how you set up the case). You should also provide explanations to every change you make inside the reference case files obtained from OpenFOAM tutorials. You can choose the inlet velocity shuch that the flow is laminar.

Objective : We perform 2 case studies as described below and compare the results.

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

  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.

Desired output

  • Measure the velocity profile at 0.085 m from the inlet of the geometry for both case studies and compare. You can use the plot over line tool for this.
  • Explain why Grading/Growth factor is essential for meshing.

Sol :

Laminar Flow : A fluide flow in which the stream of all particles of fluide are flowing in a straight line, there is no mixing of paricle are called laminar flow.

Viscouse Flow : A type of fluid flow in which there is a continuous steady motion of the particles.

Incompressible flow : The fluide flow density remains constant through over a flow.

Reynold Number (Re): It is the ratio of Inertial force to the Viscouse force.

  • Re<2000 Laminar Flow;
  • Re>2000 Turbulent Flow.

`GRADING FACTOR = (SIZE OF LAST CELL) /(SIZE OF FIRST CELL)`

Procedure

  1. We can creating a folder in run folder in OpenFOAM.
  2. Copy the Cavity folder paste in run folder, to change the blockMesh, controlDict, Pressure and velocity file which are our requirment.

Code:

blockMeshDict File

for Simple Grading

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

edges
(
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 11 14 3)
            (3 14 16 5)
        );
    }
    outlet 
    {
        type patch;
        faces
        (
            (9 20 19 8)
            (8 19 18 7)
            (7 18 17 6)
        );
    }
    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)
            
        );
    }
    NoslipWalls
    {
        type wall;
        faces
        (
            (5 16 15 4)
            (0 1 12 11)
            (4 15 17 6)
            (10 9 20 21)
            (1 10 21 12)
            
            
        );
    }
);

mergePatchPairs
(
);

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

blockMeshDict file after 0.2 GF

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

edges
(
);

boundary
(
inlet
{
type patch;
faces
(
(0 11 14 3)
(3 14 16 5)
);
}
outlet
{
type patch;
faces
(
(9 20 19 8)
(8 19 18 7)
(7 18 17 6)
);
}
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)

);
}
NoslipWalls
{
type wall;
faces
(
(5 16 15 4)
(0 1 12 11)
(4 15 17 6)
(10 9 20 21)
(1 10 21 12)


);
}
);

mergePatchPairs
(
);

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

Pressure 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;                     // Initial condition

boundaryField
{
    inlet
    {
        type            zeroGradient;
    }
    outlet
    {
        type            fixedValue;
        value           uniform 0;          
    }

    NoslipWalls
    {
        type            zeroGradient;
    }

    frontAndBack
    {
        type            empty;
    }
}

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

Velocity 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.81 0 0);             // Initial Velocity
    }
    outlet
    {
        type            zeroGradient;
    }
    NoslipWalls
    {
        type            noSlip; 
    }

    frontAndBack
    {
        type            empty;
    }
}

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

OUTPUT

block mesh using a simple grading

block Mesh after 0.2GF

velocity for simple GF

Velocity for 0.2 GF

Pressure for simple GF

Pressure for 0.2 GF

Ploting line for simple GF

Ploting line after 0.2GF

Final Conclusion

If we change the gradding factor 0.2 to 1 the solution become fine grading spacing and accuracy of the solution increases.

So simulation time for meshing is lower for lower GF.

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.