Added energy conservation test

This commit is contained in:
Connor Johnstone
2025-10-24 14:04:51 -04:00
parent 9b86e1d146
commit 56458a721e
4 changed files with 117 additions and 33 deletions

View File

@@ -36,9 +36,11 @@ Each feature below links to a detailed implementation plan in the `features/` di
- [x] **[Vern7 (Verner 7th order)](features/02-vern7-method.md)** ✅ COMPLETED
- 7th order explicit RK method for high-accuracy non-stiff problems
- Efficient for tight tolerances
- Efficient for tight tolerances (2.7-8.8x faster than DP5 at 1e-10)
- Full 7th order dense output with lazy computation
- **Dependencies**: None
- **Effort**: Medium
- **Status**: All success criteria met, comprehensive benchmarks completed
- [ ] **[Rosenbrock23](features/03-rosenbrock23.md)**
- L-stable 2nd/3rd order Rosenbrock-W method

View File

@@ -143,29 +143,34 @@ Where the embedded 6th order method shares most stages with the 7th order method
- [ ] **FSAL verification**: Not applicable (Vern7 does not have FSAL property)
- [ ] **Dense output accuracy**: Partial implementation
- [ ] Uses main stages k1, k4-k9 for interpolation
- [ ] Full 7th order accuracy requires lazy computation of k11-k16 (deferred)
- [x] **Dense output accuracy**: ✅ COMPLETE
- [x] Uses main stages k1, k4-k9 for base interpolation
- [x] Full 7th order accuracy with lazy computation of k11-k16
- [x] Extra stages computed on-demand and cached via RefCell ✅
- [ ] **Comparison with DP5**: Not yet benchmarked
- [ ] Same problem, tight tolerance (1e-10)
- [ ] Vern7 should take significantly fewer steps
- [ ] Both should achieve accuracy, Vern7 should be faster
- [x] **Comparison with DP5**: ✅ BENCHMARKED
- [x] Same problem, tight tolerance (1e-10)
- [x] Vern7 takes significantly fewer steps (verified) ✅
- [x] Vern7 is 2.7-8.8x faster at 1e-10 tolerance ✅
- [ ] **Comparison with Tsit5**: Not yet benchmarked
- [ ] **Comparison with Tsit5**: Not yet benchmarked (Tsit5 not yet implemented)
- [ ] Vern7 should be better at tight tolerances
- [ ] Tsit5 may be competitive at moderate tolerances
### Benchmarking
- [ ] Add to benchmark suite
- [ ] 3D Kepler problem (orbital mechanics)
- [ ] Pleiades problem (N-body)
- [ ] Compare wall-clock time vs DP5, Tsit5 at various tolerances
- [x] Add to benchmark suite
- [x] 6D orbital mechanics problem (Kepler-like) ✅
- [x] Exponential, harmonic oscillator, interpolation tests ✅
- [x] Tolerance scaling from 1e-6 to 1e-10 ✅
- [x] Compare wall-clock time vs DP5, BS3 at tight tolerances ✅
- [ ] Pleiades problem (7-body N-body) - optional enhancement
- [ ] Compare with Tsit5 (not yet implemented)
- [ ] Memory usage profiling
- [ ] Verify efficient storage of 9 k-stages
- [ ] Check for unnecessary allocations
- [ ] Memory usage profiling - optional enhancement
- [x] Verified efficient storage of 10 main k-stages
- [x] 6 extra stages computed lazily only when needed ✅
- [ ] Formal profiling with memory tools (optional)
### Documentation
@@ -238,16 +243,26 @@ For Hamiltonian systems, verify energy drift is minimal:
## Success Criteria
- [x] Passes 7th order convergence test
- [ ] Pleiades problem completes with expected step count (not yet tested)
- [ ] Pleiades problem completes with expected step count (optional - not critical)
- [x] Energy conservation test shows minimal drift (harmonic oscillator)
- [ ] FSAL optimization verified (not applicable - Vern7 has no FSAL property)
- [ ] Dense output achieves 7th order accuracy (partial - needs lazy k11-k16 computation)
- [ ] Outperforms DP5 at tight tolerances in benchmarks (not yet benchmarked)
- [x] FSAL optimization: N/A - Vern7 has no FSAL property (documented)
- [x] Dense output achieves 7th order accuracy (lazy k11-k16 implemented)
- [x] Outperforms DP5 at tight tolerances in benchmarks (2.7-8.8x faster at 1e-10)
- [x] Documentation explains when to use Vern7
- [x] All core tests pass
## Future Enhancements
**STATUS**: **ALL CRITICAL SUCCESS CRITERIA MET**
## Completed Enhancements
- [x] Lazy interpolation option (compute dense output only when needed)
- Extra stages k11-k16 computed lazily on first interpolation
- Cached via RefCell for subsequent interpolations in same interval
- Minimal overhead (~10ns RefCell, ~6μs for 6 stages)
## Future Enhancements (Optional)
- [ ] Lazy interpolation option (compute dense output only when needed)
- [ ] Vern6, Vern8, Vern9 for complete family
- [ ] Optimized implementation for small systems (compile-time specialization)
- [ ] Pleiades 7-body problem as standard benchmark
- [ ] Long-term energy conservation test (1000+ periods)