Challenge

Week 8 - Simulation of a backward facing step in OpenFOAM

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

vertices
(
    (0 0 0) // vertex 0
    (0 0.5 0) // vertex1
    (0 1 0)  // vertex 2
    (8 1 0) //vertex 3
    (8 0.5 0) // vertex4
    (8 0 0) // vertex5
    (8 -1 0) // vertex6
    (20 -1 0) // vertex7
    (20 0 0) // vertex8
    (20 0.5 0) // vertex9
    (20 1 0) // vertex10
    (20 1 1) // vertex11
    (20 0.5 1) // vertex12
    (20 0 1) // vertex13
    (20 -1 1) // vertex14
    (8 -1 1) // vertex15
    (8 0 1) // vertex16
    (8 0.5 1) // vertex17
    (8 1 1) // vertex18
    (0 1 1) // vertex19
    (0 0.5 1) // vertex20
    (0 0 1) // vertex21
);

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

edges
(
);

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

mergePatchPairs
(
);

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

Controldict

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

deltaT          1e-2;

writeControl    timeStep;

writeInterval   20;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;


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

u

/*--------------------------------*- 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 (0.02 0 0);
    }

    outlet
    {
        type            zeroGradient;
    }

    walls
    {
        type            noSlip;
    }
    
}

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

p

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

    walls
    {
        type            zeroGradient;
    }

}

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