Challenge

Week 8 - BlockMesh Drill down challenge

DESIGN AND ANALYSIS OF REARWARD FACING STEP .

Understanding open foam

The aim of this project is to develop a block that is technically a backward facing step and allowing a uniform flow over it and observe the velocity and pressure distribution around the corner of the step.the rearward facing step is an example for seperation flows ,flow reattachemnet zones it is widdely seen in aerodynamics of vehicles ,buildinng and many other feilds.

STEP 1 – GEOMETRY DEFINITION

We have a 2D design of a geometry that’s defined but since the software we are using for simulation is open foam and it’s a 3D solver we have to convert the geometry to 3D and simulate for 2D the simple way of doing that changing the front and back plane to empty.

This is the pictorial representation of the physics and the flow that is occurring .the profile is explained in detail below and along the z we have given a length of 0.01.

*All the dimentions in meter.

STEP 2- CREATING BLOCKS IN OPEN FOAM

  • Lets open terminal (ctrl + alt +t)and get into foam by typing foam
  • We have to check for the solvers and tutorial folders.
  • Get into tutorial folder (tut)and use ls(list option)
  • Navigate to incompressible folder (cd incompressible )
  • And move into icofoam folder where we can find cavity
  • Once we reach the domain we need to copy that to foam_run folder
  • cp – rcavity/$FOAM_RUN/***(userdefined)***.
  • After copying we need to move into FOAM_RUN folder .
  • Then move into cavity folder and system folder of cavity.
  • Use gedit blockMeshDict to navigate to the notepad and we can see the boundary and verticies and faces definition .
  • Once the definition of the faces are done we need to specify the boundaries inlet ,outlet ,fixedwall front and back plane .
  • Since we are dealing with 2D we can leave out the front and back plane which will be automatically assigned by open foam as empty .
  • Save and exit
  • Come to 0 folder of cavity and change the value of pressure and velocity
  • Use gedit to navigate into controlDict
  • And adjust the start and end time and simulation time and since we are solving it explicitly take care of dt.
  • Save and exit
  • Come back to cavity folder and execute blockMesh command and check if it runs without error .
  • Type icoFoam to simulate and once it runs successfully .
  • Open paraview by typing parafoam inbuilt function and take the required date here the velocity.

How we have put in vertices number and defined the faces .In this folder we can see that how we design the blocks.

/*--------------------------------*- 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 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.01)
    (0.08 0 0.01)
    (0.08 0.005 0.01)
    (0 0.005 0.01)
    (0.08 0.01 0.01)
    (0 0.01 0.01)
    (0.20 0.01 0.01)
    (0.20 0.005 0.01)
    (0.20 0 0.01)
    (0.20 -0.01 0.01)
    (0.08 -0.01 0.01)

    
);

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

edges
(
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 11 14 3)
            (3 14 16 5)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (9 8 19 20)
            (8 7 18 19)
            (7 6 17 18)
        );
    }
    frontAndBack
    {
        type empty;
        faces
        (
            (0 3 2 1)
            (3 5 4 2)
            (2 4 6 7)
            (1 2 7 8)
            (10 1 8 9)
            (11 12 13 14)
            (14 13 15 16)
            (12 19 18 13)
            (13 18 17 15)
            (21 20 19 12)
        );
    }
    fixedwall
    {
        type wall;
        faces
        (
            (5 16 15 4)
            (4 15 17 6)
            (1 10 21 12)
            (1 12 11 0)
            (9 20 21 10)
            
        );
    }
);

mergePatchPairs
(
);

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

we will understand what these codes are

first we can see the key and the value and the dictionary file .we have defined 22 vertices (basically vertices coresponds to points),the geomertry has 5 blocks the blocks are defined how we are dining the blocks are important the plane which contains the face and we have to number it along the anticlockwise direction ,then we define the number of cells in our problem statement we have (x=200,y=10,z=1).once block is created.we have define the faces for our domain that is inlet outlet fixed walls and front and back plane ,since we are solving for 3d we can neglect defining the face for front and back it will be assigned empty by the solver .

*******************************************************

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

deltaT          0.0001;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

the controlDict file from the system folder contains the start and end time and specified for running the analysis we are solving for 2D case of incompressible flow and since we are trying to solve for a explicit solver we need to take care of the curant number as the cases we have keep changing for the value of grading .

*************************************************************

/*--------------------------------*- 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
{
    inlet
    {
        type            zeroGradient;
    }

    outlet
    {
        type            fixedValue;
        value           uniform 0;
    }
    fixedwall
    {
        type            zeroGradient;
        
    }

    frontAndBack
    {
        type            empty;
    }
}

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

this is the pressure file which is located in the 0 folder we have to do changes to it and we can see from the dimentions we are solving for (P/p)we are fixing an uniform preessure field along the geometry and zerograd along the walls and outlet.so a pressure differnce to allow a flow to occur.

**********************************************************

/*--------------------------------*- 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
{
    inlet
    {
        type            fixedValue;
        value           uniform (1 0 0);
    }

    outlet
    {
        type            zeroGradient;
    }
    fixedwall
    {
        type            noSlip;
        value           uniform (0 0 0);
    }


    frontAndBack
    {
        type            empty;
    }
}

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

this is the velocity file under the same folder but we have to use (caps U)to navigate and first we can see we are giving a uniform field throughout and naming u=1m/s along x axis alone .

***************************************************

results and discussions

the above pasted code is for 0.8 graded mesh . once the solver is run we have to open the paraview solftware to understand the results the command line for it is paraFoam.the main objective is to find out the velocity distribution just after the step where the step is located at 0.08 metre in our geometry but we place probe to understand theeffect just after the step at 0.085m in all the three cases.the velocity distribution along the entire domain is plotted below .

case 1 -0.8 graded mesh

plot1

velocity distribution along the complete domain.

plot2

we have two plots next to each other one being the velocity and the other being the pressure ,the velocity profile goes from zero and ends up at zero ,which follows a exponential increase and reaches a peak and latter drops back to zero .

case 2 -0.5 graded mesh

plot1

the velocity distribution along the complete doamin having graded mesh of 0.5.

plot2

x axis - height at 0.085m

y axis - plot 1(variation of velocity)

plot 2 (variation of pressure)

important point to be noted is that the profile for both pressure and velocity doesnt change from our previous observations.

case 3 -0.2 graded mesh.

the below figure shows the mesh distribution along the domain how the grading works.we have increased the mesh along the walls and around the step region to capture the flow physics more accurately .

plot1

plot2

the complete velocity distribution can be seen from the plot which looks similar to the above two case observations .

plot3

x axis - height at 0.085m

y axis - plot 1(variation of velocity)

plot 2 (variation of pressure).

the pressure plot looks somewhat altered compared to tthe other two cases the reason is that we have not limited the range of the axis that will be present along the bottom of the plot over line box.once we change the min value and max value (16-19 respectively)we can get the same plot and the variation is identical in all three cases.

******************************************************

grading scheme .

case 1(0.2)

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

case 2(0.5)

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

case 3 (0.8)

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

this case is already pasted in the main program thats the blockMeshDict.

*********************************************************************************************************************

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.