Difference between revisions of "OpenFOAM/C3/Generating-Mesh-using-snappyHexMesh/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with 'Tutorial: Generating mesh using '''snappyHexMesh in OpenFOAM'''. Script and Narration: Chaitrali Ghodke. Keywords: Import STL file, background hex mesh, snappyHexMeshDict. …')
 
 
Line 114: Line 114:
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Select '''0''', '''constant '''and '''system '''folders  
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Select '''0''', '''constant '''and '''system '''folders  
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Copy the '''three folders''' '''0, constant and system.'''
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Copy the three folders '''0, constant and system.'''
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Go back to '''mesh''' >> '''snappyHexMesh '''>> '''flange_1 '''folder  
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Go back to '''mesh''' >> '''snappyHexMesh '''>> '''flange_1 '''folder  
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| '''Now let us go three levels back. '''
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now let us go three levels back.  
  
 
|-
 
|-
Line 158: Line 158:
  
 
In this, create a '''folder''' by name '''triSurface.'''  
 
In this, create a '''folder''' by name '''triSurface.'''  
 
Right click - '''Create New Folder –''' '''triSurface.'''
 
  
 
|-
 
|-
Line 195: Line 193:
  
  
cd OpenFOAM-2.2.2/tutorials/mesh/snappyHexMesh/flange_1
+
'''cd OpenFOAM-2.2.2/tutorials/mesh/snappyHexMesh/flange_1'''
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Open '''command terminal''' and enter the path for '''flange_1 '''as shown.
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Open '''command terminal''' and enter the path for '''flange_1 '''as shown.
 +
 +
Type '''cd OpenFOAM-2.2.2/tutorials/mesh/snappyHexMesh/flange_1'''
  
 
|-
 
|-
Line 204: Line 204:
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''cd constant'''
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''cd constant'''
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| There are three folders''' 0''', '''constant '''and '''system'''.
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| There are three folders''' 0, constant '''and '''system'''.
  
  
Type '''cd constant''' and press '''Enter.'''
+
Type '''cd space constant''' and press '''Enter.'''
  
 
|-
 
|-
Line 218: Line 218:
  
  
Type '''cd polymesh''' and press '''Enter.'''
+
Type '''cd space polymesh''' and press '''Enter.'''
  
 
|-
 
|-
Line 229: Line 229:
  
  
To view the contents of the file type  
+
To view the contents of the file, type '''gedit blockMeshDict'''  
 
+
'''gedit blockMeshDict'''  
+
  
 
and press '''Enter.'''
 
and press '''Enter.'''
Line 240: Line 238:
  
  
This file contains '''co-ordinates '''for '''hex mesh '''and boundary patches.
+
This file contains '''co-ordinates '''for '''hex mesh '''and '''boundary patches'''.
  
 
|-
 
|-
Line 254: Line 252:
  
  
Again type cd (space) .. (dot) (dot) and press '''Enter'''.
+
Again type '''cd (space) .. (dot) (dot)''' and press '''Enter'''.
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''cd system'''
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''cd system'''
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now type cd '''system''' and press '''Enter.'''
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now type '''cd space system''' and press '''Enter.'''
  
 
|-
 
|-
Line 271: Line 269:
  
 
'''gedit''' '''surfaceFeatureExtractDict '''
 
'''gedit''' '''surfaceFeatureExtractDict '''
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| To view the contents of the file type  
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| To view the contents of the file, type  
  
 
'''gedit''' '''surfaceFeatureExtractDict '''
 
'''gedit''' '''surfaceFeatureExtractDict '''
Line 323: Line 321:
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Give the file name for explicit feature edge refinement.
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Give the file name for explicit feature edge refinement.
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| For explicit feature edge refinement in '''castellatedMeshControls,''' I have given the file name '''flange.eMesh'''.
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| For '''Explicit feature edge refinement''' in '''castellatedMeshControls,''' I have given the file name '''flange.eMesh'''.
  
  
Line 333: Line 331:
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''cd ..'''
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''cd ..'''
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now close this and in '''command terminal '''type  
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now close this and in '''command terminal, type  
  
 
'''cd (space) .. (dot) (dot) '''and press '''Enter.'''
 
'''cd (space) .. (dot) (dot) '''and press '''Enter.'''
Line 339: Line 337:
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''cd 0'''
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''cd 0'''
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Type '''cd 0''' and press '''Enter.'''
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Type '''cd space 0''' and press '''Enter.'''
  
 
|-
 
|-
Line 350: Line 348:
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''gedit T'''  
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''gedit T'''  
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now type '''gedit T''' and press '''Enter.'''
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now type '''gedit space T''' and press '''Enter.'''
  
 
|-
 
|-
Line 357: Line 355:
  
  
You will see the initial conditions for every patch.
+
You will see the initial conditions for every '''patch'''.
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"|  
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"|  
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now we have to give initial conditions for all patches of '''flange'''.
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now, we have to give initial conditions for all '''patches''' of '''flange'''.
  
 
|-
 
|-
Line 387: Line 385:
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| On the terminal >> type blockMesh
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| On the terminal >> type blockMesh
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now, we need to mesh the geometry.
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now, we need to '''mesh''' the '''geometry'''.
  
For that in '''command terminal''' type '''blockMesh''' and press '''Enter.'''
+
For that in '''command terminal,''' type '''blockMesh''' and press '''Enter.'''
  
  
Meshing is done.
+
'''Meshing''' is done.
  
 
|-
 
|-
Line 405: Line 403:
  
  
Surface feature extraction is done.
+
'''Surface feature extraction''' is done.
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''snappyHexMesh -overwrite'''  
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''snappyHexMesh -overwrite'''  
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now type '''snappyHexMesh -overwrite''' and press '''Enter.'''
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now type '''snappyHexMesh -(dash) overwrite''' and press '''Enter.'''
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"|  
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"|  
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| '''-overwrite '''command will prevent copying the files from the last time folders.
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| '''- (dash) overwrite '''command will prevent copying the files from the last time folders.
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"|  
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"|  
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| If not, the resulting meshes will be inside the next time folders, possibly the folders '''1''', '''2''' and '''3'''.
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| If not, the resulting '''meshes''' will be inside the next time folders, possibly the folders '''1''', '''2''' and '''3'''.
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"|  
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"|  
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Meshing will take some time.
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| '''Meshing''' will take some time.
  
 
<nowiki><<PAUSE>></nowiki>
 
<nowiki><<PAUSE>></nowiki>
  
Now meshing is completed.
+
Now '''meshing''' is completed.
  
 
|-
 
|-
Line 443: Line 441:
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''paraFoam'''  
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Type '''paraFoam'''  
 
 
  
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Once solving is completed, type '''paraFoam''' and press '''Enter '''to view the geometry and the results.
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Once solving is completed, type '''paraFoam''' and press '''Enter '''to view the geometry and the results.
  
  
This will open up the '''paraview''' window.
+
This will open up the '''Paraview''' window.
  
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Click on Apply button
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Click on Apply button
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| On the left hand side of '''paraview''' window, click on '''Apply.'''
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| On the left hand side of '''Paraview''' window, click on '''Apply.'''
  
  
Line 466: Line 462:
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| In the drop down menu change from solid color to T
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| In the drop down menu change from solid color to T
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now go to the top of the active variable control drop down menu.  
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now go to the top of '''Active variable control''' drop down menu.  
  
  
Line 473: Line 469:
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Click on the play button
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Click on the play button
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now on the top of the '''paraview '''window, you can see the '''VCR''' controls.  
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Now on the top of the '''Paraview '''window, you can see the '''VCR''' controls.  
  
  
Line 483: Line 479:
 
|-
 
|-
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Toggle on the color legend
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Toggle on the color legend
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Toggle on the color legend by clicking on top left of the active variable control menu.
+
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Toggle on the color legend by clicking on top left of the '''Active variable control''' menu.
  
 
This is the colour legend for temperature '''T'''.
 
This is the colour legend for temperature '''T'''.
Line 500: Line 496:
 
Change some parameters in the '''snappyHexMeshDict''':
 
Change some parameters in the '''snappyHexMeshDict''':
  
* Refinement parameters
+
* '''Refinement''' parameters
* locationInMesh co-ordinates
+
* '''locationInMesh co-ordinates'''
* snapControls, etc.
+
* '''snapControls''', etc.
  
You can also change the temperature in the '''0''' folder and view the results in '''paraview'''.
+
You can also change the temperature in the '''0''' folder and view the results in '''Paraview'''.
  
 
|-
 
|-
Line 513: Line 509:
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| In this tutorial we learnt :
 
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| In this tutorial we learnt :
  
* To generate mesh by '''snappyHexMesh '''utility in openFoam.
+
* To generate mesh by '''snappyHexMesh '''utility in '''OpenFoam'''.
 
