OpenFOAM/C2/Simulating-flow-in-a-Lid-Driven-Cavity/English

From Script | Spoken-Tutorial
Revision as of 09:29, 4 June 2019 by Nancyvarkey (Talk | contribs)

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

Tutorial: Simulating Flow in a Lid Driven Cavity.


Script and Narration : Rahul Joshi


Keywords: Video tutorial,CFD,Lid Driven Cavity,Ghia et.al.


Visual cue Narration
Slide 1 Hello and welcome to the spoken tutorial on Simulating Flow in a Lid Driven Cavity using openfoam
Slide 2 : Learning Objectives In this tutorial I will show you
  • The Lid Driven Cavity file structure
  • Meshing the geometry
  • Solving and post-processing results in Paraview
  • Plotting and validating results on a spreadsheet.
Slide 3:

System Requirement

To record this tutorial I am using
  • Linux Operating system Ubuntu version 10.04.
  • OpenFOAM version 2.1.0
  • ParaView version 3.12.0
Slide 4: System Requirement

The tutorials were recorded using the versions specified in previous slide.

Subsequently the tutorials were edited to latest versions.

To install latest system requirements go to Installation Sheet.

Slide 4:

About Lid Driven Cavity flow

Lid driven cavity is the most widely used 2D test case for validation of a CFD code.
Slide 5 : Diagram This is diagram of Lid Driven Cavity.
Slide 6: Boundary Conditions The boundary conditions remain the same.


A moving wall and three fixed walls.

We are solving this for Reynolds no (Re) = 100


The moving wall has a velocity of 1 meter per second

Path for lid driven cavity The path for the Lid Driven Cavity is the same as discussed in the installation tutorial.
Open a command terminal Now open a command terminal.
Press ctrl +Alt+t keys simultaneously on keyboard To do this, press Ctrl+Alt+t keys simultaneously on your keyboard.
Path for lid driven cavity in terminal In the command terminal.
Type run and press enter Now type run and press Enter.
Type cd tutorials and press enter cd (space) tutorials and press Enter.
Type cd incompressible and press enter cd (space) incompressible and press Enter.
Type cd icoFoam and press enter cd (space) icoFoam (Note that F here is capital) and press Enter.
Type cd cavity cd (space) cavity and press Enter.
Type ls and press enter Now type lsand press Enter.
Three folders 0, constant and system In the file structure of cavity you will see 3 folders :

0 , constant, and system.

Type cd constant Now type cd (space) constant and press Enter.
Type ls and press enter Now type ls and press Enter.
Constant >> polyMesh The constant folder contains another folder named polymesh.


And the file describing the physical properties of fluid.

Cd polyMesh and press enter Now type cd (space) polymesh and press Enter.


Polymesh contains a file named blockMeshDict.

Type ls Now type ls and press Enter.
You can see the blockMeshDict.
Type gedit blockMeshDict and press enter To open the blockMeshDict file, type gedit blockMeshDict.


(Note that M and D here are capital).


Now press Enter.

This will open up the blockMeshDict file.


Let me drag this to the capture area.

In blockMeshDict file This contains :


coordinates for lid driven cavity

blocking and meshing parameters

and boundary patches.

No patches and arcs in the geometry Since there are arcs as well as no patches to be merged, edges and mergePatchPairs can be kept empty.
Now close this.
Terminal type cd .. and do this twice In the command terminal type : cd (space) (dot) (dot)
You will come back to the cavity folder.
Cd system and press enter Now type cd (space) system and press Enter.
Type ls and press enter Now type ls and press Enter.


This contains three files - controlDict, fvSchemes and fvSolutions.

ControlDict


fvSolution


fvSchemes

controlDict contains control parameters for start/end time.


fvSolution contains discritization schemes used in run time.


fvSchemes contains equation for solvers, tolerance, etc.

Type cd .. and press enter Now again type cd (space) (dot dot) and press Enter.
Cd 0 and press enter Now type cd ( space ) 0 (zero) and press Enter.
Now type ls and press Enter.
Initial values for bounary This contains the initial values for boundary conditions like


Pressure ,Velocity, Temperature, etc.

Type cd .. Type cd ( space ) (dot dot) to return to the cavity folder.
Mesh the geometry Now we need to mesh the geometry.


We are using a course mesh here.

Mesh the geometry by typing blockMesh in the terminal.
In terminal type blockMesh and press enter Now type blockMesh (Note that M here is capital).


And press Enter.

Meshing is done.
If there is some error in the blockMesh file, it will be shown in the terminal.
Type paraFoam and press enter To view the geometry, type paraFoam. Note that F here is capital.


And press Enter.

This will open the ParaView window.
Click on apply button Now on the left hand side of the object inspector menu click on Apply.
You can see the lid driven cavity geometry.


Now close this.

Check the mesh Check the mesh by typing checkMesh in the terminal.


Note that M here is capital.


And press Enter.

After the checkMesh command You can see the the number of cells, skewness and other parameters which are associated with the mesh.
Let me switch back to the slides.
Slide 6: icoFoam The solver we are using here is icoFoam.
icoFoam is a Transient solver for incompressible flow of Newtonian fluids.
Let me switch back to the terminal.
In terminal type icoFoam and press enter In the terminal type icoFoam.


Note that F here is capital.


And press Enter.

Iterations running will be seen in the terminal window.
Type paraFoam and press enter


After the solving is done, type paraFoam in the terminal to view the geometry and the results.
Click on APPLY On the left hand side of object inspector menu, click on Apply.
Scroll down in object inspector menu Now scroll down the properties of objector inspector menu.


You can see mesh parts, volume fields etc.

Check or uncheck these boxes Check or uncheck these boxes in the mesh part to view the different boundary regions of Lid driven cavity.
Change from solid color to capital U


initial condition


I will select capital U

Now after this,
  • on top of the left hand side, on active variable control drop-down menu,
  • change this from solid color to p or capital U
  • which are the initial conditions such as pressure or velocity.


I will select capital U.

Now this will show you the initial condition of velocity.

VCR control on top Now on top of the ParaView window, you can see the VCR control.


Click on the Play button.

Final result of velocity in lid driven cavity Now this is the final result of velocity for lid driven cavity.
Toggle on the color legend Toggle on the color legend by clicking on the top left of the active variable control menu.
This is the color legend for U velocity.
Validation of result We need to validate the results obtained.


To do this, let us plot the U and V velocity.

Menu > filters > data analysis > plot over line For this go to Filters > Data Analysis > Plot Over line
Click on it.
You can see the X , Y and Z axis
Select the X and Y axis


Select the X axis

Select the X & Y axis turn by turn.


I will select the X axis and click Apply.

You can see the Pressure and Velocity plots being plotted.
For non-dimensional analysis Since it is a non dimensional analysis, we need to plot the graph for u/U v/s y/L for Reynolds number =100.
PLot data Line click Y axis and apply To do this in Plot Data, click on the Y-axis.


And click Apply

Plot can be seen


Go to file save data

You can see the plot.


In menu bar go to File > Save Data

Give an appropriate name to your file.
Give a name to the file


save as .csv format

I will give this as cavity.


The file will be saved as dot csv file.

Now click Ok.


Again click Ok.

Go to the cavity folder in icoFoam


cavity.csv file

Now go to the cavity folder of openfoam directory.


Scroll down, you can see the cavity.csv file

Open it in OpenOffice or LibreOffice spreadsheet.
Copy u0 and points 1 and save it another page of spreadsheet In the LibreOffice spreadsheet copy the U0 (u velocity) and to the right point1 column in another spreadsheet.
U/U and y/L Now divide both these columns.


That is u zero by capital U and points 1 by capital L.

PLot the results using chart option

of spreadsheet

Plot the results in LibreOffice Charts option on top of the menu bar.
Now let me switch back to the slides.
Slide 7 : Lid Driven Cavity (OpenFOAM) Results obtained will be similar to this figure.
Slide 8: Ghia et al.(1982) & Fluent Validate the result obtained on Lid Driven Cavity by : Ghia et al. (1982) and results obtained from Fluent.
Slide 9:

Summary

In this tutorial we learnt
  • File structure of Lid Driven cavity
  • Solved lid driven cavity
  • Post-processing of results
  • Validation
Slide 10:

Assignment

As as assignment,

Change some parameters in the lid driven cavity

  • Velocity magnitude in the 0 folder
  • Kinematic viscosity in transportPorpoerties in constant folder

Plot the results of u/U and y/L

Slide 11 :

About Spoken tutorials

The video available at this URL:

http://spoken-tutorial.org/What_is_a_Spoken_Tutorial

It summarizes the Spoken Tutorial project.

If you do not have good bandwidth, you can download and watch it.

Slide 12:

About Spoken tutorials

The Spoken Tutorial Project Team

-Conducts workshops using spoken tutorials

-Gives certificates to those who pass an online test

-For more details, please write to us at contact @spoken-tutorial.org

Slide 13: Forum to answer questions

Do you have questions on THIS Spoken Tutorial? Choose the minute and second where you have the question Explain your question briefly Someone from the FOSSEE team will answer them. Please visit http://forums.spoken-tutorial.org/

Slide 14: Forum to answer questions

Questions not related to the Spoken Tutorial? Do you have general/technical questions on the Software? Please visit the FOSSEE forum http://forums.fossee.in/ Choose the Software and post your question

Slide 15: Lab Migration project

We coordinate migration from commercial CFD software like ANSYS to OpenFOAM We conduct free Workshops and provide solutions to CFD Problem Statements in OpenFOAM For more details visit this site: http://cfd.fossee.in/

Slide 16: Case Study project

We invite students to solve a feasible CFD problem statement of reasonable complexity using OpenFOAM We give honorarium and certificate to those who do this For more details visit this site: http://cfd.fossee.in/

Slide 17:

Acknowledgement

Spoken Tutorial project is a part of Talk to a Teacher project.

It is supported by the National Mission on Education through ICT, MHRD, Government of India.

More information on the same is available at the following URL link http://spoken-tutorial.org/NMEICT-Intro

Slide 18:

About the contributor

This is Rahul Joshi from IIT BOMBAY signing off.

Thanks for joining

Contributors and Content Editors

Chandrika, DeepaVedartham, Nancyvarkey, Rahuljoshi