Version:

salvus.material.visco.elastic

salvus.material.visco.elastic salvus material visco elastic
Viscoelastic materials.

Classes

Anisotropic

An elastic material parameterized anisotropic Q values.
SIGNATURE
class Anisotropic(
    salvus.material.visco.elastic._AnisotropicViscoElasticMaterial
):
    def __init__(
        self,
        Q11: _pd.types.ParameterOrConstantT,
        Q12: _pd.types.ParameterOrConstantT,
        Q13: _pd.types.ParameterOrConstantT,
        Q14: _pd.types.ParameterOrConstantT,
        Q15: _pd.types.ParameterOrConstantT,
        Q16: _pd.types.ParameterOrConstantT,
        Q22: _pd.types.ParameterOrConstantT,
        Q23: _pd.types.ParameterOrConstantT,
        Q24: _pd.types.ParameterOrConstantT,
        Q25: _pd.types.ParameterOrConstantT,
        Q26: _pd.types.ParameterOrConstantT,
        Q33: _pd.types.ParameterOrConstantT,
        Q34: _pd.types.ParameterOrConstantT,
        Q35: _pd.types.ParameterOrConstantT,
        Q36: _pd.types.ParameterOrConstantT,
        Q44: _pd.types.ParameterOrConstantT,
        Q45: _pd.types.ParameterOrConstantT,
        Q46: _pd.types.ParameterOrConstantT,
        Q55: _pd.types.ParameterOrConstantT,
        Q56: _pd.types.ParameterOrConstantT,
        Q66: _pd.types.ParameterOrConstantT,
    ) -> None: ...
ARGUMENTS
Required
Q11
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C11 entry of the stiffness tensor.
Required
Q12
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C12 entry of the stiffness tensor.
Required
Q13
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C13 entry of the stiffness tensor.
Required
Q14
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C14 entry of the stiffness tensor.
Required
Q15
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C15 entry of the stiffness tensor.
Required
Q16
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C16 entry of the stiffness tensor.
Required
Q22
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C22 entry of the stiffness tensor.
Required
Q23
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C23 entry of the stiffness tensor.
Required
Q24
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C24 entry of the stiffness tensor.
Required
Q25
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C25 entry of the stiffness tensor.
Required
Q26
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C26 entry of the stiffness tensor.
Required
Q33
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C33 entry of the stiffness tensor.
Required
Q34
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C34 entry of the stiffness tensor.
Required
Q35
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C35 entry of the stiffness tensor.
Required
Q36
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C36 entry of the stiffness tensor.
Required
Q44
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C44 entry of the stiffness tensor.
Required
Q45
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C45 entry of the stiffness tensor.
Required
Q46
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C46 entry of the stiffness tensor.
Required
Q55
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C55 entry of the stiffness tensor.
Required
Q56
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C56 entry of the stiffness tensor.
Required
Q66
Type:_pd.types.ParameterOrConstantT
Description:
Q for the C66 entry of the stiffness tensor.

Properties

  • ds(typing.Mapping)-Material's xarray representation.
  • flatten(dict)-Get all parameters as a dict.

Class Methods

