Version:

salvus.opt.smoothing

salvus.opt.smoothing salvus opt smoothing
Various parameterizations for diffusion-based smoothing.

Functions

get_smooth_model()

Get the smooth model from a previously submitted job array.
SIGNATURE
def get_smooth_model(
    job: SalvusJobArray,
    model: str | pathlib.Path | UnstructuredMesh | None = None,
    delete_job: bool = True,
) -> UnstructuredMesh: ...
ARGUMENTS
Required
job
Type:SalvusJobArray
Description:
The job array of the smoothing jobs
Optional
model
Type:str | pathlib.Path | UnstructuredMesh | None
Default value:None
Description:
The raw input model. This is optional and only to avoid additional I/O.
Optional
delete_job
Type:bool
Default value:True
Description:
Flag to determine if job should be deleted
RETURNS
Return type: UnstructuredMesh
An unstructured mesh with the smooth model attached. All other fields are copied from the input model.

run()

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.
SIGNATURE
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: ...
ARGUMENTS
Required
site_name
Type:str
Description:
The site to run on.
Optional
ranks_per_job
Type:int | None
Default value:None
Description:
The number of ranks for each individual simulation. Defaults to the site's configuration value.
Optional
wall_time_in_seconds_per_job
Type:salvus._core.types.float_ | None
Default value:None
Description:
The wall time in seconds per job if the site requires one.
Required
model
Type:str | pathlib.Path | UnstructuredMesh
Description:
The raw model, unsmoothed model.
Required
smoothing_config
Type:dict[str, _Base | str]
Description:
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.
Optional
courant_number
Type:float | None
Default value:None
Description:
Courant number for auto-time-step detection.
Optional
time_step_in_seconds
Type:float | None
Default value:None
Description:
Time step for diffusion equation.
Optional
poll_interval_in_seconds
Type:float | None
Default value:None
Description:
If given, the site will be queried with this interval. Defaults to the site's default.
Optional
verbosity
Type:int
Default value:1
Description:
The verbosity level.
RETURNS
Return type: UnstructuredMesh
An unstructured mesh with the smooth model attached. All other fields are copied from the input model.

run_async()

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.
SIGNATURE
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: ...
ARGUMENTS
Required
site_name
Type:str
Description:
The site to run on.
Optional
ranks_per_job
Type:int | None
Default value:None
Description:
The number of ranks for each individual simulation. Defaults to the site's configuration value.
Optional
wall_time_in_seconds_per_job
Type:salvus._core.types.float_ | None
Default value:None
Description:
The wall time in seconds per job if the site requires one.
Required
model
Type:str | pathlib.Path | UnstructuredMesh
Description:
The raw model, unsmoothed model.
Required
smoothing_config
Type:dict[str, _Base | str]
Description:
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.
Optional
courant_number
Type:float | None
Default value:None
Description:
Courant number for auto-time-step detection.
Optional
time_step_in_seconds
Type:float | None
Default value:None
Description:
Time step for diffusion equation.
Optional
verbosity
Type:int
Default value:1
Description:
The verbosity level.
RETURNS
Return type: SalvusJobArray
The job array of the launched smoothing jobs.

Classes

AnisotropicConstant

The type of the smoothing model
SIGNATURE
class AnisotropicConstant(
    salvus.flow.utils.deep_setters._DeepSetter, salvus.opt.smoothing._Base
):
    def __init__(self, smoothing_lengths_in_meters: list[float]): ...
ARGUMENTS
Required
smoothing_lengths_in_meters
Type:list[float]
Description:
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

AnisotropicConstant.apply()
Set the contents with a dictionary.
SIGNATURE
def apply(self, d: dict | _DeepSetter) -> None: ...
ARGUMENTS
Required
d
Type:dict | _DeepSetter
Description:
The dictionary to set.
AnisotropicConstant.copy()
Return a deep copy of the object.
SIGNATURE
def copy(self) -> _DeepSetter: ...
AnisotropicConstant.get_dictionary()
Get the contents of this object as a dictionary.
SIGNATURE
def get_dictionary(self) -> dict: ...
AnisotropicConstant.get_diffusion_model()
Compute the diffusion coefficients and return the mesh.
SIGNATURE
def get_diffusion_model(
    self, mesh: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...
ARGUMENTS
Required
mesh
Type:str | pathlib.Path | UnstructuredMesh
Description:
Mesh file.
AnisotropicConstant.validate()
Validates the current state of the configuration against its schema.
SIGNATURE
def validate(self) -> None: ...

AnisotropicModelDependent

The type of the smoothing model
SIGNATURE
class AnisotropicModelDependent(
    salvus.flow.utils.deep_setters._DeepSetter, salvus.opt.smoothing._Base
):
    def __init__(
        self,
        reference_model: str,
        reference_frequency_in_hertz: float,
        reference_velocity: str,
        smoothing_lengths_in_wavelengths: list[float],
    ): ...
ARGUMENTS
Required
reference_model
Type:str
Description:
Reference model to extract the reference velocity from. Example: mesh.h5
Required
reference_frequency_in_hertz
Type:float
Description:
Reference frequency to compute the wave length in Hz. Example: 1.0
Required
reference_velocity
Type:str
Description:
Field name of the reference velocity to compute the wave length in Hz. Example: VP
Required
smoothing_lengths_in_wavelengths
Type:list[float]
Description:
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]

