Stage: orbit classification / optimizer proxy
Source language: Fortran with optional Python plotting or validation helpers
Manuals to read first: CLAUDE.md, DOC/coordinates-and-fields.md, src/classification.f90, src/orbit_symplectic_base.f90, src/orbit_symplectic.f90, src/field/field_base.f90
Related: #39
Goal
Explore a smooth finite-time Poincare or bounce-map proxy for alpha-loss optimization. The proxy should give optimizers a differentiable or cheaply directionally differentiable target before raw long-time SIMPLE loss runs are used for validation.
Motivation
The hard SIMPLE outputs are not good local derivative targets:
- confined versus lost,
- trapped versus passing,
- regular versus chaotic,
- prompt versus non-prompt.
These labels change at class boundaries. A fixed-branch adjoint of a hard label misses the boundary motion, which is exactly what optimization needs to see. The useful first object is a smooth class-risk margin based on a finite-time map.
Exploratory design
Add a value-only prototype mode first. It should trace a fixed number of bounce tips or section crossings and emit a smooth proxy score, without changing existing hard-class outputs.
Candidate map:
z_j* -> y_j = (s_j, alpha_j)
y_{j+1} = P(y_j, field_coefficients)
Candidate score:
nu = (alpha_N - alpha_0) / (2 pi N)
D_nu = drift between first-half and second-half rotation numbers
Delta_s = smooth radial width over the event sequence
d_pq = distance to low-order p/q resonance
S_pq = Delta_s / (d_pq + d0)
C = sigmoid(smoothmax_pq(S_pq - 1) / eps)
For trapped-particle studies, combine C with a smooth trapped weight and use hard loss only as the validation metric.
Files to inspect
src/classification.f90: existing tip, crossing, class, and diagnostic logic.
src/orbit_symplectic*.f90: event tracing and implicit-step residual/Jacobian structure.
src/field/: available field values and derivatives.
python/ or test/python/: optional plotting or regression helpers.
First deliverable
File a follow-up implementation issue or PR that answers these questions from the current code:
- Which existing routine already records enough event data for
(s, alpha)?
- Which event should define the first prototype: bounce tip or Poincare section crossing?
- Which angle definition is least ambiguous for VMEC-backed SIMPLE runs?
- Which fixed small case should be used for a golden/proxy regression?
- What diagnostics should be emitted for
nu, D_nu, Delta_s, nearest resonance, smooth overlap score, and hard class?
Success criteria
and a short design note or follow-up issue identifies the smallest value-only implementation path.
Non-goals
- Do not autodifferentiate the raw long-time loss fraction.
- Do not replace existing hard classification outputs.
- Do not implement a full adjoint in the first step.
- Do not require SIMSOPT integration in this issue.
Later path
- Value-only Poincare resonance scan.
- SPSA or random-direction finite differences with common particles.
- Tangent-linear directional derivative of the smooth margin.
- Full finite-time Poincare-map adjoint with event-time correction.
Stage: orbit classification / optimizer proxy
Source language: Fortran with optional Python plotting or validation helpers
Manuals to read first:
CLAUDE.md,DOC/coordinates-and-fields.md,src/classification.f90,src/orbit_symplectic_base.f90,src/orbit_symplectic.f90,src/field/field_base.f90Related: #39
Goal
Explore a smooth finite-time Poincare or bounce-map proxy for alpha-loss optimization. The proxy should give optimizers a differentiable or cheaply directionally differentiable target before raw long-time SIMPLE loss runs are used for validation.
Motivation
The hard SIMPLE outputs are not good local derivative targets:
These labels change at class boundaries. A fixed-branch adjoint of a hard label misses the boundary motion, which is exactly what optimization needs to see. The useful first object is a smooth class-risk margin based on a finite-time map.
Exploratory design
Add a value-only prototype mode first. It should trace a fixed number of bounce tips or section crossings and emit a smooth proxy score, without changing existing hard-class outputs.
Candidate map:
Candidate score:
For trapped-particle studies, combine
Cwith a smooth trapped weight and use hard loss only as the validation metric.Files to inspect
src/classification.f90: existing tip, crossing, class, and diagnostic logic.src/orbit_symplectic*.f90: event tracing and implicit-step residual/Jacobian structure.src/field/: available field values and derivatives.python/ortest/python/: optional plotting or regression helpers.First deliverable
File a follow-up implementation issue or PR that answers these questions from the current code:
(s, alpha)?nu,D_nu,Delta_s, nearest resonance, smooth overlap score, and hard class?Success criteria
and a short design note or follow-up issue identifies the smallest value-only implementation path.
Non-goals
Later path