UserDefinedDynamic#

class UserDefinedDynamic[source]#

Bases: Flow360BaseModel

UserDefinedDynamic class for defining the user defined dynamics inputs. Please refer to this example for an implementation example.

Example

>>> fl.UserDefinedDynamic(
...    name="dynamicTheta",
...    input_vars=["momentY"],
...    constants={
...        "I": 0.443768309310345,
...        "zeta": zeta,
...        "K": K,
...        "omegaN": omegaN,
...        "theta0": theta0,
...    },
...    output_vars={
...        "omegaDot": "state[0];",
...        "omega": "state[1];",
...        "theta": "state[2];",
...    },
...    state_vars_initial_value=[str(initOmegaDot), "0.0", str(initTheta)],
...    update_law=[
...        "if (pseudoStep == 0) (momentY - K * ( state[2] - theta0 ) "
...         + "- 2 * zeta * omegaN * I *state[1] ) / I; else state[0];",
...        "if (pseudoStep == 0) state[1] + state[0] * timeStepSize; else state[1];",
...        "if (pseudoStep == 0) state[2] + state[1] * timeStepSize; else state[2];",
...    ],
...    input_boundary_patches=volume_mesh["plateBlock/noSlipWall"],
...    output_target=volume_mesh["plateBlock"],
... )

Attributes

name: str#

Name of the dynamics defined by the user.

Default:

'User defined dynamics'

input_vars: list[str]#

List of the inputs to define the user defined dynamics. Inputs can be: CL, CD, bet_NUM_torque, bet_NUM_thrust, (NUM is the index of the BET disk starting from 0), momentX, momentY, momentZ (X/Y/Z moments with respect to moment_center), forceX, forceY, forceZ.

constants: dict[str, float] | None#

A list of constants that can be used in the expressions.

Default:

None

output_vars: dict[str, typing.Annotated[str, AfterValidator(func=<function process_expressions at 0x7bbe26477a30>)]] | None#

Name of the output variables and the expression for the output variables using state variables. Outputs can be: alphaAngle, betaAngle, bet_NUM_omega (NUM is the index of the BET disk starting from 0), theta, omega and omegaDot (rotation angle/velocity/acceleration in radians for sliding interfaces), actuatorDisk_<DISK_ENTITY_NAME>_thrustMultiplier and actuatorDisk_<DISK_ENTITY_NAME>_torqueMultiplier (where <DISK_ENTITY_NAME> is the name of the actuator disk entity). Please exercise caution when choosing output variables, as any modifications to their values will be directly mirrored in the solver.

Default:

None

state_vars_initial_value: list[typing.Annotated[str, AfterValidator(func=<function process_expressions at 0x7bbe26477a30>)]]#

The initial value of state variables are specified here. The entries could be either values (in the form of strings, e.g., 0.0) or expression with constants defined earlier or any input and output variable. (e.g., 2.0 * alphaAngle + someConstant). The list entries correspond to the initial values for state[0], state[1], …, respectively.

update_law: list[typing.Annotated[str, AfterValidator(func=<function process_expressions at 0x7bbe26477a30>)]]#
Default:

'List of expressions for updating state variables. The list entries correspond to the update laws for :code:`state[0]`, :code:`state[1]`, ..., respectively. These expressions follows similar guidelines as :ref:`user Defined Expressions<UserDefinedExpressions>`.'

input_boundary_patches: EntityList[Surface, MirroredSurface], optional#

The list of Surface entities to which the input variables belongs. If multiple boundaries are specified then the summation over the boundaries are used as the input. For input variables that already specified the source in the name (like bet_NUM_torque) this entry does not have any effect.

Default:

None

output_target: Cylinder | GenericVolume | Surface | CustomVolume, optional#

The target to which the output variables belong to. For example this can be the rotating volume zone name. Only one output target is supported per user defined dynamics instance. Only Cylinder entity is supported as target for now.

Default:

None

Additional Constructors

classmethod from_file(filename)#

Load a Flow360BaseModel from a .json file.

Parameters:

filename (str)

Return type:

Flow360BaseModel

Methods

help(methods=False)#

Print fields and methods of a Flow360BaseModel using rich.

Parameters:

methods (bool)

Return type:

None

to_file(filename, **kwargs)#

Export Flow360BaseModel instance to a .json file.

Parameters:
Return type:

None