In the previous version of SPEC, when we try to compute the force derivatives, we need to take the derivative of the metric gij and Jacobian with respect to the change of interface geometry Rij and Zij.
In the innermost volume where there is a geometry axis, the derivatives are computed as if the axis is fixed in each iteration. However, this is not true. In each force iteration, the position of the geometry axis is also changed according to the innermost interface. This should be taken in to account.
In this pull request, I have included the force derivative with respect to the change of geometry axis. This presumably can give a more accurate force derivative and a better convergence if the geometry axis is changing a lot in the iterations.
@abaillod I checked the force derivatives with the finite difference by hand. If you can run your tools to get a plot of error versus finite difference step size, it will be perfect. Note that I have changed to LcomputeAxis=.True. in your finite difference subroutine. Thank you.
In the previous version of SPEC, when we try to compute the force derivatives, we need to take the derivative of the metric gij and Jacobian with respect to the change of interface geometry Rij and Zij.
In the innermost volume where there is a geometry axis, the derivatives are computed as if the axis is fixed in each iteration. However, this is not true. In each force iteration, the position of the geometry axis is also changed according to the innermost interface. This should be taken in to account.
In this pull request, I have included the force derivative with respect to the change of geometry axis. This presumably can give a more accurate force derivative and a better convergence if the geometry axis is changing a lot in the iterations.
@abaillod I checked the force derivatives with the finite difference by hand. If you can run your tools to get a plot of error versus finite difference step size, it will be perfect. Note that I have changed to
LcomputeAxis=.True.
in your finite difference subroutine. Thank you.