FLASH-X
Doxygen Generated Documentation From Interface Source Code
Functions/Subroutines
Interpolate_cubic3DF.F90 File Reference

Go to the source code of this file.

Functions/Subroutines

real function Interpolate_cubic3DF (a, x, y, z)
 

Function/Subroutine Documentation

◆ Interpolate_cubic3DF()

real function Interpolate_cubic3DF ( real, dimension (1:64), intent(in)  a,
real, intent(in)  x,
real, intent(in)  y,
real, intent(in)  z 
)

Calculates the function value for a triple [x,y,z] of rescaled [0,1] coordinates and the 64 tricubic expansion coefficients. The tricubic expansion reads, for one cube, in terms of rescaled [0,1] x,y,z coordinates:

3 3 3 i j k F (x,y,z) = sum sum sum a (i,j,k) x y z i=0 j=0 k=0

The order of the supplied expansion coefficients a (i,j,k) must be such, that the k index has the highest ranking, followed by the j index and the i index. The overall location index of the a (i,j,k) inside the 64-dimensional vector is given by the following formula:

location index of (i,j,k) = 1 + i + 4j + 16k

Since this function is (potentially) called many times from external applications, efficiency is key here and intermediate common summation terms are reused as much as possible. The strategy is partial summation and reduction at each index summation stage. The individual x-,y- and z-coordinate cubic polynomial sections are always evaluated using the Horner scheme to minimize accumulation of computation rounding errors.

a (i) : the i-th tricubic expansion coefficient x : rescaled [0,1] x coordinate y : rescaled [0,1] y coordinate z : rescaled [0,1] z coordinate

NOTES

The code checks, if the supplied triple [x,y,z] is rescaled.

Definition at line 50 of file Interpolate_cubic3DF.F90.