Project

BlockMesh Drill down challenge

Aim:

To simulate the flow through a backward facing step & to create multiple meshes and compare the results obtained from each mesh for the following profile using icoFoam.

Objective:

  • To create a block for the given dimensions
  • Then Define the control conditions to the specifications.
  • Use different mesh grading factors along the walls of the profile to compare the difference in the output of velocity profile.
  • Give the wall conditions for velocity & pressure calculations.
  • Run the simulation to get the velocity profile.
  • Conclude the observations for the change in mesh grading factor.

Conditions:

  • Number of cells along the x direction (longer dimension) = 200
  • Number of cells along the y direction = 10
  • Use a graded mesh. Grading factor near all walls should be 0.2
  • Take the boundary conditions as given in the figure for each side of the walls.

Open FOAM:

OpenFOAM (for \"Open-source Field Operation And Manipulation\") is a C++ toolbox for the development of customized numerical solvers, and pre-/post-processing utilities for the solution of continuum mechanics problems, most prominently including computational fluid dynamics(CFD).

Block:

Steps for simulation:

  • Open the terminal in the linux operating sysytem
  • Just type tutorials and it takes you to the ib-built tutorial files of the openFOAM software.type ls (list) to view the contents in the tutorials.
  • Type cd incompressible and then ls.it takes to incompressible directory file.
  • Type cd icoFoam and ls.after that we need to copy cavity directory file in icoFoam.
  • Type cp -r cavity/ $FOAM_RUN/. This command copies the cavity file and pastes directly in the run folder.
  • Type cd.type run.it takes to the run folder which creates automatically by the software and the file we copied.
  • Open the files using the change directory cd command.
  • In the file we copied, open cavity_test and type ls. in the list type cd system
  • Type ls there we see blockMeshdict, controlDict are the text files we need to edit the file accordingly to our boundary conditions.
  • Type gedit blockMeshDict .here we give a shape to the problem, applying the mesh grading , allocating the grid numbers to the respective points we assumed and save the file.
  • Likewise ,edit controldict file also give limits in words of time, like starttime, end time, time interval and deltat.
  • While selecting the deltat value ,be aware courant number. it should be less than one.otherwise the solution may diverge and stopped forcibly by software itself.
  • Come back to the cavity file using change directory command cd.
  • In this file we need to edit the velocity and pressure files accordingly to the problem.for that wee need to goto 0 file.
  • 0 file represents us that the initial conditions of the problem.and these files are inbuilt files.
  • After editing the four files come to the cavity directory .then we need to give command blockMesh to the mesh structered and the other mesh calculations are done here.
  • After completing it we need to check the mesh that it has any error in it or not.for that checkMesh command is used.
  • Now type icoFoam to calculate simulation .because in icoFoam it runs only the file we copied.
  • After the completion of simulation ,type paraFoam for the post-processing.
  • ParaView is an open source multiple-platform application for interactive, scientific visualization. It has a client server architecture to facilitate remote visualization of datasets, and generates level of detail (LOD) models to maintain interactive frame rates for large datasets. It is an application built on top of the visualization tool kit libraries. ParaView is an application designed for data parallelism on shared memory or distributed-memory multicomputers and clusters. It can also be run as a single-computer application.

blockMeshDict code:

/*--------------------------------*- 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)    //vertices 0
    (8 0 0)    //vertices 1
    (8 0.5 0)  //vertices 2
    (0 0.5 0)  //vertices 3
    (0 1 0)    //vertices 4
    (8 1 0)    //vertices 5
    (20 1 0)   //vertices 6
    (20 0.5 0) //vertices 7
    (20 0 0)   //vertices 8
    (20 -1 0)    //vertices 9
    (8 -1 0)     //vertices 10

    (8 0 0.1)    //vertices 11
    (0 0 0.1)    //vertices 12
    (0 0.5 0.1)  //vertices 13
    (8 0.5 0.1)  //vertices 14
    (8 1 0.1)    //vertices 15
    (0 1 0.1)    //vertices 16
    (20 1 0.1)   //vertices 17
    (20 0.5 0.1) //vertices 18
    (20 0 0.1)   //vertices 19
    (20 -1 0.1)  //vertices 20
    (8 -1 0.1)   //vertices 21
    
    

);

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

edges
(
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (13 12 0 3)
            (16 13 3 4)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (6 17 18 7)
            (7 18 19 8)
            (8 19 20 9)
        );
    }

    front
    {
        type empty;
        faces
        (
            (13 12 11 14)
            (16 13 14 15)
            (15 14 18 17)
            (14 11 19 18)
            (11 21 20 19)
        );
    }

    back
    {
        type empty;
        faces
        (
            (3 0 1 2)
            (4 3 2 5)
            (5 2 7 6)
            (2 1 8 7)
            (1 10 9 8)
        );
    }

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

mergePatchPairs
(
);

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

ControlDict code:

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

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

Pressure code:

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

    front
    {
        type            empty;
    }

    back
    {
        type            empty;
    }

    topandbottom
    {
        type            zeroGradient;
    }
}

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

Velocity code:

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

    outlet
    {
        type            zeroGradient;
    }

    front
    {
        type            empty;
    }

    back
    {
        type            empty;
    }

    topandbottom
    {
        type            noSlip;
    }
}

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

Mesh grading factor:

Specifies the maximum ratio of adjacent mesh edges for transitioning between coarse and fine regions. For example, a setting of 1.5 limits an elements edge length to 1.5 times the edge length of the adjacent element. A smaller grading factor produces a more uniform mesh.

It is a technique called mesh streching.

A smaller grading factor produces a more uniform mesh.

Results:

Geometry:

mesh grading factor 0.2:

mesh grading factor 0.5:

mesh grading factor 0.8:

Conclusion:

By observing the above plots, we can see that how the gradation of mesh appears.

From the plots seen above ,we can say that definitely there will be some effect on simulation by changing the mesh grading factor.

In total,we perform simulation for mesh gradation of 0.2,0.5,0.8. all these simulation throughs the similar plots.

although these have similar plots the difference has been observed by zoom in to plotat the maximum velocity and pressure points.

In velocity plots we observe that plot has been bent to iys right side.this is because we were given the condition of the walls as no-slip condition throughout the block.

The formation of pressure plots is, change in the pressure is like first increasing and then decreasing . this is because if there is an increase in velocity ,an increase in pressure also observed.

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.