Skip to content

ODE integration needs to spend less time in the deep core #122

@logan-nc

Description

@logan-nc

The benchmarking of ODE solvers in #117 reveals that all the options spend 25% of their steps stuck in the deep core near the initialization point. The majority of our physics problems of interest are going to be dominated by edge or global kink responses - not core-localized modes and definitely not modes localized in a range of ~0.05 psi or less. As such, reducing the number of steps here seems like an opportunity for real wins in speed. I see a few possible approaches:

  1. Minimum change: Add absolute tolerances that allow the ODE solver to take larger steps there. The issue is probably that we have strict relative tolerances and the ODE has just started out, so everything is super small. Small relative tolerances on small solutions lead us to make small steps. A clever way to set a reasonable absolute tolerance would be the quickest solution with the least amount of change to the code.

  2. Biggest change: It would be interesting is we could integrate backwards from edge-to-core and then reshuffle the linear solution coefficients to match the original core boundary conditions DCON uses to initialize in the core. There are probably a few gotchas to be encountered here, as it is definitely a bigger change. It might be worth it though. Starting in the edge would naturally spend more time there, which is consistent with both the likely physics of interest for stability and for plasma response calculations. Solutions are larger for more m out there, so the relative tolerances should kick in more naturally and be less overkill than they are in the core (but we could always incorporate (1) into this strategy as well if we did that first).

  3. A middle-ground approach: Instead of fully switching the integration, we could do something similar to the banded matrix option the fortran DCON had... but instead of banding we just expand the mpert every time we cross a rational surface by tacking on a vector of 0's and letting the mode coupling start to build it up from there. Put another way, the final full u would be the final mpert corresponding to qa but we'd only be solving a subset of the low-m of it in the core. So instead of "banded" we'd be "blocked". This would save the integrator a lot of work tracking super small high-m solutions in the core with it's tight relative tolerances. The full solve has ignorable small high-m solutions there anyways. Benchmarks I've done show the edge modes of DCON are not sensitive to the core truncation - even out to mid-radius or beyond. So I expect this approach would give perfectly fine results.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions