OpenFOAM/C3/Generating-Mesh-using-snappyHexMesh/English
Tutorial: Generating mesh using snappyHexMesh in OpenFOAM.
Script and Narration: Chaitrali Ghodke.
Keywords: Import STL file, background hex mesh, snappyHexMeshDict.
|
|
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
|
Slide 3: Pre-requisite | As a pre-requisite,
|
Slide 4:
System Requirement |
To record this tutorial, I am using
|
Slide 5:
|
We are solving an existing case of flange from
laplacianFoam in basic directory.
|
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 mesh | Then click on mesh folder. |
Click on snappyHexMesh | You will see the snappyHexMesh folder.
|
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.
|
Double-click on flange | You will see flange case.
|
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.
|
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.
|
Double-click flange.stl.gz file | In this, you will see flange.stl.gz 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
|
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 ls | Now type ls and press Enter. |
Type cd polymesh | You will see the polymesh and triSurface folders.
|
Type ls | Now type ls and press Enter. |
Type gedit blockMeshDict | You can see the blockMeshDict file.
and press Enter. |
This will open up the blockMeshDict file.
| |
Close blockMeshDict
Type cd .. |
Now close this and in the command terminal 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.
|
Type
gedit surfaceFeatureExtractDict |
To view the contents of the file, type
gedit surfaceFeatureExtractDict and press Enter.
|
Open surfaceFeatureExtractDict | This will open up the surfaceFeatureExtractDict file.
|
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.
|
Give the geometry name | In snappyHexMeshDict I have already made some changes.
|
Give the file name for explicit feature edge refinement. | For Explicit feature edge refinement in castellatedMeshControls, I have given the file name flange.eMesh.
|
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.
|
Type gedit T | Now type gedit space T and press Enter. |
This will open up the T file.
| |
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.
|
Run surfaceFeatureExtract
|
Now type surfaceFeatureExtract and press Enter.
|
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.
|
Type paraFoam | Once solving is completed, type paraFoam and press Enter to view the geometry and the results.
|
Click on Apply button | On the left hand side of Paraview window, click on Apply.
|
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.
|
Click on the play button | Now on the top of the Paraview window, you can see the VCR controls.
|
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.
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:
You can also change the temperature in the 0 folder and view the results in Paraview. |
Slide 7 : Summary
|
In this tutorial we learnt :
|
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. |