OpenFOAM/C3/Unstructured-mesh-generation-using-Gmsh/English

From Script | Spoken-Tutorial
Revision as of 16:14, 18 August 2015 by Nancyvarkey (Talk | contribs)

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

Tutorial: Unstructured Mesh generation using GMSH


Script and Narration: Pavan Mehta


Keywords: Video tutorial, CFD, GMSH, unstructured mesh, curved lines, circular arc, ruled surface


Visual Cue
Narration
Slide 1 Hello and welcome to the spoken tutorial on Unstructured Mesh generation using GMSH.
Slide 2: Learning Objective In this tutorial we will learn to
  • Create an unstructured mesh in GMSH
  • Create plane surfaces
  • Basic manipulations using the file with extension .geo
Slide 3: System requirement To record this tutorial I am using
  • Ubuntu Linux Operating system 14.04
  • GMSH version 2.8.5
  • OpenFOAM version 2.4.0
Slide 4: Pre-requisite This tutorial is a continuation of:

Creation of sphere using GMSH


We have already learnt to create a sphere using GMSH earlier.


If you don't know how to do so, refer to the GMSH spoken tutorials in the OpenFOAM series on this website.

Slide 5: Sphere Geometry and Domain Here is our problem statement.


This picture shows the flow direction and boundary faces.


We will now learn how to create an unstructured mesh using GMSH.

Slide 6: Points for Domain (slide) Note that the size of the domain is 45 X 30 X 30, and the radius of the sphere is 1.


However, these dimensions can vary from problem to problem.


The points for the domain are as shown here.

Narration Let us switch to GMSH now.


Here is the sphere we created earlier.

Pause recording and create the points and lines of the domain. I have also created all the points and lines of the domain.


To create the points of the domain, kindly refer to the tutorial mentioned earlier.

Selecting the option plane surface


Using this option, selecting the edges

Now, select the option plane surface.


Then select the respective edges for the surface. The selection will be displayed in red.

Press E Press E on the keyboard to execute the selection.


On doing so, we can see the dotted lines.

Pause recording and create all the surfaces. Repeat the process until all surfaces are created.
Select Physical Groups >> Add >> surface Now, select the option Physical Groups, then Add and then surface.
Select the four faces for wall >> Press E Now, select these four faces for the wall and press E on the keyboard.
Select the face for inlet >> Press E Select the front face for inlet and press E.
Select the face for outlet >> Press E Select the back face for outlet and press E.
Close GMSH Now close GMSH.
Open sphere1.geo file >> go to the bottom Now, open the sphere1.geo file in gEdit Text Editor.


Note that there are additions to this file.


Also note that the identification numbers for the entities is in continuation of the earlier series.

Replace the numerical values to a variable d As done earlier, replace the numerical values.


Use the letter d for the domain mesh variable.

Typing d = 0.5; at the beginning of the document Then, at the beginning of the file type

d = 0.5;

Narration To name the boundaries, change the numerical value with your desired name, as demonstrated.
Replacing the integer with “wall” The first physical surface, we made in the interface was wall.


So, here, we will replace it with wall.

Replacing the integer with “inlet” The second physical surface, we made in the interface was inlet.


Hence, here, we will replace it with inlet.

Replacing the integer with “outlet” The third physical surface, we made in the interface was outlet.


So, here, we will replace it with outlet.

Typing Surface Loop()={};


and highlighting

Now type, Surface Loop, ID which is the next integer in round brackets


equals the IDs of all surfaces of the domain in braces

which is 43, 45, 47, 49, 51 and 53

Typing Volume()={};


and highlighting

For definition of volume, use Volume, ID which is the next integer in round brackets


equals the IDs of the two surfaces in braces


Which is 29 and 56.

Typing Physical Volume();


and highlighting

For physical volume, use Physical Volume, ID which is the next integer in round brackets


equals the IDs of the volume in braces


which is 58.

Save and close sphere1.geo Save this file and close it.
In the terminal >> type gmsh sphere1.geo


Now, using the terminal reopen GMSH by typing:

gmsh sphere1.geo and press Enter

Narration In GMSH, a bottom to top approach is followed
  • That is, first 1D mesh is created
  • Using 1D mesh, 2D mesh is created
  • Using 2D mesh, 3D mesh is created
1D mesh creation, by pressing F1 key For 1D mesh creation, press F1 key.
2D mesh creation, by pressing F2 key For 2D mesh creation, press F2 key.
3D mesh creation, by pressing F3 key For 3D mesh creation, press F3 key.
Point to the status bar. This may take a while. Watch the progress in the status bar.


It shows Done now.

Once the mesh is created, we need to optimize it

to remove faulty cells.

Optimizing mesh using Optimize 3d Netgen option For optimization click on Modules , then Mesh and then on Optimize 3d Netgen option
Point to the status bar. This may also take a while.


Once again, watch the progress in the status bar.

Saving mesh and closing terminal To save the mesh go to File, Save mesh and close the terminal.
Slide 7: Importing mesh in OpenFOAM Create OpenFOAM case directory without the constant folder


In the case directory, copy the newly created file sphere1.msh


Using the terminal window, go to the case directory of this problem.

Open a new terminal >> type gmshToFoam sphere.msh Once you are in the case directory,


Type: gmshToFoam sphere1.msh and press Enter


To convert the mesh


Ensure that the same boundary names are there in the files of folder 0, before proceeding to the next step.

Slide 8: Summary Let us summarise.

In this tutorial we have learnt to:

  • Create an unstructured mesh in GMSH
  • Create plane surfaces
  • Basic manipulations using the file with extension .geo
Slide 9: Assignment As an assignment,


Make refinement in the mesh by changing the values of:


s, d and


Mesh.CharacteristicLengthFromCurvature

Slide 10: About FOSSEE OpenFOAM series is created by the FOSSEE Project, IIT Bombay.


FOSSEE stands for Free and Open Source Software for Education.


This project promotes the use of free and open source software tools.


For more details, please visit: http://fossee.in/

Slide 11: About Spoken tutorials


The video at this link summarises the Spoken Tutorial project.

Please download and watch it.

Slide 12:

About Spoken tutorials


The Spoken Tutorial Project Team conducts workshops and gives certificates on passing online tests.

For more details, please write to us.

Slide 13: Acknowledgement Spoken Tutorial Project is funded by NMEICT, MHRD, Government of India.

More information on this Mission is available at this link.


This is Pavan Mehta from FOSSEE Project, IIT BOMBAY signing off.

Thanks for joining.

Contributors and Content Editors

Mehtapavanp, Nancyvarkey