* Simulate temperature distribution of a '''flange'''.
 
* Simulate temperature distribution of a '''flange'''.
  

Latest revision as of 11:59, 11 July 2014

Tutorial: Generating mesh using snappyHexMesh in OpenFOAM.


Script and Narration: Chaitrali Ghodke.


Keywords: Import STL file, background hex mesh, snappyHexMeshDict.


Visual Cue
Narration
Slide 1 Hello and welcome to the spoken tutorial on generating mesh using snappyHexMesh in OpenFOAM.
Slide 2 : Learning Objectives


In this tutorial we will learn to
  • Generate mesh using snappyHexMesh utility
  • Simulate temperature distribution of a flange.


Slide 3: Pre-requisite As a pre-requisite,
  • You should know parameters in snappyHexMeshDict to generate mesh.
  • For more details, refer the tutorial on introduction to snappyHexMesh in OpenFOAM.


Slide 4:

System Requirement

To record this tutorial, I am using
  • Ubuntu Linux Operating system version 12.04.
  • OpenFOAM version 2.2.2
  • ParaView version 3.12.0


Slide 5:


We are solving an existing case of flange from

laplacianFoam in basic directory.


laplacianFoam solver solves simple laplace equations.

Click on home >> OpenFoam-2.2.2 Now let us go to home folder and click on OpenFoam-2.2.2 folder.
Click on tutorials You will see tutorials.


Click on it.

Click on mesh Then click on mesh folder.
Click on snappyHexMesh You will see the snappyHexMesh folder.


Click on it

Right click >> Create new folder >> flange_1 In this folder, create a new folder by name flange_1.

Right click >> Create New Folder >> flange_1.

Go back to tutorials >> basic folder Now let's go back two levels.
Double-click on basic folder Open the basic folder.
Double-click on laplacianFoam You will see laplacianFoam folder.


Click on it.

Double-click on flange You will see flange case.


Click on it to open the folder.

Select 0, constant and system folders Copy the three folders 0, constant and system.
Go back to mesh >> snappyHexMesh >> flange_1 folder Now let us go three levels back.
Paste them there Paste the copied folders inside the flange_1 folder.
Go back to snappyHexMesh >> flange folder Now let us go one level back.
Double-click flange folder Click on flange folder.
Double-click on system You will see constant and system folders.


Click on system folder.

Select snappyHexMeshDict and surfaceFeatureExtractDict Copy snappyHexMeshDict and surfaceFeatureExtractDict from this folder.
Go back to snappyHexMesh >> flange_1 folder Now let us go two levels back.
Paste them there Paste these two files inside the system directory of flange_1 folder.
Right click >> Create new folder >> triSurface Now let us go one level back.

Click on constant folder.

In this, create a folder by name triSurface.

Go back to tutorials >> resources >> geometry folder Now let us go four levels back.
Double-click on resources Open the resources folder.
Double-click on geometry You will see geometry folder.


Now, open the geometry folder.

Double-click flange.stl.gz file In this, you will see flange.stl.gz file.


Extract this file.

Go to tutorials >> mesh >> snappyHexMesh >> flange_1 >> constant >> triSurface Give the path of triSurface folder in constant directory of flange_1 folder.
Now close this.
Ctrl+Alt+t simultaneously


cd OpenFOAM-2.2.2/tutorials/mesh/snappyHexMesh/flange_1

Open command terminal and enter the path for flange_1 as shown.

Type cd OpenFOAM-2.2.2/tutorials/mesh/snappyHexMesh/flange_1

Type ls Now type ls and press Enter.
Type cd constant There are three folders 0, constant and system.


Type cd space constant and press Enter.

Type ls Now type ls and press Enter.
Type cd polymesh You will see the polymesh and triSurface folders.


Type cd space polymesh and press Enter.

Type ls Now type ls and press Enter.
Type gedit blockMeshDict You can see the blockMeshDict file.


To view the contents of the file, type gedit blockMeshDict

and press Enter.

This will open up the blockMeshDict file.


This file contains co-ordinates for hex mesh and boundary patches.

Close blockMeshDict


Type cd ..

Type cd ..

Now close this and in the command terminal type

cd (space) .. (dot) (dot) and press Enter.


Again type cd (space) .. (dot) (dot) and press Enter.

Type cd system Now type cd space system and press Enter.
Type ls Now type ls and press Enter.


