Priority: High
Problem
The VMEC from_cyl Newton iteration in libneo can fail for points near the magnetic axis or outside the plasma domain. This causes silent failures or crashes during coordinate transformations, particularly in:
- Chartmap spline construction (when sampling VMEC field at chartmap grid points)
- Particle position conversions between coordinate systems
Current Behavior
- Newton iteration may not converge
- Error handling is inconsistent across call sites
- Some failures are silent, others cause crashes
Proposed Solution
- Add robust error handling at all
from_cyl call sites
- Implement fallback strategies (e.g., nearest valid point, graceful particle loss)
- Consider adding iteration limits and convergence tolerance parameters
- Document which regions are problematic (near axis, near/outside separatrix)
Related
- Chartmap boundary limitation (splines restricted to [0.1, 0.99] to avoid this issue)
- See
DOC/coordinates-and-fields.md Appendix A.4
Priority: High
Problem
The VMEC
from_cylNewton iteration in libneo can fail for points near the magnetic axis or outside the plasma domain. This causes silent failures or crashes during coordinate transformations, particularly in:Current Behavior
Proposed Solution
from_cylcall sitesRelated
DOC/coordinates-and-fields.mdAppendix A.4