Mondaic

salvus.mesh.algorithms.distributed_mesh.mesh_from_domain_mpi

salvus.mesh.algorithms.distributed_mesh.mesh_from_domain_mpi salvus mesh algorithms distributed_mesh mesh_from_domain_mpi

An MPI version of mesh_from_domain().

Functions

distributed_mesh_from_mesh()

def distributed_mesh_from_mesh(
    comm: int,
    mesh: Mesh | UnstructuredMesh | None,
    timer: Timer | None = None,
    verbosity: int = 1,
) -> DistributedMesh: ...

Convert a local mesh on rank 0 to a distribute mesh on multiple ranks.

Parameters
  • comm int — int,
  • mesh Mesh | UnstructuredMesh | None — The mesh
  • timer Timer | None — Execution timer.
  • verbosity int — The verbosity level.
Returns DistributedMesh

mesh_from_domain_mpi()

def mesh_from_domain_mpi(
    comm: int,
    domain: domain_module.Domain | None,
    model: Material | LayeredModel | MeshingProtocol | None,
    mesh_resolution: MeshResolution,
    model_override: Material | str | None = None,
    execution_policy: bindings.ExecutionPolicy = salvus._core.lib.salvus_core_python_bindings.ExecutionPolicy,
    mesh_postprocessing_callback_function: (
        typing.Callable[[Mesh], Mesh] | None
    ) = None,
    timer: Timer | None = None,
    verbosity: int = 1,
    diagnostic_output_directory: pathlib.Path | None = None,
    interior_deformation_order: int | None = None,
) -> DistributedMesh: ...

Create a distributed mesh on multiple ranks, avoiding duplicate work.

An MPI version of mesh_from_domain(). Note that some arguments only need to be provided on the root rank. If so, computational cost on the system as a whole can be reduced by avoiding creating of large objects on the remaining ranks at the call site.

Parameters
  • comm int — The MPI communicator to use.
  • domain domain_module.Domain | None — The mesh’s domain. Can be None on non-root ranks.
  • model Material | LayeredModel | MeshingProtocol | None — Either a single Material, a LayeredModel, or a MeshingProtocol. If either a Material or a LayeredModel is passed, it will internally be wrapped in a default MeshingProtocol. For complete control over the meshing algorithms and associated policies, pass a MeshingProtocol object that contains the LayeredModel you would like to mesh. The model only needs to be passed on rank 0. Pass None on the other ranks, although it will be ignored if passed, even if different per rank.
  • mesh_resolution MeshResolution — The desired mesh resolution.
  • model_override Material | str | None — A single material instance that will override the size functions that the mesh has been built with. Alternatively the string “skip_model_interpolation” can be passed here which will return a mesh with no model parameters attached. Currently not supported in distributed meshing.
  • execution_policy bindings.ExecutionPolicy — Execution policy governing the maximum allowable parallelism of child routines.
  • mesh_postprocessing_callback_function typing.Callable[[Mesh], Mesh] | None — Optional callback function that takes a single Mesh as input and returns a possibly modified Mesh. This function will be applied on each chunk after it has been built, and finally also on the embedding mesh.
  • timer Timer | None — Execution timer.
  • verbosity int — The verbosity level.
  • diagnostic_output_directory pathlib.Path | None — If set, meshes with invalid Jacobians will be written to this directory for debugging purposes.
  • interior_deformation_order int | None — Initial polynomial order used to interpolate boundary deformations into the element interior during interface reinterpolation. The backend currently only accepts 1 or mesh.shape_order. If None (default), the backend default is used (the mesh’s own shape order). If any rank still has invalid Jacobians after reinterpolation at this order, the order is automatically swept to the other allowed value on the failing ranks. Setting this explicitly only changes the starting point of the sweep; the same automatic recovery still applies.
Returns DistributedMesh