Local:Mesh generation with gmsh

From AMCGMedia

Jump to: navigation, search

gmsh is a versatile 1-, 2- and 3- dimensional mesh generator which may be used to generate meshes for use with fluidity. Gmsh is particularly suitable for setting up idealised test cases and industrial type problems in which the domain is composed of flat surfaces and simple curves.


Installing and running gmsh

Installing gmsh

Gmsh is included in both Debian and Ubuntu and can be installed on any amcg workstation using:

wajig install gmsh

Invoking gmsh

Unsurprisingly, gmsh is run on the command line by typing "gmsh". It is also possible to run gmsh on a previously output .geo file.

Generating meshes

Before reading this section you may wish to look at the gmsh tutorial

Gmsh files

Gmsh outputs two sorts of files:

.geo files
describe the geometry of the domain including both geometric and physical entity labels.
.msh files
contain the output mesh. These are converted to triangle format for input to fluidity.

Converting msh files to triangle format

The gmsh2triangle script in the tools directory converts msh files to triangle format, which is supported by Fluidity. If you are generating a 2 dimensional mesh, the default behaviour is to still output 3 dimensional positions. If you require 2d positions in this case (most people will) then you need to supply the --2d option to gmsh2triangle.

Elementary entities and physical groups

Elementary entities are the geometric building blocks of the domain: points, lines, surfaces, volumes and so on. These are used by gmsh and are reported in the .msh file but are not used by fluidity.

In contrast, physical groups attach labels to groups of elementary entities. It is important that all the boundaries in your mesh as well as the whole interior of the domain are assigned to physical groups. The physical group numbers are transmitted via the .msh and triangle files to fluidity. In fluidity the entries in the boundary surface_id lists correspond to these numbers. They are therefore essential for prescribing boundary conditions to the problem.

If any part of the domain or boundary does not belong to a physical group then the relevant elements will not be output to the mesh file and your problem will almost certainly crash.

Further information

The gmsh website and reference manual.

This page was last modified on 26 October 2011, at 12:31. This page has been accessed 4,828 times.