Skip to content

Commit

Permalink
Fixes a bug in evaluate cubic
Browse files Browse the repository at this point in the history
In current CVMix master, the returned value of fprime in evaluate cubic
is not correct.  For example, when linear interpolation is used, the
returned value of fprime is

fprime = coeffs(2) + h + h^2

it should be

fprime = coeffs(2) + coeffs(3)*h + coeffs(4)*h^2

As it currently sits, the returned fprime is much too large (6 orders of
magnitude in my tests relative to the corrected version)
  • Loading branch information
vanroekel committed Nov 21, 2016
1 parent d83f582 commit f6746fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/shared/cvmix_math.F90
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ function cvmix_math_evaluate_cubic(coeffs, x_in, fprime)
cvmix_math_evaluate_cubic = cvmix_math_evaluate_cubic + &
coeffs(i)*(x_in**(i-1))
if (present(fprime).and.(i.gt.2)) &
fprime = fprime + real(i-1,cvmix_r8)*(x_in**(i-2))
fprime = fprime + coeffs(i)*real(i-1,cvmix_r8)*(x_in**(i-2))
end do

end function cvmix_math_evaluate_cubic
Expand Down

0 comments on commit f6746fd

Please sign in to comment.