The generic purpose of a user function is to populate a result array with values obtained by operating on args, as shown in the examples, using this template:
#include "Real.h"
void name(result, int size, args ...);
name: the function name. This is arbitrary: STAR-CCM+ does not impose particular function names for particular functionality. There are, however, some protected names which must be avoided: ucarg, ucfunc, ucfunction, uclib, ufarg, uffunc, uflib.
result: the array of values returned by the user function. It should be declared as
Real *result
for a scalar function, or
Real (*result)[3]
for a vector function. Each element of the result array represents a cell or face, depending on the type of the user function.
size: the number of elements in the result array.
args: the arguments which STAR-CCM+ should pass to the function, chosen from the list of available variables and requested through ucarg. The form of declaration for a variable arg of type T is given in the table below.
For example,
CoordReal (*centroid)[3], Real *temperature
would declare centroid position and temperature as arguments.
The Real and CoordReal types define the precision of floating-point variables in Real.h.