Menu

Executive Programs

Workshops

Projects

Blogs

Careers

Placements

Student Reviews


For Business


More

Academic Training

Informative Articles

Find Jobs

We are Hiring!


All Courses

Choose a category

Loading...

All Courses

All Courses

logo

Loading...
Executive Programs
Workshops
For Business

Success Stories

Placements

Student Reviews

More

Projects

Blogs

Academic Training

Find Jobs

Informative Articles

We're Hiring!

phone+91 9342691281Log in
  1. Home/
  2. Kishoremoorthy SP/
  3. Week 8 - Simulation of a backward facing step in OpenFOAM

Week 8 - Simulation of a backward facing step in OpenFOAM

Objective  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). Theory- Here the aim is simulate an incompressible-laminar-flow through backward facing step geometry.…

  • CFD
  • HTML
  • Kishoremoorthy SP

    updated on 03 May 2023

Objective 

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).

Theory-

Here the aim is simulate an incompressible-laminar-flow through backward facing step geometry. Accordingly need to select the solver respectively.

Solver - ICOFOAM

Futher since the solver uses PISO algorithm for continunity equa -∇⋅u=0">∇⋅u=0

Momentum equal 

u-Velocity">u−Velocity& p">p-Kinematic Pressure

 

Procedure-

     1.Generate Blockmesh

  • Geometry 

  • Boundary 

  2.OpenFoam Script -

  • To start the simulation process. Open the terminal on Ubuntu operating system by shortcut - Ctrl+alt+T or right click->Open terminal(4th from bottom).
  • Enter short - 'tut' then 'ls' and it will take you to the in-built tutorial files present and display the file names.
  • In our case we are solving an incompressible problem. So enter 'cd incompressible' followed by 'ls' it takes you to the solvers present in incompressible file.
  • We are using solver IcoFoam. So enter 'cd icofoam' then 'ls' . Followed by another 'cd cavity'.
  • Now copy the cavity file by -'cp -r cavity/$FOAM_RUN/cavity_test. It successful copies into a run folder and saves it as cavity_test.
  • Note- Before copying make a new working directoty by 'mkdir Run_test' so that u dont mess up things.
  • Follow the commands to create blockMesh.

 

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

vertices
(
    (0 0 0) //0
    (80 0 0)//1
    (80 5 0)//2
    (0 5 0)//3
    (0 0 1)//4
    (80 0 1)//5
    (80 5 1)//6
    (0 5 1)//7 
    (200 5 1)//8
    (200 0 1)//9
    (200 0 0)//10
    (200 5 0)//11
    (0 -5 0)//12
    (80 -5 0)//13
    (80 -5 1)//14
    (0 -5 1)//15
    (200 -5 1)//16
    (200 -5 0)//17
    (80 -10 0)//18
    (200 -10 0)//19
    (200 -10 1)//20
    (80 -10 1)//21
    
);

blocks
(
    hex (0 1 2 3 4 5 6 7) (200 20 1) simpleGrading (1 1 1)
    hex (1 10 11 2 5 9 8 6) (200 20 1) simpleGrading (1 1 1)
    hex (12 13 1 0 15 14 5 4) (200 20 1) simpleGrading (1 1 1)
    hex (13 17 10 1 14 16 9 5) (200 20 1) simpleGrading (1 1 1)
    hex (18 19 17 13 21 20 16 14) (200 20 1) simpleGrading (1 1 1)
    
);

edges
(

);

boundary
(
    Inlet
    {
        type patch;
        faces
        (
            (3 0 4 7)
            (0 12 15 4)
        );
    } 
    Outlet
    {
        type patch;
        faces
        (
            (11 10 9 8)
            (10 17 16 9)
            (17 19 20 16)
        );
    }
    fixedWalls
    {
        type wall;
        faces
        (
          (3 2 6 7)
          (2 11 8 6)
          (12 13 14 15)
          (18 19 20 21)
          (13 18 21 14)  
        );
    }
    FrontAndBack
    {
        type empty;
        faces
        (
          (0 3 2 1) //Front 
          (12 0 1 13)
          (18 13 17 19)
          (13 1 10 17)
          (1 2 11 10)
          
          (4 5 6 7)
          (15 14 5 4)
          (21 20 16 14)
          (5 9 8 6)
                           
        );
    }
);

mergePatchPairs
(
);

