salvus.material.visco.elastic
salvus.material.visco.elastic salvus material visco elastic Viscoelastic materials.
Classes
Anisotropic
Anisotropicclass 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,
extensions: typing.Mapping[str, Material] = default,
) -> None: ...An elastic material parameterized anisotropic Q values.
Q11_pd.types.ParameterOrConstantT — Q for the C11 entry of the stiffness tensor.Q12_pd.types.ParameterOrConstantT — Q for the C12 entry of the stiffness tensor.Q13_pd.types.ParameterOrConstantT — Q for the C13 entry of the stiffness tensor.Q14_pd.types.ParameterOrConstantT — Q for the C14 entry of the stiffness tensor.Q15_pd.types.ParameterOrConstantT — Q for the C15 entry of the stiffness tensor.Q16_pd.types.ParameterOrConstantT — Q for the C16 entry of the stiffness tensor.Q22_pd.types.ParameterOrConstantT — Q for the C22 entry of the stiffness tensor.Q23_pd.types.ParameterOrConstantT — Q for the C23 entry of the stiffness tensor.Q24_pd.types.ParameterOrConstantT — Q for the C24 entry of the stiffness tensor.Q25_pd.types.ParameterOrConstantT — Q for the C25 entry of the stiffness tensor.Q26_pd.types.ParameterOrConstantT — Q for the C26 entry of the stiffness tensor.Q33_pd.types.ParameterOrConstantT — Q for the C33 entry of the stiffness tensor.Q34_pd.types.ParameterOrConstantT — Q for the C34 entry of the stiffness tensor.Q35_pd.types.ParameterOrConstantT — Q for the C35 entry of the stiffness tensor.Q36_pd.types.ParameterOrConstantT — Q for the C36 entry of the stiffness tensor.Q44_pd.types.ParameterOrConstantT — Q for the C44 entry of the stiffness tensor.Q45_pd.types.ParameterOrConstantT — Q for the C45 entry of the stiffness tensor.Q46_pd.types.ParameterOrConstantT — Q for the C46 entry of the stiffness tensor.Q55_pd.types.ParameterOrConstantT — Q for the C55 entry of the stiffness tensor.Q56_pd.types.ParameterOrConstantT — Q for the C56 entry of the stiffness tensor.Q66_pd.types.ParameterOrConstantT — Q for the C66 entry of the stiffness tensor.extensionstyping.Mapping[str, Material] =<factory>— Attached extension materials. This material supports none, so this must stay empty.
attenuation Material | None
attenuation Material | NoneOptional attenuation extension.
ds typing.Mapping
ds typing.MappingMaterial’s xarray representation.
flatten dict
flatten dictGet all parameters as a dict, including extension parameters.
orientation Material | None
orientation Material | NoneOptional orientation extension.
from_dataset()
from_dataset()def from_dataset(ds: xr.Dataset) -> Material[_pd.types.ParameterFlavorT]: ...Construct a material from an xarray Dataset.
dsxr.Dataset — The dataset to construct the material from.
from_json()
from_json()def from_json(d: Dict) -> Any: ...Recreate the object from a dictionary serialization of its initialization parameters.
Only load trusted input.
dDict — Dictionary containing its init parameters and a few other things.
from_material()
from_material()def from_material(
m: Material[_pd.types.ParameterFlavorT],
reduction_method: (
typing.Literal["remove-components", "force"] | None
) = None,
) -> typing.Self: ...Construct this material from another within the same physical system.
mMaterial[_pd.types.ParameterFlavorT] — Material to transform.reduction_methodtyping.Literal['remove-components', 'force'] | None =None— Method to move between incompatible symmetry classes. None will only move to symmetries that are equal or more permissive, whileremove-componentswill 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.
from_params()
from_params()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: ...Construct this material from generic parameters.
q11_pd.types.ParameterInput — Q for the C11 entry of the stiffness tensor.q12_pd.types.ParameterInput — Q for the C12 entry of the stiffness tensor.q13_pd.types.ParameterInput — Q for the C13 entry of the stiffness tensor.q14_pd.types.ParameterInput — Q for the C14 entry of the stiffness tensor.q15_pd.types.ParameterInput — Q for the C15 entry of the stiffness tensor.q16_pd.types.ParameterInput — Q for the C16 entry of the stiffness tensor.q22_pd.types.ParameterInput — Q for the C22 entry of the stiffness tensor.q23_pd.types.ParameterInput — Q for the C23 entry of the stiffness tensor.q24_pd.types.ParameterInput — Q for the C24 entry of the stiffness tensor.q25_pd.types.ParameterInput — Q for the C25 entry of the stiffness tensor.q26_pd.types.ParameterInput — Q for the C26 entry of the stiffness tensor.q33_pd.types.ParameterInput — Q for the C33 entry of the stiffness tensor.q34_pd.types.ParameterInput — Q for the C34 entry of the stiffness tensor.q35_pd.types.ParameterInput — Q for the C35 entry of the stiffness tensor.q36_pd.types.ParameterInput — Q for the C36 entry of the stiffness tensor.q44_pd.types.ParameterInput — Q for the C44 entry of the stiffness tensor.q45_pd.types.ParameterInput — Q for the C45 entry of the stiffness tensor.q46_pd.types.ParameterInput — Q for the C46 entry of the stiffness tensor.q55_pd.types.ParameterInput — Q for the C55 entry of the stiffness tensor.q56_pd.types.ParameterInput — Q for the C56 entry of the stiffness tensor.q66_pd.types.ParameterInput — Q for the C66 entry of the stiffness tensor.
material_system()
material_system()def material_system() -> type[Material]: ...Method that will return the material system of material.
map()
map()def map(
self, f: typing.Callable[[str, typing.Any], tuple[str, typing.Any]]
) -> Self: ...Generic map for materials, recursing into extension materials.
See dataclass_utils.MappableDataclass.map for the base semantics.
Extension materials (in extensions) are mapped independently, since
f is defined in terms of a single material’s own parameter names.
ftyping.Callable[[str, typing.Any], tuple[str, typing.Any]] — Callable taking (key, value) and returning (key, value).
map_realized_parameters()
map_realized_parameters()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: ...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.
f_constanttyping.Callable[[str, _pd.realized.constant.Parameter], _pd.realized.constant.Parameter] =salvus.material.base_materials._map_realized_default— The function to apply to constant parameters. Defaults to returning the parameter as-is.f_discretetyping.Callable[[str, _pd.realized.discrete.Parameter], _pd.realized.discrete.Parameter] =salvus.material.base_materials._map_realized_default— The function to apply to discrete parameters. Defaults to returning the parameter as-is.f_analytictyping.Callable[[str, _pd.realized.analytic.Parameter], _pd.realized.analytic.Parameter] =salvus.material.base_materials._map_realized_default— The function to apply to analytic parameters. Defaults to returning the parameter as-is.
qc_test()
qc_test()def qc_test(
self,
level: validation.QCLevel | str = QCLevel.strict,
display_issues: bool = True,
) -> dict[str, MaterialQCIssue]: ...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.
levelvalidation.QCLevel | str =QCLevel.strict— 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.display_issuesbool =True— If True, prints the issues found during the quality control checks. If False, issues are collected but not printed.
type is the type of the issue (e.g, “mesh” or “material”) and code is a specific code for the issue (e.g., “NON_POSITIVE_VP”). If no issues are found, an empty dictionary is returned.to_json()
to_json()def to_json(
self,
external_file_hash: Optional[str] = None,
timer: Optional[salvus._core.timer.timer.Timer] = None,
log_to_logger: bool = False,
comm: Optional[int] = None,
) -> Dict: ...Serialize the object to a dictionary that can be written to JSON.
external_file_hashOptional[str] =None— 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.timerOptional[salvus._core.timer.timer.Timer] =None— Execution timer.log_to_loggerbool =False— Log timings to the logger.commOptional[int] =None— MPI communicator, if any.
to_wavelength_oracle()
to_wavelength_oracle()def to_wavelength_oracle(
self, n_dim: typing.Literal[2, 3] | None = None
) -> _pd.types.ParameterOrConstantT: ...The wavelength oracle.
n_dimtyping.Literal[2, 3] | None =None— Dimension to return the oracle for, deprecated.
with_extension()
with_extension()def with_extension(self, name: str, value: Material | None) -> Self: ...Attach or detach an extension material by name.
Passing value=None always removes the extension, even if name
isn’t in _supported_extensions (mirrors removing something that
was never there). Attaching a real value that isn’t supported
raises, as does constructing the material with it directly.
namestr — Extension name (e.g.,"attenuation","orientation").valueMaterial | None — Extension material, orNoneto remove.
Canonical
Canonicalclass Canonical(salvus.material.visco.elastic._ViscoElasticMaterial):
def __init__(
self,
QMU: _pd.types.ParameterOrConstantT,
QKAPPA: _pd.types.ParameterOrConstantT,
extensions: typing.Mapping[str, Material] = default,
) -> None: ...An elastic material parameterized by density and p-wave velocity.
QMU_pd.types.ParameterOrConstantT — Q for Lame’s second parameter (mu).QKAPPA_pd.types.ParameterOrConstantT — Q for the bulk modulus.extensionstyping.Mapping[str, Material] =<factory>— Attached extension materials. This material supports none, so this must stay empty.
attenuation Material | None
attenuation Material | NoneOptional attenuation extension.
ds typing.Mapping
ds typing.MappingMaterial’s xarray representation.
flatten dict
flatten dictGet all parameters as a dict, including extension parameters.
orientation Material | None
orientation Material | NoneOptional orientation extension.
from_dataset()
from_dataset()def from_dataset(ds: xr.Dataset) -> Material[_pd.types.ParameterFlavorT]: ...Construct a material from an xarray Dataset.
dsxr.Dataset — The dataset to construct the material from.
from_json()
from_json()def from_json(d: Dict) -> Any: ...Recreate the object from a dictionary serialization of its initialization parameters.
Only load trusted input.
dDict — Dictionary containing its init parameters and a few other things.
from_material()
from_material()def from_material(
m: Material[_pd.types.ParameterFlavorT],
reduction_method: (
typing.Literal["remove-components", "force"] | None
) = None,
) -> typing.Self: ...Construct this material from another within the same physical system.
mMaterial[_pd.types.ParameterFlavorT] — Material to transform.reduction_methodtyping.Literal['remove-components', 'force'] | None =None— Method to move between incompatible symmetry classes. None will only move to symmetries that are equal or more permissive, whileremove-componentswill 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.
from_params()
from_params()def from_params(
qmu: _pd.types.ParameterInput, qkappa: _pd.types.ParameterInput
) -> Canonical: ...Construct this material from generic parameters.
qmu_pd.types.ParameterInput — Q for Lame’s second parameter (mu).qkappa_pd.types.ParameterInput — Q for the bulk modulus.
material_system()
material_system()def material_system() -> type[Material]: ...Method that will return the material system of material.
map()
map()def map(
self, f: typing.Callable[[str, typing.Any], tuple[str, typing.Any]]
) -> Self: ...Generic map for materials, recursing into extension materials.
See dataclass_utils.MappableDataclass.map for the base semantics.
Extension materials (in extensions) are mapped independently, since
f is defined in terms of a single material’s own parameter names.
ftyping.Callable[[str, typing.Any], tuple[str, typing.Any]] — Callable taking (key, value) and returning (key, value).
map_realized_parameters()
map_realized_parameters()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: ...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.
f_constanttyping.Callable[[str, _pd.realized.constant.Parameter], _pd.realized.constant.Parameter] =salvus.material.base_materials._map_realized_default— The function to apply to constant parameters. Defaults to returning the parameter as-is.f_discretetyping.Callable[[str, _pd.realized.discrete.Parameter], _pd.realized.discrete.Parameter] =salvus.material.base_materials._map_realized_default— The function to apply to discrete parameters. Defaults to returning the parameter as-is.f_analytictyping.Callable[[str, _pd.realized.analytic.Parameter], _pd.realized.analytic.Parameter] =salvus.material.base_materials._map_realized_default— The function to apply to analytic parameters. Defaults to returning the parameter as-is.
qc_test()
qc_test()def qc_test(
self,
level: validation.QCLevel | str = QCLevel.strict,
display_issues: bool = True,
) -> dict[str, MaterialQCIssue]: ...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.
levelvalidation.QCLevel | str =QCLevel.strict— 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.display_issuesbool =True— If True, prints the issues found during the quality control checks. If False, issues are collected but not printed.
type is the type of the issue (e.g, “mesh” or “material”) and code is a specific code for the issue (e.g., “NON_POSITIVE_VP”). If no issues are found, an empty dictionary is returned.to_json()
to_json()def to_json(
self,
external_file_hash: Optional[str] = None,
timer: Optional[salvus._core.timer.timer.Timer] = None,
log_to_logger: bool = False,
comm: Optional[int] = None,
) -> Dict: ...Serialize the object to a dictionary that can be written to JSON.
external_file_hashOptional[str] =None— 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.timerOptional[salvus._core.timer.timer.Timer] =None— Execution timer.log_to_loggerbool =False— Log timings to the logger.commOptional[int] =None— MPI communicator, if any.
to_wavelength_oracle()
to_wavelength_oracle()def to_wavelength_oracle(
self, n_dim: typing.Literal[2, 3] | None = None
) -> _pd.types.ParameterOrConstantT: ...The wavelength oracle.
n_dimtyping.Literal[2, 3] | None =None— Dimension to return the oracle for, deprecated.
with_extension()
with_extension()def with_extension(self, name: str, value: Material | None) -> Self: ...Attach or detach an extension material by name.
Passing value=None always removes the extension, even if name
isn’t in _supported_extensions (mirrors removing something that
was never there). Attaching a real value that isn’t supported
raises, as does constructing the material with it directly.
namestr — Extension name (e.g.,"attenuation","orientation").valueMaterial | None — Extension material, orNoneto remove.