Create: Variables

Variables are user-defined single- or vector-valued quantities used to generate custom values during simulation. They are most often defined through local or global user-defined functions (UDFs), though some can be modified dynamically within reactions or tuned at runtime from external data sources. Variables may be constant or time-dependent, and can serve as either final output data or intermediate values used by other UDFs.

Primary Classes of Variables

  • Voxel Variables: Defined at each lattice voxel in the computational domain, voxel variables are calculated via voxel-based local UDFs operating on local fluid and/or particle properties such as velocity, pressure, strain, viscosity, species concentration, and temperature. They can also use voxel position and proximity to solid surfaces. Typical applications include custom fluid property calculations, particle statistics, or species concentrations.

  • Global Variables: Flexible quantities that can aggregate (reduce) voxel, particle, static surface, or moving surface variables. They may also link to simulation setup data, output data, or be updated from external sources at runtime. Global variables can be defined via local UDFs, system UDFs, or without a UDF entirely.

Related Constructs

  • Global Constants Table: Centralized constant values referenced anywhere in the simulation setup. These constants simplify UDF logic by avoiding hard-coded numbers and ensure consistent values across multiple functions.

  • UDF Regions: Boolean masks isolating specific lattice regions. Within a UDF, a voxel inside the region evaluates to 1 (true), while voxels outside evaluate to 0 (false). UDF Regions restrict variables, reactions, or outputs to zones such as impeller vortices or baffle-adjacent areas.