Global Variables Dialog Box |
The Global Variables dialog box is displayed by selecting Data|Edit Global Variables...
Global Variables are useful for (1) making the formulas easier to understand, and (2) changing the results of several formulas in a single step. A global variable can be used in a Formula, in the same way that Data Sets can be used. However, unlike Data Sets, Global Variables do not vary spatially. Each Global Variable has a Name, Type, Value, and optionally a Comment.
Name and Type are defined the same way as in Data Sets.
Value is the constant associated with a Global Variable that is used when evaluating a Global Variable in a Formula.
The Comment is optional. Typically, it is used to explain what the Global Variable means or why it is used.
One example of how a global variable could be used is in a formula for unit conversions. For example, suppose a user had a pumping rate that was measured in cubic feet per second and the time unit of the model was days. The user could define a Global Variable with a value of 86400 named "SecondsPerDay" If the actual pumping rate was 10 cubic feet per second, a formula for the pumping rate could be entered as "SecondsPerDay*10" rather than "864000." When checking pumping rates later on, the former formula would be easier to relate to the field data than the latter.
Another example of how Global Variables could be used would be to define Global Variables named "RiverK," "RiverWidth," and "RiverSedimentThickness" with values of 1e-5, 20, and 2 respectively. Then when defining river boundaries, the user could set the formula for the conductance to "((RiverK * RiverWidth) * ObjectIntersectLength) / RiverSedimentThickness." The conductance of all the rivers could then be changed by changing any of the three Global Variables.
The values of global variables can be imported from a text file by clicking the Import global variables button. They can be saved to a text file by clicking the Save global variables button.
Each line of the global variables files must be either empty, start with the # character to identify the line as a comment or list the name and value of an existing global variable. On a line defining a new value for a global variable, the name of the global variable must be at the beginning of the line must be first followed by one or more spaces followed by the value. A period must be used as the decimal separator. For boolean global variables, the value must be either "True" or "False" (without the quotes). For text variables, the value may optionally be enclosed in quotes. When importing global variables, all of the variables in the global variables file must already be defined in the model and the type of data for the variables must match the types of the variables. It is also possible to import a global variables file from the command line.
# Example global variables file. Variable1 1.2 Variable2 3 Variable3 False Variable4 Some other text |