Browse Source

Reduce Newton-Raphson test plan from 14 to 11 files after overlap analysis

- Remove test_energy_conservation_analytical.cpp (covered by hybrid test)
- Rename test_extreme_orientation to test_extreme_orientation_mixed
- Remove duplicate polar/retrograde tests (covered by test_precision_boundaries)
- Document test reduction rationale in planning doc
main
cinnaboot 5 months ago
parent
commit
9f01cc3e3c
  1. 178
      docs/planning/newton_raphson_test_plan.md

178
docs/planning/newton_raphson_test_plan.md

@ -5,7 +5,7 @@ Test cases for Newton-Raphson analytical propagation implementation, organized b
## File Organization
Each test file requires a dedicated config file (1:1 mapping).
Total estimated test files: 13-14
Total estimated test files: 11 (reduced from 14 after overlap analysis)
## Current Progress (2026-01-31)
@ -186,7 +186,7 @@ Total estimated test files: 13-14
- 849a212 Fix orbital_elements_to_cartesian: circular orbit velocity and refactor for clarity
- 986a94e Update test plan: document progress on 3 fixed test files
### Remaining Tests (8 files)
### Remaining Tests (5 files)
#### 7. ⬜ test_cartesian_to_elements_extreme.cpp + .toml
- Purpose: Edge cases in orbital parameters
@ -202,12 +202,13 @@ Total estimated test files: 13-14
- Rotation singularities for polar
#### 8. ⬜ test_cartesian_to_elements_quadrature.cpp + .toml
- Purpose: Test calculations at orbital quadrature points
- Purpose: Test cartesian→elements conversion at quadrature points
- Config: Spacecraft at true anomalies: 0, π/2, π, 3π/2
- Tests:
- Cross product calculations at quadrants
- Eccentricity vector accuracy
- Position/velocity vector relationships
- NOTE: Tests NEW function (opposite direction of test_inclined_orbits)
#### 9. ⬜ test_hybrid_impulse_burns.cpp + .toml
- Purpose: Impulsive burn handling
@ -236,17 +237,15 @@ Total estimated test files: 13-14
- Pre/post burn energy validation
- Long-term energy drift comparison
#### 12. ⬜ test_extreme_orientation.cpp + .toml
- Purpose: 3D orientation edge cases
#### 12. ⬜ test_extreme_orientation_mixed.cpp + .toml
- Purpose: Combined high inclination + high eccentricity
- Config:
- Polar orbit (i=90°)
- Retrograde orbit (i=180°)
- Mixed: high inclination + high eccentricity
- High inclination (i>π/3) + high eccentricity (e>0.8)
- Tests:
- Rotation matrix behavior at i=π/2
- Rotation matrix behavior at extreme combinations
- Ω and ω singularity handling
- Z-coordinate preservation for polar
- Velocity vector orientation
- NOTE: Removed duplicate polar/retrograde tests (covered by test_precision_boundaries)
#### 13. ⬜ test_extreme_timescales.cpp + .toml
- Purpose: Orbital period extremes
@ -261,19 +260,11 @@ Total estimated test files: 13-14
- Low altitude: atmospheric boundary (if applicable)
- Long-duration propagation (10+ periods)
#### 14. ⬜ test_energy_conservation_analytical.cpp + .toml (OPTIONAL)
- Purpose: Long-term energy conservation validation
- Config: Standard circular/elliptical orbit
- Tests:
- Energy drift over 10+ orbital periods
- Kinetic/potential energy consistency
- Vis-viva equation verification at all anomalies
## Phase 1: Core Math Functions
### Cartesian to Orbital Elements (3 files)
#### 1. test_cartesian_to_elements_basic.cpp + .toml
#### 1. ✅ test_cartesian_to_elements_basic.cpp + .toml
- Purpose: Basic round-trip conversion accuracy
- Config: Moderate eccentricity, zero inclination orbit
- Tests:
@ -281,7 +272,7 @@ Total estimated test files: 13-14
- Position/velocity magnitude preservation
- Semi-major axis, eccentricity accuracy
#### 2. test_cartesian_to_elements_extreme.cpp + .toml
#### 7. ⬜ test_cartesian_to_elements_extreme.cpp + .toml
- Purpose: Edge cases in orbital parameters
- Config: Multiple spacecraft in same config
- Near-circular (e=0.001)
@ -294,17 +285,18 @@ Total estimated test files: 13-14
- Degenerate Ω calculation for equatorial
- Rotation singularities for polar
#### 3. test_cartesian_to_elements_quadrature.cpp + .toml
- Purpose: Test calculations at orbital quadrature points
#### 8. ⬜ test_cartesian_to_elements_quadrature.cpp + .toml
- Purpose: Test cartesian→elements conversion at quadrature points
- Config: Spacecraft at true anomalies: 0, π/2, π, 3π/2
- Tests:
- Cross product calculations at quadrants
- Eccentricity vector accuracy
- Position/velocity vector relationships
- NOTE: Tests NEW function (opposite direction of test_inclined_orbits)
### Newton-Raphson Solver (1-2 files)
### Newton-Raphson Solver (1 file)
#### 4. test_newton_raphson_convergence.cpp + .toml
#### 2. ✅ test_newton_raphson_convergence.cpp (NO CONFIG)
- Purpose: Verify convergence behavior across eccentricity ranges
- Config: Spacecraft with programmatically varied parameters
- Tests:
@ -313,11 +305,10 @@ Total estimated test files: 13-14
- Mean anomaly near π: worst-case convergence
- Large mean anomaly values (M > 1000): periodicity handling
- Eccentricity at boundaries (e = 0.9999, 1.0001)
- Note: Could split to separate config if boundary cases need dedicated config
### Analytical Propagation (2 files)
#### 5. test_analytical_propagation_apsides.cpp + .toml
#### 3. ✅ test_analytical_propagation_apsides.cpp + .toml
- Purpose: Propagation through orbital apsides
- Config: Elliptical orbit
- Tests:
@ -326,7 +317,7 @@ Total estimated test files: 13-14
- At exact orbital period: should return to initial state
- True anomaly accuracy after full orbit
#### 6. test_analytical_propagation_timesteps.cpp + .toml
#### 4. ✅ test_analytical_propagation_timesteps.cpp + .toml
- Purpose: Timestep size validation
- Config: Standard orbit
- Tests:
@ -337,7 +328,7 @@ Total estimated test files: 13-14
## Phase 2: Hybrid Integration
#### 7. test_hybrid_impulse_burns.cpp + .toml
#### 9. ⬜ test_hybrid_impulse_burns.cpp + .toml
- Purpose: Impulsive burn handling
- Config: Spacecraft with pre-configured maneuvers
- Tests:
@ -347,7 +338,7 @@ Total estimated test files: 13-14
- Minimal burns (Δv < 1 m/s)
- Large burns (Δv > orbital velocity)
#### 8. test_hybrid_continuous_thrust.cpp + .toml
#### 10. ⬜ test_hybrid_continuous_thrust.cpp + .toml
- Purpose: Continuous thrust integration
- Config: Spacecraft with finite-duration burns
- Tests:
@ -356,7 +347,7 @@ Total estimated test files: 13-14
- Numerical vs. analytical mode transitions
- Energy conservation during burns
#### 9. test_hybrid_energy_conservation.cpp + .toml
#### 11. ⬜ test_hybrid_energy_conservation.cpp + .toml
- Purpose: Compare analytical vs. numerical propagation
- Config: Same spacecraft propagated with both methods
- Tests:
@ -366,7 +357,7 @@ Total estimated test files: 13-14
## Extreme Orbits (3 files)
#### 10. test_extreme_eccentricity.cpp + .toml
#### 5. ✅ test_extreme_eccentricity.cpp + .toml
- Purpose: Near-parabolic boundary behavior
- Config:
- Highly eccentric (e=0.99)
@ -377,19 +368,17 @@ Total estimated test files: 13-14
- Velocity magnitude accuracy
- Period calculation (or lack thereof for e≥1)
#### 11. test_extreme_orientation.cpp + .toml
- Purpose: 3D orientation edge cases
#### 12. ⬜ test_extreme_orientation_mixed.cpp + .toml
- Purpose: Combined high inclination + high eccentricity
- Config:
- Polar orbit (i=90°)
- Retrograde orbit (i=180°)
- Mixed: high inclination + high eccentricity
- High inclination (i>π/3) + high eccentricity (e>0.8)
- Tests:
- Rotation matrix behavior at i=π/2
- Rotation matrix behavior at extreme combinations
- Ω and ω singularity handling
- Z-coordinate preservation for polar
- Velocity vector orientation
- NOTE: Removed duplicate polar/retrograde tests (covered by test_precision_boundaries)
#### 12. test_extreme_timescales.cpp + .toml
#### 13. ⬜ test_extreme_timescales.cpp + .toml
- Purpose: Orbital period extremes
- Config:
- Mercury-like orbiter (period ~88 days)
@ -402,9 +391,9 @@ Total estimated test files: 13-14
- Low altitude: atmospheric boundary (if applicable)
- Long-duration propagation (10+ periods)
## Numerical Precision (1-2 files)
## Numerical Precision (1 file)
#### 13. test_precision_boundaries.cpp + .toml
#### 6. ✅ test_precision_boundaries.cpp + .toml
- Purpose: Exact boundary value handling
- Config:
- Perfect circle (e=0)
@ -417,15 +406,6 @@ Total estimated test files: 13-14
- Inclination at 0°, 90°, 180°
- Semi-major axis sign change
- Angular momentum conservation
- Note: If energy conservation needs separate config, this becomes 2 files
#### 14. (Optional) test_energy_conservation_analytical.cpp + .toml
- Purpose: Long-term energy conservation validation
- Config: Standard circular/elliptical orbit
- Tests:
- Energy drift over 10+ orbital periods
- Kinetic/potential energy consistency
- Vis-viva equation verification at all anomalies
## Overlap Analysis with Existing Tests
@ -447,11 +427,30 @@ Total estimated test files: 13-14
- SOI transitions (deferred)
- Root body transitions (deferred)
**Overlaps Identified:**
### Test Reduction Applied (Reduced from 14 to 11 files)
**Tests Removed (3 files):**
1. **test_energy_conservation_analytical.cpp** (OPTIONAL - REMOVED)
- Reason: Long-term energy drift testing covered by `test_hybrid_energy_conservation.cpp`
- The hybrid test compares analytical vs RK4 energy, providing stronger validation
2. **test_extreme_orientation.cpp: Polar (i=90°) & Retrograde (i=180°)** (REMOVED)
- Reason: Polar and retrograde boundary cases already covered by `test_precision_boundaries.cpp`
- Only "mixed: high inclination + high eccentricity" case retained
- Renamed to `test_extreme_orientation_mixed.cpp`
3. **test_extreme_orientation.cpp: Original full scope** (REDUCED)
- Reason: Duplicate with existing test_precision_boundaries
- Polar orbit (i=π/2): Already tested in test_precision_boundaries
- Retrograde orbit (i=π): Already tested in test_precision_boundaries
**Overlap Analysis:**
**test_inclined_orbits.cpp** (Molniya: e=0.74, i=63.4°)
- Overlaps: Extreme eccentricity, Extreme orientation
- Gap: Need e=0.99+, retrograde (i>π/2), polar (i=π/2 exactly)
- Note: Does NOT overlap with test_cartesian_to_elements_quadrature (tests opposite conversion direction)
**test_moon_orbits.cpp** (Moon ~27 day period)
- Overlaps: Extreme timescales
@ -460,6 +459,7 @@ Total estimated test files: 13-14
**test_energy.cpp** (circular orbit energy)
- Overlaps: Energy conservation tests
- Gap: Need analytical propagation validation, method comparison
- Note: test_energy_conservation_analytical removed; hybrid test covers this gap
**test_orbital_period.cpp** (Earth 365 days, Mars 687 days)
- Overlaps: Extreme timescales
@ -485,25 +485,29 @@ Total estimated test files: 13-14
**Can Share Configs (Partial Overlap):**
1. **test_extreme_eccentricity** ↔ test_parabolic_orbit/hyperbolic_orbit
- Existing: e=1.0, 1.5
- New: e=0.99, 0.9999, 1.0001
- May need new config for e=0.99, 0.9999 cases
- Existing: e=1.0, 1.5
- New: e=0.99, 0.9999, 1.0001
- May need new config for e=0.99, 0.9999 cases
2. **test_hybrid_impulse_burns** ↔ test_maneuvers
- Can reuse burn infrastructure
- New scenarios require separate config (Hohmann, apsides burns)
- Can reuse burn infrastructure
- New scenarios require separate config (Hohmann, apsides burns)
3. **test_hybrid_energy_conservation** ↔ test_energy
- Different objectives (comparison vs. drift)
- Could share circular orbit config
- Different objectives (comparison vs. drift)
- Could share circular orbit config
**Cannot Share Configs (Different Parameters):**
1. **test_extreme_orientation** vs test_inclined_orbits
- Existing: i=1.107 (63.4°)
- New: i=π/2 (90°), i>π/2 (retrograde)
1. **test_extreme_orientation_mixed** vs test_inclined_orbits
- Existing: i=1.107 (63.4°)
- New: Combined high inclination + high eccentricity (unique)
2. **test_cartesian_to_elements_extreme** vs all existing
- New test category (no existing tests)
- New test category (no existing tests)
3. **test_cartesian_to_elements_quadrature** vs test_inclined_orbits
- Tests opposite conversion direction (cartesian→elements vs elements→cartesian)
- Both needed for complete validation
### Unique New Test Categories
@ -516,51 +520,55 @@ Total estimated test files: 13-14
6. Propagation through apsides - 1 test
**New Orbital Regimes:**
7. Retrograde orbits (i > 90°) - 1 test
7. Combined high inclination + high eccentricity - 1 test (reduced from 3 orientation tests)
8. Extremely fast orbits (Mercury-like, <100 days) - 1 test
9. Extremely slow orbits (>10 years) - 1 test
10. Boundary values (e=0, i=π/2, i=π) - 1 test
10. Boundary values (e=0, i=π/2, i=π) - 1 test (already in test_precision_boundaries)
### Minimal File Count with Sharing
**Current estimate: 13-14 files**
**Optimization opportunities:**
- Combine e=0.99 with parabolic/hyperbolic configs → -1 file
- Share energy config between test_energy and test_hybrid_energy_conservation → -1 file
- Use existing Molniya config for some extreme orientation tests → -1 file
**Final estimate: 11 files** (reduced from 14)
**Optimized estimate: ~11 files**
**Reductions applied:**
- Removed test_energy_conservation_analytical.cpp (OPTIONAL, covered by hybrid test)
- Removed duplicate polar/retrograde tests from test_extreme_orientation (covered by test_precision_boundaries)
- Renamed to test_extreme_orientation_mixed.cpp (only tests combined high inclination + eccentricity)
**Recommended: Keep 13-14 files**
**Recommendation: Keep 11 files**
- Each test has self-documenting config
- Easier to debug isolated failures
- Config reuse doesn't save much (configs are small)
- Clear separation of concerns
- No duplicate test coverage
## Implementation Priority
### Phase 1 (Foundation)
1. test_cartesian_to_elements_basic.cpp (round-trip conversion)
2. test_newton_raphson_convergence.cpp (solver validation)
3. test_analytical_propagation_apsides.cpp (basic propagation)
1. test_cartesian_to_elements_basic.cpp (round-trip conversion)
2. test_newton_raphson_convergence.cpp (solver validation)
3. test_analytical_propagation_apsides.cpp (basic propagation)
### Phase 2 (Hybrid Integration)
4. test_hybrid_impulse_burns.cpp (impulsive burns)
5. test_hybrid_continuous_thrust.cpp (continuous burns)
6. test_hybrid_energy_conservation.cpp (method comparison)
4. test_hybrid_impulse_burns.cpp (impulsive burns)
5. test_hybrid_continuous_thrust.cpp (continuous burns)
6. test_hybrid_energy_conservation.cpp (method comparison)
### Phase 3 (Edge Cases)
7. test_extreme_eccentricity.cpp (e≈1.0)
8. test_extreme_orientation.cpp (polar/retrograde)
9. test_extreme_timescales.cpp (fast/slow periods)
10. test_precision_boundaries.cpp (exact values)
11. test_cartesian_to_elements_extreme.cpp (edge cases)
12. test_cartesian_to_elements_quadrature.cpp (quadrants)
13. test_analytical_propagation_timesteps.cpp (large/small dt)
7. test_extreme_eccentricity.cpp (e≈1.0)
8. ⬜ test_extreme_orientation_mixed.cpp (high inclination + high eccentricity)
9. test_extreme_timescales.cpp (fast/slow periods)
10. test_precision_boundaries.cpp (exact values)
11. test_cartesian_to_elements_extreme.cpp (edge cases)
12. ⬜ test_cartesian_to_elements_quadrature.cpp (cartesian→elements conversion)
13. test_analytical_propagation_timesteps.cpp (large/small dt)
## Notes
- Config files are shared with existing tests where possible
- Each .cpp file requires corresponding .toml config
- Some test categories can share configs if parameters align
- SOI transition tests deferred per user requirements
- **Test count reduced from 14 to 11 after overlap analysis** (2026-02-01)
- Removed tests:
- test_energy_conservation_analytical.cpp (OPTIONAL - covered by hybrid test)
- Duplicate polar/retrograde tests in test_extreme_orientation (covered by test_precision_boundaries)
- Retained test_cartesian_to_elements_quadrature.cpp (validates NEW function, opposite direction of test_inclined_orbits)

Loading…
Cancel
Save