About Adaptive Interpolation Schemes
A general dynamic interpolation scheme is implemented in the TQ-library. At a slight cost of accuracy, this scheme allows you to rapidly obtain equilibrium values for state variables and functions for many different values of a predefined set of conditions.
Multiple sets of conditions and requested variable values can be defined in order to obtain different values for different situations. These are stored internally as different branches.
The accuracy of the scheme can be adjusted by setting the number of steps in the composition/temperature/pressure space where the interpolation is performed.
For a given set of conditions (a branch), the scheme builds up an interpolation matrix within the bounds of the conditions that have been previously defined. As long as the subsequent condition values are kept within these limits, the returned values are calculated from the interpolation matrix. If the condition values are outside these limits then the scheme automatically extends the interpolation matrix. With this procedure the scheme extends the interpolation matrix so that it can return values from a growing range of conditions in composition, temperature and pressure.
For each set of condition values within a branch a unique identifying number is calculated. This number is used to find the correct position in the interpolation matrix using a hash table.
If the memory requirements to extend the interpolation exceeds the available memory, the nodes in the matrix that are less frequently used are removed to free up some memory.
For a general reference about the interpolation scheme, see Larsson and Höglund (2015): "A Scheme for More Efficient Usage of CALPHAD Data in Simulations’, Calphad, 50, 1–5.