Skip to content

Mesh

GUERNICA is built on top of MFEM and inherits its meshing infrastructure. In practice, this means that any mesh format supported by MFEM can also be used by GUERNICA. More information on MFEM mesh formats can be found in the MFEM mesh format documentation.

At present, GUERNICA supports 2D quadrilateral meshes only.

Location and usage

Meshes live in the mesh/ directory.

The mesh used for a simulation is set in the input file under [grid]:

ini [grid] mesh = mesh/<name>

A copy of the mesh in MFEM .mesh format is saved to the output directory for each run with the name ex9.mesh.

MFEM .mesh structure

MFEM .mesh files are split into five sections:

  • dimension
  • elements
  • boundary
  • vertices
  • nodes

Each section is described below in the context of GUERNICA.

dimension

For GUERNICA, the dimension must currently be:

text dimension 2

Only 2D meshes are supported.

elements

The elements section first lists the number of elements.

Each element is then defined as:

text <attribute> <geometry type> <vertex 0> <vertex 1> <vertex 2> <vertex 3>

For GUERNICA, these must be quadrilateral elements. The vertices should be listed starting at one corner and then proceeding anti-clockwise around the quad.

boundary

The boundary section first lists the number of non-periodic boundary faces.

Each boundary face is then defined as:

text <attribute> <geometry type> <vertex 0> <vertex 1>

The ordering of boundary vertices should stay consistent throughout the entire mesh. For example, if one boundary edge is defined anti-clockwise, all boundary edges should follow that same convention.

Boundary attributes can be used to define different boundary conditions in the input file through: text [boundaries:<name>] attrs =

vertices

The vertices section lists the number of unique vertices.

nodes

The nodes section starts with:

text nodes FiniteElementSpace FiniteElementCollection: H1_2D_P1 VDim: 2 Ordering: 1

The FiniteElementCollection can be either:

  • H1_2D_P1
  • L2_T1_2D_P1

L2_T1_2D_P1

L2_T1_2D_P1 must be used when dealing with periodic boundary conditions.

It can still be used even without any periodic boundary conditions, but this is not recommended, since H1_2D_P1 is a little more straightforward.

Periodic boundary conditions are not handled explicitly by GUERNICA, so they are not defined in the boundary section of either the mesh or the input file. Instead, they are handled implicitly in the mesh by using shared vertices.

For L2_T1_2D_P1, the nodes are listed in groups of 4 for each element:

  1. one starting vertex,
  2. the two vertices connected to that first vertex,
  3. the final vertex, which is the one not connected directly to the first vertex.

H1_2D_P1

H1_2D_P1 cannot be used when periodic boundary conditions are desired.

It should be used when there are no periodic boundary conditions.

For H1_2D_P1, the nodes are listed in accordance with their numbering as defined in the elements and boundary sections. That is, node 0 goes first, followed by node 1, followed by node 2, and so on.

Practical notes

  • GUERNICA currently supports only 2D quad meshes.
  • Meshes live in mesh/.
  • The simulation mesh is set through [grid] mesh = mesh/<name>.
  • A copy of the mesh is written to the output directory as ex9.mesh.
  • Boundary attributes are used to assign boundary conditions in the input file.
  • H1_2D_P1 should be used for non-periodic meshes.
  • L2_T1_2D_P1 must be used for periodic meshes.

Gmsh meshes

WIP