Mapping finite element data between meshes

class pymapping.Mapper(verbose=True)

Class for mapping finite element data between meshes

Parameters:verbose (bool) – Whehter print out progress information
prepare(mesh_source, mesh_target, method='P1P0', intersection_type=None)

Prepare field mapping between meshes, must be run before transfer(). The source mesh must contain the field that you want to transfer to the target mesh.

Parameters:
  • mesh_source (meshio mesh) – Source mesh
  • mesh_target (meshio mesh) – Target mesh
  • method (str) – Mapping methods: P1P0, P1P1, P0P0 or P0P1
  • intersection_type (str) – Intersection algorithm depending on meshes and the method Most used types: Triangulation, PointLocator
transfer(field_name, nature='IntensiveMaximum', default_value=nan)

Transfer field from the source mesh to the target mesh, after prepare().

Parameters:
  • field_name (str) – Name of the field defined in the source mesh
  • nature (str) – Physical nature of the field (IntensiveMaximum, IntensiveConservation, ExtensiveMaximum or ExtensiveConservation)
  • default_value (float) – Default value when mapping is not possible
pymapping.cleanup_mesh_meshio(mesh)

Drop all cells with a lower dimension from a meshio mesh

class pymapping.MappingResult(field_target, mesh_target=None)

Container class for mapped field on the target mesh

array()

Return the numpy array of the mapped field

discretization_points()

Return the location of discretization points on which the field array is defined

export_vtk(vtkfile)

Export the mapped field to a VTK file

mesh_meshio()

Return the meshio mesh object containing the mapped field

pymapping.mesh_mc_from_meshio(mesh, check=False)

Convert a meshio mesh to a medcoupling mesh

Parameters:
  • mesh (meshio mesh) – Mesh object
  • check (bool) – Check if the medcoupling mesh is consist
pymapping.field_mc_from_meshio(mesh, field_name, on='points', mesh_mc=None, nature='IntensiveMaximum')

Convert a meshio field to a medcoupling field

Parameters:
  • mesh (meshio mesh) – Mesh object
  • field_name (str) – Name of the field defined in the meshio mesh
  • on (str) – Support of the field (points or cells)
  • mesh_mc (medcoupling mesh) – MEDCoupling mesh of the current meshio mesh
  • nature (str) – Physical nature of the field (IntensiveMaximum, IntensiveConservation, ExtensiveMaximum or ExtensiveConservation)

Indices and tables