Skip to content

Place pulse-data double points from composition mu, not EOS mu - #1132

Merged
rhdtownsend merged 2 commits into
mainfrom
pulse-double-points-composition
Nov 27, 2026
Merged

rhdtownsend merged 2 commits into
mainfrom
pulse-double-points-composition

Conversation

@rhdtownsend

Copy link
Copy Markdown
Contributor

Problem

When add_double_points_to_pulse_data is enabled, set_segment_indices (star/private/pulse_utils.f90) decides where to put double points from grad_mu = dln(mu)/dln(P), using s%mu. That mu includes the free electrons supplied by the EOS, so partial ionization zones (H/He ionization in the envelopes of hotter stars) can exceed threshold_grad_mu_for_double_point even though the composition there is uniform.

At a double point the density takes the per-side cell values rather than an interpolated face value, so these spurious double points put density discontinuities of a few percent into the exported pulsation model (P and T stay continuous). Faces in the ionization zone also cross the threshold back and forth from one model to the next. The point count toggles, and GYRE frequencies jump discontinuously between adjacent models (by several tenths of a µHz for radial p modes in a ~1.7 Msun, ~8600 K main-sequence model with threshold 1). Any code that tracks frequencies along a track, such as asteroseismic fitting that bisects in age on a frequency offset, can then fail to converge.

Fix

Evaluate grad_mu from the mean molecular weight of the composition alone, assuming full ionization: mu_comp = abar/(1 + zbar). Double points then mark only real composition discontinuities (e.g. the gradient left by a receding convective core), which is what the control is meant for. The controls.defaults documentation for threshold_grad_mu_for_double_point and the changelog are updated to match.

This changes behavior outright rather than adding a new control: placing double points at ionization features is not physically meaningful.

Testing

  • With the change, an embedded MESA+GYRE seismic-fitting code that previously failed on 7 of 9 parameter points for a 1.72 Msun, 8600 K target ("too many redos" from the frequency jumps) converges on all 9.
  • Models without ionization-triggered double points (a 1.5 Msun, 6800 K target; a solar-like model) give bit-identical results before and after.
  • fortitude, sphinx-lint, and check_defaults.py pass.

Pulsation models with double points may differ from earlier versions; the changelog notes this.

🤖 Generated with Claude Code

set_segment_indices evaluated grad_mu from s%mu, which includes the
free electrons supplied by the EOS. Partial ionization zones therefore
triggered double points where the composition is uniform, introducing
spurious density discontinuities into pulsation models, and frequencies
jumped as faces crossed the threshold between models. Evaluate grad_mu
from abar/(1 + zbar) instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rhdtownsend added a commit to rhdtownsend/em that referenced this pull request Nov 21, 2026
…and probe harness

- create_star now tries pre-MS central temperatures 5e5, 4e5, 6e5 K in
  turn (PRE_MS_T_C_DEFAULT, overridable via pre_ms_T_c), fixing initial
  model convergence failures for some AMP parameter sets
- patches/mesa-26.04.1-double-points.patch: MESA fix placing pulse-data
  double points from composition mu rather than EOS mu (upstream as
  MESAHub/mesa#1132); without it, hot models stall evolve_star_seismic
  with "too many redos". CLAUDE.md documents the requirement
- em_probe frontend and scripts/probe_failures.py for diagnosing
  initial-model failures

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Debraheem

Copy link
Copy Markdown
Member

This seems like a good change, and looks fine to merge to me. I guess this logic is just used for finding where to add double points from real composition jumps in the profile, so using the fully ionized mu directly from the composition is just as good if not better than relying on the mu coming out of the EOS.

@Debraheem
Debraheem self-requested a review November 26, 2026 19:49
@rhdtownsend
rhdtownsend merged commit e76a7c3 into main Nov 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants