GMSH - Open Source Meshing Program
The purpose of this web-page is to summarize the capabilities of FreeCAD and GMSH by adding user experience while running the tutorial cases. The information is being updated gradually, starting with a visual description of the output from each tutorial. This will help a potential user of GMSH to directly jump to the tutorial which fits his/her requirements. Though it is imperative to go though all the tutorials the way the authors of this program have designed. The publisher of cfdyna.com has not made contribution to some of the example cases included here and asserts no claim or copyright. The purpose is to compile information in a place for reference to current and future users of GMSH program for learning purposes.
While FreeCAD uses Python for scripting, GMSH calls its scripting language as 'affectation'. A new variable is defined as eSize = 1e-2; and a new point can be created as Point(1) = {0, 0, 0, eSize};
The recommended method to convert a GMSH mesh to OpenFOAM format is to use utility gmshToFoam. The syntax is gmshToFoam case.msh -case oFCase. As per thread on cfd-onine.com, gmshToFoam can convert only version 2 of Gmsh format. You MSH file is version 4. Use "-format msh2 -2" command line switch while generating MSH file. In the GUI: File->Export and pick the version in the dropdown menu. In a .geo script: add the line Mesh.MshFileVersion = x.y; for any version number x.y. This can be saved as default options. In the API: gmsh::option::setNumber("Mesh.MshFileVersion", x.y).
Another option is to use GMSH to generate surface mesh and export it to an STL format. Then use snappyHexMesh to generate the volume mesh. The advantage of this approach is that the physical entities (inlets, outlets...) defined in GMSH can get exported into STL and subsequently into sHM. Thus, topoSet and createPatch utilities may not be needed on final mesh.
How many of these names have you heard of? Click on the names to know more about them!
The FreeCAD file, STEP and STL geometry can be found here: Z-Bend FreeCAD, Z-Bend geometry in STEP format and Z-Bend STL Geometry. The STL geometry can be used in snappyHexMesh to generate a mesh for CFD simulation in OpenFOAM. The STEP/IGES format can be imported in GMSH using File -> Merge option. The mesh can be generated in GMSH after setting element size as depicted below. Progress information and messages are displayed in the bottom part of GUI in GMSH. If it is not visible, use Tools -> Message Console path or control-L command to activate / deactivate it.Once STEP geometry is imported in GMSH, following log message is printed in console. Note that no solid is defined. In addition to boundary patches such as inlet, outlet and walls, fluid zone also need to be defined. The option is to follow Geometry > Add > Volume > Select volume boundary (click on the surfaces that form a closed volume).
In order to save an STEP geometry in native *.geo format, follow the utility File > Export... > Geometry - Gmsh Unrolled GEO. Add the extension .geo in the file name.
The selection of entities in GMSH using mouse key can be turned OFF and ON as shown below. This is required to set "Physics Group". In the graphical interface, select Geometry > Physical Groups > Add > Surface and then hover over each of the surfaces which are shown by the dashed gray lines. The numbering will be revealed in a box near mouse cursor for the nearest surface.
Description and features: The most basic functionality of GMSH capability to create points, lines, surface and physical entities (that is regions or zones). The domain is 2D and mesh generated is triangular which is default setting.
Description and features: This is an example of volume meshing with tetrahedrons. The surfaces bounding the volume are all planar.
Description and features: Here the capability to generate hybrid mesh (hexahedron + tetrahedrons) along with 1:1 interface is explained. Creation of surface by extrusion with twisting is visible. The mesh has also been generated by extrude feature. This example also demonstrates application of including a *.geo file into another GMSH *.geo file.
The functionality presented in this tutorial can be used to generate following two meshes with extrude feature. The main *.geo file can be downloaded from here. The section of the pipe is generated by this file.
The main *.geo file can be downloaded from here. The section of the pipe is generated by this file.
Note the following:
Description and features: This tutorial explains usage of curve primitives other than straight lines such as arcs, splines, B-splines, circular and elliptical arcs ...
Description and features: The usage of loop to create geometrical entities, arrays to store variables and application of user-defined macro is explained in this example.
Description and features: The generation of structured mesh using transfinite interpolation is explained through this tutorials. Optinally, elliptical smoothing can be used to smoothen the grid but (like any smoothing operation) it may not necessarily improve the quality of the mesh.
Description and features: The tutorials 7, 8 and 9 demonstrates post-processig capabilities of GMSH.
The content on CFDyna.com is being constantly refined and improvised with on-the-job experience, testing, and training. Examples might be simplified to improve insight into the physics and basic understanding. Linked pages, articles, references, and examples are constantly reviewed to reduce errors, but we cannot warrant full correctness of all content.
Template by OS Templates