Using Tools > Working with User Code > Fortran User Interface Reference > Template User Function (Fortran)

Your Ad Here




Template User Function (Fortran)

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.

Argument Type
(StoredVariable< T >)
    
Declaration
(all intent(in))

int

 

integer arg(*)

Real

 

real(StarReal) arg(*)

unsigned int

 

integer arg(*)

Vector< 2, unsigned int >

 

integer arg(2,*)

Vector< 3, CoordReal >

 

real(CoordReal) arg(3,*)

Vector< 3, Real >

 

real(StarReal) arg(3,*)

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.

Return to CD-adapco STAR-CCM+ Index


Your Ad Here