OpenFOAM/C3/Creating-a-sphere-in-GMSH/English

From Script | Spoken-Tutorial
Revision as of 20:39, 8 August 2015 by Mehtapavanp (Talk | contribs)

Jump to: navigation, search

Tutorial: Creating a sphere in 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 Creating a sphere in GMSH.
Slide 2: Learning Objective In this tutorial, we will learn to
  • Create a circular arc
  • Create ruled surfaces
  • and 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


Slide 4: Pre-requisite As a pre-requisite, user should have basic knowledge of creating points.


If not, refer to the GMSH spoken tutorials in the OpenFOAM series on this website.

Slide 5: Points for sphere Let us begin.


  • The origin of the sphere is at (0,0,0).
  • And the other points of the sphere are as displayed.


Switch to terminal


In terminal type gmsh sphere1.geo and press enter

Let us now open GMSH from the terminal.


To open the terminal, press Ctrl+Alt+T keys.


Now type gmsh sphere1.geo


and Press Enter


GMSH is opened.

Switch to GMSH's interface I have already created 7 points for the sphere, as shown here.


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

In GMSH's interface, selecting circle arc option I'll now demonstrate how to make a circular arc.


In GMSH, a circular arc is strictly created less than Pi.

Select circle arc in LHS menu To create an arc, select circle arc option in the left-hand-side menu.
Creating curved lines by selecting 1st , 2nd and then 3rd point Now, I will select the right-most point as the starting point of the arc.


Then, select this point here as the center point. Please note: This is the point with the coordinates (0,0,0).


And finally, I will select a point on the top-side as the end point of the arc.

Pause recording and create all the arcs and complete the sphere. Repeat the process till all arcs are created.


Remember to keep the same centre point for all the arcs.

Selecting the option ruled surface


and then selecting respective edges

Now select ruled surface option from the left-hand side menu, to create the curved surface.


Select the bounding edges for the surface, as demonstrated here.


Notice that the selected edges are now in red colour.

Press E


Press E on the keyboard to execute this selection.


You can see that the surface has been created.


This is indicated by the dotted line, as shown here.

Pause recording and create all the surfaces


Repeat the process and create all 8 surfaces of the sphere.
Show the completed sphere On completion, your sphere should look like this.
Going to home folder and opening sphere1.geo text file, by double clicking Now, go to the Home folder.


Locate and open the file sphere1.geo using gedit Text Editor.

Narration Information related to the geometrical entities that we just created, are stored here.
Explaining general syntax of GMSH In GMSH, the general syntax is


Geometrical entity, identification number inside the parenthesis


which equals to an expression.

Explaining syntax of point


Simultaneously highlighting the syntax

Here, for point, the expression is


Point, identification number inside parenthesis, which is usually the next integer starting from 1


equals to X,Y,Z coordinates and the value of mesh element size inside braces.

Explaining further on syntax of point This value is the desired mesh element size.


The size of the mesh elements will then be computed by linearly interpolating these values on the initial mesh.

Replacing the numerical value to a variable, s Let us now replace the numerical value of the points of the sphere, to a variable, s.
Type s=0.1; at the beginning of the document At the beginning, type s = 0.1;


This is for specifying the value of mesh element size of the sphere.

Explaining the necessity of refinement


and typing Mesh.CharacteristicLengthFromCurvature = 0.05;

To capture the boundary layer, we will refine the mesh near the sphere.


For this purpose, we shall use the line,

Mesh.CharacteristicLengthFromCurvature = 0.05;

Explaining the syntax Mesh.CharacteristicLenghtFromCurvature The syntax Mesh.CharacteristicLengthFromCurvature


will adapt the mesh with respect to the curvature of the geometrical entities.

Type Surface Loop For volume creation, we require all the bounding surfaces.


For this, at the end of the file, type

Surface Loop followed by its identity


which is the next integer inside parenthesis


Which equals the identities of all the surfaces of the sphere within braces.


Here, the identities are 14, 16, 18, 20, 22, 24, 26 and 28.

Saving and Closing the text file Now save and close the sphere1.geo file.
Switch to GMSH's interface

Select Physical Groups >> Add >> Surface option --> select all the surfaces --> Press E

Let's switch to the GMSH interface.


In the left-hand-side menu, click on Physical Groups, then Add, and then Surface option.


Select all the surfaces of the sphere.


Press E on the keyboard to execute this selection.

Double-click to open sphere1.geo file >> go to the last line of the file. Now, again open sphere1.geo file in the Text Editor.

Right at the bottom, notice that a new line of code has been added.

Replace this number with sphere in double inverted commas and explaining it's importance Replace this number with sphere within quotes.


This will help us to easily identify the boundaries of the sphere while post processing or otherwise.

Save and close the file. Now save and close the file.
Narration This completes this tutorial. Let us summarize.
Slide 6: Summary In this tutorial we learnt to
  • Create curved lines and surfaces
  • Create a sphere and
  • and basic manipulations using the file with extension .geo


Slide 7: Assignment As an assignment,

Create a sphere with a larger radius.

Slide 8: 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 9: About the Spoken tutorial project


The video at this link summarises the Spoken Tutorial project.

Please download and watch it.

Slide 10:

Spoken tutorials Workshops


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

For more details, please write to us.

Slide 11: 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