Challenge

Week 8 - Simulation of a backward facing step in OpenFOAM

AIM: -

In this challenge, you are going to simulate an incompressible-laminar-viscous flow through the backward facing step geometry. You should perform a transient simulation. The solver can be chosen based on the described physics of the flow. You need to explain the entire simulation procedure (how you set up the case). You should also provide explanations to every change you make inside the reference case files obtained from Open FOAM tutorials. You can choose the inlet velocity such that the flow is laminar.

After that, you will perform 2 case studies as described below and compare the results.

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 (including the step wall).

You can use the following mesh parameters but you can feel free to modify these values.

Mesh specification

  1. Number of cells along the x direction (longer dimension) = 200
  2. Number of cells along the longer y direction = 20;

Boundary condition specification

The domain specifications are provided in the following figure.

Desired output

  • Measure the velocity profile at 0.085 m from the inlet of the geometry for both case studies and compare. You can use the plot over line tool for this.
  • Explain why Grading/Growth factor is essential for meshing. 

PROCEDURE: -

<!-- [if !supportLists]-->·         <!--[endif]-->To start simulation process, first start the terminal in Linux operating system using CTRL + ALT + T.

<!-- [if !supportLists]-->·         <!--[endif]-->We have to simulate our problem in OpenFOAM and solve the problem using tutorials in open FOAM.

<!-- [if !supportLists]-->·         <!--[endif]-->Type ‘tut’ to open OpenFOAM tutorial directory and type ‘ls’ to identify tutorials present inside this directory.

<!-- [if !supportLists]-->·         <!--[endif]-->Type ‘legacy’ to solve the incompressible flow simulation to explore the folder.

<!-- [if !supportLists]-->·         <!--[endif]-->Type ’cd incompressible’ to explore folder.

<!-- [if !supportLists]-->·         <!--[endif]-->We need to explore icoFoam folder, Type ‘cd icoFoam’ and ‘ls’ to explore this folder in terminal.

<!-- [if !supportLists]-->·         <!--[endif]-->We going to see cavity folder and copy to cavity folder using ‘cp-r cavity’ command and paste it in OpenFoam.

<!-- [if !supportLists]-->·         <!--[endif]-->We can make any changes to the cavity_test file, which will never affect the openFoam official files. Open cavity_test folder. Here, we can provide specification for our block mesh in system folder.

<!-- [if !supportLists]-->·         <!--[endif]-->There are 4 script file system folder and by opening blockMeshDict we can create domain and provide required specification for block mesh. So, open this file by typing ‘gedit blockMeshDict’.

<!-- [if !supportLists]-->·         <!--[endif]-->The blockMeshDict file is a script file that contains information regarding all aspects of the geometry.

When we open this file, first, we are going to see header information in the form of comment which is not executable.

Then, we will see file identifier by which openFoam reads to understand type of file its reading in this case it is ‘blockMeshDict’. it contains information in the dictionary format, means, key and the value format.

<!-- [if !supportLists]-->·         <!--[endif]-->Set units in meters, by converting all type of length in to meter.

<!-- [if !supportLists]-->o    <!--[endif]-->Convert To Meters 0.1

In the same blockMesh file go to the lines where we the word hex can be found. That is the line where we specify the faces of the blocks and also the number of cells in X, Y and Z direction.

Also, we specify the faces as the inlet, outlet and walls as shown in the picture below

The next step is to navigate to the controlDict folder and specify the simulation time as 200 seconds.The script file looks as follows.

Define the initial value for velocity and pressure. We have to go back in cavity_copy directory using ‘cd ..’ command and select folder ‘0’.

Initial setting for Velocity:

Initial setting for Pressure:

At this point, our problem statement is set, we can now proceed to deploy mesh using ‘blockMesh’ command and then use ‘checkMesh’ command to check if there any error in our mesh.

block mesh:

Check mesh:

After, checking mesh we get following confirmation

At this stage, we can check our mesh is as per requirement or not by using paraView typing paraFoam command.

Once paraview opened uncheck the all fields and click apply

Take a look at above mesh. One can notice it is not uniform all over the surface. So let us just adjust the mesh grid following way.

After making above changes, now the mesh is uniformly distributed along the surface.

After deploying mesh, now we are ready to run the simulation. Simulation that we selected was icoFoam. Hence, just type ‘icoFoam’ and simulation will start.

Mesh grid: -

Velocity Distribution along the domain area: -

Pressure Distribution along the domain area: -

To Calculate velocity at distance 0.085 from inlet modify following parameters.

Velocity Plot: -

With Grading Factor 0.2 (cell near fixed walls)

Now, let’s solve same problem for grading factor 0.2

Output mesh from above codes: -

Velocity Distribution along the domain area: -

Pressure Distribution along the domain area: -

Velocity Plot: -

With Grading Factor 0.2 (cell near All walls)

Next, use grading factor 0.2 for all walls in the system.

 

Output mesh from above codes: -

Velocity Distribution along the domain area: -

Pressure Distribution along the domain area: -

Velocity Plot: -

Results

we have done plotting velocity plot for both, without grading factor and with 0.2 grading factor, cases.

If we take a look at all the three-line graph, we can see, the plot for velocity without grading factor seems smoother and more accurate than other two plot.

So, one can say, grading can disrupt out result. But it is incorrect. Because, if we take good look at it, we can notice, the mesh is fine at step wall along the X-axis but very coarse along Y-axis.

Therefore, we are not getting smooth plot for velocity at 0.085 point at Y-axis.

To understand this thing clearly, we can see below figure, where we can see- on the left side there is coarse mesh and on the right-side fine mesh.

Above picture, their respective graphs are presented, which can really convince anyone how at any given point mesh produce a plot.

The one on the right-side mesh is giving very smooth plot except one small pick near point 0.01 and on the other hand, for coarse structured mesh, the curve of graph the curve is not smooth, there are sharp corner forming at the top of the curve.

After learning how mesh actually works, we should use fine mesh near the point where we expect our results.

In CFD fluid always shows large changes near walls and obstacles along its way and to capture those changes effectively we should always use grading or finer mesh near a wall.

To get effective and reliable results, one should know where to use finer grading factor.

In a bid to obtain more effective results, suppose, if we use large number of fine elements, it could use our computation time and also require large computational memory (RAM).

Therefore, use of grading is important, so that, we can use fine mesh to capture the flow at boundary wall and obstacles, course mesh at more open area.

We can also see importance of fine mesh by observing following picture. As grading factor increasing near step, the resolution of image in improving. Means, as the number of elements is increasing, the flow result is also increasing.

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.