Difference between revisions of "OpenFOAM-version-7/C2/Simulation-a-2D-Turbulent-Flow-in-a-Channel-using-OpenFOAM/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with "'''Title of the script:''' Simulation of a Turbulent Flow in a 2D Channel using OpenFOAM '''Author:''' Padmini Priyadarshini '''Keywords:''' OpenFOAM, Turbulence, K-Epsilon,...")
 
Line 3: Line 3:
 
'''Author:''' Padmini Priyadarshini
 
'''Author:''' Padmini Priyadarshini
  
'''Keywords:''' OpenFOAM, Turbulence, K-Epsilon, Paraview, Video-Tutorial
+
'''Keywords:''' OpenFOAM, Turbulence, k-epsilon, yplus, expansion ratio, blockMesh, wall function, channel flow, simpleFoam, ParaView, video tutorial
  
  
  
{| border="1"
+
{| border = "1"
 
|-  
 
|-  
 
|| '''Visual Cue'''
 
|| '''Visual Cue'''
Line 20: Line 20:
 
* Set up '''turbulence''' '''parameters'''
 
* Set up '''turbulence''' '''parameters'''
 
* '''Run '''the '''simulation'''
 
* '''Run '''the '''simulation'''
 
 
|-  
 
|-  
 
|| Slide: System Specifications
 
|| Slide: System Specifications
Line 35: Line 34:
 
|| Slide: Prerequisites
 
|| Slide: Prerequisites
 
* If not, please go through the prerequisite '''OpenFOAM '''tutorial on https://spoken-tutorial.org
 
* If not, please go through the prerequisite '''OpenFOAM '''tutorial on https://spoken-tutorial.org
 
 
|| As a prerequisite:
 
|| As a prerequisite:
 
* You should have basic knowledge of '''turbulent flows''' and '''fluid dynamics'''.
 
* You should have basic knowledge of '''turbulent flows''' and '''fluid dynamics'''.
* You should also be familiar with '''simulating '''a''' flow''' through a''' pipe''' in '''OpenFOAM'''.
+
* You should also be familiar with '''simulating a flow through a pipe''' in '''OpenFOAM'''.
 
* If not, please go through the prerequisite '''OpenFOAM''' tutorial on this website
 
* If not, please go through the prerequisite '''OpenFOAM''' tutorial on this website
 
 
|-
 
|-
 
|| Slide: Code Files
 
|| Slide: Code Files
Line 47: Line 44:
 
* Please download and extract them
 
* Please download and extract them
 
* Make a copy and then use them while practising
 
* Make a copy and then use them while practising
 
 
|-
 
|-
 
|| Slide: Solver detail
 
|| Slide: Solver detail
 
|| We will use the '''simpleFoam solver''' to '''simulate''' this problem.
 
|| We will use the '''simpleFoam solver''' to '''simulate''' this problem.
 +
  
 
'''simpleFoam''' is a '''steady-state solver''' for '''incompressible''', '''turbulent flow'''.
 
'''simpleFoam''' is a '''steady-state solver''' for '''incompressible''', '''turbulent flow'''.
Line 56: Line 53:
 
|| Slide: Problem statement
 
|| Slide: Problem statement
 
|| The diagram shows a''' 2D channel '''of '''length''' '''65 m '''and '''width 1 m'''.
 
|| The diagram shows a''' 2D channel '''of '''length''' '''65 m '''and '''width 1 m'''.
 +
  
 
The '''kinematic viscosity''' is '''1e-05 m<sup>2</sup>/s.'''
 
The '''kinematic viscosity''' is '''1e-05 m<sup>2</sup>/s.'''
 +
  
 
The '''Inlet velocity '''is '''20 m/s. '''
 
The '''Inlet velocity '''is '''20 m/s. '''
 +
  
 
'''Outlet pressure '''is set to '''0 atmosphere.'''
 
'''Outlet pressure '''is set to '''0 atmosphere.'''
Line 65: Line 65:
 
|| Slide: Flow Properties
 
|| Slide: Flow Properties
 
|| '''Reynolds number''' is '''2 million'''.
 
|| '''Reynolds number''' is '''2 million'''.
 +
  
 
And the '''flow''' is '''turbulent.'''
 
And the '''flow''' is '''turbulent.'''
Line 70: Line 71:
 
|| Slide: K-Epsilon turbulence model
 
|| Slide: K-Epsilon turbulence model
 
|| '''K-epsilon '''is a widely used '''RAS''' '''turbulence model.'''
 
|| '''K-epsilon '''is a widely used '''RAS''' '''turbulence model.'''
 +
  
 
It is a '''two-equation model'''.
 
It is a '''two-equation model'''.
 +
  
 
It solves:
 
It solves:
 
* The '''turbulent kinetic energy''' '''transport equation''', and
 
* The '''turbulent kinetic energy''' '''transport equation''', and
 
* The '''turbulent dissipation rate transport''' '''equation'''
 
* The '''turbulent dissipation rate transport''' '''equation'''
 
 
|-  
 
|-  
 
|| Only Narration
 
|| Only Narration
Line 96: Line 98:
 
'''cd $FOAM_RUN'''
 
'''cd $FOAM_RUN'''
 
|| Let us''' '''open the '''Run directory'''.
 
|| Let us''' '''open the '''Run directory'''.
 +
  
 
To do so, type the following '''command.'''
 
To do so, type the following '''command.'''
Line 102: Line 105:
  
 
'''cp -r ~/Downloads/kepsilon .'''
 
'''cp -r ~/Downloads/kepsilon .'''
|| and copy the downloaded file into the run directory.
+
|| And copy the downloaded file into the run directory.
 +
 
  
 
To do so, type the following '''command.'''
 
To do so, type the following '''command.'''
Line 108: Line 112:
 
|| Only Narration  
 
|| Only Narration  
 
|| I have downloaded the file into my '''Downloads directory.'''
 
|| I have downloaded the file into my '''Downloads directory.'''
 +
  
 
Please change the '''path''' as per your machine.
 
Please change the '''path''' as per your machine.
Line 118: Line 123:
 
|| Slide: Y plus
 
|| Slide: Y plus
 
|| '''YPlus '''is the '''dimensionless wall distance.'''
 
|| '''YPlus '''is the '''dimensionless wall distance.'''
 +
  
 
For '''wall function''' '''approach,''' '''yplus''' value should be between '''30 '''and '''300.'''
 
For '''wall function''' '''approach,''' '''yplus''' value should be between '''30 '''and '''300.'''
Line 123: Line 129:
 
|| Slide: Wall distance, yp
 
|| Slide: Wall distance, yp
 
|| Let “'''yp'''” be the distance between the '''wall''' and the nearest '''cell centre.'''
 
|| Let “'''yp'''” be the distance between the '''wall''' and the nearest '''cell centre.'''
 +
  
 
For our '''case''', '''yp''' is '''0.00155''' for a '''yplus''' value of '''100.'''
 
For our '''case''', '''yp''' is '''0.00155''' for a '''yplus''' value of '''100.'''
 +
  
 
For '''channel flow, '''the''' skin friction coefficient, Cf''' is given by this formula.
 
For '''channel flow, '''the''' skin friction coefficient, Cf''' is given by this formula.
 
|-
 
|-
|| [Terminal] Type:  
+
|| Only Narration
 +
|| The '''Additional Reading Material''' has more details on the''' wall function approach'''.
 +
 
 +
 
 +
It mentions the steps used to calculate '''yp'''.
 +
|-
 +
|| [Terminal] Type:
 +
 
  
 
'''ls system'''
 
'''ls system'''
|| Type''' '''the following''' command''' view the content of the '''system''' directory.
+
|| Type''' '''the following''' command''' to view the content of the '''system''' directory.
 
|-
 
|-
|| [Terminal]  
+
|| [Terminal] Highlight:
 +
 
  
Highlight '''blockMeshDict'''
+
'''blockMeshDict'''
 
|| This directory contains the '''blockMeshDict''' file.
 
|| This directory contains the '''blockMeshDict''' file.
 
|-
 
|-
Line 147: Line 163:
 
|| Let us take a look at the '''inlet boundary condition '''for '''kappa.'''
 
|| Let us take a look at the '''inlet boundary condition '''for '''kappa.'''
  
We will use '''turbulentIntensityKineticEnergyInlet '''
+
 
 +
We will use '''turbulentIntensityKineticEnergyInlet'''
 +
 
  
 
This calculates''' kappa '''using the user-specified '''turbulence intensity'''.
 
This calculates''' kappa '''using the user-specified '''turbulence intensity'''.
  
For our '''case, turbulent intensity''' is '''0.00261 '''and '''Turbulent kinetic energy''' is '''0.41 m<sup>2</sup>/s<sup>2'''</sup>
+
 
 +
For our '''case, turbulent intensity''' is '''0.0261 '''and '''Turbulent kinetic energy''' is '''0.41 m<sup>2</sup>/s<sup>2'''</sup>
 
|-
 
|-
 
|| Slide: Inlet Boundary Condition - epsilon
 
|| Slide: Inlet Boundary Condition - epsilon
 +
 +
  
 
|| Let us take a look at the '''inlet boundary condition '''for '''epsilon.'''
 
|| Let us take a look at the '''inlet boundary condition '''for '''epsilon.'''
 +
  
 
We will use '''turbulentMixingLengthDissipationRateInlet '''
 
We will use '''turbulentMixingLengthDissipationRateInlet '''
 +
  
 
This calculates '''epsilon''' using '''kappa '''and  
 
This calculates '''epsilon''' using '''kappa '''and  
  
 
user-specified '''mixingLength'''.
 
user-specified '''mixingLength'''.
 +
  
 
'''mixingLength '''refers to the''' turbulent length scale.'''
 
'''mixingLength '''refers to the''' turbulent length scale.'''
 +
  
 
'''Kappa''' value is automatically put in by the '''solver'''.
 
'''Kappa''' value is automatically put in by the '''solver'''.
 +
  
 
Here''', '''the''' turbulent length scale''' is '''0.07 m'''.
 
Here''', '''the''' turbulent length scale''' is '''0.07 m'''.
 +
  
 
And, the value of the '''turbulent dissipation rate''' is '''0.61 m<sup>2</sup>/s<sup>3'''</sup>
 
And, the value of the '''turbulent dissipation rate''' is '''0.61 m<sup>2</sup>/s<sup>3'''</sup>
Line 173: Line 200:
 
|| Slide: Wall Boundary Condition  
 
|| Slide: Wall Boundary Condition  
 
|| Next, let us take a look at the wall '''boundary conditions '''to be''' '''used.  
 
|| Next, let us take a look at the wall '''boundary conditions '''to be''' '''used.  
 +
  
 
* '''turbulent kinetic energy '''is set to '''kqRWallFunction '''
 
* '''turbulent kinetic energy '''is set to '''kqRWallFunction '''
 
+
* '''turbulent dissipation '''is set to '''epsilonWallFunction'''
* '''turbulent dissipation i'''s set to '''epsilonWallFunction'''
+
 
+
 
|-
 
|-
 
|| Slide: Outlet Boundary Condition  
 
|| Slide: Outlet Boundary Condition  
 
|| This slide shows the '''outlet boundary condition.'''
 
|| This slide shows the '''outlet boundary condition.'''
 +
  
 
'''zeroGradient boundary condition''' is imposed at the '''outlet '''for both parameters.
 
'''zeroGradient boundary condition''' is imposed at the '''outlet '''for both parameters.
Line 186: Line 213:
 
|| Slide: Kinematic eddy viscosity, nut
 
|| Slide: Kinematic eddy viscosity, nut
 
|| '''Kinematic eddy viscosity''' is a dependent '''variable'''.
 
|| '''Kinematic eddy viscosity''' is a dependent '''variable'''.
 +
  
 
Hence, its value is calculated by the''' solver'''.
 
Hence, its value is calculated by the''' solver'''.
 +
  
 
At the '''wall, nutWallFunction''' is used.
 
At the '''wall, nutWallFunction''' is used.
 
|-
 
|-
 
|| Only Narration
 
|| Only Narration
|| Let us take a look at the '''boundary''' and '''initial conditions''' for '''turbulent kinetic energy'''.
+
|| The '''Additional Reading Material''' has more details on the boundary conditions.
 +
 
 +
 
 +
Please refer to it.
 +
 
 +
 
 +
Let us take a look at the '''boundary''' and '''initial conditions''' for '''turbulent kinetic energy'''.
 
|-
 
|-
|| [Terminal] Type:  
+
|| [Terminal] Type:
 +
 
  
 
'''gedit 0/k'''
 
'''gedit 0/k'''
 
|| Open the '''k''' file in a '''text editor.'''
 
|| Open the '''k''' file in a '''text editor.'''
 
|-
 
|-
|| [gedit -'''k''']  
+
|| [gedit -'''k'''] Highlight:
  
Highlight '''internalField .. 0.41;'''
+
 
 +
'''internalField uniform 0.41;'''
 
|| The''' internalField''' is initialised as '''0.41'''
 
|| The''' internalField''' is initialised as '''0.41'''
 
|-
 
|-
|| [gedit -'''k''']  
+
|| [gedit -'''k'''] Highlight:''' '''
  
Highlight''' type turbulentIntensityKineticEnergyInlet'''
+
 
 +
'''type turbulentIntensityKineticEnergyInlet'''
 
|| The''' inlet boundary type''' is set to '''turbulentIntensityKineticEnergyInlet'''
 
|| The''' inlet boundary type''' is set to '''turbulentIntensityKineticEnergyInlet'''
 
|-
 
|-
|| [gedit -'''k''']  
+
|| [gedit -'''k'''] Highlight:''' '''
 +
 
  
Highlight''' intensity 0.00261;'''
+
'''intensity 0.0261;'''
|| The '''keyword intensity '''represents the '''turbulent intensity''', and is set to '''0.00261'''
+
|| The keyword''' intensity '''represents the '''turbulent intensity''', and is set to '''0.0261'''
 
|-
 
|-
|| [gedit -'''k''']  
+
|| [gedit -'''k'''] Highlight:''' '''
  
Highlight''' value $internalField;'''
+
 
 +
'''value $internalField;'''
 
|| We have passed the '''internalField''' value to the '''patch field''' value.
 
|| We have passed the '''internalField''' value to the '''patch field''' value.
 
|-
 
|-
|| [gedit -'''k''']  
+
|| [gedit -'''k'''] Highlight:
  
Highlight '''zeroGradient;'''
+
 
 +
'''zeroGradient;'''
 
|| '''outlet''' is set to '''zeroGradient.'''
 
|| '''outlet''' is set to '''zeroGradient.'''
 
|-
 
|-
|| [gedit -'''k''']  
+
|| [gedit -'''k'''] Highlight:
 +
 
  
Highlight '''kqRWallFunction'''
+
'''kqRWallFunction'''
 
|| The '''patch''' type for both walls are set to '''kqRWallFunction'''.
 
|| The '''patch''' type for both walls are set to '''kqRWallFunction'''.
 
|-
 
|-
|| [gedit -'''k''']  
+
|| [gedit -'''k'''] Highlight:
  
Highlight '''value $internalField; '''
+
 
 +
'''value $internalField; '''
 
|| The''' internalField''' value is passed to the '''patch field '''value'''.'''
 
|| The''' internalField''' value is passed to the '''patch field '''value'''.'''
 
|-
 
|-
|| [gedit -'''k''']  
+
|| [gedit -'''k'''] Highlight:''' '''
  
Highlight''' type empty;'''
+
 
 +
'''type empty;'''
 
|| The '''frontAndBack patch '''is set as '''empty.'''
 
|| The '''frontAndBack patch '''is set as '''empty.'''
 
|-
 
|-
|| [gedit - '''k''']  
+
|| [gedit - '''k'''] Close Text Editor
 
+
Close Text Editor
+
 
|| Close the '''k''' file.
 
|| Close the '''k''' file.
 
|-
 
|-
Line 248: Line 290:
 
|-
 
|-
 
|| [Terminal] Type:  
 
|| [Terminal] Type:  
 +
  
 
'''gedit 0/epsilon'''
 
'''gedit 0/epsilon'''
 
|| Open the '''epsilon''' file in a '''text editor.'''
 
|| Open the '''epsilon''' file in a '''text editor.'''
 
|-
 
|-
|| [gedit -'''epsilon''']  
+
|| [gedit -'''epsilon'''] Highlight:
  
Highlight '''0.61'''
+
 
 +
'''0.61'''
 
|| The '''internalField '''value is initialized to '''0.61'''
 
|| The '''internalField '''value is initialized to '''0.61'''
 
|-
 
|-
|| [gedit -'''epsilon''']  
+
|| [gedit -'''epsilon'''] Highlight:
 +
 
  
Highlight '''turbulentMixingLengthDissipationRateInlet'''
+
'''turbulentMixingLengthDissipationRateInlet'''
 
|| The '''inlet''' type is defined as '''turbulentMixingLengthDissipationRateInlet'''
 
|| The '''inlet''' type is defined as '''turbulentMixingLengthDissipationRateInlet'''
 
|-
 
|-
|| [gedit -'''epsilon''']  
+
|| [gedit -'''epsilon'''] Highlight:
  
Highlight '''0.07'''
+
 
 +
'''0.07'''
 
|| The field''' mixingLength''' is set to '''0.07'''
 
|| The field''' mixingLength''' is set to '''0.07'''
 
|-
 
|-
|| [gedit -'''epsilon''']  
+
|| [gedit -'''epsilon'''] Highlight:
  
Highlight '''$internalField'''
+
 
 +
'''$internalField'''
 
|| The '''internalField''' value is passed to the '''patch field '''value'''.'''
 
|| The '''internalField''' value is passed to the '''patch field '''value'''.'''
 
|-
 
|-
|| [gedit -'''epsilon''']  
+
|| [gedit -'''epsilon'''] Highlight:
 +
 
  
Highlight '''zeroGradient.'''
+
'''zeroGradient'''
 
|| The '''outlet patch''' is defined as '''zeroGradient.'''
 
|| The '''outlet patch''' is defined as '''zeroGradient.'''
 
|-
 
|-
|| [gedit -'''epsilon''']  
+
|| [gedit -'''epsilon'''] Highlight:
  
Highlight '''epsilonWallFunction'''.
+
 
 +
'''epsilonWallFunction'''
 
|| The '''wall patch type '''is set to '''epsilonWallFunction.'''
 
|| The '''wall patch type '''is set to '''epsilonWallFunction.'''
 
|-
 
|-
|| [gedit - e'''psilon''']  
+
|| [gedit - e'''psilon'''] Close Text Editor
 
+
Close Text Editor
+
 
|| Close the '''epsilon''' file.
 
|| Close the '''epsilon''' file.
 
|-
 
|-
|| [Terminal] Type:  
+
|| [Terminal] Type:
 +
 
  
 
'''gedit 0/nut'''
 
'''gedit 0/nut'''
 
|| Now, let’s open the '''nut '''file in a '''text editor.'''
 
|| Now, let’s open the '''nut '''file in a '''text editor.'''
 
|-
 
|-
|| [gedit -'''nut''']  
+
|| [gedit -'''nut'''] Highlight:
 +
 
  
Highlight '''calculated'''
+
'''calculated'''
 
|| The '''inlet''' and '''outlet patches''' are set to '''calculated.'''
 
|| The '''inlet''' and '''outlet patches''' are set to '''calculated.'''
 
|-
 
|-
|| [gedit -'''nut''']  
+
|| [gedit -'''nut'''] Highlight:
  
Highlight '''type nutkWallFunction;'''
+
 
 +
'''type nutkWallFunction;'''
 
|| The '''wall patch type '''is set as '''nutkWallFunction'''.
 
|| The '''wall patch type '''is set as '''nutkWallFunction'''.
 
|-
 
|-
|| [gedit - '''nut''']  
+
|| [gedit - '''nut'''] Close Text Editor
 
+
Close Text Editor
+
 
|| Close the '''nut''' file.
 
|| Close the '''nut''' file.
 
|-
 
|-
 
|| [Terminal] Type:  
 
|| [Terminal] Type:  
 +
  
 
'''gedit 0/U'''
 
'''gedit 0/U'''
 
|| Next, open the '''velocity '''file in a '''text editor.'''
 
|| Next, open the '''velocity '''file in a '''text editor.'''
 
|-
 
|-
|| [gedit -'''U''']  
+
|| [gedit -'''U'''] Highlight:''' '''
  
Highlight''' (20 0 0)'''
+
 
 +
'''(20 0 0)'''
 
|| The '''inlet patch''' is given a fixed value of '''20 '''along the axis.
 
|| The '''inlet patch''' is given a fixed value of '''20 '''along the axis.
 
|-
 
|-
|| [gedit -'''U''']  
+
|| [gedit -'''U'''] Highlight:''' '''
  
Highlight''' zeroGradient'''
+
 
 +
'''zeroGradient'''
 
|| The '''outlet patch''' is set to '''zeroGradient.'''
 
|| The '''outlet patch''' is set to '''zeroGradient.'''
 
|-  
 
|-  
|| [gedit -'''U]'''  
+
|| [gedit -'''U]''' Close Text Editor
 
+
Close Text Editor
+
 
|| Close the '''U''' file.
 
|| Close the '''U''' file.
 
|-  
 
|-  
Line 331: Line 380:
 
|-
 
|-
 
|| [Terminal] Type:  
 
|| [Terminal] Type:  
 +
  
 
'''blockMesh'''
 
'''blockMesh'''
Line 336: Line 386:
 
|-
 
|-
 
|| [Terminal] Type:  
 
|| [Terminal] Type:  
 +
  
 
'''simpleFoam'''
 
'''simpleFoam'''
Line 343: Line 394:
 
|| The '''simulation''' will take some time depending on your computer’s '''hardware'''.
 
|| The '''simulation''' will take some time depending on your computer’s '''hardware'''.
 
|-
 
|-
|| [Terminal]  
+
|| [Terminal] Highlight:''' '''
  
Highlight''' “End”'''
+
 
 +
'''End'''
 
|| The word '''End''' indicates that the '''simulatio'''n has finished successfully.
 
|| The word '''End''' indicates that the '''simulatio'''n has finished successfully.
 
|-
 
|-
Line 353: Line 405:
 
|| Only Narration
 
|| Only Narration
 
|| With this we have come to the end of the tutorial.
 
|| With this we have come to the end of the tutorial.
 +
  
 
Let us summarize.
 
Let us summarize.
Line 361: Line 414:
 
* Set up the''' initial '''and '''boundary conditions''' for''' turbulence parameters'''
 
* Set up the''' initial '''and '''boundary conditions''' for''' turbulence parameters'''
 
* '''Run''' the '''simulation'''
 
* '''Run''' the '''simulation'''
 
 
|-
 
|-
 
|| Slide: Assignment
 
|| Slide: Assignment
Line 367: Line 419:
 
* Change the '''inlet boundary condition''' for '''kappa '''and''' epsilon''' to''' fixedValue'''
 
* Change the '''inlet boundary condition''' for '''kappa '''and''' epsilon''' to''' fixedValue'''
 
* Repeat the '''simulation''' for a '''velocity '''value of '''40 m/s''', change '''kappa '''and '''epsilon''' accordingly
 
* Repeat the '''simulation''' for a '''velocity '''value of '''40 m/s''', change '''kappa '''and '''epsilon''' accordingly
 
 
|-
 
|-
 
|| Slide: About the Spoken Tutorial Project
 
|| Slide: About the Spoken Tutorial Project
 
|| The video at the following link summarises the Spoken Tutorial project.
 
|| The video at the following link summarises the Spoken Tutorial project.
 +
  
 
Please download and watch it.
 
Please download and watch it.
Line 376: Line 428:
 
|| Slide: Spoken Tutorial Workshops
 
|| Slide: Spoken Tutorial Workshops
 
|| We conduct workshops using Spoken Tutorials and give certificates.
 
|| We conduct workshops using Spoken Tutorials and give certificates.
 +
  
 
Please contact us.
 
Please contact us.
 
|-
 
|-
 
|| Slide: Spoken Tutorial Forum
 
|| Slide: Spoken Tutorial Forum
||  
+
|| Please post your timed queries in this forum.
* Please post your timed queries in this forum.
+
 
+
 
|-
 
|-
 
|| Slide: FOSSEE Forum
 
|| Slide: FOSSEE Forum
Line 388: Line 439:
 
* Do you have any general/technical questions?
 
* Do you have any general/technical questions?
 
* Please visit the forum given in the link.
 
* Please visit the forum given in the link.
 
 
|-
 
|-
 
|| Slide: FOSSEE Case Study Project
 
|| Slide: FOSSEE Case Study Project
Line 395: Line 445:
 
* We give honorarium and certificates to those who do this.
 
* We give honorarium and certificates to those who do this.
 
* For more details, please visit these sites.
 
* For more details, please visit these sites.
 
 
|-
 
|-
 
|| Slide: Spoken Tutorial  
 
|| Slide: Spoken Tutorial  
 
|| The Spoken Tutorial project is supported by MHRD, Govt. of India.
 
|| The Spoken Tutorial project is supported by MHRD, Govt. of India.
 +
  
 
The script for this tutorial is contributed by Padmini.
 
The script for this tutorial is contributed by Padmini.
 +
  
 
And this is Swetha from IIT Bombay signing off.
 
And this is Swetha from IIT Bombay signing off.
 +
  
 
Thank you for joining.
 
Thank you for joining.
 
|-
 
|-
 
|}
 
|}

Revision as of 17:08, 27 July 2020

Title of the script: Simulation of a Turbulent Flow in a 2D Channel using OpenFOAM

Author: Padmini Priyadarshini

Keywords: OpenFOAM, Turbulence, k-epsilon, yplus, expansion ratio, blockMesh, wall function, channel flow, simpleFoam, ParaView, video tutorial


Visual Cue Narration
Slide: Opening Slide Welcome to this tutorial on Simulation of Turbulent Flow in a 2D Channel using OpenFOAM.
Slide: Learning Objective In this tutorial, we will learn how to:
  • Implement k-epsilon model
  • Set up turbulence parameters
  • 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 turbulent flows and fluid dynamics.
  • You should also be familiar with simulating a flow through a pipe in OpenFOAM.
  • 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 m and width 1 m.


The kinematic viscosity is 1e-05 m2/s.


The Inlet velocity is 20 m/s.


Outlet pressure is set to 0 atmosphere.

Slide: Flow Properties Reynolds number is 2 million.


And the flow is turbulent.

Slide: K-Epsilon turbulence model K-epsilon is a widely used RAS turbulence model.


It is a two-equation model.


It solves:

  • The turbulent kinetic energy transport equation, and
  • The turbulent dissipation rate transport equation
Only Narration Let us set up the case.
Only Narration Download the kepsilon folder provided in the Code file and extract it.
CTRL + ALT + T Open the terminal by pressing Ctrl, Alt & T keys.
[Terminal]

Only Narration

From now onwards please remember to press the Enter key after typing each command in the Terminal.
[Terminal] Type:

cd $FOAM_RUN

Let us open the Run directory.


To do so, type the following command.

[Terminal] Type:

cp -r ~/Downloads/kepsilon .

And copy the downloaded file into the run directory.


To do so, type the following command.

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


Please change the path as per your machine.

[Terminal] Type:

cd kepsilon

With this command, we will navigate to the kepsilon directory.
Slide: Y plus YPlus is the dimensionless wall distance.


For wall function approach, yplus value should be between 30 and 300.

Slide: Wall distance, yp Let “yp” be the distance between the wall and the nearest cell centre.


For our case, yp is 0.00155 for a yplus value of 100.


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

Only Narration The Additional Reading Material has more details on the wall function approach.


It mentions the steps used to calculate yp.

[Terminal] Type:


ls system

Type the following command to view the content of the system directory.
[Terminal] Highlight:


blockMeshDict

This directory contains the blockMeshDict file.
Only Narration I have already set up the blockMesh file for a 2D multi-block channel with this yp value.
Only Narration Let us take a look at the initial and boundary conditions of the flow variables.
Slide: Inlet Boundary Condition - k Let us take a look at the inlet boundary condition for kappa.


We will use turbulentIntensityKineticEnergyInlet


This calculates kappa using the user-specified turbulence intensity.


For our case, turbulent intensity is 0.0261 and Turbulent kinetic energy is 0.41 m2/s2

Slide: Inlet Boundary Condition - epsilon


Let us take a look at the inlet boundary condition for epsilon.


We will use turbulentMixingLengthDissipationRateInlet


This calculates epsilon using kappa and

user-specified mixingLength.


mixingLength refers to the turbulent length scale.


Kappa value is automatically put in by the solver.


Here, the turbulent length scale is 0.07 m.


And, the value of the turbulent dissipation rate is 0.61 m2/s3

Slide: Wall Boundary Condition Next, let us take a look at the wall boundary conditions to be used.


  • turbulent kinetic energy is set to kqRWallFunction
  • turbulent dissipation is set to epsilonWallFunction
Slide: Outlet Boundary Condition This slide shows the outlet boundary condition.


zeroGradient boundary condition is imposed at the outlet for both parameters.

Slide: Kinematic eddy viscosity, nut Kinematic eddy viscosity is a dependent variable.


Hence, its value is calculated by the solver.


At the wall, nutWallFunction is used.

Only Narration The Additional Reading Material has more details on the boundary conditions.


Please refer to it.


Let us take a look at the boundary and initial conditions for turbulent kinetic energy.

[Terminal] Type:


gedit 0/k

Open the k file in a text editor.
[gedit -k] Highlight:


internalField uniform 0.41;

The internalField is initialised as 0.41
[gedit -k] Highlight:


type turbulentIntensityKineticEnergyInlet

The inlet boundary type is set to turbulentIntensityKineticEnergyInlet
[gedit -k] Highlight:


intensity 0.0261;

The keyword intensity represents the turbulent intensity, and is set to 0.0261
[gedit -k] Highlight:


value $internalField;

We have passed the internalField value to the patch field value.
[gedit -k] Highlight:


zeroGradient;

outlet is set to zeroGradient.
[gedit -k] Highlight:


kqRWallFunction

The patch type for both walls are set to kqRWallFunction.
[gedit -k] Highlight:


value $internalField;

The internalField value is passed to the patch field value.
[gedit -k] Highlight:


type empty;

The frontAndBack patch is set as empty.
[gedit - k] Close Text Editor Close the k file.
Only Narration Let’s take a look at the epsilon file.
[Terminal] Type:


gedit 0/epsilon

Open the epsilon file in a text editor.
[gedit -epsilon] Highlight:


0.61

The internalField value is initialized to 0.61
[gedit -epsilon] Highlight:


turbulentMixingLengthDissipationRateInlet

The inlet type is defined as turbulentMixingLengthDissipationRateInlet
[gedit -epsilon] Highlight:


0.07

The field mixingLength is set to 0.07
[gedit -epsilon] Highlight:


$internalField

The internalField value is passed to the patch field value.
[gedit -epsilon] Highlight:


zeroGradient

The outlet patch is defined as zeroGradient.
[gedit -epsilon] Highlight:


epsilonWallFunction

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


gedit 0/nut

Now, let’s open the nut file in a text editor.
[gedit -nut] Highlight:


calculated

The inlet and outlet patches are set to calculated.
[gedit -nut] Highlight:


type nutkWallFunction;

The wall patch type is set as nutkWallFunction.
[gedit - nut] Close Text Editor Close the nut file.
[Terminal] Type:


gedit 0/U

Next, open the velocity file in a text editor.
[gedit -U] Highlight:


(20 0 0)

The inlet patch is given a fixed value of 20 along the axis.
[gedit -U] Highlight:


zeroGradient

The outlet patch is set to zeroGradient.
[gedit -U] Close Text Editor Close the U file.
Only Narration The case is ready to be run.
[Terminal] Type:


blockMesh

Type blockMesh to mesh the geometry.
[Terminal] Type:


simpleFoam

Type simpleFoam in the terminal.
Only Narration The simulation will take some time depending on your computer’s hardware.
[Terminal] Highlight:


End

The word End indicates that the simulation has finished successfully.
Slide: Outlet Velocity Profile The slide shows the velocity profile at the channel exit.
Only Narration With this we have come to the end of the tutorial.


Let us summarize.

Slide: Summary In this tutorial, we learnt to,
  • Implement k-epsilon turbulence model
  • Set up the initial and boundary conditions for turbulence parameters
  • Run the simulation
Slide: Assignment As an assignment:
  • Change the inlet boundary condition for kappa and epsilon to fixedValue
  • Repeat the simulation for a velocity value of 40 m/s, change kappa and epsilon accordingly
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 from IIT Bombay signing off.


Thank you for joining.

Contributors and Content Editors

Ashleymelvin, Divyesh7, Nancyvarkey