// ************************************************************************* //
  • The coordinace of the geometer are in meters. So we will use convertToMeters be 0.001
  • Total vertices are 21. To define the vertices firstly set a origin and use x-,y-and z- coordinace for every verties.
  • Now define the blocks of the mesh. Each block is a compound entry consisiting of list of vertice labels.
  • So follow an orderly manner and giving the number of grids different-different such that one grid is 1mm.
  • Use mergePatchPairs to merge the faces for creating % blocks and save it.
  • In the terminal enter 'cd ..' one step back i.e out of 'system file' , enter 'blockMesh' 

  • Enter 'checkMesh' to know whether the created mesh is good or bad. Enter 'paraFoam' to check it in paraFoam.

  • Similarly define the inlet, outlet, fixedwalls(noSlip) and FrontAndback faces. 
  • Further define ControlDict,pressure,velocity and transportProperties, Just that the commands will be similar but the files for them will have different location.
/*--------------------------------*- 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;
     
   }
   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       dictionary;
    location    "constant";
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

nu              [0 2 -1 0 0 0 0] 0.001;


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

Below is the BlockMesh created - 

  • To calculate the value type 'icoFoam' in terminal.Now when it solves the values do appear on the terminal.
  • To check the effect of pressure and velocity on the mesh. We are sipposed to see the mesh on paraview. Apply the properties and we can see on mesh's paraview. Also after playing the frame it shows at many different time frames.
  • Final plot the graph of mesh velocity at the line 0.085m.
  • Incase of diifculty in plotting then refer to the text file present in videos section of OpenFoam. 

     3. Mesh -

If we look at the below mesh. One can notice that mesh is not uniform all over the surface.Inorder to make it equal we can do the following changes-

blocks
(
    hex (0 1 2 3 4 5 6 7) (80 5 1) simpleGrading (1 1 1)
    hex (1 10 11 2 5 9 8 6) (120 5 1) simpleGrading (1 1 1)
    hex (12 13 1 0 15 14 5 4) (80 5 1) simpleGrading (1 1 1)
    hex (13 17 10 1 14 16 9 5) (120 5 1) simpleGrading (1 1 1)
    hex (18 19 17 13 21 20 16 14) (120 5 1) simpleGrading (1 1 1)
    
);

After the making the changes, now the mesh is uniformly distributed.

     3.1.Mesh from inside-

FixedEnd-

Inlet -

 Results -

Case 1 - Grading factor =1 

Mesh Grid

Velocity Distribution along the domain area with velocity at distance 0.085 from inlet

 

Velocity Plot

Pressure Distribution along the domain area

Case 2 - Grading factor 0.2(cell near Fixed walls)

Code

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

vertices
(
    (0 0 0) //0
    (80 0 0)//1
    (80 5 0)//2
    (0 5 0)//3
    (0 0 1)//4
    (80 0 1)//5
    (80 5 1)//6
    (0 5 1)//7 
    (200 5 1)//8
    (200 0 1)//9
    (200 0 0)//10
    (200 5 0)//11
    (0 -5 0)//12
    (80 -5 0)//13
    (80 -5 1)//14
    (0 -5 1)//15
    (200 -5 1)//16
    (200 -5 0)//17
    (80 -10 0)//18
    (200 -10 0)//19
    (200 -10 1)//20
    (80 -10 1)//21
    
);

blocks
(
    hex (0 1 2 3 4 5 6 7) (80 5 1) simpleGrading (0.2 0.2 1) //Block1
    
    hex (1 10 11 2 5 9 8 6) (120 5 1) simpleGrading (5 0.2 1) //Block2
    
    hex (12 13 1 0 15 14 5 4) (80 5 1) simpleGrading (0.2 5 1) //Block3
    
    hex (13 17 10 1 14 16 9 5) (120 5 1) simpleGrading (5 5 1) //Block4
   
    hex (18 19 17 13 21 20 16 14) (120 5 1)  simpleGrading (5 5 1) //Block5   
);

edges
(

);

boundary
(
    Inlet
    {
        type patch;
        faces
        (
            (3 0 4 7)
            (0 12 15 4)
        );
    } 
    Outlet
    {
        type patch;
        faces
        (
            (11 10 9 8)
            (10 17 16 9)
            (17 19 20 16)
        );
    }
    fixedWalls
    {
        type wall;
        faces
        (
          (3 2 6 7)
          (2 11 8 6)
          (12 13 14 15)
          (18 19 20 21)
          (13 18 21 14)  
        );
    }
    FrontAndBack
    {
        type empty;
        faces
        (
          (0 3 2 1) //Front 
          (12 0 1 13)
          (18 13 17 19)
          (13 1 10 17)
          (1 2 11 10)
          
          (4 5 6 7)
          (15 14 5 4)
          (21 20 16 14)
          (14 16 9 5)
          (5 9 8 6)
                           
        );
    }
);

mergePatchPairs
(
);

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

Mesh generated by above Code

Velocity Distribution along domain area 

 

Velocity Plot

Pressure Distribution along domain area

Pressure Plot

Case 2 - Grading factor 0.2(cell near All walls)

Code 

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

vertices
(
    (0 0 0) //0
    (80 0 0)//1
    (80 5 0)//2
    (0 5 0)//3
    (0 0 1)//4
    (80 0 1)//5
    (80 5 1)//6
    (0 5 1)//7 
    (200 5 1)//8
    (200 0 1)//9
    (200 0 0)//10
    (200 5 0)//11
    (0 -5 0)//12
    (80 -5 0)//13
    (80 -5 1)//14
    (0 -5 1)//15
    (200 -5 1)//16
    (200 -5 0)//17
    (80 -10 0)//18
    (200 -10 0)//19
    (200 -10 1)//20
    (80 -10 1)//21
    
);

blocks
(
    hex (0 1 2 3 4 5 6 7) (80 5 1)                    //Block1
    simpleGrading 
    (
      (  
        (0.5 0.5 5)//50 y-direc, 50% cells, expansion=5
        (0.5 0.5 0.2)//50 y-direc, 50% cells, expansion=0.2
      )
      (
        (0.2 0.1 1)//20 y-direc, 10% cells, expansion=1
        (0.8 0.9 0.2)//80 y-direc, 90% cells, expansion=0.2
      )
      1   //z-direction expansion ratio 
    )
    hex (1 10 11 2 5 9 8 6) (120 5 1)                    //Block2
    simpleGrading
    (
      (  
        (0.5 0.5 5) //50 y-direc, 50% cells, expansion=5
        (0.5 0.5 0.2)//50 y-direc, 50% cells, expansion=0.2
      )
      (
        (0.2 0.1 1)//20 y-direc, 10% cells, expansion=1
        (0.8 0.9 0.2)//80 y-direc, 90% cells, expansion=0.2
      )
      1   //z-direction expansion ratio 
    ) 
    hex (12 13 1 0 15 14 5 4) (80 5 1)                    //Block3
    simpleGrading 
    (
      (  
        (0.5 0.5 5)//50 y-direc, 50% cells, expansion=5
        (0.5 0.5 0.2)//50 y-direc, 50% cells, expansion=0.2
      )
      (
        (0.8 0.9 0.2)//80 y-direc, 90% cells, expansion=0.2
        (0.2 0.1 1)//20 y-direc, 10% cells, expansion=1
      )
      1   //z-direction expansion ratio 
    )
    hex (13 17 10 1 14 16 9 5) (120 5 1)                    //Block4
    simpleGrading 
    (
      (  
        (0.5 0.5 5)//50 y-direc, 50% cells, expansion=5
        (0.5 0.5 0.2)//50 y-direc, 50% cells, expansion=0.2
      )
      (
        (0.8 0.9 0.2)//80 y-direc, 90% cells, expansion=0.2
        (0.2 0.1 1)//20 y-direc, 10% cells, expansion=1
      )
      1   //z-direction expansion ratio 
    )
    hex (18 19 17 13 21 20 16 14) (120 5 1)                    //Block5
    simpleGrading 
    (
      (  
        (0.5 0.5 5)//50 y-direc, 50% cells, expansion=5
        (0.5 0.5 0.2)//50 y-direc, 50% cells, expansion=0.2
      )
      (
        (0.9 0.9 5)//90 y-direc, 90% cells, expansion=5
        (0.1 0.1 1)//10 y-direc, 10% cells, expansion=1
      )
      1   //z-direction expansion ratio 
    )
    
);

edges
(

);

boundary
(
    Inlet
    {
        type patch;
        faces
        (
            (3 0 4 7)
            (0 12 15 4)
        );
    } 
    Outlet
    {
        type patch;
        faces
        (
            (11 10 9 8)
            (10 17 16 9)
            (17 19 20 16)
        );
    }
    fixedWalls
    {
        type wall;
        faces
        (
          (3 2 6 7)
          (2 11 8 6)
          (12 13 14 15)
          (18 19 20 21)
          (13 18 21 14)  
        );
    }
    FrontAndBack
    {
        type empty;
        faces
        (
          (0 3 2 1) //Front 
          (12 0 1 13)
          (18 13 17 19)
          (13 1 10 17)
          (1 2 11 10)
          
          (4 5 6 7)
          (15 14 5 4)
          (21 20 16 14)
          (14 16 9 5)
          (5 9 8 6)
                           
        );
    }
);

mergePatchPairs
(
);

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

Mesh generated by above Code

Velocity Distribution along the domain area 

 

Velocity Plot

Pressure Distribution along the domain area

Pressure Plot

 

 Inference from above results 

  • From the above challenge, we have learnt to plotting velocity for both without and with Grading factor 0.2 cases.
  • When we compare all velocity plot, one can that velocity plot without grading factor is more smooth and accurate than other 2 plots. From which we can assume that grading factor dispruts result.That isn't true, as it is noticable mesh is fine at step walll along X-axis whereas very coarse along Y-axis. Hence the reason for the velocity plot not to be smoot at distance 0.085 along Y-axis.
  • Upto here we know how mesh actually works. One should keep in mind that using fine mesh near the point obtains a better reults.
  • In CFD, fluids usually show large changes near the walls and obstacles along its way.
  • To get efficaious results, one sholud know where to finer grading factor.
  • In a bid to obtain results, one might supposedly use large number of fine element, which could lead to large computational time and memory allocation. Other wordds total wastage.
  • Therefore, how to use grading factor is important.
  • One should use fine mesh to capture flow at boundary walls and obstacles whereas coarse mesh for more open area. 

Leave a comment

Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.

Please  login to add a comment

Other comments...

No comments yet!
Be the first to add a comment

Read more Projects by Kishoremoorthy SP (26)

Week 4 Challenge : CFD Meshing for BMW car

Objective:

AIM:      FOR THE GIVE MODEL, CHECK AND SOLVE ALL GEOMETRICAL ERRORS ON HALF PORTION AND ASSIGN APPROPRITATE PIDS. PERFORMS MESHING WITH GIVEN TARGET LENGTH AND ELEMENT QUALITY CRITERIA. AFTER MESHING THE HALF MODEL,DO SYMMETRY TO THE OTHER SIDE. PRODECURE: INITIALLY, OPEN THE GIVEN BMW MODEL IN ANSA SOFTWARE.…

calendar

20 Oct 2023 11:25 AM IST

  • ANSA
  • CFD
Read more

Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation

Objective:

Aim: employing the symmetry boundary condition to simulate an axis-symmetric laminar flow through the pipe's constant cross-section. Using both symmetry and wedge boundary conditions, simulate the aforementioned angles—10, 25, and 45 degrees—and evaluate your results using HP equations. Introduction: Hagen-Poiseuille's…

calendar

04 May 2023 03:14 PM IST

  • CFD
  • HTML
Read more

Week 11 - Simulation of Flow through a pipe in OpenFoam

Objective:

Aim: Simulate axisymmetric flow in a pipe through foam. Objective: Verify the hydrodynamic length using the numerical result Verify a fully developed flow rate profile with its analytical profile Verify the maximum velocity and pressure drop for fully developed flow Post-process Shear Stress and verify wall shear stress…

calendar

04 May 2023 03:04 PM IST

  • CFD
  • HTML
  • MATLAB
Read more

Week 9 - FVM Literature Review

Objective:

AIM To describe the need for interpolation schemes and flux limiters in Finite Volume Method (FVM).   OBJECTIVE To study and understand What is Finite Volume Method(FVM) Write down the major differences between FDM & FVM Describe the need for interpolation schemes and flux limiters in FVM   INTRODUCTION            …

calendar

03 May 2023 05:47 AM IST

  • CFD
  • HTML
  • STAR-CCM
Read more

Schedule a counselling session

Please enter your name
Please enter a valid email
Please enter a valid number

Related Courses

coursecardcoursetype

Post Graduate Program in CFD Solver Development

4.8

119 Hours of Content

coursecard

Introduction to OpenFOAM Development

4.9

18 Hours of Content

coursecardcoursetype

Post Graduate Program in Battery Technology for Mechanical Engineers

4.8

81 Hours of Content

coursecardcoursetype

Post Graduate Program in Automation & Pre-Processing for FEA & CFD Analysis

4.7

81 Hours of Content

coursecardcoursetype

Post Graduate Program in Hybrid Electric Vehicle Design and Analysis

4.8

343 Hours of Content

Schedule a counselling session

Please enter your name
Please enter a valid email
Please enter a valid number

              Do You Want To Showcase Your Technical Skills?
              Sign-Up for our projects.