## BlockMesh Analysis of a Backward Facing Step

MESH GENERATION AND ANALYSIS USING BLOCKMESH FOR FLOW OVER A BACKWARD FACING STEP:

The purpose of the following project is to generate the geometry for a variation of the incompressible cavity flow problem in OpenFOAM. For this purpose we have modified the lid-driven cavity tutorial in OpenFOAM to generate the mesh. We would be looking at the generation of the Mesh with and without grading and its flow simulation.

ASSUMPTIONS:

1. Low speed forced convection flow

2. Friction factor in walls have been neglected

3. Low Reynold's number flow through a closed channel

4. No-slip conditions in the top and bottom wall surfaces

INTRODUCTION:

Mesh Specifications:

Number of cells along the x direction (longer dimension) = 200

Number of cells along the y direction = 10

The above figure shows us the required geometry that has to be designed.

We generated the required geometry using 6 blocks as shown below:

The individual blocks are classified into types: (i) 80 cells (along x) x 5 cells (along y) and (ii) 120 cells (along x) x 5 cells (along y). As the problem is a 2 Dimensional case we set the number of cells along z as 1. The overall length of the object has been restricted to 200 cells along x and 20 cells along y as inferred from the problem statement.

We define the particular geometry by editing the blockMeshDict file as shown below:

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

convertToMeters 1;

vertices
(
(0 0 0)            // vertex 0
(0.08 0 0)         // vertex 1
(0.08 0.005 0)     // vertex 2
(0 0.005 0)        // vertex 3
(0 0.01 0)         // vertex 4
(0.08 0.01 0)      // vertex 5
(0.08 -0.005 0)    // vertex 6
(0.08 -0.01 0)     // vertex 7
(0.2 -0.01 0)      // vertex 8
(0.2 -0.005 0)     // vertex 9
(0.2 0 0)          // vertex 10
(0.2 0.005 0)      // vertex 11
(0.2 0.01 0)       // vertex 12
(0 0 0.001)        // vertex 13
(0.08 0 0.001)     // vertex 14
(0.08 0.005 0.001) // vertex 15
(0 0.005 0.001)    // vertex 16
(0 0.01 0.001)     // vertex 17
(0.08 0.01 0.001)  // vertex 18
(0.08 -0.005 0.001)// vertex 19
(0.08 -0.01 0.001) // vertex 20
(0.2 -0.01 0.001)  // vertex 21
(0.2 -0.005 0.001) // vertex 22
(0.2 0 0.001)      // vertex 23
(0.2 0.005 0.001)  // vertex 24
(0.2 0.01 0.001)   // vertex 25
);

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

edges
(
);

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

mergePatchPairs
(
);

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

This enabled the following geometry to be generated in OpenFOAM with the required specifications. Here the simpleGrading factor has been set to (1 1 1) indicating that it is an ungraded mesh.

The mesh generation and the simulation results are shown below:

We now introduce a grading factor that is defined by f = (size of the end cell)/(size of the start cell) This is used to refine the mesh at a certain desired location to get a more accurate solution at the said location. In our problem we need to capture the velocity profile at x = 0.085m from the inlet and for that we graded the mesh both in the x and y directions. Hence we needed to refine the mesh near the backward step in the object by suitably grading the mesh near the exit of the inlet. The results for various mesh grading factors are:

Mesh Grading Factor (f = 0.8):

The necessary changes made to the blockMeshDict file is shown below:

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


A. Mesh (f = 0.8)

B. Velocity Profile (f = 0.8)

Mesh Grading Factor (f = 0.4):

The necessary changes made to the blockMeshDict file is shown below:

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

A. Mesh (f = 0.4):

B. Velocity Profile (f=0.4):

Mesh Grading Factor (f = 0.2):

The necessary changes made to the blockMeshDict file is shown below:

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

A. Mesh (f = 0.2):

B. Velocity Profile (f = 0.2):

RESULTS:

The results obtained show us the velocity profile obtained at a distance of x = 0.085m from the inlet for the entire cross section of the geometry in the y direction. We used the line probe tool to capture the required data.

The required Raw Data was processed and plotted to obtain smooth curves of the velocity profiles using the OriginPro 2018 Graphing Software. We used its signal processing toolkit and the adjacent-averaging technique (with points window = 100) to process and plot the required data which is presented below for various grading schemes.

From the plot we can see little to no boundary layer seperation of the two mixing streams which occurs when the fluid head passes just over the step and experiences exit loss. This is a qualitative effect that should give us an approximation of accuracy of our simulation depending on the mesh refinement (or the grading factor f).

ii. Results for mesh with f = 0.8:

In the above plot, again we can see little to no boundary layer seperation hence the required grading factor (f = 0.8) does not provide much refinement of the mesh at x = 0.085m

iii. Results for mesh with f = 0.4:

The above plot shows better boundary layer seperation than mesh grading factor f = 0.8 hence is more accurate than f = 0.8

iv. Results for mesh (f = 0.2):

The above plot shows a good amount of boundary layer seperation and also provides accurate information of velocity near the top surface. We can observe the boundary layer being formed on the bottom surface due to the viscous shear forces of the incoming fluid stream from the inlet and mixing with the stagnant zone of the exit to the backward step.

CFL Numbers for different mesh grading factors:

The maximum value of the CFL number increases as the grading factor decreases. It is expected because grading factor f decreases with the decreasing distance between two adjacent cells at some parts of the mesh. The mean value of the CFL number almost remains constant throughout. It is not recommended to use a very low value of f because the max CFL number might go beyond 1 and make the solution unstable.

