This is an old revision of the document!
Reading gmsh files
Meshes (files with extension
.geo
or .msh
) generated by gmsh can be imported in Metafor. This is a very easy way to define a mesh (and groups of nodes or elements) when the geometry of the model is too difficult to be modelled with the tools available in Metafor.
The “physical groups” that have been defined in gmsh (i.e. list of nodes for the boundary conditions, or list of elements for multi-material simulations) are translated into Groups
in Metafor.
In practice, the gmsh file (extension .msh
) must be imported in Metafor with the commands:
from toolbox.gmsh import GmshImport importer = GmshImport(filename, domain) importer.setOrder(order=1) importer.setOpti(opti=True) importer.setAlgo(algo='default') importer.execute()
with
filename | str | filename including .msh or .geo extension |
domain | Domain | domain used to store the mesh |
order | int | order of the elements [default=1] |
opti | bool | activate mesh optimisation [default=True] |
algo | str | activate mesh optimisation [default='default'] |
If the file extension is .geo
(corresponding to a gmsh script instead of a mesh), gmsh is executed automatically by Metafor and the script is read to produce a mesh file in the workspace directory.
gmsh.exe
is not reachable from Metafor
. The easiest way to solve this problem is to manually copy gmsh.exe
in the same folder as Metafor.exe
(e.g. in c:\Program Files\Metafor
).
Examples can be found in apps.externalMeshers.gmshtestXX