Project

Simulation of flow over a backward facing step in openFoam

AIM:- To simulate flow over a backward facing step in openFoam using icoFoam solver

openFoam is a software package used for scientific computing purposes. most comonly used in applications related to CFD. it is an open source software which means its source code is is open for anybody for looking or editing. The fact that it is an open source package is the reason why it is so popular. the person using openFoam can easily check the back end of the process and so has complete control over what they are performing. compared to other comercial packages this gives a slight edge.

openFoam is written in C++ so it follows the same syntax. it is structured in such a way that it can be not only be used for applicaions but also for development. for standard cases openFoam provides solvers. and by specifying the geometry and the initial and boundary conditions these inbuilt solvers can be used for solving standard cases. and for special cases and non standard cases users can write their own solvers based on the openFoam syntax.for this project we are using the icoFoam solver to simulate the flow over a backward facing step. the test case is exported from the tuorials provided by the openFoam and its geometry, boundary and initial conditions were edited as per the requirement

icoFoam solver : it is one of the standard solvers of openFoam. as the name suggests it solves for incompressible flows. it is a transient slover for incompressible laminar newtonian fluids. it uses the PISO algorithm of finite volume method of discreetization to solve the incompressible continuity equation and the momentum equations. the input requirements are pressure \'P\' and velocity \'V\'

geometry: the required geometry is a backward facing step. openFoam is command line based so to provide the geometry for simulation we can either import an ansys mesh file and concvert it to openFoam file or we can use the inbuilt blockMeshDict file for that. the blockMeshDict file when executed creates the mesh which is then evaluated and post processed graphically in paraFoam. the basic idea of creating geometry is that we can use blocks and combine them to create complex shapes. by matching faces of blocks complicated shapes can be created. in this case three blocks were used to create the required geometry. the blocks are created by specifying their vertices. the very first vertice becomes the local origin for the geometry. for numbering the vertices the right hand thumb rule is used. after the vertices are numbered the vertices which makes a block are specified as a part of hexahedron and the number of cells which would make the face in a direction is also specified. and simplegrading is also specified. it is basically stretching or compressing the cells near the walls for better meshing. for the project the geometry is obtained for multiple instances of simpleGrading.

the boundary conditions in this case are inlet wall, outlet wall , front -back ,top -bottom , and the step wall. out of those only the inlet and outlet walls are of importance in calculations to the other boundaries are defined as empty, which means that they are not considered in calculations.

the simulation can be completed in folowing steps:

  1. creating the geometry by using the blockMesh file or by importing from ansys
  2. run the blockmesh in the command prompt to create the mesh
  3. provide the initial conditions for the case by editing the \'P\' and \'U\' files in the \'0\' folder of the case directory
  4. run the icoFoam command in the prompt to complete the calculations
  5. post process the results in paraview by using the paraFoam command in the prompt

blockMesh file details: the required geometry is obtained by using three blocks. the blocks are arranged in the required way by matching their respective vertices. boundary conditions are specified and defined. this case has an inlet type boundary, an outlet type boundary , top- bottom and front-back faces walls. out of which inlet and outlet walls are specified as patches , top bottom and the step face are no slip walls and the top and bottom faces are empty type .

/*--------------------------------*- C++ -*----------------------------------*\\
  =========                 |
  \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\\\    /   O peration     | Website:  https://openfoam.org
    \\\\  /    A nd           | Version:  7
     \\\\/     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 1 0) //2
(0 1 0) //3
(0 0 .25)  //4
(8 0 .25)  //5
(8 1 .25) //6
(0 1 .25) //7
(20 0 0) //8
(20 1 0) //9
(20 0 .25) //10
(20 1 .25)//11
(8 -1 0)//12 
(20 -1 0) //13
(8 -1 .25) //14
(20 -1 .25)//15
);

blocks
(
    hex (0 1 2 3 4 5 6 7) (200 10 1) simpleGrading (1 1 1)
    hex (1 8 9 2 5 10 11 6) (200 10 1) simpleGrading (1 1 1)
    hex (12 13 8 1 14 15 10 5) (200 10 1) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
    inletWall
    {
        type patch;
        faces
            (
            (0 4 7 3)
  	    );	      
    }
    outletWall
    {
        type patch;
        faces
            ( 
            (9 8 10 11)
            (8 13 15 10)
            );
    }
    frontAndBack
    {
        type empty;
        faces
            (
            (2 3 0 1)
	    (9 2 1 8) 
            (8 1 12 13) 
	    (5 4 7 6)
            (10 5 6 11)
            (15 14 5 10)
            );
    }
    noSlipWalls
    {
        type wall;
        faces
            (
            (3 7 6 2) 
            (2 6 9 11) 
            (4 0 1 5) 
            (14 12 13 15) 
            (12 14 5 1)
            );
    }
);

mergePatchPairs
(
);

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

the above blockmesh geometry is for simplegrading value = 1

initial velocity conditions : the initial velocity is set for 1.5 m/s

/*--------------------------------*- C++ -*----------------------------------*\\
  =========                 |
  \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\\\    /   O peration     | Website:  https://openfoam.org
    \\\\  /    A nd           | Version:  7
     \\\\/     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
{
    inletWall
    {
        type            fixedValue;
        value           uniform (1.5 0 0);
    }

    outletWall
    {
        type            zeroGradient;
    }

    frontAndBack
    {
        type            empty;
    }

    noSlipWalls
    {
	type		noSlip;
    }
}

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

initial conditions for pressure: atmospheric conditions are taken for the pressure

/*--------------------------------*- C++ -*----------------------------------*\\
  =========                 |
  \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\\\    /   O peration     | Website:  https://openfoam.org
    \\\\  /    A nd           | Version:  7
     \\\\/     M anipulation  |
\\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    inletWall
    {
        type            zeroGradient;
	
    }

    outletWall
    {
        type            fixedValue;
	value		uniform 0;
    }

    frontAndBack
    {
        type            empty;
    }
    noSlipWalls
    {
    	type		zeroGradient;
    }
}

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

time for the simulation is specified in the controldict file in the system folder of the case directory.

this simulation is performed for 0.1 seconds with a time step of 1e-5.

controldict file:

/*--------------------------------*- C++ -*----------------------------------*\\
  =========                 |
  \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\\\    /   O peration     | Website:  https://openfoam.org
    \\\\  /    A nd           | Version:  7
     \\\\/     M anipulation  |
\\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    \"system\";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     icoFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         0.1;

deltaT          1e-5;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

results:

for grading factor of 0.2

for grading factor of 0.5

grading factor of 0.8

conclusions:

  • inbuilt solvers of openFoam can be used to solve standard cases. in this case the flow was incompressible so icoFoam solver was used
  • complex geometry can be created by blockMesh method, if correct procedure is followed to specify the vertices of respective boundaries
  • simple grading does not drastically effect the end results of the simulation..
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.