beam-tracing / Scotty

Beam tracing code for diagnostics
https://scotty.readthedocs.io/en/latest/
GNU General Public License v3.0
7 stars 4 forks source link

Refactor derivatives #99

Closed ZedThree closed 1 year ago

ZedThree commented 1 year ago

Pulls out the apply_stencil function from the Hamiltonian derivatives into a standalone function derivative. This will automatically cache results of the passed-in function so that taking multiple partial derivatives of the same function at the same location will be faster.

Also adds d_poloidal_flux_d* methods to MagneticField so that we can take advantage of RectBivariateSpline.partial_derivative for interpolate fields.

Overall this gives a speed up of ~5-10%