variable_values#

Part.variable_values(variable: Variable, elem_type: int = 0, imaginary: bool = False, component: int = 0) array#

Return a numpy array containing the value(s) of a variable. If the variable is a part variable, a single float value is returned. If the variable is a nodal variable, the resulting numpy array will have the same number of values as there are nodes. If the variable is elemental, the elem_type selects the block of elements to return the variable values for (elem_type is ignored for other variable types).

Parameters:
variableVariable

The variable to return the values for.

elem_typeint

Used only if the variable location is elemental, this keyword selects the element type to return the variable values for.

imaginarybool

If the variable is of type complex, setting this to True will select the imaginary portion of the data.

componentint

Select the channel for a multivalued variable type. For example, if the variable is a vector, setting component to 1 will select the ‘Y’ component.

Returns:
numpy.array

A numpy array or a single scalar float.