Skip to content

feat(models): preserve bulk across MagmaOcean fractional stages - #11

Merged
bknight1 merged 12 commits into
mainfrom
feat/magma-ocean-bulk-preservation
Aug 16, 2026
Merged

feat(models): preserve bulk across MagmaOcean fractional stages#11
bknight1 merged 12 commits into
mainfrom
feat/magma-ocean-bulk-preservation

Conversation

@bknight1

Copy link
Copy Markdown
Owner

Summary

  • MagmaOcean.run_fractional_stages now preserves self.X (bulk composition) across stages via saved_X/try/finally, preventing drift.
  • starting_melt length is validated against the bulk composition before any state mutation.
  • find_temperature_at_vol_frac raises RuntimeError on bisection failure (was returning bracket endpoint silently).
  • avg_melt is computed only over melt-bearing samples (was dividing by total pressure intervals, inflating average when melt was absent).
  • total_solid == 0 branch returns empty layer_modes (was a division-by-zero risk).

Depends on: #9 (refactor/instance-aware-extract-grid)

Test plan

  • python3 -m unittest tests/test_fractionation.py (3 MagmaOcean tests pass)
  • python3 -m unittest discover tests (5 tests pass, 0 failures)

@bknight1 bknight1 added enhancement New feature or request needs-review Requires reviewer attention labels Aug 16, 2026
@bknight1
bknight1 merged commit 4df16ba into main Aug 16, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request needs-review Requires reviewer attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant