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

salvus.opt.smoothing

Various parameterizations for diffusion-based smoothing.

Functions

get_smooth_model()

def get_smooth_model(
    job: salvus.flow.sites.salvus_job_array.SalvusJobArray,
    model: Optional[
        str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh
    ] = None,
    delete_job: bool = True,
) -> salvus.mesh.unstructured_mesh.UnstructuredMesh:
    ...

Get the smooth model from a previously submitted job array

Parameters
  • job salvus.flow.sites.salvus_job_array.SalvusJobArray — The job array of the smoothing jobs
  • model Optional[str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh] — The raw input model. This is optional and only to avoid additional I/O.
  • delete_job bool — Flag to determine if job should be deleted
Returns salvus.mesh.unstructured_mesh.UnstructuredMesh — An unstructured mesh with the smooth model attached. All other fields are copied from the input model.

run()

def run(
    site_name: str,
    ranks_per_job: Optional[int] = None,
    wall_time_in_seconds_per_job: Optional[int] = None,
    model: Union[
        str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh
    ],
    smoothing_config: Dict[str, Union[salvus.opt.smoothing._Base, str]],
    courant_number: Optional[float] = None,
    time_step_in_seconds: Optional[float] = None,
    poll_interval_in_seconds: Optional[float] = None,
    verbosity: int = 1,
) -> salvus.mesh.unstructured_mesh.UnstructuredMesh:
    ...

Smooth a model and return the smoothed model.

The smoothed model will retain a copy of the original contents of each field that is not smoothed.

It will internally submit one job for every to-be-smoothed parameter, thus ranks and wall time settings are per job.

Parameters
  • site_name str — The site to run on.
  • ranks_per_job Optional[int] — The number of ranks for each individual simulation. Defaults to the site’s configuration value.
  • wall_time_in_seconds_per_job Optional[int] — The wall time in seconds per job if the site requires one.
  • model Union[str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh] — The raw model, unsmoothed model.
  • smoothing_config Dict[str, Union[salvus.opt.smoothing._Base, str]] — Smoothing configuration for each smoothing field. Must be a dictionary with the keys being the to-be-smoothed fields and the values smoothing configurations for each field or, alternatively, (remote) file name of precomputed diffusion models.
  • courant_number Optional[float] — Courant number for auto-time-step detection.
  • time_step_in_seconds Optional[float] — Time step for diffusion equation.
  • poll_interval_in_seconds Optional[float] — If given, the site will be queried with this interval. Defaults to the site’s default.
  • verbosity int — The verbosity level.
Returns salvus.mesh.unstructured_mesh.UnstructuredMesh — An unstructured mesh with the smooth model attached. All other fields are copied from the input model.

run_async()

def run_async(
    site_name: str,
    ranks_per_job: Optional[int] = None,
    wall_time_in_seconds_per_job: Optional[int] = None,
    model: Union[
        str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh
    ],
    smoothing_config: Dict[str, Union[salvus.opt.smoothing._Base, str]],
    courant_number: Optional[float] = None,
    time_step_in_seconds: Optional[float] = None,
    verbosity: int = 1,
) -> salvus.flow.sites.salvus_job_array.SalvusJobArray:
    ...

Smooth a model asynchronously and return the resulting job array.

The smoothed model will retain a copy of the original contents of each field that is not smoothed.

It will internally submit one job for every to-be-smoothed parameter, thus ranks and wall time settings are per job.

Parameters
  • site_name str — The site to run on.
  • ranks_per_job Optional[int] — The number of ranks for each individual simulation. Defaults to the site’s configuration value.
  • wall_time_in_seconds_per_job Optional[int] — The wall time in seconds per job if the site requires one.
  • model Union[str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh] — The raw model, unsmoothed model.
  • smoothing_config Dict[str, Union[salvus.opt.smoothing._Base, str]] — Smoothing configuration for each smoothing field. Must be a dictionary with the keys being the to-be-smoothed fields and the values smoothing configurations for each field or, alternatively, (remote) file name of precomputed diffusion models.
  • courant_number Optional[float] — Courant number for auto-time-step detection.
  • time_step_in_seconds Optional[float] — Time step for diffusion equation.
  • verbosity int — The verbosity level.
Returns salvus.flow.sites.salvus_job_array.SalvusJobArray — The job array of the launched smoothing jobs.

Classes

AnisotropicConstant

class AnisotropicConstant(
    salvus.flow.utils.deep_setters._DeepSetter, salvus.opt.smoothing._Base
):
    def __init__(self, smoothing_lengths_in_meters: List[float]):
        ...

The type of the smoothing model

Parameters
  • smoothing_lengths_in_meters List[float] — Anisotropic smoothing length in meters. Depending on the reference frame of the input mesh this is either X, Y, Z or r, theta, phi. Example: [1.0, 2.0]
Methods
apply()
def apply(self, d: Union[Dict, _DeepSetter]) -> None:
    ...

Set the contents with a dictionary.

Parameters
  • d Union[Dict, _DeepSetter] — The dictionary to set.
