Mondaic
This API reference is not for the latest stable Salvus version.

salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy

Inter- and Intralayer coarsening policies.

Functions

no_filter()

def no_filter(
    p: salvus.mesh.layered_meshing.material.parameter._GenericParameterType,
) -> salvus.mesh.layered_meshing.material.parameter._GenericParameterType:
    ...

Identity function returning the oracle as-is.

Parameters
  • p salvus.mesh.layered_meshing.material.parameter._GenericParameterType — The oracle.
Returns salvus.mesh.layered_meshing.material.parameter._GenericParameterType

Classes

InterlayerCoarseningPolicy

class InterlayerCoarseningPolicy(builtins.object):
    def __init__(self) -> None:
        ...

Policies for coarsening between model layers. Doubling, tripling, etc.

Methods
interlayer_connector()
def interlayer_connector(
    self,
    l0: Tuple[List[int], int],
    l1: Tuple[List[int], int],
    cs: salvus.project.components.types.CoordinateSystem,
    layer_bounds: Dict[str, Tuple[float, float]],
) -> Tuple[
    List[
        Tuple[
            int,
            Union[
                salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy._InterlayerConnectorProtocol2D,
                salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy._InterlayerConnectorProtocol3D,
            ],
        ]
    ],
    List[
        Tuple[
            int,
            Union[
                salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy._InterlayerConnectorProtocol2D,
                salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy._InterlayerConnectorProtocol3D,
            ],
        ]
    ],
]:
    ...

Callable which returns a MeshBlock that connects two layers.

A tuple of lists of tuple is returned, the first element of which is the number of connecting mesh blocks that need to be constructed. For instance, if the interlayer policy is “doubling”, and the number of elements between two layers different by a factor 4, the first element of the returned tuple should be 2. The second element is a partial function with the n_elem_ arguments already applied, and which can then subsequently be called with extents.

A tuple is returned, the first element specifying the connectors required for the layer’s top, and the second for the layer’s bottom.

Parameters
  • l0 Tuple[List[int], int] — Tuple of: (list of number of elements in each horizontal direction, number of vertical elements) in the top layer.
  • l1 Tuple[List[int], int] — Tuple of: (list of number of elements in each horizontal direction, number of vertical elements) in the bottom layer.
  • cs salvus.project.components.types.CoordinateSystem — The coordinate system.
  • layer_bounds Dict[str, Tuple[float, float]] — The bounds of the associated layer.
Returns Tuple[List[Tuple[int, Union[salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy._InterlayerConnectorProtocol2D, salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy._InterlayerConnectorProtocol3D]]], List[Tuple[int, Union[salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy._InterlayerConnectorProtocol2D, salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy._InterlayerConnectorProtocol3D]]]] — A tuple of (num_required_connectors, ConnectorProtocol).
interlayer_constraint()
def interlayer_constraint(
    self,
    a: List[ortools.sat.python.cp_model.IntVar],
    b: List[ortools.sat.python.cp_model.IntVar],
) -> List[List[ortools.sat.python.cp_model.BoundedLinearExpression]]:
    ...

Constraint on the number of horizontal elements in two adjacent layers.

Parameters
  • a List[ortools.sat.python.cp_model.IntVar] — Number of elements in layer a.
  • b List[ortools.sat.python.cp_model.IntVar] — Number of elements in layer b.
Returns List[List[ortools.sat.python.cp_model.BoundedLinearExpression]] — Constraint on the number of elements.

IntralayerCoarseningPolicy

class IntralayerCoarseningPolicy(builtins.object):
    def __init__(
        self,
        fixed_horizontal_element_boundaries: Optional[
            List[float], List[List[float]]
        ] = None,
        min_layer_thickness: Optional[float] = None,
    ):
        ...

Policies for coarsening within model layers. Vertical refinements, etc.

Construct a new intralayer coarsening policy.

Parameters
  • fixed_horizontal_element_boundaries Optional[List[float], List[List[float]]] — An optional array of horizontal coordinate values where fixed element boundaries should occur. Useful for respecting the mesh of simple vertical structures and the like. For 3-D meshes one can pass a list of lists of values, which correspond to the first and second coordinate axes (i.e x and y) respectively.
  • min_layer_thickness Optional[float] — If a float is specified here, mask out all elements in this layer where the layer thickness is less than this value. Useful for masking out elements in shallow water layers.
Methods
basic_block()
def basic_block(
    self,
    elem_p_wav: Tuple[float, ...],
    n_elm_h: List[int],
    n_elm_c: int,
    i_bot: salvus.mesh.layered_meshing.interface.Interface,
    i_top: salvus.mesh.layered_meshing.interface.Interface,
    b_flat: float,
    t_flat: float,
    mw: salvus.mesh.layered_meshing.material.parameter._RealizedParameter,
    cs: salvus.project.components.types.CoordinateSystem,
) -> List[salvus.mesh.mesh_block.mesh_block.MeshBlock]:
    ...

Get the intralayer mesh block.

May return an empty list if it is detected that the connector blocks already span the entire layer.

Parameters
  • elem_p_wav Tuple[float, ...] — The number of elements per wavelength.
  • n_elm_h List[int] — The number of elements in the horizontal directions.
  • n_elm_c int — The total number of elements in the connectors.
  • i_bot salvus.mesh.layered_meshing.interface.Interface — The bottom bounding interface.
  • i_top salvus.mesh.layered_meshing.interface.Interface — The top bounding interface.
  • b_flat float — The bottom elevation, accounting for connectors.
  • t_flat float — The top elevation, accounting for connectors.
  • mw salvus.mesh.layered_meshing.material.parameter._RealizedParameter — The minimum wavelengths.
  • cs salvus.project.components.types.CoordinateSystem — The coordinate system.
Returns List[salvus.mesh.mesh_block.mesh_block.MeshBlock] — The mesh block.

LocalRefinementPolicy

class LocalRefinementPolicy(builtins.object):
    def __init__(
        self,
        f: Callable[
            [salvus.mesh.unstructured_mesh.UnstructuredMesh], numpy.ndarray
        ],
        refinement_level: int = 1,
        refinement_style: str = "unstable",
        unique_points_tolerance: int = 8,
    ) -> None:
        ...

Pass information regarding local refinement to the Layered Mesher.

Parameters
  • f Callable[[salvus.mesh.unstructured_mesh.UnstructuredMesh], numpy.ndarray] — A callable returning a boolean mask dictating where to refine. See documentation of __call__ below.
  • refinement_level int — How many times to refine the mesh. See documentation of unstructured_mesh.refine_locally(...) for more information. If None, will be automatically determined from fac.
  • refinement_style str — Which refinement style to use. See documentation of unstructured_mesh.refine_locally(...) for more information. If None, will be automatically determined based on the value of refinement_level.
  • unique_points_tolerance int — The number of decimal digits used to determine unique points in the refined mesh.

OracleFilter

class OracleFilter(typing_extensions.Protocol):
    def __init__(self):
        ...

A protocol which wavelength oracle filter callbacks must respect.

Submodules