Customizing the thermal solver

This lesson explains how to extend the thermal solver using user-written subroutines and plugin functions to model custom thermal behavior.

This lesson may include hands-on exercises. Review the Discussion section for background information or click the button to proceed to the practical section.

Discussion

The thermal solver allows you to customize the thermal solver to model behavior that is not available through the standard user interface. Customization is achieved through user-written subroutines and plugin functions, which enable advanced control over boundary conditions, material properties, solver parameters, and solution behavior.

User-written subroutines provide multiple access points during the solution process, including initialization, each steady-state iteration or transient time step, and run completion. These subroutines allow direct interaction with the thermal solver by retrieving or modifying temperatures, heat loads, conductances, capacitances, solver controls, and time-stepping parameters. User subroutines are well suited for modeling complex physical phenomena, implementing custom control logic, or exporting solver data in specialized formats.

Simcenter 3D supports different types of user subroutines, such as USER1, which modifies the thermal model during the solve, and USERF, which extends table interpolation capabilities. During the solution, the thermal solver uses internal element labels for performance reasons, and predefined routines are available to convert between internal and external labels when reporting results.

Plugin functions provide a complementary approach for extending solver functionality. It is a compiled C++ function that returns a single value and can be used directly in expressions within Simcenter 3D. Common usage includes defining custom correlations, boundary conditions, or material behavior based on solver context data such as temperatures, material properties, element geometry, and solution time.

The workflow for using plugin functions includes writing the C++ source code using supported API methods, compiling the code into a shared library, loading the library into Simcenter 3D, and referencing the function in expressions. User-written subroutines and plugin functions can be used together within the same solution to achieve flexible and powerful solver customization.

Hands-on material

To gain experience with the topics discussed here, complete the following:

Further learning