OpenFOAM-version-7/C2/Turbulence-Modelling-in-OpenFOAM/English

From Script | Spoken-Tutorial
Revision as of 13:09, 17 September 2020 by Nancyvarkey (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Title of the script: Turbulence Modelling in OpenFOAM

Author: Padmini Priyadarshini

Keywords: OpenFOAM, Turbulence, YPlus, K-Omega, K-OmegaSST, Paraview, Video-Tutorial


Visual Cue Narration
Slide: Opening Slide Welcome to this tutorial on Turbulence Modelling in OpenFOAM.
Slide: Learning Objective In this tutorial, we will learn how to,
  • Set up the blockMeshDict dictionary for a given YPlus value
  • Implement k-omega and k-omega SST turbulence models
  • Run the simulation
Slide: System Specifications To record this tutorial, I am using,
  • Linux Mint OS version 18.3
  • OpenFOAM version 7
  • ParaView version 5.6.0
  • gedit Text Editor

However, you may use any other text editor of your choice.

The steps explained in this tutorial are identical in Ubuntu Linux OS.

Slide: Prerequisites As a prerequisite:
  • You should have basic knowledge of geometric progression
  • You should be familiar with simulating a turbulent flow through a channel and
  • You should also be familiar with Multi-block Meshing of 2D geometry
  • If not, please go through the prerequisite OpenFOAM tutorial on this website
Slide: Code Files
  • The files used in this tutorial are available in the Code Files link on this tutorial page
  • Please download and extract them
  • Make a copy and then use them while practising
Slide: Solver detail We will use the simpleFoam solver to simulate this problem.

simpleFoam is a steady-state solver for incompressible, turbulent flow.

Slide: Problem statement The diagram shows a 2D channel of length 65 metres and width 1 metre.

The kinematic viscosity is 1e to the power of minus 5 metres per second.

The Inlet velocity is 20 metres per second.

Outlet pressure is set to zero atmosphere.

Slide: Flow Properties Reynolds number is 2 million.


The flow is turbulent.

Only Narration First, We will use k-epsilon turbulence model to simulate this case.

Let us set up the case.

Only Narration Download the kepsilon folder provided in the Code files link and extract it.
CTRL + ALT + T Open the terminal by pressing Ctrl, Alt & T keys.
Only Narration Here onwards, please remember to press the Enter key after typing each command in the terminal.
[Terminal] Type: cd $FOAM_RUN Open the Run directory by typing this command.
[Terminal]

Type: cp -r ~/Downloads/kepsilon .

Copy the downloaded file into the RUN directory.

To do that, type the following command.

Only Narration I have downloaded the file into the Downloads directory.

Please change the command according to the file path on your machine.

[Terminal] Type: cd kepsilon Navigate to the kepsilon directory.
[Terminal] Type:

gedit system/blockMeshDict

Open the blockMeshDict file in a text editor.
[gedit -blockMeshDict]

Highlight blocks

Scroll down to the keyword “blocks”.
[gedit -blockMeshDict]

Highlight hex .... (1 0.18 1);

The domain has two equal-sized blocks.
[gedit -blockMeshDict]

Highlight 75 30

For each block, the cell number is set to 75 in the x-direction, and 30 in the y-direction.
Slide: Wall distance, yp Let “yp” be the distance between the wall and the nearest cell centre.

For our case, yp is 0.0031 for YPlus value of 200.

For channel flow, the skin friction coefficient, Cf, is given by this formula.

Slide: Cell width The width of the cell near the wall is 0.0062.
Slide: Expansion ratio The expansion ratio is the ratio of the last cell width to the first cell width.
Slide: Expansion ratio calculation It is calculated using geometric progression formula.

Please refer to the Additional Reading Material for more details.

Slide: Expansion ratio value The expansion ratio in the +y direction is found to be
  • 5.57 for block 1, and
  • 0.18 for block 2
  • for a block of width of 0.5 m and cell number 30.


Please refer to the Additional Reading Material on this tutorial page for details.

Only Narration I have already put these values into the blockMeshDict file.
[gedit -blockMeshDict]

Highlight simpleGrading

simpleGrading describes the uniform expansion ratio in x, y, and z-directions.
Only Narration For our case, the expansion ratio in the y-direction is
[gedit -blockMeshDict]

Highlight 5.57

5.57 for block 1
[gedit -blockMeshDict]

Highlight 0.18

0.18 for block 2
[gedit - blockMeshDict] Close Text Editor Close the blockMeshDict file.
Only Narration The case is now ready to be run.
[Terminal] Type: blockMesh On the terminal, type blockMesh to mesh the geometry.
[Terminal] Type:

simpleFoam

Then type simpleFoam in the terminal to run the simulation.
Only Narration The simulation will take some time depending on your computer’s hardware.
[Terminal] Highlight End The simulation is complete.
Only Narration Let's check the final value of YPlus.
[Terminal] Type:

simpleFoam -postProcess -func "yPlus" -latestTime

Now type the following command on the terminal to get the YPlus value on the walls.
[Terminal]

Highlight Patch to 214.786

We can see that the YPlus value stays below 300.
[Terminal] Type: cd .. Let us go back to the RUN directory using the cd command.
Only Narration Let us simulate the same problem using the k-omega turbulence model now.
Slide: K-Omega turbulence model k-omega is a two-equation model.

It solves-

  • The turbulent kinetic energy transport equation, and
  • The specific turbulent dissipation rate transport equation
Slide: Inlet Boundary Condition - omega Let's look at the boundary and initial conditions for omega.

We will use turbulentMixingLengthFrequencyInlet

It calculates omega using kappa and user-specified mixing length.

Mixing length refers to the turbulent length scale.

Kappa value is automatically put in by the solver.

Here, the value of turbulent length scale is 0.07 metres

The specific turbulent dissipation rate value is 16.67 second inverse

Where empirical constant, cmu is equal to 0.09

Slide: Wall & Outlet Boundary Condition - omega Wall boundary condition is set to omegaWallFunction.

zeroGradient boundary condition is imposed at the outlet.

Please refer to the Additional Reading Material on this tutorial page for details.

Only Narration Download the komega folder provided in the Code files link and extract it.
[Terminal] Type:

cp -r ~/Downloads/komega .

Copy the downloaded file into RUN directory.

To do that, type the following command in the terminal.

[Terminal] Type:

cd komega

Navigate to the komega directory using the cd command.
Only Narration Let’s take a look at the specific turbulent dissipation rate file.
[Terminal] Type: gedit 0/omega Open the omega file in a text editor.
[gedit -omega]

Highlight internalField ... 16.67;

The internalField value is initialised as 16.67
[gedit -omega]

Highlight type turbulentMixingLengthFrequencyInlet

The inlet boundary type is set to turbulentMixingLengthFrequencyInlet
[gedit -omega]

Highlight mixingLength 0.07;

The keyword mixingLength represents the Turbulent length scale, and is set to 0.07
[gedit -omega]

Highlight value $internalField;

We have passed the internalField value to the patch field value.
[gedit -omega] Highlight zeroGradient The outlet patch type is set to zeroGradient.
[gedit -omega]

Highlight omegaWallFunction

The wall patch type is set to omegaWallFunction.
[gedit -omega] Close Text Editor Close the omega file.
[Terminal] Type:

gedit constant/turbulenceProperties

Open the turbulenceProperties file in a text editor.
[gedit -turbulenceProperties]

Highlight kOmega

kOmega is selected as the RASModel.

Note, O is capitalized here.

[gedit -turbulenceProperties]

Highlight on

Ensure the keyword turbulence is set to On.
[gedit -turbulenceProperties]

Close Text Editor

Close the turbulenceProperties file.
Only Narration The case is now ready to be run.
[Terminal] Type: blockMesh On the terminal, type blockMesh to mesh the geometry.
[Terminal] Type: simpleFoam Now, type the following command to run the case.
[Terminal] Highlight End The simulation is over.
[Terminal] Type: cd .. Let us go back to the RUN directory using the cd command.
Only Narration Now, let’s run the same case with the k-omegaSST turbulence model.
Slide: K-omegaSST turbulence model The K-omega SST turbulence model is a hybrid model.

In the near-wall region, K-omegaSST uses the K-omega turbulence model.

In the region away from the wall, it switches to the K-epsilon turbulence model.

Please refer to the Additional Reading Material on this tutorial page for details.

Only Narration Download the komegasst folder provided in the Code files link and extract it.
[Terminal] Type:

cp -r ~/Downloads/komegasst .

Copy the downloaded file into the RUN directory.

To do that, type the following command in the terminal.

[Terminal] Type: cd komegasst Navigate to the komegasst directory using the cd command.
Only Narration komega and komegasst models use the same turbulence variables.

Hence, the files in the zero directory are the same.

[Terminal] Type:

gedit constant/turbulenceProperties

Open the turbulence properties file in a text editor.
[gedit -turbulenceProperties]

Highlight kOmegaSST

RASModel field entry is set to kOmegaSST.

Note, O and SST are capitalized here.

[gedit -turbulenceProperties]

Close Text Editor

Close the turbulenceProperties file.
[Terminal] Type:

gedit system/fvSchemes

Open fvSchemes dictionary in a text editor.
Only Narration Scroll down to the end of the document.
[gedit -fvSchemes]

Highlight wallDist ... ;}

