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

salvus.project.configuration.model

Classes

LinearSolids

class LinearSolids(salvus.flow.utils.serialization_helpers.SerializationMixin):
    def __init__(
        self,
        reference_frequency: Union[
            int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
        ],
        min_frequency: Optional[
            int,
            numpy.int32,
            numpy.int64,
            float,
            numpy.float32,
            numpy.float64,
            Callable[
                [salvus.mesh.unstructured_mesh.UnstructuredMesh],
                Union[
                    int,
                    numpy.int32,
                    numpy.int64,
                    float,
                    numpy.float32,
                    numpy.float64,
                ],
            ],
        ] = None,
        max_frequency: Optional[
            int,
            numpy.int32,
            numpy.int64,
            float,
            numpy.float32,
            numpy.float64,
            Callable[
                [salvus.mesh.unstructured_mesh.UnstructuredMesh],
                Union[
                    int,
                    numpy.int32,
                    numpy.int64,
                    float,
                    numpy.float32,
                    numpy.float64,
                ],
            ],
        ] = None,
    ) -> None:
        ...

Parameters controlling the use of linear solids in viscous simulations.

There are two mutually exclusive ways to attach the linear solids required for viscous simulations in Salvus_Project_. The first is by specifying them in a background model (https://mondaic.com/docs/tutorials/meshing/1d_models/1D_models/), while the other is through this interface. To avoid ambiguities, these methods cannot be combined.

At a minimum, you must set the reference frequency. This is the frequency at which any acoustic or elastic parameters you provide are defined. You can also supply parameters which define a frequency band over which Q should be considered constant. If these parameters are no supplied here, sane defaults will be used (see the documentation for the min_frequency and max_frequency member functions).

For more details, please see https://doi.org/10.1093/gji/ggu314.

Parameters
  • reference_frequency Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Frequency at which material parameters are defined.
  • min_frequency Optional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64, Callable[[salvus.mesh.unstructured_mesh.UnstructuredMesh], Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64]]] — Minimum frequency for which the linear solid approximation is valid. If None, defer the computation of this value until later (for instance, until a mesh is built for a specific frequency).
  • max_frequency Optional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64, Callable[[salvus.mesh.unstructured_mesh.UnstructuredMesh], Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64]]] — Maximum frequency for which the linear solid approximation is valid. If None, defer the computation of this value until later (for instance, until a mesh is built for a specific frequency).
Attributes
reference_frequency float

Get the reference frequency.

Methods
from_json()
def from_json(d: Dict) -> Any:
    ...

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

Parameters
  • d Dict — Dictionary containing its init parameters and a few other things.
Returns Any
max_frequency()
def max_frequency(
    self,
    mesh_frequency: float,
    mesh: Optional[salvus.mesh.unstructured_mesh.UnstructuredMesh] = None,
) -> float:
    ...

Return or compute the maximum frequency for which

If the maximum was set to None, return mesh_frequency * 10.

Parameters
  • mesh_frequency float — The maximum frequency resolved by the mesh.
  • mesh Optional[salvus.mesh.unstructured_mesh.UnstructuredMesh] — An optional mesh object for deferred frequency computation.
Returns float — The value according to the above rules.
min_frequency()
def min_frequency(
    self,
    mesh_frequency: float,
    mesh: Optional[salvus.mesh.unstructured_mesh.UnstructuredMesh] = None,
) -> float:
    ...

Return or compute the minimum frequency for which

If the minimum was set to None, returns mesh_frequency / 100.

Parameters
  • mesh_frequency float — The maximum frequency resolved by the mesh.
  • mesh Optional[salvus.mesh.unstructured_mesh.UnstructuredMesh] — An optional mesh object for deferred frequency computation.
Returns float — The value according to the above rules.
to_json()
def to_json(self, external_file_hash: Optional[str] = None) -> Dict:
    ...

Serialize the object to dictionary that can be written to JSON.

Parameters
  • external_file_hash Optional[str] — Hash of any external files associated with this object. Can be passed here in which case it will be stored in a centralized location in the JSON file.
Returns Dict

ModelConfiguration

class ModelConfiguration(
    salvus.flow.utils.serialization_helpers.SerializationMixin
):
    def __init__(
        self,
        background_model: Optional[
            str, salvus.project.configuration.model.background._BackgroundBase
        ],
        volume_models: Optional[List[str], str] = None,
        linear_solids: Optional[LinearSolids] = None,
    ) -> None:
        ...

Model configuration.

This is a collection of up to one background model with any number of volumetric material models. At mesh building time all models added to a configuration part will be combined and interpolated onto the mesh.

Parameters
  • background_model Optional[str, salvus.project.configuration.model.background._BackgroundBase] — The background model definition.
  • volume_models Optional[List[str], str] — A list of volumetric models.
  • linear_solids Optional[LinearSolids] — A set of parameters which describe the linear solids to be used in viscous simulations.
Attributes
background_model Optional[str, salvus.project.configuration.model.background._BackgroundBase]

The background model.

linear_solids Optional[LinearSolids]

The parameters governing any linear solids to be attached.

volume_models Optional[List[str]]

The volume models.

Methods
from_json()
def from_json(d: Dict) -> Any:
    ...

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

Parameters
  • d Dict — Dictionary containing its init parameters and a few other things.
Returns Any
to_json()
def to_json(self) -> Dict:
    ...

Serialize the object to dictionary that can be written to JSON.

Returns Dict

Submodules