REMARKS:

i. Flow quantities can be accurately predicted at the desired location by grading the mesh suitablly.

ii. The finer the mesh (lower value of f), the more accurately the fluid physics can be visualized.

iii. The value of the Kinematic Viscosity nu = 0.01 m^2s^-1

iv. The start time of the simulation was set at t = 0 s and the end time was set at t = 0.1 s and the time-step used was set at Deltat = 0.0001 s

v. The solver used was icoFOAM, normally used for low Re, incompressible flows.

vi. The boundary conditions for the problem is specified as follows:

(a) Pressure (P): [P = p/rho]

/*--------------------------------*- C++ -*----------------------------------*
=========                 |
\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
\    /   O peration     | Website:  https://openfoam.org
\  /    A nd           | Version:  6
\/     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
{
}

outlet
{
type            fixedValue;
value           uniform 0;
}

noSlipWalls
{
}

frontAndBack
{
type            empty;
}
}

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

(b) Velocity (U):

/*--------------------------------*- C++ -*----------------------------------*
=========                 |
\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
\    /   O peration     | Website:  https://openfoam.org
\  /    A nd           | Version:  6
\/     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
{
}

noSlipWalls
{
type            noSlip;
}

frontAndBack
{
type            empty;
}
}

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

### Pipe flow simulation in OpenFOAM (Part 2/2: Symmetry boundary conditions) Priyotosh Bairagya · 2018-10-08 11:27:26

LAMINAR INCOMPRESSIBLE FLOW SIMULATION THROUGH A PIPE IN OPENFOAM: [PART 2/2]: SYMMETRY BOUNDARY CONDITION: OBJECTIVES:1. Creating the Mesh-Script (blockMeshDict file) with symmetry boundary condition.2. Simulation Results and post processing the velocity profile at Read more

### Pipe flow simulation in OpenFOAM (Part 1/2: Wedge boundary conditions) Priyotosh Bairagya · 2018-10-07 05:05:54

LAMINAR INCOMPRESSIBLE FLOW SIMULATION THROUGH A PIPE IN OPENFOAM: [PART 1/2]: WEDGE BOUNDARY CONDITION: OBJECTIVES:1. Calculation of Pre-eliminary quantinites related to the flow.2. Creating the Mesh script (blockMeshDict file) for specifying the geometry and bounda Read more

### Flux Limiters and Interpolation Schemes in Finite Volume Method Priyotosh Bairagya · 2018-10-05 12:18:40

I. Interpolation Schemes in Finite Volume Method: The approximation of surface and volume integrals may require values of the variable at locations other than the computational nodes of the CV. Values at these locations are obtained using interpolation formulae. Some o Read more

### Analysis of Solution Stability in a 2D Heat conduction problem Priyotosh Bairagya · 2018-09-20 22:56:03

ANALYSIS OF NUMERICAL STABILITY OF VARIOUS ITERATIVE SOLVERS FOR TRANSIENT 2D HEAT CONDUCTION: [Part: 3/3] INTRODUCTION: The criterion of stability of a numerical scheme is determined by the way the errors propagate while the solution moves from one time-step to th Read more

### Analysis of Steady and Unsteady State solutions of a 2D Heat conduction problem Priyotosh Bairagya · 2018-09-16 10:37:07

ANALYSIS OF VARIOUS ITERATIVE SCHEMES FOR THE SOLUTION OF A 2D HEAT CONDUCTION PROBLEM: [PART: 2/3] In the previous part we had explained the problem statement and the MATLAB Program in detail. In this Part we are going to explain the outputs from the 2D Heat Conduct Read more

### Flow simulation of a 1D Super-Sonic nozzle using the Mac-Cormack method Priyotosh Bairagya · 2018-09-02 12:55:50

NUMERICAL SOLUTION OF 1D SUPERSONIC NOZZLE FLOW SIMULATION BY MAC-CORMACK METHOD PROJECT OBJECTIVES: i. Numerical solution of the governing equations in both conservative and non-conservative forms. ii. Creating user defined functions for calculating the flow quan Read more

### Simulation of 2D heat conduction in steady and unsteady forms Priyotosh Bairagya · 2018-08-31 14:34:23

Simulation of a 2D Heat Conduction problem in steady and unsteady/transient forms using iterative methods. Project Objectives: 1. Solving the 2 Dimensional Heat conduction equation in the generalized form using various iterative techniques: i. Explicit Solver (for Read more

### Iterative solution of a system of linear equations and an analysis of spectral radius of a matrix Priyotosh Bairagya · 2018-08-31 10:13:18

UNDERSTANDING LINEAR SYSTEMS(ANALYSIS OF VARIOUS ITERATIVE SCHEMES TO SOLVE A SYSTEM OF LINEAR EQUATIONS TO FIND THE EIGEN VALUES AND SPECTRAL RADIUS) (A) PROBLEM STATEMENT: Given coefficient matrix: A = [[5,1,2],[-3,9,4],[1,2,-7]] Given Solution Matrix: X = [[x Read more

### MATLAB Program to solve the 1D linear wave equation Priyotosh Bairagya · 2018-08-18 22:51:02

WEEK 4: (Effect of Grid-Size on output for the solution of 1D linear wave equation) 1. Problem Setup: Given Partial Differential Equation: (delu)/(delt) + c(delu)/(delx) = 0 Numerical Discretization:  u_(i,n+1) = u_(i,n) + (cDeltat)/(Deltax)*(u_(i-1,n+1) Read more