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

salvus.project.configuration.bathymetry.cartesian

Classes

OceanLayer

class OceanLayer(
    salvus.project.configuration.bathymetry.cartesian._CartesianBase
):
    def __init__(
        self,
        name: str,
        data: Union[pathlib.Path, str, xarray.core.dataset.Dataset],
        reference_elevation: float,
        ocean_surface_datum: float = 0.0,
        ocean_layer_style: str = "match_ocean_bottom",
        ocean_layer_vp: float = 1450.0,
        ocean_layer_density: float = 1020.0,
        ocean_layer_cutoff: Optional[float] = None,
        use_symlink: bool = False,
    ): ...

Approximate the effect of bodies of water with fluid elements.

While the “ocean loading” approximation produces good results when considering lower-frequency waves, it cannot model ocean-rebverbarated phases. When an ocean layer is added to the simulation, true acoustic elements are placed in ocean regions, and these elements are coupled to the crust via a standard fluid-solid coupling algorithm. When the ocean gets to thin (near the shore), the ocean loading approximation is then used.

Parameters
  • name str — Name of the bathymetry model.
  • data Union[pathlib.Path, str, xarray.core.dataset.Dataset] — Path to the bathymetry data file, or an xarray Dataset.
  • reference_elevation float — Elevation to which the bathymetry model is referenced.
  • ocean_surface_datum float — The elevation value in the bathymetry file that is considered as the ocean’s surface. All elevations less than this value will be considered as underwater. Defaults to 0.0.
  • ocean_layer_style str — The method used to refine the elements in the water layer in the horizontal direction. Phases in the vertical direction should be resolved regardless of the option specified here. Options are: “match_ocean_bottom”: Use the horizontal element size at the ocean bottom as the horizontal element size within the ocean. This may over- / under-resolve the ocean phases depending on the ratio of the sub-surface to ocean velocities.
  • ocean_layer_vp float — The (constant) velocity of water in the ocean layer. Defaults to 1450.0 m/s.
  • ocean_layer_density float — The (constant) density of water in the ocean layer. Defaults to 1020 kg/m**3.
  • ocean_layer_cutoff Optional[float] — Use the ocean loading approximation once the ocean becomes shallower than this value in meters. Defaults to None, in which case an appropriate value will be computed using the period of the mesh.
  • use_symlink bool — Don’t copy the data to the project but only symlink it. The downside of symlinking is that the project is no longer fully self-contained. The upside is that very large external files that could be used for multiple projects don’t get copied.
Attributes
coordinates Union[numpy.ndarray, Tuple[numpy.ndarray, numpy.ndarray]]

Coordinates of the data values.

ds xarray.core.dataset.Dataset

The actual dataset representing the model.

name str

Model name.

ocean_layer_cutoff Optional[float]

Ocean layer cutoff.

ocean_layer_density float

Density of the ocean layer.

ocean_layer_style str

Style of ocean layer.

ocean_layer_vp float

P-wave velocity of the ocean layer.

reference_elevation float

Reference elevation height.

relative_elevation_model numpy.ndarray

Relative elevation model.

shore_smoothing_factor Optional[float]

Shore smoothing factor.

Methods
from_json()
def from_json(parent_folder: pathlib.Path, d: Dict) -> _ModelBase: ...

Recreate the object from a dictionary serialization of its initialization parameters.

Parameters
  • parent_folder pathlib.Path — Path to which the serialized model is relative to.
  • d Dict — Dictionary containing its init parameters and a few other things.
Returns _ModelBase
from_surface_topography()
def from_surface_topography(
    name: str,
    topography: salvus.project.configuration.topography.cartesian.SurfaceTopography,
    ocean_layer_style: str = "match_ocean_bottom",
    ocean_surface_datum: float = 0.0,
    ocean_layer_vp: float = 1450.0,
    ocean_layer_density: float = 1020.0,
    ocean_layer_cutoff: Optional[float] = None,
    use_symlink: bool = False,
) -> OceanLayer: ...

Create a bathymetry model from a suitable topography model.

For cartesian domains topography and bathymetry models can be identical. This constructor decorates a cartesian topography model with the necessary parameters for bathymetry.

Parameters
  • name str — Name of the bathymetry model.
  • topography salvus.project.configuration.topography.cartesian.SurfaceTopography — Topography model from which to extract bathymetry.
  • ocean_layer_style str — The method used to refine the elements in the water layer in the horizontal direction. Phases in the vertical direction should be resolved regardless of the option specified here. Options are: “match_ocean_bottom”: Use the horizontal element size at the ocean bottom as the horizontal element size within the ocean. This may over- / under-resolve the ocean phases depending on the ratio of the sub-surface to ocean velocities.
  • ocean_surface_datum float — The elevation value in the bathymetry file that is considered as the ocean’s surface. All elevations less than this value will be considered as underwater. Defaults to 0.0.
  • ocean_layer_vp float — The (constant) velocity of water in the ocean layer. Defaults to 1450.0 m/s.
  • ocean_layer_density float — The (constant) density of water in the ocean layer. Defaults to 1020 kg/m**3.
  • ocean_layer_cutoff Optional[float] — Use the ocean loading approximation once the ocean becomes shallower than this value in meters. Defaults to None, in which case an appropriate value will be computed using the period of the mesh.
  • use_symlink bool — Don’t copy the data to the project but only symlink it. The downside of symlinking is that the project is no longer fully self-contained. The upside is that very large external files that could be used for multiple projects don’t get copied.
Returns OceanLayer
to_json()
def to_json(self, parent_folder: Union[str, pathlib.Path]) -> Dict: ...

Serialize the model to JSON (and an associated NetCDF file).

Parameters
  • parent_folder Union[str, pathlib.Path] — Parent folder where the JSON + NetCDF files should be stored.
Returns Dict