salvus.opt.smoothing
salvus.opt.smoothing salvus opt smoothing Various parameterizations for diffusion-based smoothing.
Functions
get_smooth_model()
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.
jobSalvusJobArray — The job array of the smoothing jobsmodelstr | pathlib.Path | UnstructuredMesh | None — The raw input model. This is optional and only to avoid additional I/O.delete_jobbool — Flag to determine if job should be deleted
run()
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.
site_namestr — The site to run on.ranks_per_jobint | None — The number of ranks for each individual simulation. Defaults to the site’s configuration value.wall_time_in_seconds_per_jobsalvus._core.types.float_ | None — The wall time in seconds per job if the site requires one.modelstr | pathlib.Path | UnstructuredMesh — The raw model, unsmoothed model.smoothing_configdict[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_numberfloat | None — Courant number for auto-time-step detection.time_step_in_secondsfloat | None — Time step for diffusion equation.poll_interval_in_secondsfloat | None — If given, the site will be queried with this interval. Defaults to the site’s default.verbosityint — The verbosity level.
run_async()
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.
site_namestr — The site to run on.ranks_per_jobint | None — The number of ranks for each individual simulation. Defaults to the site’s configuration value.wall_time_in_seconds_per_jobsalvus._core.types.float_ | None — The wall time in seconds per job if the site requires one.modelstr | pathlib.Path | UnstructuredMesh — The raw model, unsmoothed model.smoothing_configdict[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_numberfloat | None — Courant number for auto-time-step detection.time_step_in_secondsfloat | None — Time step for diffusion equation.verbosityint — The verbosity level.
Classes
AnisotropicConstant
AnisotropicConstantclass 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
smoothing_lengths_in_meterslist[float] — Anisotropic smoothing length in meters. Depending on the reference frame of the input mesh this is eitherX,Y,Zorr,theta,phi. Example:[1.0, 2.0]
apply()
apply()def apply(self, d: dict | _DeepSetter) -> None: ...Set the contents with a dictionary.
ddict | _DeepSetter — The dictionary to set.
copy()
copy()def copy(self) -> _DeepSetter: ...Return a deep copy of the object.
get_dictionary()
get_dictionary()def get_dictionary(self) -> dict: ...Get the contents of this object as a dictionary.
get_diffusion_model()
get_diffusion_model()def get_diffusion_model(
self, mesh: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...Compute the diffusion coefficients and return the mesh.
meshstr | pathlib.Path | UnstructuredMesh — Mesh file.
validate()
validate()def validate(self) -> None: ...Validates the current state of the configuration against its schema.
AnisotropicModelDependent
AnisotropicModelDependentclass 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
reference_velocitystr — Field name of the reference velocity to compute the wave length in Hz. Example:VPsmoothing_lengths_in_wavelengthslist[float] — Anisotropic smoothing length in wavelengths. Depending on the reference frame of the input mesh this is eitherX,Y,Zorr,theta,phi. Example:[1.0, 2.0]reference_frequency_in_hertzfloat — Reference frequency to compute the wave length in Hz. Example:1.0reference_modelstr — Reference model to extract the reference velocity from. Example:mesh.h5
apply()
apply()def apply(self, d: dict | _DeepSetter) -> None: ...Set the contents with a dictionary.
ddict | _DeepSetter — The dictionary to set.
copy()
copy()def copy(self) -> _DeepSetter: ...Return a deep copy of the object.
get_dictionary()
get_dictionary()def get_dictionary(self) -> dict: ...Get the contents of this object as a dictionary.
get_diffusion_model()
get_diffusion_model()def get_diffusion_model(
self, mesh: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...Compute the diffusion coefficients and return the mesh.
meshstr | pathlib.Path | UnstructuredMesh — Mesh file.
validate()
validate()def validate(self) -> None: ...Validates the current state of the configuration against its schema.
AnisotropicSpaceDependent
AnisotropicSpaceDependentclass 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
fieldslist[str] — Field name containing the isotropic smoothing length in meters. Depending on the reference frame of the input mesh this is eitherX,Y,ZorN,E,Z. Example:['SmoothX', 'SmoothY', 'SmoothZ']modelstr — Model that contains the smoothing field. Example:mesh.h5
apply()
apply()def apply(self, d: dict | _DeepSetter) -> None: ...Set the contents with a dictionary.
ddict | _DeepSetter — The dictionary to set.
copy()
copy()def copy(self) -> _DeepSetter: ...Return a deep copy of the object.
get_dictionary()
get_dictionary()def get_dictionary(self) -> dict: ...Get the contents of this object as a dictionary.
get_diffusion_model()
get_diffusion_model()def get_diffusion_model(
self, mesh: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...Compute the diffusion coefficients and return the mesh.
meshstr | pathlib.Path | UnstructuredMesh — Mesh file.
validate()
validate()def validate(self) -> None: ...Validates the current state of the configuration against its schema.
Custom
Customclass Custom(
salvus.flow.utils.deep_setters._DeepSetter, salvus.opt.smoothing._Base
):
def __init__(self, diffusion_model: str): ...The type of the smoothing model
diffusion_modelstr — Name of the model containing the diffusion coefficients. Example:diffusion.h5
apply()
apply()def apply(self, d: dict | _DeepSetter) -> None: ...Set the contents with a dictionary.
ddict | _DeepSetter — The dictionary to set.
copy()
copy()def copy(self) -> _DeepSetter: ...Return a deep copy of the object.
get_dictionary()
get_dictionary()def get_dictionary(self) -> dict: ...Get the contents of this object as a dictionary.
get_diffusion_model()
get_diffusion_model()def get_diffusion_model(
self, mesh: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...Compute the diffusion coefficients and return the mesh.
meshstr | pathlib.Path | UnstructuredMesh — Mesh file.
validate()
validate()def validate(self) -> None: ...Validates the current state of the configuration against its schema.
IsotropicConstant
IsotropicConstantclass 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
smoothing_length_in_metersfloat — Isotropic smoothing length in meters. Example:1.0
apply()
apply()def apply(self, d: dict | _DeepSetter) -> None: ...Set the contents with a dictionary.
ddict | _DeepSetter — The dictionary to set.
copy()
copy()def copy(self) -> _DeepSetter: ...Return a deep copy of the object.
get_dictionary()
get_dictionary()def get_dictionary(self) -> dict: ...Get the contents of this object as a dictionary.
get_diffusion_model()
get_diffusion_model()def get_diffusion_model(
self, mesh: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...Compute the diffusion coefficients and return the mesh.
meshstr | pathlib.Path | UnstructuredMesh — Mesh file.
validate()
validate()def validate(self) -> None: ...Validates the current state of the configuration against its schema.
IsotropicModelDependent
IsotropicModelDependentclass 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
reference_velocitystr — Field name of the reference velocity to compute the wave length in Hz. Example:VPsmoothing_length_in_wavelengthsfloat — Isotropic smoothing length in wavelengths. Example:1.0reference_frequency_in_hertzfloat — Reference frequency to compute the wave length in Hz. Example:1.0reference_modeltyping.Optional[str] — Reference model to extract the reference velocity from. Example:mesh.h5
apply()
apply()def apply(self, d: dict | _DeepSetter) -> None: ...Set the contents with a dictionary.
ddict | _DeepSetter — The dictionary to set.
copy()
copy()def copy(self) -> _DeepSetter: ...Return a deep copy of the object.
get_dictionary()
get_dictionary()def get_dictionary(self) -> dict: ...Get the contents of this object as a dictionary.
get_diffusion_model()
get_diffusion_model()def get_diffusion_model(
self, mesh: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...Compute the diffusion coefficients and return the mesh.
meshstr | pathlib.Path | UnstructuredMesh — Mesh file.
validate()
validate()def validate(self) -> None: ...Validates the current state of the configuration against its schema.
IsotropicSpaceDependent
IsotropicSpaceDependentclass IsotropicSpaceDependent(
salvus.flow.utils.deep_setters._DeepSetter, salvus.opt.smoothing._Base
):
def __init__(self, model: str, field: str): ...The type of the smoothing model
modelstr — Model that contains the smoothing field. Example:mesh.h5fieldstr — Field name containing the isotropic smoothing length in meters. Example:smooth
apply()
apply()def apply(self, d: dict | _DeepSetter) -> None: ...Set the contents with a dictionary.
ddict | _DeepSetter — The dictionary to set.
copy()
copy()def copy(self) -> _DeepSetter: ...Return a deep copy of the object.
get_dictionary()
get_dictionary()def get_dictionary(self) -> dict: ...Get the contents of this object as a dictionary.
get_diffusion_model()
get_diffusion_model()def get_diffusion_model(
self, mesh: str | pathlib.Path | UnstructuredMesh
) -> UnstructuredMesh: ...Compute the diffusion coefficients and return the mesh.
meshstr | pathlib.Path | UnstructuredMesh — Mesh file.
validate()
validate()def validate(self) -> None: ...Validates the current state of the configuration against its schema.