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

salvus.project.configuration.model.utils

Utility functions supporting models and their configuration.

Functions

derive_bm_file()

def derive_bm_file(
    vm: salvus.project.configuration.model.volume.cartesian._CartesianBase,
    detect_discontinuities_with: str = "vs",
) -> str:
    ...

Create a depth-dependent .bm model from a Cartesian volume model.

It is sometimes useful to extract an appropriate 1-D model, varying in depth, from a general 2- or 3-D volume model, that can then be used as a “size function” for a future mesh generation stage. This function returns such a model as a string in the BM format, which can then be written to disk and used as a background_model in, for instance, a concrete ModelConfiguration. Since the mesh size with depth is determined by the background model, using an appropriate one such as that returned from this function can have the advantage of ensuring that the element sizes properly coarsen with depth, which can lead to more efficient simulations without a loss of accuracy.

This function is conservative in the sense that it find the minimum parameter value in a given vertical layer, and uses this as the 1-D value across the line (2-D) or plane (3-D) of the returned BM model.

More information about 1-D models and the BM format can be found here: https://mondaic.com/docs/tutorials/meshing/1d_models/1D_models/

Parameters
  • vm salvus.project.configuration.model.volume.cartesian._CartesianBase — Cartesian volume model — can be 2- or 3-D.
  • detect_discontinuities_with str — A parameter which is used to determine where an artificial “discontinuity” should be placed, to allow for a doubling layer to be inserted during mesh generation. Note that this discontinuity does not necessarily imply that there is a physical discontinuity present at a depth (although it might): it is primarily a tool used by the size function.
Returns str — A BM model as a string, ready to be written to a file and used as a background model.