5.10. User Defined Functions (UDF)

Ansys Forte allows use of user-defined functions to customize/enhance some of the nominal built-in computations. In this release of Forte, there are 4 categories for which such customizations are available. These are:

Forte supports usage of three computer programming languages: Fortran, C, and C++, to build a user-defined function shared-object library (a file with extension "dll" on Windows systems and with extension "so" on the Linux operating system). Each module (category listed above) builds into a corresponding shared-object library file.

The detailed instructions on how to build the library and various functionalities available are documented in the README.txt file. On Windows systems, this file is located in the InstallDir\forte.win64\user_defined_functions, where the default location for the installation directory is InstallDir. (For example, on Windows systems, this location is C:\ANSYS Inc\vNNN\reaction where NNN is a particular version number, such as 222). Also, there are descriptive comments in each program-source file that provide details on input, output, and the intended usage.

Using user-defined functions from CKCFD-API

Forte uses Ansys Chemkin CKCFD-API for efficient computation of chemical source terms. You can also use the corresponding user-defined functionalities, either progress variable for certain reactions or net-production rate for certain species. However, this is done outside of compilation-and-building of the user-defined shared-objects mentioned earlier. For example, on Windows systems, a shared-object library named kinetics_usrdll.dll can be built using the make utilities available through Ansys Chemkin located in InstallDir\chemkinpro.win64\samples\chemkin_cfd_api\user_routines. (The instructions on compiling and building can be obtained from Ansys.) Note that the kinetics_usrdll.dll gets built into InstallDir\chemkinpro.win64\bin directory. You then must copy that file into the location where Forte expects to find the user-defined function shared-objects, which by default is InstallDir\forte.win64\user_defined_functions\bin.


Note:  The file NOTE.txt in InstallDir\forte.win64\user_defined_functions\bin mentions that the (user-defined) shared-object files generated by the make utility in Forte will be automatically copied (via the make script) into the just-mentioned bin folder. However, this applies only to the three files mentioned in the previous subsection and not to the kinetics_usr. The latter must be built and copied as mentioned in the above paragraph.