Methods

AnisotropicModelDependent.apply()
Set the contents with a dictionary.
SIGNATURE
def apply(self, d: dict | _DeepSetter) -> None: ...
ARGUMENTS
Required
d
Type:dict | _DeepSetter
Description:
The dictionary to set.
AnisotropicModelDependent.copy()
Return a deep copy of the object.
SIGNATURE
def copy(self) -> _DeepSetter: ...
AnisotropicModelDependent.get_dictionary()
Get the contents of this object as a dictionary.
SIGNATURE
def get_dictionary(self) -> dict: ...
AnisotropicModelDependent.get_diffusion_model()
Compute the diffusion coefficients and return the mesh.
SIGNATURE
def get_diffusion_model(
    self, mesh: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...
ARGUMENTS
Required
mesh
Type:str | pathlib.Path | UnstructuredMesh
Description:
Mesh file.
AnisotropicModelDependent.validate()
Validates the current state of the configuration against its schema.
SIGNATURE
def validate(self) -> None: ...

AnisotropicSpaceDependent

The type of the smoothing model
SIGNATURE
class AnisotropicSpaceDependent(
    salvus.flow.utils.deep_setters._DeepSetter, salvus.opt.smoothing._Base
):
    def __init__(self, model: str, fields: list[str]): ...
ARGUMENTS
Required
model
Type:str
Description:
Model that contains the smoothing field. Example: mesh.h5
Required
fields
Type:list[str]
Description:
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

AnisotropicSpaceDependent.apply()
Set the contents with a dictionary.
SIGNATURE
def apply(self, d: dict | _DeepSetter) -> None: ...
ARGUMENTS
Required
d
Type:dict | _DeepSetter
Description:
The dictionary to set.
AnisotropicSpaceDependent.copy()
Return a deep copy of the object.
SIGNATURE
def copy(self) -> _DeepSetter: ...
AnisotropicSpaceDependent.get_dictionary()
Get the contents of this object as a dictionary.
SIGNATURE
def get_dictionary(self) -> dict: ...
AnisotropicSpaceDependent.get_diffusion_model()
Compute the diffusion coefficients and return the mesh.
SIGNATURE
def get_diffusion_model(
    self, mesh: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...
ARGUMENTS
Required
mesh
Type:str | pathlib.Path | UnstructuredMesh
Description:
Mesh file.
AnisotropicSpaceDependent.validate()
Validates the current state of the configuration against its schema.
SIGNATURE
def validate(self) -> None: ...

Custom

The type of the smoothing model
SIGNATURE
class Custom(
    salvus.flow.utils.deep_setters._DeepSetter, salvus.opt.smoothing._Base
):
    def __init__(self, diffusion_model: str): ...
ARGUMENTS
Required
diffusion_model
Type:str
Description:
Name of the model containing the diffusion coefficients. Example: diffusion.h5

Methods

Custom.apply()
Set the contents with a dictionary.
SIGNATURE
def apply(self, d: dict | _DeepSetter) -> None: ...
ARGUMENTS
Required
d
Type:dict | _DeepSetter
Description:
The dictionary to set.
Custom.copy()
Return a deep copy of the object.
SIGNATURE
def copy(self) -> _DeepSetter: ...
Custom.get_dictionary()
Get the contents of this object as a dictionary.
SIGNATURE
def get_dictionary(self) -> dict: ...
Custom.get_diffusion_model()
Compute the diffusion coefficients and return the mesh.
SIGNATURE
def get_diffusion_model(
    self, mesh: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...
ARGUMENTS
Required
mesh
Type:str | pathlib.Path | UnstructuredMesh
Description:
Mesh file.
Custom.validate()
Validates the current state of the configuration against its schema.
SIGNATURE
def validate(self) -> None: ...

IsotropicConstant

The type of the smoothing model
SIGNATURE
class IsotropicConstant(
    salvus.flow.utils.deep_setters._DeepSetter, salvus.opt.smoothing._Base
):
    def __init__(self, smoothing_length_in_meters: float): ...
ARGUMENTS
Required
smoothing_length_in_meters
Type:float
Description:
Isotropic smoothing length in meters. Example: 1.0

Methods

IsotropicConstant.apply()
Set the contents with a dictionary.
SIGNATURE
def apply(self, d: dict | _DeepSetter) -> None: ...
ARGUMENTS
Required
d
Type:dict | _DeepSetter
Description:
The dictionary to set.
IsotropicConstant.copy()
Return a deep copy of the object.
SIGNATURE
def copy(self) -> _DeepSetter: ...
IsotropicConstant.get_dictionary()
Get the contents of this object as a dictionary.
SIGNATURE
def get_dictionary(self) -> dict: ...
IsotropicConstant.get_diffusion_model()
Compute the diffusion coefficients and return the mesh.
SIGNATURE
def get_diffusion_model(
    self, mesh: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...
ARGUMENTS
Required
mesh
Type:str | pathlib.Path | UnstructuredMesh
Description:
Mesh file.
IsotropicConstant.validate()
Validates the current state of the configuration against its schema.
SIGNATURE
def validate(self) -> None: ...

IsotropicModelDependent

The type of the smoothing model
SIGNATURE
class IsotropicModelDependent(
    salvus.flow.utils.deep_setters._DeepSetter, salvus.opt.smoothing._Base
):
    def __init__(
        self,
        reference_frequency_in_hertz: float,
        reference_velocity: str,
        smoothing_length_in_wavelengths: float,
        reference_model: typing.Optional[str] = None,
    ): ...
ARGUMENTS
Required
reference_frequency_in_hertz
Type:float
Description:
Reference frequency to compute the wave length in Hz. Example: 1.0
Required
reference_velocity
Type:str
Description:
Field name of the reference velocity to compute the wave length in Hz. Example: VP
Required
smoothing_length_in_wavelengths
Type:float
Description:
Isotropic smoothing length in wavelengths. Example: 1.0
Optional
reference_model
Type:typing.Optional[str]
Default value:None
Description:
Reference model to extract the reference velocity from. Example: mesh.h5

Methods

IsotropicModelDependent.apply()
Set the contents with a dictionary.
SIGNATURE
def apply(self, d: dict | _DeepSetter) -> None: ...
ARGUMENTS
Required
d
Type:dict | _DeepSetter
Description:
The dictionary to set.
IsotropicModelDependent.copy()
Return a deep copy of the object.
SIGNATURE
def copy(self) -> _DeepSetter: ...
IsotropicModelDependent.get_dictionary()
Get the contents of this object as a dictionary.
SIGNATURE
def get_dictionary(self) -> dict: ...
IsotropicModelDependent.get_diffusion_model()
Compute the diffusion coefficients and return the mesh.
SIGNATURE
def get_diffusion_model(
    self, mesh: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...
ARGUMENTS
Required
mesh
Type:str | pathlib.Path | UnstructuredMesh
Description:
Mesh file.
IsotropicModelDependent.validate()
Validates the current state of the configuration against its schema.
SIGNATURE
def validate(self) -> None: ...

IsotropicSpaceDependent

The type of the smoothing model
SIGNATURE
class IsotropicSpaceDependent(
    salvus.flow.utils.deep_setters._DeepSetter, salvus.opt.smoothing._Base
):
    def __init__(self, model: str, field: str): ...
ARGUMENTS
Required
model
Type:str
Description:
Model that contains the smoothing field. Example: mesh.h5
Required
field
Type:str
Description:
Field name containing the isotropic smoothing length in meters. Example: smooth

Methods

IsotropicSpaceDependent.apply()
Set the contents with a dictionary.
SIGNATURE
def apply(self, d: dict | _DeepSetter) -> None: ...
ARGUMENTS
Required
d
Type:dict | _DeepSetter
Description:
The dictionary to set.
IsotropicSpaceDependent.copy()
Return a deep copy of the object.
SIGNATURE
def copy(self) -> _DeepSetter: ...
IsotropicSpaceDependent.get_dictionary()
Get the contents of this object as a dictionary.
SIGNATURE
def get_dictionary(self) -> dict: ...
IsotropicSpaceDependent.get_diffusion_model()
Compute the diffusion coefficients and return the mesh.
SIGNATURE
def get_diffusion_model(
    self, mesh: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...
ARGUMENTS
Required
mesh
Type:str | pathlib.Path | UnstructuredMesh
Description:
Mesh file.
IsotropicSpaceDependent.validate()
Validates the current state of the configuration against its schema.
SIGNATURE
def validate(self) -> None: ...
PAGE CONTENTS