# Global Variables¶

Each global variable is a single value that is globally available in all user defined functions. The value may be computed by the following methods:

1. No Calculator – The value is set by one of the UDFs

2. Fluid – The value is computed from a reduction on the Fluid cells

3. Particles – The value is computed from a reduction on the particles set

4. Probe – The value is set by a probe value

5. Interfaces – Like the Fluid, but the reduction is limited to those cells that contain the free surface

## Reductions¶

A reduction is an operation that takes in many values and computes a single value. These are the available reductions:

1. Minimum

2. Maximum

3. Mean

4. Sum

5. Standard Deviation

6. Relative Standard Deviation

## Evaluation Region¶

By default, global variables are reduced over the entire domain. By appending children geometry objects, you can limit the region of evaluation. So for example, if you add a Box geometry as a child to the global variable, the global variable will only operate on the internal cells within the box.

## Examples¶

Set value to maximum fluid velocity. At runtime this UDF is evaluated over the fluid cells. The value is set to the fluid velocity magnitude. The maximum is then taken of all the values, returning the maximum velocity magnitude into the global variable value. This global variable can then be used by any other UDF.

• Set the Data Source = Fluid

• Set the Reduction = Maximum

• Set the code expression to:

value = v;