Introduction
The thermal solver Application Programming Interface (API) allows you to create or add functionality or algorithms, not currently supported by the Simcenter 3D software, to enhance the thermal solver capabilities and share data with other simulation codes. You can use API methods to write the plugin function that is compiled as a shared library and inserted into a thermal flow simulation to:
- Define your own boundary conditions, material properties.
- Specify customized model parameters.
- Initialize a solution.
There are two ways how you can extend the thermal solver functionality. You can add:
- The user-written subroutines at various stages of the calculation, which are automatically compiled and loaded at run time.
- The compiled plugin functions in expressions that are used at run time.
While plugin functions and user-written subroutines play similar roles, there are some fundamental differences.
- A plugin function always returns a single value of a specific type and cannot change the value of any arguments passed to it.
- A user-written subroutine is a block of statements that carries out one or more tasks packed into a discrete structure. A subroutine does not return a value the way a function does, but it can return values by changing the value of arguments passed to it.
You can use plugin functions and user-written subroutines in your solution simultaneously.
This manual describes how to create and use user-written subroutines and plugin functions with FORTRAN or C++ programming languages and provides simple examples.
You can find a C++ code example of a plugin function in the UserFunctions.cpp file located in the [installation_path]\nxcae_extras\tmg\plugin_examples\thermal_solver\ExpressionsShell folder. For an example of a complete user-written subroutine that applies a heat load to a model, see Example - user written subroutine section.