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:
subroutine name(result, size, args ...)
use StarRealMod
integer, intent(in) :: size
name: the function name. This is arbitrary: STAR-CCM+ does not impose particular function names for particular functionality. There are some protected names however 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(StarReal), intent(out) :: result(size)
for a scalar function, or:
real(StarReal), intent(out) :: result(3,size)
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 ufarg. The form of declaration for a variable arg of type T is given in the table below.
For example,
real(CoordReal), intent(in) :: centroid(3,*)
real(StarReal), intent(in) :: temperature(*)
would declare centroid position and temperature as arguments.
The StarReal and CoordReal types define the precision of floating-point variables in StarReal.f.