ElmerIce meshing tools
This directory contains meshing tools designed to facilitate the mesh generation of real system and the interaction with GIS software.
An example demonstrating the use of Contour2geo.py and MeshToShp.py can be found here
Contour2geo.py
USAGE :
Generate a Gmsh geometry file (.geo) from a closed contour.
The contour can be provided as :
an ASCII file with x,y coordinates.
a shapefile: either a single polygon or a collection of polylines.
By default the contour is a Gmsh compound line, i.e. the mesh will exactly follow the contour nodes. In case of a very complex curved contour it might be interesting to simplify the contour, to avoid over-refinement.
Splines can be used with the argument --spline, but it may be less accurate to really track the contour and may leed to loops.
The mandatory -r argument prescribe the uniform mesh resolution. The mesh size is prescribed at the boundary nodes and by prescribing a uniform background field.
Once created the .geo can be edited to change the default values (see Gmsh documentation).
Mesh your file using:
If the input file contains only one feature (ASCII file or shapefile with 1 polygon or 1 polyline), there will be only one boundary condition type. Otherwise (in case of several polylines) each feature will be attributed a physical identification.
If there is several polylines they must form an ordered closed contour. If the attribute BC (integer) is present, the program will use this attribute BC to order the lines as shown in the picture:
In general, the workflow in a GIS software will be as follow:
Create a polygon feature of you domain
Convert the polygon to lines
Split the lines where you want to define different boundary conditions
Check that all the lines have the same orientation (you can reverse the orientation of the lines)
Enventualy create the attribute BC (integer) and give the value so that the BC form a continuous closed contour
MeshToShp.py
USAGE :
Generate shapefiles for the boundaries (polyline) and elements (polygons) from a serial 2D Elmer mesh stored under
Shapefiles are stored under a new directory _shp.
Attributes are:
BodyId or BCId: the body or BC identification
etype : the element type
enum : the element number