Anisotropic.from_dataset()
Construct a material from an xarray Dataset.
SIGNATURE
def from_dataset(ds: xr.Dataset) -> Material[_pd.types.ParameterFlavorT]: ...
ARGUMENTS
Required
ds
Type:xr.Dataset
Description:
The dataset to construct the material from.
Anisotropic.from_json()
Recreate the object from a dictionary serialization of its initialization parameters.
SIGNATURE
def from_json(d: builtins.dict) -> Any: ...
ARGUMENTS
Required
d
Type:builtins.dict
Description:
Dictionary containing its init parameters and a few other things.
Anisotropic.from_material()
Construct this material from another within the same physical system.
SIGNATURE
def from_material(
    m: Material[_pd.types.ParameterFlavorT],
    reduction_method: (
        typing.Literal["remove-components", "force"] | None
    ) = None,
) -> typing.Self: ...
ARGUMENTS
Required
m
Type:Material[_pd.types.ParameterFlavorT]
Description:
Material to transform.
Optional
reduction_method
Type:typing.Literal['remove-components', 'force'] | None
Default value:None
Description:
Method to move between incompatible symmetry classes. None will only move to symmetries that are equal or more permissive, while remove-components will drop components that are found to match the new material's constraints as necessary, and thus leading to loss of free parameters but not of information. The option "force" will take all information necessary to construct the new parameter set without verification, leading to loss of information.
Anisotropic.from_params()
Construct this material from generic parameters.
SIGNATURE
def from_params(
    q11: _pd.types.ParameterInput,
    q12: _pd.types.ParameterInput,
    q13: _pd.types.ParameterInput,
    q14: _pd.types.ParameterInput,
    q15: _pd.types.ParameterInput,
    q16: _pd.types.ParameterInput,
    q22: _pd.types.ParameterInput,
    q23: _pd.types.ParameterInput,
    q24: _pd.types.ParameterInput,
    q25: _pd.types.ParameterInput,
    q26: _pd.types.ParameterInput,
    q33: _pd.types.ParameterInput,
    q34: _pd.types.ParameterInput,
    q35: _pd.types.ParameterInput,
    q36: _pd.types.ParameterInput,
    q44: _pd.types.ParameterInput,
    q45: _pd.types.ParameterInput,
    q46: _pd.types.ParameterInput,
    q55: _pd.types.ParameterInput,
    q56: _pd.types.ParameterInput,
    q66: _pd.types.ParameterInput,
) -> Anisotropic: ...
ARGUMENTS
Required
q11
Type:_pd.types.ParameterInput
Description:
Q for the C11 entry of the stiffness tensor.
Required
q12
Type:_pd.types.ParameterInput
Description:
Q for the C12 entry of the stiffness tensor.
Required
q13
Type:_pd.types.ParameterInput
Description:
Q for the C13 entry of the stiffness tensor.
Required
q14
Type:_pd.types.ParameterInput
Description:
Q for the C14 entry of the stiffness tensor.
Required
q15
Type:_pd.types.ParameterInput
Description:
Q for the C15 entry of the stiffness tensor.
Required
q16
Type:_pd.types.ParameterInput
Description:
Q for the C16 entry of the stiffness tensor.
Required
q22
Type:_pd.types.ParameterInput
Description:
Q for the C22 entry of the stiffness tensor.
Required
q23
Type:_pd.types.ParameterInput
Description:
Q for the C23 entry of the stiffness tensor.
Required
q24
Type:_pd.types.ParameterInput
Description:
Q for the C24 entry of the stiffness tensor.
Required
q25
Type:_pd.types.ParameterInput
Description:
Q for the C25 entry of the stiffness tensor.
Required
q26
Type:_pd.types.ParameterInput
Description:
Q for the C26 entry of the stiffness tensor.
Required
q33
Type:_pd.types.ParameterInput
Description:
Q for the C33 entry of the stiffness tensor.
Required
q34
Type:_pd.types.ParameterInput
Description:
Q for the C34 entry of the stiffness tensor.
Required
q35
Type:_pd.types.ParameterInput
Description:
Q for the C35 entry of the stiffness tensor.
Required
q36
Type:_pd.types.ParameterInput
Description:
Q for the C36 entry of the stiffness tensor.
Required
q44
Type:_pd.types.ParameterInput
Description:
Q for the C44 entry of the stiffness tensor.
Required
q45
Type:_pd.types.ParameterInput
Description:
Q for the C45 entry of the stiffness tensor.
Required
q46
Type:_pd.types.ParameterInput
Description:
Q for the C46 entry of the stiffness tensor.
Required
q55
Type:_pd.types.ParameterInput
Description:
Q for the C55 entry of the stiffness tensor.
Required
q56
Type:_pd.types.ParameterInput
Description:
Q for the C56 entry of the stiffness tensor.
Required
q66
Type:_pd.types.ParameterInput
Description:
Q for the C66 entry of the stiffness tensor.
Anisotropic.material_system()
Method that will return the material system of material.
SIGNATURE
def material_system() -> type[Material]: ...

Methods

Anisotropic.map()
Generic map for dataclass instances.
f should be a function taking two parameters: the name of the dataclass member and its value, and it should return a tuple containing the same quantities. If a member is not to be transformed, f should just return a tuple of the input member name and value, unchanged. Both names and values can be transformed, with the semantics following those of dataclasses.replace.
In Salvus we primarily treat dataclasses as containers offering semantics similar to typed dictionaries. Deriving from this protocol allows any relevant dataclass to additionally be treated functorially. This allows for the generic un- and re-wrapping of value held in dataclasses, and essentially replaces the following imperative code:
@dataclass
class A:
    member: int

