Working with User Code
User code allows Simcenter STAR-CCM+ to be customized with functions written in a compiled language such as C, C++ or Fortran.
User code takes the form of one or more user libraries that are attached to Simcenter STAR-CCM+, each of which contains one or more user functions and a library registration function. When a user library has been attached, its user functions are available for use and are provided in drop-down lists for any operation that needs them. You can use these functions to specify values on a region or a boundary, initialization, and visualization.
User functions can only be accessed on a part if the data used to define the user function exists on that part. For the data to exist, it must be allocated on the specific part and must have been initialized.
You can view the status of the user code where the currently attached user libraries are shown, under the
node.
The User Code node, which has a pop-up menu, is the manager object for all user code libraries that have been saved in the simulation.
The pop-up menu has the following option:
New User Library: Executes the create user library action and adds a user code library to the User Code node.
It exists even when empty to allow creation of the first user code library. The user code manager can hold any number of user code libraries up to the memory limits of the computer.
User functions and library registration functions can be coded in any language, as long as that language is able to bind like C functions or Fortran subroutines. For convenience, the C language interface and the Fortran language interface are documented separately, although conceptually they are identical. Functions in other languages should follow one of these interfaces. A list of the variables available from Simcenter STAR-CCM+ and some examples of user code are also provided.
FORTRAN is not supported on Windows.