Version:

salvus.mesh.layered_meshing.detail.realize

salvus.mesh.layered_meshing.detail.realize salvus mesh layered_meshing detail realize
Functions to realize relative coordinates.

Functions

canonicalize_coordinates()

Transform a coordinate array into a form suitable for the layered mesher.
For cartesian coordinates, no transformation is required. Spherical coordinates are transformed to radians, and optionally shifted by pi / 2 to account for differences in coordinate conventions in different parts of Salvus.
SIGNATURE
def canonicalize_coordinates(
    cs: CoordinateSystem,
    coords: npt.NDArray,
    shift_longitude_pi_2: bool = False,
    convert_to_colat: bool = False,
) -> npt.NDArray: ...
ARGUMENTS
Required
cs
Type:CoordinateSystem
Description:
The coordinate system.
Required
coords
Type:npt.NDArray
Description:
The coordinates.
Optional
shift_longitude_pi_2
Type:bool
Default value:False
Description:
Subtract pi/2 to the longitude coordinate after conversion to radians. Only relevant for 2-D spherical systems.
Optional
convert_to_colat
Type:bool
Default value:False
Description:
Convert latitude values (-90.0 to +90.0 degrees) to colatitude values (0.0 to +180.0 degrees).
RETURNS
Return type: npt.NDArray
The coordinates in their internal form.

compute_elevation()

Realize a relative elevation into an absolute elevation.
Absolute coordinates are passed-through.
SIGNATURE
def compute_elevation(
    elevation: float | _interface.Depth | _interface.Height,
    e_bot: float | None,
    e_top: float | None,
) -> float | _interface.Depth | _interface.Height: ...
ARGUMENTS
Required
elevation
Type:float | _interface.Depth | _interface.Height
Description:
The elevation value to transform.
Required
e_bot
Type:float | None
Description:
The elevation of the bottom of the domain.
Required
e_top
Type:float | None
Description:
The elevation of the top of the domain.
EXCEPTIONS
ValueError
If the elevation cannot be realized.
RETURNS
Return type: float | _interface.Depth | _interface.Height
The realized elevation.

is_full_sphere()

Returns true if the domain represents a full sphere.
SIGNATURE
def is_full_sphere(
    db: _domain.DomainBounds, cs: CoordinateSystem, i_bot: _interface.Interface
) -> bool: ...
ARGUMENTS
Required
db
Type:_domain.DomainBounds
Description:
The domain bounds.
Required
cs
Type:CoordinateSystem
Description:
The coordinate system.
Required
i_bot
Type:_interface.Interface
Description:
The bottom interface (which may signify radius == 0).
RETURNS
Return type: bool
Whether the domain represents a full sphere.

is_full_spherical_shell()

Returns true if the domain represents a full spherical shell.
SIGNATURE
def is_full_spherical_shell(
    bounds: _domain.DomainBounds | dict[str, tuple[float, float]],
    cs: CoordinateSystem,
) -> bool: ...
ARGUMENTS
Required
bounds
Type:_domain.DomainBounds | dict[str, tuple[float, float]]
Description:
The domain bounds.
Required
cs
Type:CoordinateSystem
Description:
The coordinate system.
RETURNS
Return type: bool
Whether the domain represents a full spherical shell.

realize_domain()

'Realize' a domain by resolving any non-absolute coordinates.
Domains can sometimes have extents that are specified at a later point than domain creation. For instance, domains can have top and bottom bounds of infinity, which instructs the mesher to realize the maximum and minimum vertical coordinates to those specified by the top / bottom interfaces.
If the coordinates of a relevant interface are relative, and the domain top / bottom is not yet defined, an exception will be raised.
SIGNATURE
def realize_domain(
    d: T, t_ref: _interface.Interface, b_ref: _interface.Interface
) -> T: ...
ARGUMENTS
Required
d
Type:T
Description:
The domain to realize.
Required
t_ref
Type:_interface.Interface
Description:
The reference coordinate of the top interface.
Required
b_ref
Type:_interface.Interface
Description:
The reference coordinate of the bottom interface.
RETURNS
Return type: T
A domain bounds object with absolute coordinates.

realize_interface()

Realize an interface to ensure it is suitable for further processing.
Realization here refers to ensuring that the xarray representation of the interface contains all the dimensions that are expected given the dimensions of the domain, that any relative reference coordinates are transformed to absolute coordinates, and that the interface has an extent that is great enough to cover the bounds of the domain.
SIGNATURE
def realize_interface(
    interface: _interface.Interface, bounds: _domain.DomainBounds
) -> _interface.Interface: ...
ARGUMENTS
Required
interface
Type:_interface.Interface
Description:
The interface to realize.
Required
bounds
Type:_domain.DomainBounds
Description:
The bounds of the realized domain.
RETURNS
Return type: _interface.Interface
A realized interface which spans the domain bounds.