# Before
my_a = A(member=1)
my_a_new = dataclasses.replace(my_a, member=2 * my_a.member)

# After
my_a_new = A(val=1).map(lambda key, val: (key, 2 * val))
As with many functional patterns, the perceived benefits for simple demonstrative purposes is minimal. The scalability of this pattern becomes apparent, however, when parsing deeply nested abstractions, as the transformation logic can be factored out into independent functions. This is used extensively, for example, in the realization logic of the layered mesher, where generic materials can have generic parameters, etc.
SIGNATURE
def map(
    self, f: typing.Callable[[str, typing.Any], tuple[str, typing.Any]]
) -> typing.Self: ...
ARGUMENTS
Required
f
Type:typing.Callable[[str, typing.Any], tuple[str, typing.Any]]
Description:
The function to map over the dataclass.
Anisotropic.map_realized_parameters()
Apply functions to each parameter individually, distinguishing _pd.
Useful when one wants to transform each parameter type separately. For instance, transformations of discrete parameters often require more associated logic than their constant equivalents. This function abstracts away the boilerplate of check for each parameter type, and subsequently transforming it with some function, as well as ensuring that the parameters are indeed of the correct realized type.
The signatures of each transformation function should take the parameter's name and value as two distinct inputs, and return the (potentially modified) parameter value.
SIGNATURE
def map_realized_parameters(
    self,
    f_constant: typing.Callable[
        [str, _pd.realized.constant.Parameter], _pd.realized.constant.Parameter
    ] = salvus.material.base_materials._map_realized_default,
    f_discrete: typing.Callable[
        [str, _pd.realized.discrete.Parameter], _pd.realized.discrete.Parameter
    ] = salvus.material.base_materials._map_realized_default,
    f_analytic: typing.Callable[
        [str, _pd.realized.analytic.Parameter], _pd.realized.analytic.Parameter
    ] = salvus.material.base_materials._map_realized_default,
) -> Self: ...
ARGUMENTS
Optional
f_constant
Type:typing.Callable[[str, _pd.realized.constant.Parameter], _pd.realized.constant.Parameter]
Default value:salvus.material.base_materials._map_realized_default
Description:
The function to apply to constant parameters. Defaults to returning the parameter as-is.
Optional
f_discrete
Type:typing.Callable[[str, _pd.realized.discrete.Parameter], _pd.realized.discrete.Parameter]
Default value:salvus.material.base_materials._map_realized_default
Description:
The function to apply to discrete parameters. Defaults to returning the parameter as-is.
Optional
f_analytic
Type:typing.Callable[[str, _pd.realized.analytic.Parameter], _pd.realized.analytic.Parameter]
Default value:salvus.material.base_materials._map_realized_default
Description:
The function to apply to analytic parameters. Defaults to returning the parameter as-is.
Anisotropic.qc_test()
Run a series of material quality control tests.
The function also prints a summary of the issues found, including their severity and any mitigation steps that can be taken.
SIGNATURE
def qc_test(
    self,
    level: validation.QCLevel | str = QCLevel.strict,
    display_issues: bool = True,
) -> dict[str, MaterialQCIssue]: ...
ARGUMENTS
Optional
level
Type:validation.QCLevel | str
Default value:QCLevel.strict
Description:
The level of quality control to perform. The BASIC level performs minimal checks, while the STRICT level performs more thorough checks that are potentially slow. One can pass an enumeration value or a string representation of the level.
Optional
display_issues
Type:bool
Default value:True
Description:
If True, prints the issues found during the quality control checks. If False, issues are collected but not printed.
Anisotropic.to_json()
Serialize the object to a dictionary that can be written to JSON.
SIGNATURE
def to_json(
    self,
    external_file_hash: types = None,
    timer: types = None,
    log_to_logger: bool = False,
    comm: types = None,
) -> builtins.dict: ...
ARGUMENTS
Optional
external_file_hash
Type:types
Default value:None
Description:
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.
Optional
timer
Type:types
Default value:None
Description:
Execution timer.
Optional
log_to_logger
Type:bool
Default value:False
Description:
Log timings to the logger.
Optional
comm
Type:types
Default value:None
Description:
MPI communicator, if any.
Anisotropic.to_wavelength_oracle()
The wavelength oracle.
SIGNATURE
def to_wavelength_oracle(
    self, n_dim: typing.Literal[2, 3] | None = None
) -> _pd.types.ParameterOrConstantT: ...
ARGUMENTS
Optional
n_dim
Type:typing.Literal[2, 3] | None
Default value:None
Description:
Dimension to return the oracle for, deprecated.
Anisotropic.with_orientation()
Experimetal method to add orientation to a material.
SIGNATURE
def with_orientation(self, orientation: Material | None) -> Material: ...
ARGUMENTS
Required
orientation
Type:Material | None
Description:
The orientation.