wallDist sub-dictionary is included in the fvSchemes dictionary.
Only Narration This enables the calculation of the distance between the cell centre and the nearest wall.
[gedit -fvSchemes] Close Text Editor Close the fvSchemes file.
Only Narration The setup is now ready.

Let us run the simulation.

[Terminal] Type: blockMesh Mesh the geometry using the blockMesh command on the terminal.
[Terminal] Type: simpleFoam Type simpleFoam in the terminal.
[Terminal] Highlight End The simulation is finished successfully.
Show slide

Exit velocity profile - comparison

The slide shows the exit velocity profile for all three turbulence models
Only Narration With this, we have come to the end of the tutorial.

Let’s summarize.

Slide: Summary In this tutorial, we have learnt to,
  • Set up the blockMeshDict file for a given YPlus value
  • Implement k-omega and k-omega SST turbulence models
  • Run the simulation
Slide: Assignment As an assignment:
  • Repeat the simulation for a YPlus value of 250 using k-epsilon model
  • Repeat the simulation for a velocity of 40 metres per second using k-omega and k-omega SST model
Slide: About the Spoken Tutorial Project The video at the following link summarises the Spoken Tutorial project.

Please download and watch it.

Slide: Spoken Tutorial Workshops We conduct workshops using Spoken Tutorials and give certificates.

Please contact us.

Slide: Spoken Tutorial Forum Please post your timed queries in this forum.
Slide: FOSSEE Forum
  • Do you have any general/technical questions?
  • Please visit the forum given in the link.
Slide: FOSSEE Case Study Project
  • The FOSSEE team coordinates solving feasible CFD problems of reasonable complexity using OpenFOAM.
  • We give honorarium and certificates to those who do this.
  • For more details, please visit these sites.
Slide: Spoken Tutorial The Spoken Tutorial project is supported by MHRD, Govt. of India.

The script for this tutorial is contributed by Padmini.

And this is Swetha Sridhar from IIT Bombay signing off. Thanks for joining.

Contributors and Content Editors

Divyesh7, Nancyvarkey