salvus.mesh.layered_meshing.utils.flood
Functions relating to flooding layers.
Functions
flood()
flood()def flood(
layer: salvus.mesh.layered_meshing.layered_model.layer.Layer,
flood_from: Union[
float,
salvus.mesh.layered_meshing.interface.Depth,
salvus.mesh.layered_meshing.interface.Height,
],
flood_direction: Literal[("up", "down")],
new_layer_bounds: Optional[
salvus.mesh.layered_meshing.layered_model.layer.LayerBounds
] = None,
) -> salvus.mesh.layered_meshing.layered_model.layer.Layer:
...Flood a layer.
Flooding in this context refers to first splitting the representation of a material’s parameters at a user-defined vertical coordinate. On either side of this coordinate value the parameter is then populated by:
1. The parameter's values as evaluated at the vertical coordinate, or
2. The parameter's original values, unchanged.
For instance, given parameter values of [1.0, 1.5, 2.0] which correspond
to vertical locations of [0.0, 0.5, 1.0] respectively, flooding “upwards”
from a vertical coordinate of 0.5 would result in the model [1.0, 1.5,
1.5], while flooding “downwards” would result in the model [1.5, 1.5, 2.0].
All parameter types can be flooding. More specifically:
Constant Parameters
The flooding of constant parameters is trivial, as they have no vertical coordinate to slice. As such, they are simply returned as-is.
Discrete Parameters
The input parameter can contain absolute or relative coordinates. If a
vertical coordinate is present in the parameter’s representation, the
parameter will be returned with all values on one side of flood_from
coming from the input model, with all parameters on the other side set to
the value of the parameter evaluated along the flooding plane. If no
vertical coordinate is present, the parameter will be returned as it was
passed in.
Important to note is that this function does not (currently) add the flooding plane coordinate / value to the returned parameter. This additional functionality is planned when considering parameters using absolute vertical coordinates, or those using relative coordinates between two flat interfaces. Considering the case involving deformed bounding interfaces and relative coordinates requires the presence of two separate relative coordinate systems, and as such requires a full split of the relevant layer.
Analytic Parameters
The input parameter must contain absolute coordinates. If a vertical
coordinate is present in the parameter’s representation, a new analytic
parameter which is flooded via the use of a sympy.Piecewise(...)
representation will be returned. If no vertical coordinate is present, the
analytic parameter will be returned as it was passed in.
layersalvus.mesh.layered_meshing.layered_model.layer.Layer — The layer to flood.flood_fromUnion[float, salvus.mesh.layered_meshing.interface.Depth, salvus.mesh.layered_meshing.interface.Height] — The vertical coordinate from which to flood the layer’s parameters.flood_directionLiteral[('up', 'down')] — The direction with which to flood, can be"up"or"down".new_layer_boundsOptional[salvus.mesh.layered_meshing.layered_model.layer.LayerBounds] — The bounds of the layer post-flooding. Can be different than the layer’s current bounds. IfNone, will default to the layer’s current bounds.
new_layer_bounds.