Browse Source

Add session summary - Newton-Raphson propagation planning

main
cinnaboot 5 months ago
parent
commit
d891ebd117
  1. 133
      docs/session_summaries/2026-01-30-newton-raphson-propagation-planning.md

133
docs/session_summaries/2026-01-30-newton-raphson-propagation-planning.md

@ -0,0 +1,133 @@
# Session Summary - 2026-01-30 - Newton-Raphson Propagation Planning
## Overview
Session focused on creating a comprehensive implementation plan for Newton-Raphson analytical propagation to replace RK4 integration, enabling much larger simulation timesteps.
## Changes Made
### New Files Created
- **docs/newton_raphson_propagation_plan.md** (538 lines)
- Complete implementation plan for analytical propagation
- 5 implementation phases (30-44 hours estimated)
- Hybrid approach: analytical propagation (99% of time) + RK4 during burns (1%)
- Detailed algorithms, technical challenges, performance analysis
- Migration strategy and success criteria
### Files Modified
- None (documentation only)
## Commits
- **c455c78**: Add Newton-Raphson analytical propagation implementation plan
## Results
### Key Insights from Time Step Stability Analysis (Previous Session)
- RK4 at 60s is very stable (only 22% of stability limit)
- Mercury orbiter at 200km altitude is limiting factor: 270s max stable dt
- Io and Moon are very stable with RK4 (>596s max stable dt)
- Current default (60s) provides excellent margin
### Newton-Raphson vs RK4 Comparison
| Aspect | Newton-Raphson (Analytical) | RK4 (Numerical) |
|--------|---------------------------|-----------------|
| Timestep | Days/weeks | Seconds/minutes |
| Accuracy | Exact (2-body) | Approximate |
| Long-term energy | Perfect | Drift accumulates |
| N-body support | Limited (needs patching) | Native support |
| Non-gravitational forces | No | Yes |
| Computational cost | Low (3-5 iterations) | Medium (4 evaluations) |
### Design Decisions Documented
1. **Hybrid approach**: Use analytical propagation for orbital motion, RK4 during burns
2. **Burn execution**: Numerical integration (RK4) for flexible timesteps during continuous thrust
3. **SOI transitions**: Reuse existing infrastructure with orbital element transformations
4. **Default behavior**: Analytical propagation will be default when implemented
5. **Initial guess**: Use series expansion formula for faster Newton-Raphson convergence
```cpp
E₀ = M + e·sin(M) + (e²/2)·sin(2M)
```
### Expected Performance Gains
| Scenario | RK4 dt | Analytical dt | Speedup |
|----------|--------|--------------|---------|
| Low Earth Orbit | 60s | 3600s (1 hour) | 60x |
| Geostationary Orbit | 60s | 3600s (1 hour) | 60x |
| Moon orbit | 60s | 86400s (1 day) | 1440x |
| Interplanetary | 60s | 172800s (2 days) | 2880x |
## Implementation Phases (Planned)
### Phase 1: Core Mathematical Functions (4-6 hours)
- `cartesian_to_orbital_elements()` conversion
- Newton-Raphson solver for Kepler's equation
- Analytical propagation step function
### Phase 2: Hybrid Integration System (6-8 hours)
- Propagation mode selection logic
- Burn execution with numerical integration
- RK4 with external force support
### Phase 3: SOI Transition Handling (8-12 hours)
- Orbital element transformation across SOI boundaries
- Direct conversion vs. Lambert's problem approach
### Phase 4: Burn Command Interface (4-6 hours)
- Impulsive burn command
- Finite duration burn command
### Phase 5: Testing and Validation (8-12 hours)
- Unit tests for all mathematical functions
- Integration tests for burns and SOI transitions
- Performance benchmarks
**Total estimated effort: 30-44 hours**
## Remaining Issues
None - this was a planning/documentation session only. No code implementation was performed.
## Next Steps
**Immediate**: None - implementation deferred to future session
**When ready to implement**:
1. Review docs/newton_raphson_propagation_plan.md
2. Start with Phase 1 (core math functions)
3. Implement `cartesian_to_orbital_elements()` first (inverse of existing function)
4. Add comprehensive unit tests for each function
5. Validate against existing RK4 results during development
**Future documentation updates** (post-implementation):
- Update docs/technical_reference.md with new propagation methods
- Update docs/future_work.md to reflect completed Newton-Raphson implementation
- Remove "More Accurate Integration Methods" section from future work
## Technical Notes
### Key Challenge: Continuous Burns with Analytical Propagation
User's proposed solution:
1. Divide finite-duration burn into small chunks (1-10s each)
2. For each chunk:
- Get state from orbital elements (Newton-Raphson)
- Apply thrust numerically (RK4) over chunk dt
- Convert back to orbital elements
3. After burn, resume pure analytical propagation
This approach provides:
- 10-1000x faster simulation during normal operation
- Flexible timesteps during burns
- Seamless transitions between analytical and numerical modes
### Code Modifications Required
When implementation begins:
- Add new functions to `physics.h`/`physics.cpp`
- Modify Spacecraft struct (add burn state fields)
- Modify `simulation.cpp` (update spacecraft physics logic)
- Keep RK4 for burn integration (no removal needed)
- Parallel implementation during migration
## Net Line Count
- **Added**: +538 lines (docs/newton_raphson_propagation_plan.md)
- **Modified**: 0 lines
- **Deleted**: 0 lines
- **Net**: +538 lines
Loading…
Cancel
Save