A finite element mesh is a discretisation of a domain \(\Omega\) using different types of elements. The next figure is an example of a mesh composed of different types of elements (quadrangles, triangles, bars and point elements).

alternate text

Fig. 3 A finite element mesh.

Many real life finite element problems use mixed elements to correctly mesh the domain. Also to correctly represent all the quantities needed for the definition of a problem (like material properties and external forces) it is necessary to define subgroups of elements and points. So a real mesh structure can not be reduced only to the points and the elements. Also to keep track of mesh transformations (i.e. extraction, mirroring) a suitable structure is necessary.

In general the operations on meshes (i.e. extraction, integration, export to file) can be grouped by type of elements so it is not necessary to have a very low level class like “Point class” or “Element Class”. In Muscat all homogeneous entities (all triangles for example) are grouped in high level (data oriented) classes. This enable us to work on big chunks of data and leverage the full power of a high level language.

The Muscat.Containers.Mesh.Mesh class of Muscat keeps all this information in a compact but relatively simple structure.

alternate text

Fig. 4 Containers Structure of a Muscat Mesh.

alternate text

Fig. 5 Decomposition of a mesh by nodes and elements.


The nodes (Muscat.Containers.Mesh.Mesh.nodes) (or points) in a mesh are defined by:

The Muscat.Containers.Mesh.Mesh.nodes attribute stores the positions of the nodes (one node per row) (size Nb Nodes x Space Dimensionality). The size of Muscat.Containers.Mesh.Mesh.originalIDNodes must be equal to the number of nodes in the mesh.

The role of the originalIDNodes is double. In the case when the origin of the mesh is a file from disk, it is used to store the “node number” (a concept present in many file formats). In the case when the mesh is a transformation of an initial mesh (extraction for example) the originalIDNodes is used to track the origin (the index) of each entity.


The storage of elements (Muscat.Containers.ElementsContainers.ElementsContainer) is more complex because the information is heterogeneous (e.g. the number of nodes per element is different depending on the type of element).

Each type of element is only defined by its geometrical definition (i.e. linear triangle with 3 points). The mesh in Muscat does not store any information about the physics or any finite element implementation detail (i.e. reduce integration, degree of interpolation of the solution field), making the definition of the mesh relatively simple.

An attribute named Muscat.Containers.Mesh.Mesh.elements (of type Muscat.Containers.ElementsContainers.AllElements), analog to a dictionary in python, stores for each element type all the information.

The class Muscat.Containers.ElementsContainers.AllElements implements the mapping interface. The keys are of type Muscat.Containers.ElementsContainers.ElementContainerLike and the corresponding values are of type (Muscat.Containers.ElementsContainers.ElementsContainer or Muscat.Containers.ElementsContainers.StructuredElementsContainer) containing the connectivity, originalIds and the tags.

The next figure shows the names and the numbering for all the elements supported by Muscat. The vtk numbering is used to facilitate the interoperability with others libraries.

Element names and numbering

Fig. 6 Elements name and numbering (the numbering is the same as vtk for compatibility).

Nodes Tags and Element Tags

Tags Muscat.Containers.Tags.Tag are used to track subsets of nodes or elements in the mesh. Each tag is defined by a string (the name) and the indices of the entities to be captured by the tag. Internally the class Muscat.Containers.Tags.Tag uses a memory buffer and a counter to reduce the number of memory allocation in the case of incrementally adding indices to the tag.

The class Muscat.Containers.Tags.Tags offers a dictionary like interface to easy the interaction with a group of tags.

Element tags are defined locally by element types (for each ElementContainer). This means every ElementContainer has his own Tags independent of the others (using local indices).

alternate text

Fig. 7 Example of tags inside a Quadrangle_4 ElementContainer.

Nodes and Elements Fields

Thess are simple python dictionaries with keys of type str and values of type numpy array. Can be 1D arrays, with size number of nodes/elements, for scalars. Or 2D arrays, with size (number of nodes/elements, number of components), for vectors.


The mesh class contains a dictionary named Muscat.Containers.Mesh.Mesh.props to store user data related to the mesh itself. The values of the dictionary are copied (and sometimes droped) as derivative meshed are generated.

Some keys have special meaning:
  • “IsConstantRectilinear” : True if the mesh is constant Rectilinear

  • “spacing” : a np.array with the spacing in each direction

  • “origin” : a np.array with the origin of the mesh

  • “dimensions” : a np.array with the number of cells in each direction