Returns None
copy()
def copy(self) -> _DeepSetter:
    ...

Return a deep copy of the object.

Returns _DeepSetter
get_dictionary()
def get_dictionary(self) -> Dict:
    ...

Get the contents of this object as a dictionary.

Returns Dict
get_diffusion_model()
def get_diffusion_model(
    self,
    mesh: Union[
        str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh
    ],
) -> salvus.mesh.unstructured_mesh.UnstructuredMesh:
    ...

Compute the diffusion coefficients and return the mesh.

Parameters
  • mesh Union[str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh] — Mesh file.
Returns salvus.mesh.unstructured_mesh.UnstructuredMesh
validate()
def validate(self) -> None:
    ...

Validates the current state of the configuration against its schema.

Returns None

AnisotropicModelDependent

class AnisotropicModelDependent(
    salvus.flow.utils.deep_setters._DeepSetter, salvus.opt.smoothing._Base
):
    def __init__(
        self,
        reference_velocity: str,
        smoothing_lengths_in_wavelengths: List[float],
        reference_model: str,
        reference_frequency_in_hertz: float,
    ):
        ...

The type of the smoothing model

Parameters
  • reference_velocity str — Field name of the reference velocity to compute the wave length in Hz. Example: VP
  • smoothing_lengths_in_wavelengths List[float] — Anisotropic smoothing length in wavelengths. Depending on the reference frame of the input mesh this is either X, Y, Z or r, theta, phi. Example: [1.0, 2.0]
  • reference_model str — Reference model to extract the reference velocity from. Example: mesh.h5
  • reference_frequency_in_hertz float — Reference frequency to compute the wave length in Hz. Example: 1.0
Methods
apply()
def apply(self, d: Union[Dict, _DeepSetter]) -> None:
    ...

Set the contents with a dictionary.

Parameters
  • d Union[Dict, _DeepSetter] — The dictionary to set.
Returns None
copy()
def copy(self) -> _DeepSetter:
    ...

Return a deep copy of the object.

Returns _DeepSetter
get_dictionary()
def get_dictionary(self) -> Dict:
    ...

Get the contents of this object as a dictionary.

Returns Dict
get_diffusion_model()
def get_diffusion_model(
    self,
    mesh: Union[
        str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh
    ],
) -> salvus.mesh.unstructured_mesh.UnstructuredMesh:
    ...

Compute the diffusion coefficients and return the mesh.

Parameters
  • mesh Union[str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh] — Mesh file.
Returns salvus.mesh.unstructured_mesh.UnstructuredMesh
validate()
def validate(self) -> None:
    ...

Validates the current state of the configuration against its schema.

Returns None

AnisotropicSpaceDependent

class AnisotropicSpaceDependent(
    salvus.flow.utils.deep_setters._DeepSetter, salvus.opt.smoothing._Base
):
    def __init__(self, model: str, fields: List[str]):
        ...

The type of the smoothing model

Parameters
  • model str — Model that contains the smoothing field. Example: mesh.h5
  • fields List[str] — Field name containing the isotropic smoothing length in meters. Depending on the reference frame of the input mesh this is either X, Y, Z or N, E, Z. Example: ['SmoothX', 'SmoothY', 'SmoothZ']
Methods
apply()
def apply(self, d: Union[Dict, _DeepSetter]) -> None:
    ...

Set the contents with a dictionary.

Parameters
  • d Union[Dict, _DeepSetter] — The dictionary to set.
Returns None
copy()
def copy(self) -> _DeepSetter:
    ...

Return a deep copy of the object.

Returns _DeepSetter
get_dictionary()
def get_dictionary(self) -> Dict:
    ...

Get the contents of this object as a dictionary.

Returns Dict
get_diffusion_model()
def get_diffusion_model(
    self,
    mesh: Union[
        str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh
    ],
) -> salvus.mesh.unstructured_mesh.UnstructuredMesh:
    ...

Compute the diffusion coefficients and return the mesh.

Parameters
  • mesh Union[str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh] — Mesh file.
Returns salvus.mesh.unstructured_mesh.UnstructuredMesh
validate()
def validate(self) -> None:
    ...

Validates the current state of the configuration against its schema.

Returns None

Custom

class Custom(
    salvus.flow.utils.deep_setters._DeepSetter, salvus.opt.smoothing._Base
):
    def __init__(self, diffusion_model: str):
        ...

The type of the smoothing model

Parameters
  • diffusion_model str — Name of the model containing the diffusion coefficients. Example: diffusion.h5
Methods
apply()
def apply(self, d: Union[Dict, _DeepSetter]) -> None:
    ...

Set the contents with a dictionary.

Parameters
  • d Union[Dict, _DeepSetter] — The dictionary to set.
Returns None
copy()
def copy(self) -> _DeepSetter:
    ...

Return a deep copy of the object.

Returns _DeepSetter
get_dictionary()
def get_dictionary(self) -> Dict:
    ...

Get the contents of this object as a dictionary.

