Skip to content

Integrate the equilibrium ODE with fortnum DOP853 instead of ddeabm (Z2)#149

Open
krystophny wants to merge 1 commit into
fortnum/z1-zeal-region-rootsfrom
fortnum/z2-ddeabm-dop853
Open

Integrate the equilibrium ODE with fortnum DOP853 instead of ddeabm (Z2)#149
krystophny wants to merge 1 commit into
fortnum/z1-zeal-region-rootsfrom
fortnum/z2-ddeabm-dop853

Conversation

@krystophny

@krystophny krystophny commented Jun 14, 2026

Copy link
Copy Markdown
Member

Integrate the equilibrium ODE with fortnum ddeabm (Z2)

KIM/src/background_equilibrium/calculate_equil.f90 now integrates the scalar force-balance ODE du/dr with the fortnum variable-order Adams integrator (fortnum_ode_ddeabm), a clean-room equivalent of SLATEC ddeabm. This replaces the earlier DOP853 substitution and restores the original SLATEC continuation semantics.

One ddeabm_init seeds the state at r_grid(1). Each outer grid value u(i) continues the same re-entrant state to r_grid(i) (the SLATEC INFO(1)=1 restart), with the step barred from overshooting r_grid(end) (the RWORK(1) / INFO(4)=1 tstop bound). idid < 1 maps to the existing log_warning path via ode_status%code /= FORTNUM_OK.

The original scalar RHS dudr(r, u, du) is wrapped as the array-valued ode_rhs_t callback dudr(r, u, du, ctx) with neq = 1; the q-profile and pressure data ride on host association, so ctx is unused.

Cumulative on #148 z1; fortnum pinned to main 974dcf1.

Verification

This rewire compiles and runs on the cumulative tip. The KIM equilibrium quantities it feeds are not isolated in the golden comparison set; the tip golden failures all trace to the KiLCA background ODE on #143 k4 (see that PR), not to this change. No new failure category appears at this branch.

Tolerances unchanged (rtol=1e-12, atol=1e-12 for this ODE; golden bar rtol=1e-8 atol=1e-15).

Note: fortnum pin updated to current main (92de6e9) after a fortnum history rewrite; old shas no longer resolve.

@krystophny krystophny force-pushed the fortnum/z2-ddeabm-dop853 branch from 1a8f62f to 72c8dab Compare June 15, 2026 19:28
@krystophny krystophny changed the base branch from main to fortnum/z1-zeal-region-roots June 15, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant