Difference between revisions of "OpenFOAM-version-7/C2/Grid-Resolution-and-Convergence-in-OpenFOAM/English"
Ashleymelvin (Talk | contribs) (Created page with "'''Title of the script''': Grid Resolution and Convergence in OpenFOAM '''Author''': Ashley Melvin '''Keywords''': OpenFOAM, ParaView, blockMesh, meshing, mesh refinement, c...") |
Nancyvarkey (Talk | contribs) |
||
Line 17: | Line 17: | ||
|| Slide: Learning Objectives | || Slide: Learning Objectives | ||
|| In this tutorial, we will learn to: | || In this tutorial, we will learn to: | ||
− | * | + | * Refine a '''mesh''' using '''blockMeshDict''' |
* Change the '''time step''' to achieve '''numerical stability''', and | * Change the '''time step''' to achieve '''numerical stability''', and | ||
− | * Perform a '''grid independence | + | * Perform a '''grid independence study''' |
|- | |- | ||
|| Slide: System Specifications | || Slide: System Specifications | ||
Line 32: | Line 32: | ||
|| Slide: Prerequisites | || Slide: Prerequisites | ||
|| As a prerequisite: | || As a prerequisite: | ||
− | * You should be familiar with | + | * You should be familiar with setting up a '''case''' and creating a '''mesh''' in '''OpenFOAM'''. |
− | * You should also be familiar with ''' | + | * You should also be familiar with basic '''post-processing''' using '''ParaView'''. |
* If not, please go through the prerequisite '''OpenFOAM '''tutorials on this website. | * If not, please go through the prerequisite '''OpenFOAM '''tutorials on this website. | ||
|- | |- | ||
Line 43: | Line 43: | ||
|- | |- | ||
|| CTRL + ALT + T | || CTRL + ALT + T | ||
− | || Open the '''terminal''' by pressing '''Ctrl | + | || Open the '''terminal''' by pressing '''Ctrl, Alt''' & '''T''' keys. |
|- | |- | ||
| | Only Narration | | | Only Narration | ||
Line 52: | Line 52: | ||
Type: '''cd $FOAM_RUN''' | Type: '''cd $FOAM_RUN''' | ||
− | || Type the following '''command''' to move into the ''' | + | || Type the following '''command''' to move into the '''RUN directory'''. |
|- | |- | ||
|| [Terminal] Type: | || [Terminal] Type: | ||
Line 58: | Line 58: | ||
'''cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity .''' | '''cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity .''' | ||
− | || Let us copy the '''Lid driven cavity case''' from the ''' | + | || Let us copy the '''Lid driven cavity case''' from the '''TUTORIALS directory''' into the '''RUN directory'''. |
Line 67: | Line 67: | ||
Type: '''cd cavity''' | Type: '''cd cavity''' | ||
− | || Now let us go into the ''' | + | || Now let us go into the '''Lid Driven Cavity case''' folder using the '''cd command'''. |
|- | |- | ||
|| [Terminal] | || [Terminal] | ||
Line 79: | Line 79: | ||
Highlight '''(20 20 1)''' | Highlight '''(20 20 1)''' | ||
− | || This is a '''2 dimensional mesh''' having ''' | + | || This is a '''2 dimensional mesh''' having 20 '''cells''' along both '''x''' and '''y directions'''. |
|- | |- | ||
|| [gedit - '''blockMeshDict'''] | || [gedit - '''blockMeshDict'''] | ||
Line 97: | Line 97: | ||
'''deltaT''' | '''deltaT''' | ||
− | || The '''time step''' for the '''simulation''' is specified using the '''keyword | + | || The '''time step''' for the '''simulation''' is specified using the '''keyword delta T'''. |
Line 103: | Line 103: | ||
− | The '''Courant number''' is required to be less than | + | The '''Courant number''' is required to be less than 1 to achieve this. |
Line 115: | Line 115: | ||
Highlight: '''0.005 ''' | Highlight: '''0.005 ''' | ||
− | || We have calculated the '''time step''' for this '''simulation''' to be '''0.005 | + | || We have calculated the '''time step''' for this '''simulation''' to be '''0.005 seconds'''. |
− | So, this will be the value of ''' | + | So, this will be the value of '''delta T'''. |
|- | |- | ||
|| [gedit - '''controlDict'''] Close Text Editor | || [gedit - '''controlDict'''] Close Text Editor | ||
Line 127: | Line 127: | ||
'''blockMesh''' | '''blockMesh''' | ||
− | || Let us '''mesh''' the | + | || Let us '''mesh''' the geometry now using the '''blockMesh command''' on the '''terminal.''' |
|- | |- | ||
|| [Terminal] Type: | || [Terminal] Type: | ||
Line 153: | Line 153: | ||
Click on '''Apply''' | Click on '''Apply''' | ||
− | || Click on the '''Apply''' button in the '''Properties''' tab to view the | + | || Click on the '''Apply''' button in the '''Properties''' tab to view the geometry. |
|- | |- | ||
|| [ParaView] '''Active Variable Controls''' | || [ParaView] '''Active Variable Controls''' | ||
Line 185: | Line 185: | ||
|| | || | ||
* '''Probe Location filter''' shows the details of the points within an arbitrary '''sphere'''. | * '''Probe Location filter''' shows the details of the points within an arbitrary '''sphere'''. | ||
− | * By default, this '''sphere''' is centered at the '''center '''of the''' domain''' and has ''' | + | * By default, this '''sphere''' is centered at the '''center '''of the''' domain''' and has '''zero''' radius. |
* Changing these parameters will change the '''probe location''' or the '''range''' of the '''probe'''. | * Changing these parameters will change the '''probe location''' or the '''range''' of the '''probe'''. | ||
|- | |- | ||
Line 210: | Line 210: | ||
|- | |- | ||
|| Only Narration | || Only Narration | ||
− | || Now, let us increase the '''number of cells''' in the '''x''' and '''y direction''' to ''' | + | || Now, let us increase the '''number of cells''' in the '''x''' and '''y direction''' to 40 '''cells'''. |
|- | |- | ||
|| Slide: Mesh Refinement | || Slide: Mesh Refinement | ||
|| | || | ||
− | * This process of dividing the existing cells is called '''mesh refinement'''. | + | * This process of dividing the existing '''cells''' is called '''mesh refinement'''. |
* '''Mesh refinement''' changes a '''coarse mesh''' into a '''finer mesh'''. | * '''Mesh refinement''' changes a '''coarse mesh''' into a '''finer mesh'''. | ||
|- | |- | ||
Line 227: | Line 227: | ||
'''40 40''' | '''40 40''' | ||
− | || Change the ''' | + | || Change the number of '''cells''' in '''x''' and '''y direction''' as shown. |
|- | |- | ||
|| [gedit - '''blockMeshDict'''] | || [gedit - '''blockMeshDict'''] | ||
Line 236: | Line 236: | ||
|- | |- | ||
|| Only Narration | || Only Narration | ||
− | || Since we have changed the number of cells, we need to update the '''time step'''. | + | || Since we have changed the number of '''cells''', we need to update the '''time step'''. |
− | This is to ensure that the '''Courant number''' is less than | + | This is to ensure that the '''Courant number''' is less than 1. |
|- | |- | ||
|| [Terminal] Type: | || [Terminal] Type: | ||
Line 251: | Line 251: | ||
Highlight: '''0.0025''' | Highlight: '''0.0025''' | ||
− | || For the refined '''mesh''', the calculated '''time-step''' is '''0.0025 | + | || For the refined '''mesh''', the calculated '''time-step''' is '''0.0025 seconds'''. |
− | Update ''' | + | Update '''delta T''' as shown. |
|- | |- | ||
|| [gedit - '''controlDict'''] | || [gedit - '''controlDict'''] | ||
Line 266: | Line 266: | ||
Type: '''blockMesh''' | Type: '''blockMesh''' | ||
− | || Since we have changed the '''meshing parameters''', we need to '''mesh''' the | + | || Since we have changed the '''meshing parameters''', we need to '''mesh''' the geometry again. |
Line 295: | Line 295: | ||
'''icoFoam''' | '''icoFoam''' | ||
− | || Let’s run the '''icoFoam solver'''. | + | || Let’s '''run''' the '''icoFoam solver'''. |
|- | |- | ||
|| [Terminal] Type: | || [Terminal] Type: | ||
Line 322: | Line 322: | ||
|- | |- | ||
|| Only Narration | || Only Narration | ||
− | || Similarly, we can find the pressure at the '''centre''' for more number of cells. | + | || Similarly, we can find the pressure at the '''centre''' for more number of '''cells'''. |
Line 328: | Line 328: | ||
|- | |- | ||
|| Slide: Pressure at the Centre | || Slide: Pressure at the Centre | ||
− | || The following table shows the '''pressure values''' for various ''' | + | || The following table shows the '''pressure values''' for various numbers of '''cells'''. |
|- | |- | ||
|| Slide: Pressure at the Centre | || Slide: Pressure at the Centre | ||
Line 334: | Line 334: | ||
− | Let’s consider that values within the order of '''10<sup>-3'''</sup> are acceptable. | + | Let’s consider that values within the order of '''10<sup>-3'''</sup> (10 to the power minus 3) are acceptable. |
− | We can see that the pressure values at '''6400''' and '''25600 cells''' differ only by an order of '''10<sup>-4'''</sup>. | + | We can see that the pressure values at '''6400''' and '''25600 cells''' differ only by an order of '''10<sup>-4'''</sup> (10 to the power minus 4). |
− | Any more '''refinement''' than '''6400 cells,''' will only give us results that differ by less than '''10<sup>-3'''</sup>. | + | Any more '''refinement''' than '''6400 cells,''' will only give us results that differ by less than '''10<sup>-3'''</sup> (10 to the power minus 3). |
Line 365: | Line 365: | ||
|| Slide: Summary | || Slide: Summary | ||
|| In this tutorial, we have learnt to: | || In this tutorial, we have learnt to: | ||
− | * | + | * Refine a '''mesh''' using '''blockMeshDict''' |
* Change the '''time step''' to achieve '''numerical stability''', and | * Change the '''time step''' to achieve '''numerical stability''', and | ||
− | * Perform a '''grid independence | + | * Perform a '''grid independence study''' |
|- | |- | ||
|| Slide: About the Spoken Tutorial Project | || Slide: About the Spoken Tutorial Project | ||
Line 391: | Line 391: | ||
|| Slide: FOSSEE Case Study Project | || Slide: FOSSEE Case Study Project | ||
|| | || | ||
− | * The FOSSEE team coordinates solving feasible CFD problems of reasonable complexity using OpenFOAM. | + | * The FOSSEE team coordinates solving feasible '''CFD''' problems of reasonable complexity using '''OpenFOAM'''. |
* 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. |
Latest revision as of 13:14, 23 July 2020
Title of the script: Grid Resolution and Convergence in OpenFOAM
Author: Ashley Melvin
Keywords: OpenFOAM, ParaView, blockMesh, meshing, mesh refinement, coarse mesh, medium mesh, fine mesh, grid independence study, Courant number, lid-driven cavity, video tutorial
Visual Cue | Narration |
Slide: Opening Slide | Welcome to this tutorial on Grid Resolution and Convergence in OpenFOAM. |
Slide: Learning Objectives | In this tutorial, we will learn to:
|
Slide: System Specifications | To record this tutorial, I am using,
However, you may use any other text editor of your choice. |
Slide: Prerequisites | As a prerequisite:
|
Slide: Lid Driven Cavity | We will use the lid driven cavity case in this tutorial.
|
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. |
[Terminal]
|
Type the following command to move into the RUN directory. |
[Terminal] Type:
|
Let us copy the Lid driven cavity case from the TUTORIALS directory into the RUN directory.
|
[Terminal]
|
Now let us go into the Lid Driven Cavity case folder using the cd command. |
[Terminal]
|
Let’s open the blockMeshDict file in a text editor. |
[gedit - blockMeshDict]
|
This is a 2 dimensional mesh having 20 cells along both x and y directions. |
[gedit - blockMeshDict]
|
Close the blockMeshDict file. |
[Terminal]
|
Now, let’s open the controlDict file in a text editor. |
[gedit - controlDict] Highlight:
|
The time step for the simulation is specified using the keyword delta T.
|
[gedit - controlDict]
|
We have calculated the time step for this simulation to be 0.005 seconds.
|
[gedit - controlDict] Close Text Editor | Close the controlDict file. |
[Terminal] Type:
|
Let us mesh the geometry now using the blockMesh command on the terminal. |
[Terminal] Type:
icoFoam |
We will be using the icoFoam solver to simulate the case.
|
[Terminal] Highlight:
|
The iterations are now complete. |
[Terminal] Type:
|
Let us view the simulated results in ParaView using the paraFoam command. |
[ParaView] Properties Tab
|
Click on the Apply button in the Properties tab to view the geometry. |
[ParaView] Active Variable Controls
|
Next, let’s view the pressure contours for the simulation.
|
[ParaView] VCR Controls
|
Now, let us view the contours at the end of the simulation.
|
[ParaView] Data Analysis
|
Next, let’s see the values of pressure and velocity at the centre of the domain.
|
Slide: Probe Location |
|
[ParaView] Properties Tab
|
We need the values at the centre of the domain.
|
[ParaView] SpreadSheetView | We can now see the velocity and pressure values in the SpreadSheetView.
|
[ParaView] Close the Window | Then close the ParaView window. |
Only Narration | Now, let us increase the number of cells in the x and y direction to 40 cells. |
Slide: Mesh Refinement |
|
[Terminal] Type:
|
Let us open the blockMeshDict file in a text editor. |
[gedit - blockMeshDict] Highlight:
|
Change the number of cells in x and y direction as shown. |
[gedit - blockMeshDict]
|
Save and close the file. |
Only Narration | Since we have changed the number of cells, we need to update the time step.
|
[Terminal] Type:
|
Let’s open the controlDict file in a text editor. |
[gedit - controlDict]
|
For the refined mesh, the calculated time-step is 0.0025 seconds.
|
[gedit - controlDict]
|
Save and close the file. |
[Terminal]
|
Since we have changed the meshing parameters, we need to mesh the geometry again.
|
[Terminal] Type:
ls |
Let us view the contents of the cavity folder.
|
[Terminal] Highlight:
|
We can see that the files from the previous run exist in the cavity folder. |
[Terminal] Type:
|
Let’s remove these files by typing this command. |
[Terminal] Type:
|
Let’s run the icoFoam solver. |
[Terminal] Type:
|
And view the results in ParaView by typing paraFoam. |
[ParaView]
|
Let us find the value of the pressure field at the centre of the domain at the final time step.
|
[ParaView] SpreadSheetView | We can see the value of the pressure field at the centre of the domain. |
[ParaView] Close the Window | Close the ParaView window. |
Only Narration | Similarly, we can find the pressure at the centre for more number of cells.
|
Slide: Pressure at the Centre | The following table shows the pressure values for various numbers of cells. |
Slide: Pressure at the Centre | This is the Pressure versus number of cells plot based on the data.
|
Only Narration | The Additional Reading Material has more details on grid independence study.
|
Only Narration | With this we have come to the end of the tutorial.
|
Slide: Summary | In this tutorial, we have learnt to:
|
Slide: About the Spoken Tutorial Project | The video at the following link summarises the Spoken Tutorial project.
|
Slide: Spoken Tutorial Workshops | We conduct workshops using Spoken Tutorials and give certificates.
|
Slide: Spoken Tutorial Forum | Please post your timed queries in this forum. |
Slide: FOSSEE Forum |
|
Slide: FOSSEE Case Study Project |
|
Slide: Spoken Tutorial | The Spoken Tutorial project is supported by MHRD, Govt. of India.
|