Returns Dict
get_diffusion_model()
def get_diffusion_model(
    self,
    mesh: Union[
        str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh
    ],
) -> salvus.mesh.unstructured_mesh.UnstructuredMesh:
    ...

Compute the diffusion coefficients and return the mesh.

Parameters
  • mesh Union[str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh] — Mesh file.
Returns salvus.mesh.unstructured_mesh.UnstructuredMesh
validate()
def validate(self) -> None:
    ...

Validates the current state of the configuration against its schema.

Returns None

IsotropicConstant

class IsotropicConstant(
    salvus.flow.utils.deep_setters._DeepSetter, salvus.opt.smoothing._Base
):
    def __init__(self, smoothing_length_in_meters: float):
        ...

The type of the smoothing model

Parameters
  • smoothing_length_in_meters float — Isotropic smoothing length in meters. Example: 1.0
Methods
apply()
def apply(self, d: Union[Dict, _DeepSetter]) -> None:
    ...

Set the contents with a dictionary.

Parameters
  • d Union[Dict, _DeepSetter] — The dictionary to set.
Returns None
copy()
def copy(self) -> _DeepSetter:
    ...

Return a deep copy of the object.

Returns _DeepSetter
get_dictionary()
def get_dictionary(self) -> Dict:
    ...

Get the contents of this object as a dictionary.

Returns Dict
get_diffusion_model()
def get_diffusion_model(
    self,
    mesh: Union[
        str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh
    ],
) -> salvus.mesh.unstructured_mesh.UnstructuredMesh:
    ...

Compute the diffusion coefficients and return the mesh.

Parameters
  • mesh Union[str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh] — Mesh file.
Returns salvus.mesh.unstructured_mesh.UnstructuredMesh
validate()
def validate(self) -> None:
    ...

Validates the current state of the configuration against its schema.

Returns None

IsotropicModelDependent

class IsotropicModelDependent(
    salvus.flow.utils.deep_setters._DeepSetter, salvus.opt.smoothing._Base
):
    def __init__(
        self,
        reference_velocity: str,
        reference_frequency_in_hertz: float,
        smoothing_length_in_wavelengths: float,
        reference_model: Optional[str] = None,
    ):
        ...

The type of the smoothing model

Parameters
  • reference_velocity str — Field name of the reference velocity to compute the wave length in Hz. Example: VP
  • reference_frequency_in_hertz float — Reference frequency to compute the wave length in Hz. Example: 1.0
  • smoothing_length_in_wavelengths float — Isotropic smoothing length in wavelengths. Example: 1.0
  • reference_model Optional[str] — Reference model to extract the reference velocity from. Example: mesh.h5
Methods
apply()
def apply(self, d: Union[Dict, _DeepSetter]) -> None:
    ...

Set the contents with a dictionary.

Parameters
  • d Union[Dict, _DeepSetter] — The dictionary to set.
Returns None
copy()
def copy(self) -> _DeepSetter:
    ...

Return a deep copy of the object.

Returns _DeepSetter
get_dictionary()
def get_dictionary(self) -> Dict:
    ...

Get the contents of this object as a dictionary.

Returns Dict
get_diffusion_model()
def get_diffusion_model(
    self,
    mesh: Union[
        str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh
    ],
) -> salvus.mesh.unstructured_mesh.UnstructuredMesh:
    ...

Compute the diffusion coefficients and return the mesh.

Parameters
  • mesh Union[str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh] — Mesh file.
Returns salvus.mesh.unstructured_mesh.UnstructuredMesh
validate()
def validate(self) -> None:
    ...

Validates the current state of the configuration against its schema.

Returns None

IsotropicSpaceDependent

class IsotropicSpaceDependent(
    salvus.flow.utils.deep_setters._DeepSetter, salvus.opt.smoothing._Base
):
    def __init__(self, field: str, model: str):
        ...

The type of the smoothing model

Parameters
  • field str — Field name containing the isotropic smoothing length in meters. Example: smooth
  • model str — Model that contains the smoothing field. Example: mesh.h5
Methods
apply()
def apply(self, d: Union[Dict, _DeepSetter]) -> None:
    ...

Set the contents with a dictionary.

Parameters
  • d Union[Dict, _DeepSetter] — The dictionary to set.
Returns None
copy()
def copy(self) -> _DeepSetter:
    ...

Return a deep copy of the object.

Returns _DeepSetter
get_dictionary()
def get_dictionary(self) -> Dict:
    ...

Get the contents of this object as a dictionary.

Returns Dict
get_diffusion_model()
def get_diffusion_model(
    self,
    mesh: Union[
        str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh
    ],
) -> salvus.mesh.unstructured_mesh.UnstructuredMesh:
    ...

Compute the diffusion coefficients and return the mesh.

Parameters
  • mesh Union[str, pathlib.Path, salvus.mesh.unstructured_mesh.UnstructuredMesh] — Mesh file.
Returns salvus.mesh.unstructured_mesh.UnstructuredMesh
validate()
def validate(self) -> None:
    ...

Validates the current state of the configuration against its schema.

Returns None