Skip to content

Make eq.solve actually differentiable #2087

@f0uriest

Description

@f0uriest

Right now, doing eg jax.jacfwd(lambda eq: eq.solve()) doesn't work, and this makes interfacing with lots of other codes a lot more annoying. If we want to do optimization in desc we have workarounds, but if other codes just want the derivative of an equilibrium then there's a ton of extra glue code that needs to be written (and it's gotten a lot more complicated since the last time I had to do something like this).

It would be super useful if we got this to work correctly. The idea is that the input would be an equilibrium with whatever boundary/profiles you want, and the output of jvp would be another equilibrium where eq.R_lmn etc is really the tangent at F=0. This would make composing it with other jax functions super easy and not rely on knowing internals of desc in order to use our derivative information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions