Version:

salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy

salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy salvus mesh layered_meshing meshing_protocol coarsening_policy
Inter- and Intralayer coarsening policies.

Classes

InterlayerCoarseningPolicy

Policies for coarsening between model layers. Doubling, tripling, etc.
SIGNATURE
class InterlayerCoarseningPolicy(abc.ABC):
    def __init__(self) -> None: ...

Methods

InterlayerCoarseningPolicy.interlayer_connector()
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.
SIGNATURE
def interlayer_connector(
    self,
    l0: tuple[list[int], int],
    l1: tuple[list[int], int],
    cs: CoordinateSystem,
    layer_bounds: dict[str, tuple[float, float]],
) -> tuple[
    list[tuple[int, _InterlayerConnectorProtocol]],
    list[tuple[int, _InterlayerConnectorProtocol]],
]: ...
ARGUMENTS
Required
l0
Type:tuple[list[int], int]
Description:
Tuple of: (list of number of elements in each horizontal direction, number of vertical elements) in the top layer.
Required
l1
Type:tuple[list[int], int]
Description:
Tuple of: (list of number of elements in each horizontal direction, number of vertical elements) in the bottom layer.
Required
cs
Type:CoordinateSystem
Description:
The coordinate system.
Required
layer_bounds
Type:dict[str, tuple[float, float]]
Description:
The bounds of the associated layer.
InterlayerCoarseningPolicy.interlayer_constraint()
Constraint on the number of horizontal elements in two adjacent layers.
SIGNATURE
def interlayer_constraint(
    self, a: list[cp_model.IntVar], b: list[cp_model.IntVar]
) -> list[list[cp_model.BoundedLinearExpression]]: ...
ARGUMENTS
Required
a
Type:list[cp_model.IntVar]
Description:
Number of elements in layer a.
Required
b
Type:list[cp_model.IntVar]
Description:
Number of elements in layer b.

IntralayerCoarseningPolicy

Policies for coarsening within model layers. Vertical refinements, etc.
SIGNATURE
class IntralayerCoarseningPolicy(abc.ABC):
    def __init__(
        self,
        fixed_horizontal_element_boundaries: (
            list[float] | list[list[float]] | None
        ) = None,
        min_layer_thickness: float | None = None,
    ): ...
ARGUMENTS
Optional
fixed_horizontal_element_boundaries
Type:list[float] | list[list[float]] | None
Default value:None
Description:
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.
Optional
min_layer_thickness
Type:float | None
Default value:None
Description:
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

IntralayerCoarseningPolicy.basic_block()
Get the intralayer mesh block.
May return an empty list if it is detected that the connector blocks already span the entire layer.
SIGNATURE
def basic_block(
    self,
    elem_p_wav: tuple[float, ...],
    n_elm_h: list[int],
    n_elm_c: int,
    i_bot: Interface,
    i_top: Interface,
    b_flat: float,
    t_flat: float,
    mw: _pd.realized.RealizedParameter,
    cs: CoordinateSystem,
) -> list[MeshBlock]: ...
ARGUMENTS
Required
elem_p_wav
Type:tuple[float, ...]
Description:
The number of elements per wavelength.
Required
n_elm_h
Type:list[int]
Description:
The number of elements in the horizontal directions.
Required
n_elm_c
Type:int
Description:
The total number of elements in the connectors.
Required
i_bot
Type:Interface
Description:
The bottom bounding interface.
Required
i_top
Type:Interface
Description:
The top bounding interface.
Required
b_flat
Type:float
Description:
The bottom elevation, accounting for connectors.
Required
t_flat
Type:float
Description:
The top elevation, accounting for connectors.
Required
mw
Type:_pd.realized.RealizedParameter
Description:
The minimum wavelengths.
Required
cs
Type:CoordinateSystem
Description:
The coordinate system.

Submodules

Used in tutorials

Functionality from this module is used in the following tutorials.
PAGE CONTENTS