Canonical

An elastic material parameterized by density and p-wave velocity.
SIGNATURE
class Canonical(salvus.material.visco.elastic._ViscoElasticMaterial):
    def __init__(
        self,
        QMU: _pd.types.ParameterOrConstantT,
        QKAPPA: _pd.types.ParameterOrConstantT,
    ) -> None: ...
ARGUMENTS
Required
QMU
Type:_pd.types.ParameterOrConstantT
Description:
Q for Lame's second parameter (mu).
Required
QKAPPA
Type:_pd.types.ParameterOrConstantT
Description:
Q for the bulk modulus.

Properties

  • ds(typing.Mapping)-Material's xarray representation.
  • flatten(dict)-Get all parameters as a dict.

Class Methods

Canonical.from_dataset()
Construct a material from an xarray Dataset.
SIGNATURE
def from_dataset(ds: xr.Dataset) -> Material[_pd.types.ParameterFlavorT]: ...
ARGUMENTS
Required
ds
Type:xr.Dataset
Description:
The dataset to construct the material from.
Canonical.from_json()
Recreate the object from a dictionary serialization of its initialization parameters.
SIGNATURE
def from_json(d: builtins.dict) -> Any: ...
ARGUMENTS
Required
d
Type:builtins.dict
Description:
Dictionary containing its init parameters and a few other things.
Canonical.from_material()
Construct this material from another within the same physical system.
SIGNATURE
def from_material(
    m: Material[_pd.types.ParameterFlavorT],
    reduction_method: (
        typing.Literal["remove-components", "force"] | None
    ) = None,
) -> typing.Self: ...
ARGUMENTS
Required
m
Type:Material[_pd.types.ParameterFlavorT]
Description:
Material to transform.
Optional
reduction_method
Type:typing.Literal['remove-components', 'force'] | None
Default value:None
Description:
Method to move between incompatible symmetry classes. None will only move to symmetries that are equal or more permissive, while remove-components will drop components that are found to match the new material's constraints as necessary, and thus leading to loss of free parameters but not of information. The option "force" will take all information necessary to construct the new parameter set without verification, leading to loss of information.
Canonical.from_params()
Construct this material from generic parameters.
SIGNATURE
def from_params(
    qmu: _pd.types.ParameterInput, qkappa: _pd.types.ParameterInput
) -> Canonical: ...
ARGUMENTS
Required
qmu
Type:_pd.types.ParameterInput
Description:
Q for Lame's second parameter (mu).
Required
qkappa
Type:_pd.types.ParameterInput
Description:
Q for the bulk modulus.
Canonical.material_system()
Method that will return the material system of material.
SIGNATURE
def material_system() -> type[Material]: ...

Methods

Canonical.map()
Generic map for dataclass instances.
f should be a function taking two parameters: the name of the dataclass member and its value, and it should return a tuple containing the same quantities. If a member is not to be transformed, f should just return a tuple of the input member name and value, unchanged. Both names and values can be transformed, with the semantics following those of dataclasses.replace.
In Salvus we primarily treat dataclasses as containers offering semantics similar to typed dictionaries. Deriving from this protocol allows any relevant dataclass to additionally be treated functorially. This allows for the generic un- and re-wrapping of value held in dataclasses, and essentially replaces the following imperative code:
@dataclass
class A:
    member: int

# Before
my_a = A(member=1)
my_a_new = dataclasses.replace(my_a, member=2 * my_a.member)

