Mondaic

salvus.mesh.layered_meshing.detail.mesh_from_domain

salvus.mesh.layered_meshing.detail.mesh_from_domain salvus mesh layered_meshing detail mesh_from_domain

Mesh from domain.

Functions

create_layered_mesh()

def create_layered_mesh(
    d: domain_module.Domain,
    mp: MeshingProtocol,
    mr: MeshResolution,
    timer: Timer | None = None,
    verbosity: int = 1,
) -> tuple[domain_module.Domain, UnstructuredMesh, LayeredModel]: ...

Create a mesh.

This function serves as the central entry point for constructing a mesh from a LayeredModel, which is here wrapped inside a MeshingProtocol. In addition to returning the constructed mesh, the supplied LayeredModel will also be returned, after “realization”. This is useful, for instance, to then interpolate material parameters onto the mesh.

Parameters
  • d domain_module.Domain — The mesh’s domain.
  • mp MeshingProtocol — The meshing protocol.
  • mr MeshResolution — The desired mesh resolution.
  • timer Timer | None — Execution timer.
  • verbosity int — The verbosity level. Set to > 1 for more verbose output.
Returns tuple[domain_module.Domain, UnstructuredMesh, LayeredModel] — A tuple of an mesh and a realized layered model.

future_mesh_from_domain()

def future_mesh_from_domain(
    domain: Domain,
    model: Material | LayeredModel | MeshingProtocol,
    mesh_resolution: MeshResolution,
    model_override: Material | str | None = None,
    execution_policy: bindings.ExecutionPolicy = salvus._core.lib.salvus_core_python_bindings.ExecutionPolicy,
    timer: Timer | None = None,
    verbosity: int = 1,
) -> Mesh: ...

Create a Mesh from a domain.

This is an experimental alternative to mesh_from_domain that creates a block-wise mesh from a layered model.

The blocks will be constructed per entry in the layered model. This interface WILL NOT ATTACH the legacy fields fluid or block, as those are now fully defined block-wise, and not element-wise.

Parameters
  • domain Domain — The mesh’s domain.
  • model Material | LayeredModel | MeshingProtocol — 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.
  • 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.
  • execution_policy bindings.ExecutionPolicy — Execution policy governing the maximum allowable parallelism of child routines.
  • timer Timer | None — Execution timer.
  • verbosity int — The verbosity level. Set it to > 1 to get more detailed timing information.
Returns Mesh

interpolate_model()

def interpolate_model(
    mesh_resolution: MeshResolution,
    mesh: UnstructuredMesh,
    models: list[Material],
    execution_policy: bindings.ExecutionPolicy = salvus._core.lib.salvus_core_python_bindings.ExecutionPolicy,
) -> UnstructuredMesh: ...

Interpolates material parameters onto a mesh and identifies fluid elements.

This function processes a given domain and a list of material models, interpolating their parameters onto the provided mesh. It also identifies fluid elements in the mesh based on the type of material model.

Parameters
  • mesh_resolution MeshResolution — An object containing mesh resolution and precision details.
  • mesh UnstructuredMesh — The mesh object to which the material parameters will be interpolated.
  • models list[Material] — A list of material models, where each model corresponds to a block in the mesh.
  • execution_policy bindings.ExecutionPolicy — Execution policy governing the maximum allowable parallelism of child routines.
Returns UnstructuredMesh — The updated mesh object with interpolated material parameters and a “fluid” field indicating fluid elements.

mesh_from_domain()

def mesh_from_domain(
    domain: Domain,
    model: Material | LayeredModel | MeshingProtocol,
    mesh_resolution: MeshResolution,
    model_override: Material | str | None = None,
    execution_policy: bindings.ExecutionPolicy = salvus._core.lib.salvus_core_python_bindings.ExecutionPolicy,
    timer: Timer | None = None,
    verbosity: int = 1,
) -> UnstructuredMesh: ...

Create a mesh.

Construct a mesh from a domain and meshing protocol that aims to respect a desired mesh resolution. In addition to mesh creation, this function will also interpolate model parameters and find side sets, returning a mesh that is ready for a Salvus simulation

Parameters
  • domain Domain — The mesh’s domain.
  • model Material | LayeredModel | MeshingProtocol — 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.
  • 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.
  • execution_policy bindings.ExecutionPolicy — Execution policy governing the maximum allowable parallelism of child routines.
  • timer Timer | None — Execution timer.
  • verbosity int — The verbosity level. Set it to > 1 to get more detailed timing information.
Returns UnstructuredMesh — A mesh ready for simulation.