OpenFOAM/C3/Generating-Mesh-using-snappyHexMesh/English-timed

From Script | Spoken-Tutorial
Jump to: navigation, search
Time Narration
00:01 Hello and welcome to the spoken tutorial on generating mesh using snappyHexMesh in OpenFOAM.
00:08 In this tutorial, we will learn to:

Generate mesh using snappyHexMesh utility Simulate temperature distribution of a flange.

00:18 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.

00:31 To record this tutorial, I am using:

Ubuntu Linux Operating system version 12.04. OpenFOAM version 2.2.2 ParaView version 3.12.0

00:46 We are solving an existing case of flange fromlaplacianFoam in basic directory.

'laplacianFoam' solver solves simple Laplace equations.

00:58 Now, let us go to home folder and click on OpenFoam-2.2.2 folder.
01:05 You will see tutorials. Click on it.
01:09 Then click on mesh folder.
01:12 You will see the snappyHexMesh folder. Click on it.
01:17 In this folder, create a new folder by name flange_1.
01:24 Now, let's go back two levels.
01:27 Open the basic folder. You will see laplacianFoam folder. Click on it.
01:36 You will see flange case. Click on it to open the folder.
01:42 Copy the three folders 0, constant and system.
01:46 Now, let us go three levels back. Paste the copied folders inside the flange_1 folder.
01:56 Now, let us go one level back. Click on flange folder. You will see constant and system folders.
02:05 Click on system folder.
02:08 Copy snappyHexMeshDict and surfaceFeatureExtractDict from this folder. Now, let us go two levels back.
02:18 Paste these two files inside the system directory of flange_1 folder.
02:27 Now, let us go one level back. Click on constant folder. In this, create a folder by name triSurface.
02:40 Now, let us go four levels back.
02:44 Open the resources folder.
02:48 You will see geometry folder. Now, open the geometry folder.
02:53 In this, you will see flange.stl.gz file. Extract this file.
03:04 Give the path of triSurface folder in constant directory of flange_1 folder. Now close this.
03:16 Open command terminal and enter the path for flange_1 as shown. Type: cd space OpenFOAM-2.2.2/tutorials/mesh/snappyHexMesh/flange_1 and press Enter.
03:42 Now type "ls" and press Enter.
03:46 There are three folders 0, constant and system. Type cd space constant and press Enter.
03:55 Now type "ls" and press Enter. You will see the polymesh and triSurface folders.Type: cd space polymesh and press Enter.
04:09 Now type: "ls" and press Enter. You can see the blockMeshDict file.
04:16 To view the contents of the file, type: gedit space blockMeshDict and press Enter.
04:26 This will open up the blockMeshDict file. This file contains co-ordinates for hex mesh and boundary patches.
04:36 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.
04:48 Now, type: cd space system and press Enter.
04:53 Now type: "ls" and press Enter. You can see the surfaceFeatureExtractDict file.
05:01 To view the contents of the file, type: gedit space surfaceFeatureExtractDict and press Enter(Note that F, E and D here are capital).
05:15 This will open up the surfaceFeatureExtractDict file.
05:19 This file contains the information about geometry’s feature edges. The included angle is taken as 150.
05:29 Now close this. In command terminal, type: gedit space snappyHexMeshDict and press Enter(Note that H, M and D here are capital).
05:45 This will open up the snappyHexMeshDict file. This file contains all the instructions about snappyHexMesh.
05:53 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.
06:11 For Explicit feature edge refinement in castellatedMeshControls, I have given the file name flange.eMesh. This file is obtained by surfaceFeatureExtract utility.
06:23 The remaining details in the snappyHexMesh have changed as per requirements.
06:30 Now close this and in command terminal, type cd (space) .. (dot) (dot) and press Enter.
06:38 Type: cd space 0 (zero) and press Enter.
06:44 Type "ls" and press Enter. You can see the 'T' file.
06:50 Now type: gedit space T and press Enter.
06:55 This will open up the 'T' file. You will see the initial conditions for every patch.
07:04 Now, we have to give initial conditions for all patches of flange.
07:11 Copy the initial conditions for patch 1 and paste it after patch 4, in the same file 'T.' Now type "flange_" before this patch 1.
07:28 Similarly, we can do this for patch 2, 3 and 4. Save this 'T' file and close it.
07:37 And, in the command terminal type: cd (space) .. (dot) (dot)and press Enter.
07:43 Now, we need to mesh the geometry. For that, in command terminal, type: blockMesh and press Enter. Meshing is done.
07:55 Now type: surfaceFeatureExtract and press Enter (Note that F and E here are capital).Surface feature extraction is done.
08:09 Now, type: snappyHexMesh -(dash) overwrite and press Enter. - (dash) overwrite command will prevent copying the files from the last time folders.
08:24 If not, the resulting meshes will be inside the next time folders, possibly the folders 1, 2 and 3.
08:31 Meshing will take some time. Now meshing is completed.
08:36 For simulating temperature distribution, we are using 'laplacianFoam' solver.
08:42 In the command terminal, type: laplacianFoam and press Enter (Note that F here is capital).
08:51 Iterations running will be seen in the terminal window.
08:55 Once solving is completed, type: paraFoam and press Enter to view the geometry and the results. This will open up the Paraview window.
09:07 On the left hand side of Paraview window, click on Apply. The geometry can be seen here.
09:15 Scroll down the properties panel of the Object Inspector menu. Check the box for T in the Volume Fields and click on Apply.
09:25 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.
09:37 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.
09:58 Toggle on the color legend by clicking on top left of the Active variable control menu.This is the colour legend for temperature T.
10:09 Now, let me get back to the slides.
10:12 This brings us to the end of the tutorial. As an assignment-
10:16 Change some parameters in the snappyHexMeshDict:

Refinement parameters locationInMesh co-ordinates snapControls etc.

10:26 You can also change the temperature in the '0' (zero) folder and view the results in the Paraview.
10:33 In this tutorial, we learnt :

To generate mesh by snappyHexMesh utility in OpenFoam. Simulate temperature distribution of a flange.

10:44 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.

10:57 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

11:14 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:http://spoken-tutorial.org/NMEICT-Intro

11:29 This is Chaitrali Ghodke from IIT Bombay, signing off. Thanks for joining.

Contributors and Content Editors

PoojaMoolya, Pratik kamble, Sandhya.np14