# After
my_a_new = A(val=1).map(lambda key, val: (key, 2 * val))
As with many functional patterns, the perceived benefits for simple demonstrative purposes is minimal. The scalability of this pattern becomes apparent, however, when parsing deeply nested abstractions, as the transformation logic can be factored out into independent functions. This is used extensively, for example, in the realization logic of the layered mesher, where generic materials can have generic parameters, etc.
SIGNATURE
def map(
    self, f: typing.Callable[[str, typing.Any], tuple[str, typing.Any]]
) -> typing.Self: ...
ARGUMENTS
Required
f
Type:typing.Callable[[str, typing.Any], tuple[str, typing.Any]]
Description:
The function to map over the dataclass.
Canonical.map_realized_parameters()
Apply functions to each parameter individually, distinguishing _pd.
Useful when one wants to transform each parameter type separately. For instance, transformations of discrete parameters often require more associated logic than their constant equivalents. This function abstracts away the boilerplate of check for each parameter type, and subsequently transforming it with some function, as well as ensuring that the parameters are indeed of the correct realized type.
The signatures of each transformation function should take the parameter's name and value as two distinct inputs, and return the (potentially modified) parameter value.
SIGNATURE
def map_realized_parameters(
    self,
    f_constant: typing.Callable[
        [str, _pd.realized.constant.Parameter], _pd.realized.constant.Parameter
    ] = salvus.material.base_materials._map_realized_default,
    f_discrete: typing.Callable[
        [str, _pd.realized.discrete.Parameter], _pd.realized.discrete.Parameter
    ] = salvus.material.base_materials._map_realized_default,
    f_analytic: typing.Callable[
        [str, _pd.realized.analytic.Parameter], _pd.realized.analytic.Parameter
    ] = salvus.material.base_materials._map_realized_default,
) -> Self: ...
ARGUMENTS
Optional
f_constant
Type:typing.Callable[[str, _pd.realized.constant.Parameter], _pd.realized.constant.Parameter]
Default value:salvus.material.base_materials._map_realized_default
Description:
The function to apply to constant parameters. Defaults to returning the parameter as-is.
Optional
f_discrete
Type:typing.Callable[[str, _pd.realized.discrete.Parameter], _pd.realized.discrete.Parameter]
Default value:salvus.material.base_materials._map_realized_default
Description:
The function to apply to discrete parameters. Defaults to returning the parameter as-is.
Optional
f_analytic
Type:typing.Callable[[str, _pd.realized.analytic.Parameter], _pd.realized.analytic.Parameter]
Default value:salvus.material.base_materials._map_realized_default
Description:
The function to apply to analytic parameters. Defaults to returning the parameter as-is.
Canonical.qc_test()
Run a series of material quality control tests.
The function also prints a summary of the issues found, including their severity and any mitigation steps that can be taken.
SIGNATURE
def qc_test(
    self,
    level: validation.QCLevel | str = QCLevel.strict,
    display_issues: bool = True,
) -> dict[str, MaterialQCIssue]: ...
ARGUMENTS
Optional
level
Type:validation.QCLevel | str
Default value:QCLevel.strict
Description:
The level of quality control to perform. The BASIC level performs minimal checks, while the STRICT level performs more thorough checks that are potentially slow. One can pass an enumeration value or a string representation of the level.
Optional
display_issues
Type:bool
Default value:True
Description:
If True, prints the issues found during the quality control checks. If False, issues are collected but not printed.
Canonical.to_json()
Serialize the object to a dictionary that can be written to JSON.
SIGNATURE
def to_json(
    self,
    external_file_hash: types = None,
    timer: types = None,
    log_to_logger: bool = False,
    comm: types = None,
) -> builtins.dict: ...
ARGUMENTS
Optional
external_file_hash
Type:types
Default value:None
Description:
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.
Optional
timer
Type:types
Default value:None
Description:
Execution timer.
Optional
log_to_logger
Type:bool
Default value:False
Description:
Log timings to the logger.
Optional
comm
Type:types
Default value:None
Description:
MPI communicator, if any.
Canonical.to_wavelength_oracle()
The wavelength oracle.
SIGNATURE
def to_wavelength_oracle(
    self, n_dim: typing.Literal[2, 3] | None = None
) -> _pd.types.ParameterOrConstantT: ...
ARGUMENTS
Optional
n_dim
Type:typing.Literal[2, 3] | None
Default value:None
Description:
Dimension to return the oracle for, deprecated.
Canonical.with_orientation()
Experimetal method to add orientation to a material.
SIGNATURE
def with_orientation(self, orientation: Material | None) -> Material: ...
ARGUMENTS
Required
orientation
Type:Material | None
Description:
The orientation.
PAGE CONTENTS