facebookresearch / fmmax

Fourier modal method with Jax
MIT License
95 stars 9 forks source link

Test AD gradient against finite difference gradient #94

Closed mfschubert closed 6 months ago

mfschubert commented 6 months ago

This test is useful, as the vector field calculation includes a stop_gradient, and therefore may have some error. This test suggests the error is small, generally < 1e-2.

smartalecH commented 6 months ago

If we want to really check the accuracy of the gradient here, we should do richardson extrapolation on the step size.