Meshing#

class Mesh(mesh=None, volume_markers=None, surface_markers=None, type='cartesian')[source]#

Bases: object

Mesh class

Parameters:
  • mesh (fenics.Mesh, optional) – the mesh. Defaults to None.

  • volume_markers (fenics.MeshFunction, optional) – markers of the mesh cells. Defaults to None.

  • surface_markers (fenics.MeshFunction, optional) – markers of the mesh facets. Defaults to None.

  • type (str, optional) – “cartesian”, “cylindrical” or “spherical”. Defaults to “cartesian”.

Variables:
  • mesh (fenics.Mesh) – the mesh

  • volume_markers (fenics.MeshFunction) – markers of the mesh cells

  • surface_markers (fenics.MeshFunction) – markers of the mesh facets

  • dx (fenics.Measure)

  • ds (fenics.Measure)

define_measures()[source]#

Creates the fenics.Measure objects for self.dx and self.ds

class Mesh1D(**kwargs)[source]#

Bases: Mesh

1D Mesh

Variables:
  • size (float) – the size of the 1D mesh

  • start (float) – the starting point of the 1D mesh

define_markers(materials)[source]#

Iterates through the mesh and mark them based on their position in the domain

Parameters:

materials (materials {festim.Materials} -- contains the)

define_measures(materials)[source]#

Creates the fenics.Measure objects for self.dx and self.ds

define_surface_markers()[source]#

Creates the surface markers

Returns:

the meshfunction containing the surface

markers

Return type:

fenics.MeshFunction

define_volume_markers(materials)[source]#

Creates the volume markers

Parameters:

materials (festim.Materials) – the materials

Returns:

the meshfunction containing the volume

markers

Return type:

fenics.MeshFunction

class MeshFromVertices(vertices, **kwargs)[source]#

Bases: Mesh1D

Description of MeshFromVertices

Parameters:

vertices (list) – the mesh vertices

Variables:
  • vertices (list) – the mesh vertices

  • size (type) – the size of the 1D mesh

generate_mesh_from_vertices()[source]#

Generates a 1D mesh

class MeshFromXDMF(volume_file, boundary_file, **kwargs)[source]#

Bases: Mesh

Mesh read from XDMF files

Parameters:
  • volume_file (str) – path to the volume file

  • boundary_file (str) – path the boundary file

Variables:
  • volume_file (str) – name of the volume file

  • boundary_file (str) – name of the boundary file

  • mesh (fenics.Mesh) – the mesh

define_markers()[source]#

Reads volume and surface entities from XDMF files