Mondaic

salvus.mesh.layered_meshing.meshing_protocol.refinement_policy.simple_post_refinement

salvus.mesh.layered_meshing.meshing_protocol.refinement_policy.simple_post_refinement salvus mesh layered_meshing meshing_protocol refinement_policy simple_post_refinement

Apply simple post-refinement to a layered model.

Functions

simple_post_refinement()

def simple_post_refinement(
    layered_model: LayeredModel,
    domain: _domain.Domain,
    fac: float | typing.Sequence[float] | None = None,
    restrict: int | list[int] | None = None,
    refinement_style: str | None = None,
    refinement_level: int | None = None,
    unique_points_tolerance: int = 8,
    enclosing_elements_method: str = "inverse_coordinate_transform",
) -> tuple[list[filters.OracleFilter], list[LocalRefinementPolicy]]: ...

Get structures used to refinements to regions with shorter wavelengths.

Mesh refinement in Salvus is a global operation, and therefore can only take place once a “template” mesh is generated. If local refinements are desired, then it is helpful to clip, or filter, a material’s wavelength oracle to a minimum value during mesh generation time. Subsequently, it is then desirable to apply local refinements to the regions that were clipped, in order to respect the true values of the minimum wavelength in that region.

This function returns a (List[OracleFilter], LocalRefinementPolicy) tuple that streamlines a common case for the application of local refinements. The length of the list of OracleFilters is the same length as the number of layers in the model. The OracleFilter returned can be used as an argument to a MeshingProtocol’s oracle_filter parameters, which will clip the minimum value of each layer wavelength oracle as described above. The LocalRefinementPolicy will find mark all the points that were clipped for refinement, and can be passed as an argument to a MeshingProtocol’s local_refinement_policy argument.

fac refers to the multiple of an oracle’s minimum value below which refinements will be applied. The local refinements in Salvus effectively reduce the edge length in each dimension by a factor of 3, leading to 9 elements per unit volume in 2-D, and 27 elements per unit volume in 3-D. Therefore, the natural value, and default, for fac is 3.0, as after refinement the elements-per-wavelength criterion will be approximately met.

Kwargs is a list of keyword arguments to pass to get_enclosing_elements.

Parameters
  • layered_model LayeredModel — The layered model to generate refinement structures for.
  • domain _domain.Domain — The domain as the model will potentially need to be realized.
  • fac float | typing.Sequence[float] | None — The factor above an oracle’s minimum at which to clip. Defaults to 3.0.
  • restrict int | list[int] | None — Only generate policies for these layers, and use pass-through for the others. If None, generate policies for all layers. Defaults to None.
  • refinement_style str | None — Which refinement style to use. See documentation of salvus_mesh.refine_locally(...) for more information. If None, will be automatically determined based on the value of refinement_level.
  • refinement_level int | None — How many times to refine the mesh. See documentation of salvus_mesh.refine_locally(...) for more information. If None, will be automatically determined from fac.
  • unique_points_tolerance int — The number of decimal digits used to determine unique points in the refined mesh.
  • enclosing_elements_method str — The method to use for the enclosing elements search, can be either “inverse_coordinate_transform” or “bounding_box”. “inverse_coordinate_transform” is more accurate but may be significantly more expensive than “bounding_box”.
Returns tuple[list[filters.OracleFilter], list[LocalRefinementPolicy]] — A tuple of the (List[OracleFilter], LocalRefinementPolicy).

Used in tutorials