In the compute_derivatives_at_point() subroutine of the hermite_interp.f90 module in colors, the expression used to calculate centered finite differences,
df_dx = (f(i + 1, j, k) - f(i - 1, j, k))/(2.0_dp*dx)
will give incorrect results when the grid isn't uniformly spaced -- you can appreciate this from the fact that dx = x(i+1) - x(i), and so x(i-1) is not used.
As an example, applying this formula to the function y(x) = 3x + 1 sampled at x = 0, 1, 1.5 yields a slope 3.5, rather than 3.
In the compute_derivatives_at_point() subroutine of the hermite_interp.f90 module in colors, the expression used to calculate centered finite differences,
will give incorrect results when the grid isn't uniformly spaced -- you can appreciate this from the fact that dx = x(i+1) - x(i), and so x(i-1) is not used.
As an example, applying this formula to the function y(x) = 3x + 1 sampled at x = 0, 1, 1.5 yields a slope 3.5, rather than 3.