You can see the surfaceFeatureExtractDict file.

Type

gedit surfaceFeatureExtractDict

To view the contents of the file, type

gedit surfaceFeatureExtractDict

and press Enter.


(Note that F, E and D here are capital)

Open surfaceFeatureExtractDict This will open up the surfaceFeatureExtractDict file.


This file contains the information about geometry’s feature edges.


The included angle is taken as 150.

Close surfaceFeatureExtractDict Now close this.
Type gedit snappyHexMeshDict


In command terminal type

gedit snappyHexMeshDict

and press Enter.

(Note that H, M and D here are capital)

Open snappyHexMeshDict This will open up the snappyHexMeshDict file.


This file contains all the instructions about snappyHexMesh.

Give the geometry name In snappyHexMeshDict I have already made some changes.


I have named flange.stl same as that of STL file, which is in the constant/trisurface directory.

Give the file name for explicit feature edge refinement. For Explicit feature edge refinement in castellatedMeshControls, I have given the file name flange.eMesh.


This file is obtained by surfaceFeatureExtract utility.


The remaining details in the snappyHexMesh have changed as per requirements.

Type cd .. Now close this and in command terminal, type

cd (space) .. (dot) (dot) and press Enter.

Type cd 0 Type cd space 0 and press Enter.
Type ls Type ls and press Enter.


You can see the T file.

Type gedit T Now type gedit space T and press Enter.
This will open up the T file.


You will see the initial conditions for every patch.

Now, we have to give initial conditions for all patches of flange.
Copy the conditions Copy the initial conditions for patch 1 and paste it after patch 4 in the same file T.
Type flange_ Now type flange_ before this patch 1.
Give initial conditions for all patches of flange.

Save file T >> close

Similarly, we can do this for patch 2, 3 and 4.

Save this T file and close it.

Type cd .. And in the command terminal type cd (space) .. (dot) (dot)

and press Enter.

On the terminal >> type blockMesh Now, we need to mesh the geometry.

For that in command terminal, type blockMesh and press Enter.


Meshing is done.

Run surfaceFeatureExtract


Now type surfaceFeatureExtract and press Enter.


(Note that F and E here are capital.)


Surface feature extraction is done.

Type snappyHexMesh -overwrite Now type snappyHexMesh -(dash) overwrite and press Enter.
- (dash) overwrite command will prevent copying the files from the last time folders.
If not, the resulting meshes will be inside the next time folders, possibly the folders 1, 2 and 3.
Meshing will take some time.

<<PAUSE>>

Now meshing is completed.

For simulating temperature distribution, we are using laplacianFoam solver.
Type laplacianFoam In the command terminal type laplacianFoam and press Enter.


(Note that F here is capital.)


Iterations running will be seen in the terminal window.

Type paraFoam Once solving is completed, type paraFoam and press Enter to view the geometry and the results.


This will open up the Paraview window.

Click on Apply button On the left hand side of Paraview window, click on Apply.


The geometry can be seen here.

Check the box for T >> Click on Apply button Scroll down the properties panel of the object inspector menu.

Check the box for T in the volume fields and click on Apply.

In the drop down menu change from solid color to T Now go to the top of Active variable control drop down menu.


Change from solid color to capital T, which is the initial condition for the flange.

Click on the play button Now on the top of the Paraview window, you can see the VCR controls.


Click on the Play button.


Now this is the final result for temperature distribution of a flange.

Toggle on the color legend Toggle on the color legend by clicking on top left of the Active variable control menu.

This is the colour legend for temperature T.


<PAUSE>

Now let me get back to the slides.

Slide 6 : Assignment This brings us to the end of the tutorial.

As an assignment,

Change some parameters in the snappyHexMeshDict:

  • Refinement parameters
  • locationInMesh co-ordinates
  • snapControls, etc.

You can also change the temperature in the 0 folder and view the results in Paraview.

Slide 7 : Summary


In this tutorial we learnt :
  • To generate mesh by snappyHexMesh utility in OpenFoam.
  • Simulate temperature distribution of a flange.


Slide 8 :

About Spoken tutorials

Watch 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 9:

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

contact@spoken-tutorial.org

Slide 10: Acknowledgement


Spoken Tutorials are part of Talk to a Teacher project,

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

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

About the contributor This is Chaitrali Ghodke from IIT BOMBAY signing off.

Thanks for joining.

Contributors and Content Editors

Chaitralighodke, Nancyvarkey