realize_interfaces()

Realize all interfaces in a model.
Does not realize materials, or check for consistency of layering.
SIGNATURE
def realize_interfaces(
    domain: _domain.Domain, layered_model: _layered_model.LayeredModel
) -> _layered_model.LayeredModel: ...
ARGUMENTS
Required
domain
Type:_domain.Domain
Description:
The domain to realize from.
Required
layered_model
Type:_layered_model.LayeredModel
Description:
The layered model containing the interfaces to realize.
RETURNS
Return type: _layered_model.LayeredModel
A new layered model with the interfaces realized.

realize_layered_model()

Realize a layered model and domain simultaneously.
Realization of a domain and associated layered model are dependent on each other, as the domain bounds may be set by the domain itself, or the extrema of the layered model, (or both -- in which case a conflict will be detected and an exception raised). This function serves as the top-level entry point to the realization process and will sequentially realize the domain and layered model accordingly. As a result, a realized domain and realized layered model will be returned, which will be guaranteed to only hold absolute elevation values.
Note that this process does not transform models parameterized using relative coordinates to a parameterization based on absolute coordinates, as that process requires a mesh to complete. However, any materials containing parameters with relative coordinates will still be returned with proper extrusions along all relevant axes, and with relative elevations realized.
SIGNATURE
def realize_layered_model(
    domain: T, layered_model: _layered_model.LayeredModel
) -> tuple[T, _layered_model.LayeredModel]: ...
ARGUMENTS
Required
domain
Type:T
Description:
The domain to realize.
Required
layered_model
Type:_layered_model.LayeredModel
Description:
The layered model to realize.
RETURNS
Return type: tuple[T, _layered_model.LayeredModel]
A tuple comprised of the realized domain and the realized layered model.

realize_layered_model_ab()

Extrude a realized layered model to respect absorbing boundary layers.
The extrusion logic for absorbing boundary layers is somewhat complex -- for example we must recursively realize and extrude to ensure that consistent extrusion behavior is maintained even when nD materials contain variations within the extrusion layers. The current complexity is also affected by the need to match legacy behavior, which conditionally extrudes by an additional element edge depending on the domain and axis under consideration.
SIGNATURE
def realize_layered_model_ab(
    d: _domain.Domain,
    lm: _layered_model.LayeredModel,
    mesh_resolution: types.MeshResolution,
    oracle_filter: typing.Sequence[filters.OracleFilter],
    ab_params: basic_mesh.AbsorbingBoundaryParameters | None,
) -> tuple[
    _domain.Domain,
    _layered_model.LayeredModel,
    list[_pd.realized.RealizedParameter],
    list[str],
    float,
]: ...
ARGUMENTS
Required
d
Type:_domain.Domain
Description:
The realized domain.
Required
lm
Type:_layered_model.LayeredModel
Description:
The layered model.
Required
mesh_resolution
Type:types.MeshResolution
Description:
The mesh resolution.
Required
oracle_filter
Type:typing.Sequence[filters.OracleFilter]
Description:
The oracle filtered.
Required
ab_params
Type:basic_mesh.AbsorbingBoundaryParameters | None
Description:
Parameters governing absorbing boundary extrusion.
RETURNS
Return type: tuple[_domain.Domain, _layered_model.LayeredModel, list[_pd.realized.RealizedParameter], list[str], float]
A tuple containing: - The realized domain, extruded to account for absorbing boundaries. - The realized layered model, extruded to account for absorbing boundaries. - A list of (potentially volumetric) minimum wavelengths, encapsulated within the relevant RealizedParameter class. - A list of side set names that should be marked as absorbing.

realize_material()

Realize a material to ensure it is suitable for further processing.
Realization here refers to transforming material parameters parametrized using relative coordinates (i.e. depth, or height) or generic coordinates (i.e. v for vertical) to absolute coordinates with proper dimension names. The will result for, in 2-D Cartesian domains, v being mapped to y, and depths / heights being transformed to absolute vertical coordinates using the domain bounds as a reference.
What will not be transformed is the vertical coordinate value of v_relative. This is a special dimension name that will be realized later on in the meshing process, once the discrete boundaries or a layer are known.
SIGNATURE
def realize_material(
    top_interface: _interface.Interface,
    material: Material,
    bot_interface: _interface.Interface,
    domain: _domain.Domain,
) -> Material: ...
ARGUMENTS
Required
top_interface
Type:_interface.Interface
Description:
The top realized interface of the material's layer.
Required
material
Type:Material
Description:
The material.
Required
bot_interface
Type:_interface.Interface
Description:
The bottom realized interface of the material's layer.
Required
domain
Type:_domain.Domain
Description:
The realized domain.
RETURNS
Return type: Material
A realized material which spans the domain bounds.
PAGE CONTENTS