Mondaic

salvus.opt.smoothing

salvus.opt.smoothing salvus opt smoothing

Various parameterizations for diffusion-based smoothing.

Functions

get_smooth_model()

def get_smooth_model(
    job: SalvusJobArray,
    model: str | pathlib.Path | UnstructuredMesh | None = None,
    delete_job: bool = True,
) -> UnstructuredMesh: ...

Get the smooth model from a previously submitted job array.

Parameters
  • job SalvusJobArray — The job array of the smoothing jobs
  • model str | pathlib.Path | UnstructuredMesh | None — 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 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: int | None = None,
    wall_time_in_seconds_per_job: salvus._core.types.float_ | None = None,
    model: str | pathlib.Path | UnstructuredMesh,
    smoothing_config: dict[str, _Base | str],
    courant_number: float | None = None,
    time_step_in_seconds: float | None = None,
    poll_interval_in_seconds: float | None = None,
    verbosity: int = 1,
) -> 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 int | None — The number of ranks for each individual simulation. Defaults to the site’s configuration value.
  • wall_time_in_seconds_per_job salvus._core.types.float_ | None — The wall time in seconds per job if the site requires one.
  • model str | pathlib.Path | UnstructuredMesh — The raw model, unsmoothed model.
  • smoothing_config dict[str, _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 float | None — Courant number for auto-time-step detection.
  • time_step_in_seconds float | None — Time step for diffusion equation.
  • poll_interval_in_seconds float | None — If given, the site will be queried with this interval. Defaults to the site’s default.
  • verbosity int — The verbosity level.
Returns 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: int | None = None,
    wall_time_in_seconds_per_job: salvus._core.types.float_ | None = None,
    model: str | pathlib.Path | UnstructuredMesh,
    smoothing_config: dict[str, _Base | str],
    courant_number: float | None = None,
    time_step_in_seconds: float | None = None,
    verbosity: int = 1,
) -> 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 int | None — The number of ranks for each individual simulation. Defaults to the site’s configuration value.
  • wall_time_in_seconds_per_job salvus._core.types.float_ | None — The wall time in seconds per job if the site requires one.
  • model str | pathlib.Path | UnstructuredMesh — The raw model, unsmoothed model.
  • smoothing_config dict[str, _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 float | None — Courant number for auto-time-step detection.
  • time_step_in_seconds float | None — Time step for diffusion equation.
  • verbosity int — The verbosity level.
Returns 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: dict | _DeepSetter) -> None: ...

Set the contents with a dictionary.

Parameters
  • d 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: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...

Compute the diffusion coefficients and return the mesh.

Parameters
  • mesh str | pathlib.Path | UnstructuredMesh — Mesh file.
Returns 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_frequency_in_hertz: float,
        reference_model: str,
    ): ...

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_frequency_in_hertz float — Reference frequency to compute the wave length in Hz. Example: 1.0
  • reference_model str — Reference model to extract the reference velocity from. Example: mesh.h5
Methods
apply()
def apply(self, d: dict | _DeepSetter) -> None: ...

Set the contents with a dictionary.

Parameters
  • d 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: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...

Compute the diffusion coefficients and return the mesh.

Parameters
  • mesh str | pathlib.Path | UnstructuredMesh — Mesh file.
Returns 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, fields: list[str], model: str): ...

The type of the smoothing model

Parameters
  • 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']
  • model str — Model that contains the smoothing field. Example: mesh.h5
Methods
apply()
def apply(self, d: dict | _DeepSetter) -> None: ...

Set the contents with a dictionary.

Parameters
  • d 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: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...

Compute the diffusion coefficients and return the mesh.

Parameters
  • mesh str | pathlib.Path | UnstructuredMesh — Mesh file.
Returns 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: dict | _DeepSetter) -> None: ...

Set the contents with a dictionary.

Parameters
  • d 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: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...

Compute the diffusion coefficients and return the mesh.

Parameters
  • mesh str | pathlib.Path | UnstructuredMesh — Mesh file.
Returns 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: dict | _DeepSetter) -> None: ...

Set the contents with a dictionary.

Parameters
  • d 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: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...

Compute the diffusion coefficients and return the mesh.

Parameters
  • mesh str | pathlib.Path | UnstructuredMesh — Mesh file.
Returns 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,
        smoothing_length_in_wavelengths: float,
        reference_frequency_in_hertz: float,
        reference_model: typing.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
  • smoothing_length_in_wavelengths float — Isotropic smoothing length in wavelengths. Example: 1.0
  • reference_frequency_in_hertz float — Reference frequency to compute the wave length in Hz. Example: 1.0
  • reference_model typing.Optional[str] — Reference model to extract the reference velocity from. Example: mesh.h5
Methods
apply()
def apply(self, d: dict | _DeepSetter) -> None: ...

Set the contents with a dictionary.

Parameters
  • d 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: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...

Compute the diffusion coefficients and return the mesh.

Parameters
  • mesh str | pathlib.Path | UnstructuredMesh — Mesh file.
Returns 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, model: str, field: str): ...

The type of the smoothing model

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

Set the contents with a dictionary.

Parameters
  • d 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: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...

Compute the diffusion coefficients and return the mesh.

Parameters
  • mesh str | pathlib.Path | UnstructuredMesh — Mesh file.
Returns UnstructuredMesh
validate()
def validate(self) -> None: ...

Validates the current state of the configuration against its schema.

Returns None