flow360.NavierStokesSolver#
- pydantic model NavierStokesSolver[source]#
NavierStokesSolver
class for setting up compressible Navier-Stokes solver- Parameters:
absolute_tolerance (Optional[PositiveFloat] = 1e-10) – relative_tolerance : Optional[NonNegativeFloat] = 0 order_of_accuracy : Optional[Literal[1, 2]] = 2 CFL_multiplier : Optional[PositiveFloat] = 1.0 update_jacobian_frequency : Optional[PositiveInt] = 4 max_force_jac_update_physical_steps : Optional[NonNegativeInt] = 0 kappa_MUSCL : Optional[ConstrainedFloatValue] = -1 equation_eval_frequency : Optional[PositiveInt] = 1 numerical_dissipation_factor : Optional[ConstrainedFloatValue] = 1 limit_velocity : Optional[bool] = False limit_pressure_density : Optional[bool] = False linear_solver : Optional[LinearSolver] = LinearSolver(max_iterations=30, absolute_tolerance=None, relative_tolerance=None, _type=’LinearSolver’) model_type : Literal[‘Compressible’] = Compressible low_mach_preconditioner : Optional[bool] = False low_mach_preconditioner_threshold : Optional[NonNegativeFloat] = None
absolute_tolerance – Tolerance for the NS residual, below which the solver goes to the next physical step
relative_tolerance – Tolerance to the relative residual, below which the solver goes to the next physical step. Relative residual is defined as the ratio of the current pseudoStep’s residual to the maximum residual present in the first 10 pseudoSteps within the current physicalStep. NOTE: relativeTolerance is ignored in steady simulations and only absoluteTolerance is used as the convergence criterion
CFL_multiplier – Factor to the CFL definitions defined in “timeStepping” section
kappa_MUSCL – Kappa for the MUSCL scheme, range from [-1, 1], with 1 being unstable. The default value of -1 leads to a 2nd order upwind scheme and is the most stable. A value of 0.33 leads to a blended upwind/central scheme and is recommended for low subsonic flows leading to reduced dissipation
update_jacobian_frequency – Frequency at which the jacobian is updated.
equation_eval_frequency – Frequency at which to update the compressible NS equation in loosely-coupled simulations
max_force_jac_update_physical_steps – When which physical steps, the jacobian matrix is updated every pseudo step
order_of_accuracy – Order of accuracy in space
limit_velocity – Limiter for velocity
limit_pressure_density – Limiter for pressure and density
numerical_dissipation_factor – A factor in the range [0.01, 1.0] which exponentially reduces the dissipation of the numerical flux. The recommended starting value for most low-dissipation runs is 0.2
linear_solver – Linear solver settings
low_mach_preconditioner – Uses preconditioning for accelerating low Mach number flows.
low_mach_preconditioner_threshold – For flow regions with Mach numbers smaller than threshold, the input Mach number to the preconditioner is assumed to be the threshold value if it is smaller than the threshold. The default value for the threshold is the freestream Mach number.
- Returns:
An instance of the component class NavierStokesSolver.
- Return type:
Example
>>> ns = NavierStokesSolver(absolute_tolerance=1e-10)
- Fields:
CFL_multiplier (pydantic.types.PositiveFloat | None)
absolute_tolerance (pydantic.types.PositiveFloat | None)
equation_eval_frequency (pydantic.types.PositiveInt | None)
kappa_MUSCL (flow360.component.flow360_params.solvers.ConstrainedFloatValue | None)
limit_pressure_density (bool | None)
limit_velocity (bool | None)
linear_solver (flow360.component.flow360_params.solvers.LinearSolver | None)
low_mach_preconditioner (bool | None)
low_mach_preconditioner_threshold (pydantic.types.NonNegativeFloat | None)
max_force_jac_update_physical_steps (pydantic.types.NonNegativeInt | None)
model_type (Literal['Compressible'])
numerical_dissipation_factor (flow360.component.flow360_params.solvers.ConstrainedFloatValue | None)
order_of_accuracy (Literal[1, 2] | None)
relative_tolerance (pydantic.types.NonNegativeFloat | None)
update_jacobian_frequency (pydantic.types.PositiveInt | None)
- field CFL_multiplier = 1.0 (alias 'CFLMultiplier')#
- Constraints:
exclusiveMinimum = 0
- field kappa_MUSCL = -1 (alias 'kappaMUSCL')#
- Constraints:
minimum = -1
maximum = 1
- field equation_eval_frequency = 1 (alias 'equationEvalFrequency')#
- Constraints:
exclusiveMinimum = 0
- field numerical_dissipation_factor = 1 (alias 'numericalDissipationFactor')#
- Constraints:
minimum = 0.01
maximum = 1
- field limit_velocity = False (alias 'limitVelocity')#
- field limit_pressure_density = False (alias 'limitPressureDensity')#
- field linear_solver = LinearSolver(max_iterations=30, absolute_tolerance=None, relative_tolerance=None, _type='LinearSolver') (alias 'linearSolver')#
- Constraints:
title = LinearSolver
description =
LinearSolver
class for setting up linear solver for heat equation Parameters ———- max_iterations : Optional[PositiveInt] = 50 absolute_tolerance : Optional[PositiveFloat] = None relative_tolerance : Optional[PositiveFloat] = None Parameters ———- max_iterations : PositiveInt, optional Maximum number of linear solver iterations, by default 50 absolute_tolerance : PositiveFloat, optional The linear solver converges when the final residual of the pseudo steps below this value. Either absolute tolerance or relative tolerance can be used to determine convergence, by default 1e-10 relative_tolerance : The linear solver converges when the ratio of the final residual and the initial residual of the pseudo step is below this value. Returns ——-LinearSolver
An instance of the component class LinearSolver. Example ——- >>> ls = LinearSolver( max_iterations=50, absoluteTolerance=1e-10 )type = object
properties = {‘maxIterations’: {‘title’: ‘Maxiterations’, ‘default’: 50, ‘exclusiveMinimum’: 0, ‘type’: ‘integer’}, ‘absoluteTolerance’: {‘title’: ‘Absolutetolerance’, ‘exclusiveMinimum’: 0, ‘type’: ‘number’}, ‘relativeTolerance’: {‘title’: ‘Relativetolerance’, ‘exclusiveMinimum’: 0, ‘type’: ‘number’}, ‘_type’: {‘title’: ‘ Type’, ‘default’: ‘LinearSolver’, ‘enum’: [‘LinearSolver’], ‘type’: ‘string’}}
additionalProperties = False
- field model_type = 'Compressible' (alias 'modelType')#
- Constraints:
const = Compressible
- field low_mach_preconditioner = False (alias 'lowMachPreconditioner')#
- field low_mach_preconditioner_threshold = None (alias 'lowMachPreconditionerThreshold')#
- Constraints:
minimum = 0
- classmethod add_type_field()#
Automatically place “type” field with model name in the model field dictionary.
- append(params, overwrite=False)#
append parametrs to the model
- Parameters:
params (Flow360BaseModel) – Flow360BaseModel parameters to be appended
overwrite (bool, optional) – Whether to overwrite if key exists, by default False
- classmethod construct(_fields_set=None, **values)#
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
- copy(update=None, **kwargs)#
Copy a Flow360BaseModel. With
deep=True
as default.
- dict(*args, exclude=None, **kwargs)#
Returns dict representation of the model.
- Parameters:
*args – Arguments passed to pydantic’s
dict
method.**kwargs – Keyword arguments passed to pydantic’s
dict
method.
- Returns:
A formatted dict.
- Return type:
Example
>>> params.dict()
- classmethod dict_from_file(filename)#
Loads a dictionary containing the model from a .json or .yaml file.
- Parameters:
filename (str) – Full path to the .yaml or .json file to load the
Flow360BaseModel
from.- Returns:
A dictionary containing the model.
- Return type:
Example
>>> params = Flow360Params.from_file(filename='folder/flow360.json')
- classmethod flow360_schema()#
Generate a schema json string for the flow360 model
- classmethod flow360_ui_schema()#
Generate a UI schema json string for the flow360 model
- classmethod from_file(filename)#
Loads a
Flow360BaseModel
from .json, or .yaml file.- Parameters:
filename (str) – Full path to the .yaml or .json file to load the
Flow360BaseModel
from.- Returns:
An instance of the component class calling load.
- Return type:
Flow360BaseModel
Example
>>> simulation = Simulation.from_file(filename='folder/sim.json')
- classmethod from_json(filename, **parse_obj_kwargs)#
Load a
Flow360BaseModel
from .json file.- Parameters:
filename (str) – Full path to the .json file to load the
Flow360BaseModel
from.- Returns:
Flow360BaseModel
– An instance of the component class calling load.**parse_obj_kwargs – Keyword arguments passed to pydantic’s
parse_obj
method.
Example
>>> params = Flow360Params.from_json(filename='folder/flow360.json')
- classmethod from_orm(obj)#
- classmethod from_yaml(filename, **parse_obj_kwargs)#
Loads
Flow360BaseModel
from .yaml file.- Parameters:
filename (str) – Full path to the .yaml file to load the
Flow360BaseModel
from.**parse_obj_kwargs – Keyword arguments passed to pydantic’s
parse_obj
method.
- Returns:
An instance of the component class calling from_yaml.
- Return type:
Flow360BaseModel
Example
>>> params = Flow360Params.from_yaml(filename='folder/flow360.yaml')
- classmethod generate_docstring()#
Generates a docstring for a Flow360 model and saves it to the __doc__ of the class.
- help(methods=False)#
Prints message describing the fields and methods of a
Flow360BaseModel
.- Parameters:
methods (bool = False) – Whether to also print out information about object’s methods.
Example
>>> solver_params.help(methods=True)
- json(*args, exclude=None, **kwargs)#
Returns json representation of the model.
- Parameters:
*args – Arguments passed to pydantic’s
json
method.**kwargs – Keyword arguments passed to pydantic’s
json
method.
- Returns:
A formatted json. Sets default vaules by_alias=True, exclude_none=True
- Return type:
json
Example
>>> params.json()
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)#
- classmethod parse_obj(obj)#
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)#
- classmethod schema(by_alias=True, ref_template='#/definitions/{model}')#
- classmethod schema_json(*, by_alias=True, ref_template='#/definitions/{model}', **dumps_kwargs)#
- set_will_export_to_flow360(flag)#
Recursivly sets flag will_export_to_flow360
- Parameters:
flag (bool) – set to true before exporting to flow360 json
- to_file(filename)#
Exports
Flow360BaseModel
instance to .json or .yaml file- Parameters:
filename (str) – Full path to the .json or .yaml or file to save the
Flow360BaseModel
to.
Example
>>> params.to_file(filename='folder/flow360.json')
- to_json(filename)#
Exports
Flow360BaseModel
instance to .json file- Parameters:
filename (str) – Full path to the .json file to save the
Flow360BaseModel
to.
Example
>>> params.to_json(filename='folder/flow360.json')
- to_yaml(filename)#
Exports
Flow360BaseModel
instance to .yaml file.- Parameters:
filename (str) – Full path to the .yaml file to save the
Flow360BaseModel
to.
Example
>>> params.to_yaml(filename='folder/flow360.yaml')
- classmethod update_forward_refs(**localns)#
Try to update ForwardRefs on fields based on this Model, globalns and localns.
- classmethod validate(value)#
- field absolute_tolerance = 1e-10 (alias 'absoluteTolerance')#
- Constraints:
exclusiveMinimum = 0
- field relative_tolerance = 0 (alias 'relativeTolerance')#
- Constraints:
minimum = 0
- field order_of_accuracy = 2 (alias 'orderOfAccuracy')#
- field update_jacobian_frequency = 4 (alias 'updateJacobianFrequency')#
- Constraints:
exclusiveMinimum = 0
- field max_force_jac_update_physical_steps = 0 (alias 'maxForceJacUpdatePhysicalSteps')#
- Constraints:
minimum = 0