Global Variables Panel
This page is about the workspace controls for global variables, expressions and units. What an expression may contain, how units are parsed, the state variables and when expressions are evaluated are documented once, on the engine site: Global Variables, Expressions and Units.
The panel
Open Global Variables in the Navigator. Each row is one variable:
| Column | Meaning |
|---|---|
| Name | The identifier you use in expressions, e.g. P_high. Names are case-sensitive, use only letters, digits and underscores, cannot start with a digit, and must not clash with the built-in names listed below or with another variable. |
| Type | The physical quantity (Pressure, Temperature, Time, Velocity, Molar Flow Rate, …, or Dimensionless / Custom). It fixes the SI base unit the value is stored in, shown next to the value. |
| Expression | A number or a formula, optionally ending in a unit, e.g. 3.5 [bar] or 2*P_low. |
| Value | The evaluated value in SI base units, recomputed after every edit. A problem with the row (an invalid name, a unit that does not match the Type, a circular reference, an unknown name) is shown on a line under it. |
| Description | Free text for your own notes. |
+ Add variable adds a row named var1, var2, … and × removes one. Variables are saved with the deck.
To use a variable, type its name into any numeric field, for example P_high in a pressure profile's final value, t_feed in two step times so that they always stay equal, or y_feed and 1 - y_feed as the two mole fractions of a feed composition.
Names
Names are case-sensitive, use only letters, digits and underscores, cannot start with a digit, and must not clash with the built-in names or with another variable. The workspace checks a name as you type it and only accepts it when it is valid: if you leave the box with an invalid name, it goes back to the previous one.
Units
Field units
Numeric fields in the workspace have a unit menu next to them. Pressure fields open in bar and temperature fields in °C; every other quantity opens in its SI base unit (s, m, mol/s, …). Typing a plain number with a unit selected stores it as number [unit], which the engine converts on evaluation; a plain number with no unit, or with the base unit selected, is taken to be in SI already. A value the deck stores in SI is shown converted to the selected unit (a stored 101325 reads as 1.01325 with bar selected) and is only rewritten when you edit it. A formula is stored exactly as you type it, so give it an inline unit or write it in SI.
Checks
Variable type
If a variable's Type is a specific quantity and its expression ends in a unit of a different quantity (say Type Pressure and 300 [K]), the deck is marked not runnable with the message inline unit is Temperature but variable category is Pressure. A variable of type Dimensionless (the default for a new row) or Custom accepts any unit and keeps its type.
The workspace also checks the dimensions of every expression that uses a variable, so a variable cannot be put into a field of the wrong quantity. With F_in of type Molar Flow, typing F_in into a stream's velocity field shows “F_in” is Molar Flow [mol·s⁻¹], but this field needs Velocity [m·s⁻¹], and the same check runs on each variable's own expression against its Type. The rules:
- A variable has the dimension of its Type. A Dimensionless variable takes the dimension of its own expression (
5 [bar]is a pressure,2*F_ina molar flow) and is a plain number otherwise; a Custom variable is never checked. - A plain number fits any dimension, so
2*F_inandP_low + 1e5are fine. +,-, comparisons,min,max,sum,avgand the two branches of?:need the same dimension on both sides (P_low + F_inis an error);*and/combine dimensions;x^nraises them to a constant power andsqrthalves them;exp,log,sinand the other functions give a plain number.T,P,c,y,vandRhave their physical dimensions;PIis a plain number.- An expression ending in a unit has that unit's dimension; the formula before it must be a plain number or already have that dimension.
A name that is not a variable, a state variable or a function (a typo such as F_inn, or a variable that was renamed) is flagged the same way. These problems mark the field and its Navigator section with a cross, and Run, the parametric study and the optimiser will not start until they are fixed.
Evaluation
The workspace re-evaluates every expression after each edit so that the Value column and the field values stay current. Circular references are flagged on the variable's row and the deck will not run; a reference to an undefined name is flagged on the field. Keep the list in dependency order: define base quantities first and derived ones after them.
Global variables in studies
The Parametric Study, Optimisation and Parameterisation tools list global variables as parameters (group User variables). Each trial sets the parameter it varies to a plain number, so varying a variable moves every field that refers to it. A field written in terms of a variable is not listed at all: vary the variable. To change several inputs together, make them all refer to one variable and vary the variable.