A State Variable Definition (

) defines a state variable with an update expression and update event.
The Settings window has the following sections:
You connect the definition to the proper declaration by specifying the declared variable the Variable name field. The
Variable name follows the rules described in
Entering Names and Expressions and must match the name of a variable declaration somewhere in the same physics interface.
Also specify an initial value in the Initial value field and an expression used to update the state variable in the
Update expression field. The expressions in the
Initial value and
Update expression fields must match the dimension of the declared variable.
If desired, select the Store the first time derivative checkbox to store the first time derivatives. You can then also add an expression for update in the
Update expression field.
From the Update list, choose
At beginning of step (the default),
After predictor step,
At end of step, or
Only initialization. If you have chosen
After predictor step or
At end of step you can choose a value from the
Value at interpolation output list:
Start of solver step (the default) or
Linear interpolation.
The options in the Selection list and
Output entities list define the selection where this variable definition is valid. See
Specifying Selections for more information. If you choose
Global in the
Selection list, then the State Variable will be analogous to a state variable defined in a
Global Definitions >
State Variables node in the Model Builder.
From the Integration order list, choose
Automatic (the default),
From discretization, or
Custom shape order to define the integration order for the state variable. If you chose
From discretization, also specify the discretization to use in the
Discretization field. If you chose
Custom shape order, also specify the shape order in the
Order field (default: 2).
From the Value type list, choose
Complex (the default), for a complex-valued state variable, or
Real.
If you select the Associate with internal state of dependent variable checkbox, you can specify a dependent variable or shape variable. This means that, when solving, you can find the state variable components under the solver field node corresponding to the specified dependent variable (these are found under
Solution >
Dependent Variables). In the
Dependent variable reference list, you choose if you can use the physical quantity as the reference (choose
Use physical quantity, which is the default), or if you have to append a unique tag (choose
Use physical quantity + tag and enter a tag in the
Unique tag field). It is possible to choose
Variable name from the
Dependent variable reference list and enter a name as reference in the
Variable name field. The
Physical quantity list defines what quantity the dependent variable represents, including the unit. As mentioned previously, the physical quantity is also used to generate the unique reference tag for the dependent variable. In addition to the predefined and built-in physical quantities you can use locally defined physical quantities or physical quantities imported from an external resource. See
Dependent Variable Declaration for more information.
If the Associate with internal state of dependent variable checkbox is cleared, each state variable will create its own solver field node. For the setting associated with the
Dependent variable reference list, see the corresponding settings for
Coefficient Form Equation.