flow360.UserDefinedDynamic#
- class UserDefinedDynamic[source]#
Bases:
Flow360BaseModel
UserDefinedDynamic
class for defining the user defined dynamics inputs.Example
The following example comes from the User Defined Dynamics Tutorial Case. Please refer to this tutorial for more details about the User Defined Dynamics.
>>> 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"], ... )
- input_vars: List[str] [Required]#
List of the inputs to define the user defined dynamics. For example
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 tomoment_center
),forceX
,forceY
,forceZ
. For a full list of supported variable, see here.
- output_vars: Dict[str, Annotated[str, AfterValidator(func=process_expressions)]] | None = None#
Name of the output variables and the expression for the output variables using state variables. For example
alphaAngle
,betaAngle
,bet_NUM_omega
(NUM is the index of the BET disk starting from 0),theta
,omega
andomegaDot
(rotation angle/velocity/acceleration in radians for sliding interfaces). For a full list of supported variable, see here. Please exercise caution when choosing output variables, as any modifications to their values will be directly mirrored in the solver. Expressions follows similar guidelines as User Defined Expressions.
- state_vars_initial_value: List[Annotated[str, AfterValidator(func=process_expressions)]] [Required]#
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 forstate[0]
,state[1]
, …, respectively.
- update_law: List[Annotated[str, AfterValidator(func=process_expressions)]] = '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<userDefinedExpressionsKnowledgeBase>`.'#
- input_boundary_patches: EntityList[Surface] | None = None#
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.