Settings
General settings for defining simulations
General Settings
Units
- class onscale.settings.Units(unit_system: str | None = None, *, length: str | None = None, time: str | None = None, mass: str | None = None, temperature: str | None = None, energy: str | None = None, power: str | None = None)
Override global units for simulation.
Default for all units is None, meaning the simulation will assume standard units, usually (meters, kilograms, seconds, Kelvin).
Support for various units will vary based on physics solver.
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... on.settings.Units(length='km', time='s')
- Parameters:
unit_system – DEPRECATED, specify individual units separately
length – Length units.
time – Time units.
mass – Mass units.
temperature – Temperature units.
energy – Energy units.
power – Power units.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
Scalar
(This feature is deprecated)
- class onscale.settings.Scalar(length: float = None, time: float = None, mass: float = None)
Implementation of this object is purely for backwards compat with SOLVE, not indended to make functional sense.
SOLVE previously used this object incorrectly to define units in a CadFile. See Geometry._compat_units for more info.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
Multi-Physics Settings
Gravity
- class onscale.settings.Gravity(acceleration: Collection[float | str | Var | Function] | None = None, coord_system: CoordinateSystem | None = None)
Define environment gravity for simulation.
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... on.settings.Gravity([0, 0, -9.81])
- Parameters:
acceleration – Vector of acceleration in global units. Default is [0.0, 0.0, -9.81].
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
EnabledPhysics
- class onscale.settings.EnabledPhysics(physics: str | Iterable[str])
An object used to specify physics to enable
By default, all physics types associated with defined loads/outputs are considered enabled, but this object can be used to restrict that set.
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... on.settings.EnabledPhysics("thermal")
- Parameters:
physics – one or more physics type names
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
Outputs
- class onscale.settings.Outputs(probe_format: str | None = None, field_data_format: str | None = None, field_sample_count: int | None = None)
Global settings for simulation outputs
- Parameters:
probe_format – Output file format to save probe data, either ‘json’ or ‘csv’.
field_data_format – Output file format to save field data, either ‘component’ or ‘tensor’.
field_sample_count – The total number of output frames to generate field output for.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
InitFile
- class onscale.settings.InitFile(paths: str | List[str])
One or more files which contain input conditions for a simulation run.
The contents of these files will vary based on which solver is being used.
- Parameters:
paths – Names of input files to include in the solve.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
MultiPhysics
- class onscale.settings.MultiPhysics(coupling: str | None = None, solver: Solver | None = None, mechanical_solver: Solver | None = None, thermal_solver: Solver | None = None)
Global settings for the multiphysics solver selection
- Parameters:
coupling – Coupling type for multiphysics simulation, either ‘monolithic’ or ‘block’. If not specified, will default to ‘monolithic’. ‘block’ coupling requires both mechanical and thermal physics to be enabled
solver – Required if the coupling type is ‘monolithic’
mechanical_solver – Required if the coupling type is ‘block’ and mechanical physics is enabled
thermal_solver – Required if the coupling type is ‘block’ and thermal physics is enabled
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
AMR
- class onscale.settings.AMR(adaptation_steps: int = 1, min_refinement_per_adaptation: int = 1, max_refinement_per_adaptation: int = 3, refinement_threshold_percent: int = 5)
Use adaptive mesh refinement in the simulation .. rubric:: Examples
>>> import onscale as on >>> >>> with on.Simulation('My Sim') as sim: ... on.settings.AMR(adaptation_steps=1, min_refinement_per_adaptation=1, max_refinement_per_adaptation=3, refinement_threshold_percent=5)
- Parameters:
adaptation_steps – Number of adptation steps to perform during mesh refinement process
min_refinement_per_adaptation – minimum number of refinement steps to carry out during each adaptation step
max_refinement_per_adaptation – maximum number of refinement steps to carry out during each adaptation step
refinement_threshold_percent – Threshold percentage error above which the cells will be marked for refinement
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
DisabledPhysics
(This feature is deprecated)
- class onscale.settings.DisabledPhysics(physics: str | Iterable[str])
An object used to specify specific physics to enable/restrict
By default, these will be inferred from loads/conditions/outputs, but this object can be used to explicitly control simulations.
Examples: >>> import onscale as on >>> with on.Simulation(“Static Solve”) as sim: … on.settings.DisabledPhysics(“thermal”)
Acoustic Settings
FrequencyOfInterest
- class onscale.settings.FrequencyOfInterest(frequency: float | str | Var | Function)
Configure frequency of interest for acoustic simulations.
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... on.settings.FrequencyOfInterest(frequency=100000)
- Parameters:
frequency – The value to set the frequency of interest for the model
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
MeshVelocity
- class onscale.settings.MeshVelocity(velocity: float | str | Var | Function)
Configure mesh velocity for acoustic simulations.
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... on.settings.MeshVelocity(velocity=1000)
- Parameters:
velocity – The value to set the mesh velocity
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
Mechanical Settings
Deformations
- class onscale.settings.Deformations(deformation_type: DeformationType | str)
Configure deformations for mechanical simulations.
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... on.settings.Deformations("large")
Initialize deformations.
- Parameters:
deformation_type – The type of deformation to set, or the case-insensitive string equivalent of one.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
Thermal Settings
AmbientTemperature
- class onscale.settings.AmbientTemperature(magnitude: float | str | Var | Function)
Set the ambient temperature for a simulation.
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... on.settings.AmbientTemperature(magnitude=273.15)
- Parameters:
magnitude – Temperature in global unit system.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
Fluid Settings
Flow
- class onscale.settings.Flow(mode: str = 'internal', compressibility: str = 'incompressible', form: str = 'auto', turbulence: str | None = 'auto', wall_model: str = 'auto', wall_thermal_type: str = 'adiabatic', wall_temperature: float | None = None, max_velocity_estimate: float | None = None)
Configure flow settings for fluid simulations
- Parameters:
mode –
Either “general” or “internal”.
”general” solves for external flow around geometry or a mixed external-internal flow about a hollow geometry.
”internal” solves only for internal flow through a hollow geometry.
compressibility – Either “incompressible” or “compressible”. Determines whether to use incompressible or compressible Navier-Stokes equations.
form –
One of “auto”, “inviscid”, “laminar”, “rans”, “des”, “les”, “dns”. Determines form fluid flow equations to be solved. Defaults to “auto”.
”auto” - Infer the best method from the simulation setup.
”inviscid” - Invicid Euler flow equations
”laminar” - Navier-Stokes equations without turbulence
”rans” - Reynolds-Averaged Navier-Stokes
”des” - Detached Eddy Simulation
”les” - Large Eddy Simulation
”dns” - Directed Numerical Simulation
turbulence –
One of “auto”, “k-epsilon”, “k-omega”, “sst”, “spalart-allmaras”, “smagorinsky”, or None. Defaults to “auto”. Setting this to None means no turbulence model will be used.
”auto” - Infer the appropriate turbulence model from the simulation setup.
”k_epsilon” - Only available if form=”rans”.
”k_omega” - Only available if form=”rans”.
”sst” - Shear Stress Transport k-omega. Only available if form=”rans” or form=”des”.
”spalart_allmaras” - Available with any form.
”smagorinsky” - Only available with form=”les”.
Auto model based on the argument for form:
”inviscid” -> None
”laminar” -> None
”rans” -> “sst”
”des” -> “spalart_allmaras”
”les” -> “smagorinsky”
”dns” -> None
wall_model –
One of “auto”, “wall_function”, or “no_slip”.
”auto” - Infer the wall model based on the simulation setup.
”wall_function” - Models near-wall flow using wall function.
”no_slip” - Models near-wall flow using the Navier-Stokes equations.
Auto value depends on the argument for form:
”invicid” -> None
”laminar” -> “wall_function”
”rans” -> “wall_function”
”des” -> “full_integration”
”les” -> “full_integration”
”dns” -> “full_integration”
wall_thermal_type –
How the wall handles heat transfer:
”adiabatic” (default) - There is no heat transfer.
”isothermal” - Uniform heat transfer. If selected, must also specify the wall temperature.
wall_temperature – The wall temperature for the wall_thermal_type=”isothermal”.
max_velocity_estimate – Estimated maximum fluid velocity Used to compute a stable time step when inlet velocity is not provided (ex: Natural Convection Thermo-Fluid simulation)
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
Equilibrium
- class onscale.settings.Equilibrium(path: str)
An input equilibrium from a previous fluid dynamics solution
Only relevant for linearlized fidelity.
- Parameters:
path – Equilibrium solution from a previous solve.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
Perturbation
- class onscale.settings.Perturbation(path: str)
An input perturbation from a previous fluid dynamics solution
Only relevant for linearlized fidelity.
- Parameters:
path – Perturbation solution from a previous solve.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
ReferencePressure
- class onscale.settings.ReferencePressure(pressure: float | str | Var | Function)
An input reference pressure to be used within a fluid dynamics solution
- Parameters:
pressure – The pressure value to use as the reference val
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
Global Mesh Settings
- class onscale.settings.Mesher(mesh_index: int | None = None, use_regular_mesh: bool | None = None, use_feature_detection: bool | None = None, use_regular_mesh_for_tube_model: bool | None = None, mesher_engine: MesherEngine | None = None)
Global mesh settings for meshing.
- mesh_index
# TODO
- use_regular_mesh
if a tube-shaped model is detected, use a regular mesh
- use_feature_detection
DEPRECATED
- use_regular_mesh_for_tube_model
DEPRECATED
- mesher_engine
the default is meshing with cm2, but we can switch it to mesh with Prime instead
Examples
>>> import onscale as on >>> >>> with on.Simulation('My Sim') as sim: ... on.settings.Mesher()
Initialize the global meshing settings.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
Contact Settings
Initial Contact/Bonding
- class onscale.settings.InitialContact(bonded: bool | None = None, conformal_mesh: bool | None = None, alias: str | None = None)
Define whether touching faces should be bonded together.
This applies to all external faces of the geometry.
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... on.settings.InitialContact(bonded=True)
Set the initial contact setting parameters.
- Parameters:
bonded – Boolean specifying if touching faces should get bonded.
conformal_mesh – Whether to use a conformal mesh accross parts with adjacent faces. If false, will mesh the parts nonconformally.
alias – Optional alias for this setting.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
General Contact
- class onscale.settings.GeneralContact(enabled: bool | None = None, disabled: bool | None = None, method: ContactMethod | None = None, interaction_type: None | str | InteractionType = None, alias: str | None = None)
Define settings for contact interaction between all external faces of the geometry.
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... contact_method = on.interactions.contact_methods.PenaltyMethod() ... on.settings.GeneralContact(method=contact_method, interaction_type="surface_to_surface")
Construct a GeneralContact.
- Parameters:
enabled – Boolean specifying if general contact is enabled (defaults to True).
disabled – DEPRECATED use enabled instead.
method – Can be either on.interactions.contact_methods.PenaltyMethod or AugmentedLagrangian
interaction_type – Either “node_to_surface” or “surface_to_surface”
alias – Optional alias for this setting
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.