UserVariable#

class UserVariable[source]#

Bases: Variable

Class representing a user-defined symbolic variable

Properties

value: Any#

Get the value of the variable from the global context.

Additional Constructors

in_units(new_unit=None)[source]#

Requesting the output of the variable to be in the given (new_unit) units.

Parameters:

new_unit (str | Literal['SI_unit_system', 'CGS_unit_system', 'Imperial_unit_system'] | ~unyt.unit_object.Unit | None)

Return type:

Self

Methods

classmethod check_valid_user_variable_name(v)[source]#

Validate a variable identifier (ASCII only).

Parameters:

v (str)

Return type:

str

classmethod preprocess_variable_declaration(values)#

Supporting syntax like a = fl.Variable(name=”a”, value=1, description=”some description”).

Parameters:

values (Any)

Return type:

dict[str, Any]