Skip to content

Star nonadiabatic linear analysis (Star_lna) + updates and other bug fixes - #1063

Draft
Debraheem wants to merge 39 commits into
EbF/hydro_changes_and_bug_fixesfrom
EbF/star_lna
Draft

Debraheem wants to merge 39 commits into
EbF/hydro_changes_and_bug_fixesfrom
EbF/star_lna

Conversation

@Debraheem

Copy link
Copy Markdown
Member

Star LNA and pulsation updates

  • Add radial linear nonadiabatic analysis for TDC and RSP2, including envelope selection, mode diagnostics, work integrals, and initial velocity kicks.
  • Add GYRE schema 130 export of the TDC background.
  • Replace the RSP2 pressure scale height equation with a luminosity balance equation using independent face superadiabaticity. Update remeshing and saved state.
  • Correct turbulent energy accounting and eddy viscosity work for both velocity formulations.
  • Correct LNA convective flux, turbulent pressure, neutrino loss, and inner radiation gradient perturbations.
  • Save the Riemann face state before the solver predictor.
  • Fix mass remapping, overshoot interpolation, and boundary handling.
  • Add TDC RSG and QS pulsation development cases and update the TDC and RSP2 Cepheid cases.
  • Update PPISN/PISN cases with surface-removal fixes, solver controls, and corrected binary progenitor stopping and handoff conditions.

Debraheem and others added 24 commits September 4, 2026 01:37
Use the hydro TDC mixing length and preserve the legacy GYRE export warning. Add the u_flag Riemann operator and dPrad/dm temperature-gradient form while retaining the STAR LNA compatibility guards.
Fix a regression in the ordinary atmospheric temperature BC introduced in
B10 (#195) and retained in B11 (#200). Disabling the pressure offset for
the momentum BC also disabled the temperature offset, incorrectly imposing
the atmospheric face temperature at the center of cell 1.

Compute the temperature offset independently with automatic differentiation.
Keep momentum boundary pressure and its radiation-pressure floor at the
outer face. Apply the same correction in star_LNA. Custom surface PT hooks
and surface luminosity boundary conditions are unchanged.

References to Bill Paxton's TDC changes:

B10 (#195):
0b386fb
#195

B11 (#200):
9ca1ea7
#200
Move direct surface removal before the solve.
Initialize the fixed face temperature using the rebuilt surface gradient,
rejecting nonpositive or nonfinite temperatures.
Apply the corrections across the dev cases and synchronize PGSTAR settings.
Adopt Neev's L2 checks and remove unused POSYDON and diagnostic code. Guard missing-star accesses and allow each star to reach its own selected stopping condition, defaulting to log central temperature 9. Print the model filename before saving.

Match the 100+70 Msun, 10-day, Z=0.0001 setup and PPISN overshoot. Preserve the completed star's mass during the wide-orbit handoff.

Include the updated timestep, mixing, solver, drag, and PGBINARY controls.
Replace the RSP2 pressure-scale-height unknown with signed superadiabaticity and solve luminosity balance directly. Update hydrodynamics, LNA, energy work, solver diagnostics, remeshing, and saved-state plumbing together. Remove the RSP2 enthalpy-flux limiter while retaining the TDC option.

Use consistent cell-centered mixing lengths in TDC and RSP2. Correct cell-centered mass remapping and partial-mass energy accounting. Include the RSP2 case configuration and diagnostic changes, remove obsolete controls, and delete the Cepheid plotting helper and its README.

Bump the photo version and revise the RSP2 saved-model fields. Validation: whitespace checks and four standalone algebra/source checks passed. MESA was not compiled or run.
Evaluate the starting face pressure and velocity before the RSP2 predictor changes turbulent pressure. Preserve the existing Riemann equations and time weights, and propagate starting turbulence errors.

The partial mass energy integral correction is already in 4b5e4e9. Source ordering and independent partial mass and half cell energy checks pass. No MESA compilation or model run was performed.
* Freeze Lc and Lt consistently when flux perturbations are disabled.
* Use full thermal neutrino derivatives.
* Retain TDC velocity and density derivatives in turbulent pressure.
* Correct TDC radiation gradient spacing at the excised inner boundary.
@Debraheem
Debraheem added this pull request to stack #1055 September 22, 2026 01:01
* Format the Cepheid and RSG plotting scripts with Ruff.
* Note the improved PPISN and PISN test cases using TDC during pulsations.

All static-analysis checks pass.
@rhdtownsend

Copy link
Copy Markdown
Contributor

Does this commit introduce a new revision of the GYRE file schema? If so, that's a decision/change that must be made on the GYRE end, not the MESA end.

@Debraheem

Copy link
Copy Markdown
Member Author

Does this commit introduce a new revision of the GYRE file schema? If so, that's a decision/change that must be made on the GYRE end, not the MESA end.

Yes, I have a gyre fork that pairs with this schema change, about to be opened on the GYRE github. I can decouple the changes if needed later.

Comment on lines +455 to +481
! gyre_write_tdc_lna_background
! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! If true, write the experimental schema 130 TDC LNA background block
! when exporting GYRE pulse data. This is a MESA data export
! only; it does not run GYRE, solve for mode perturbations, or write
! mode dependent complex TDC coefficients.
!
! Appended schema 130 columns are real background/closure ingredients:
! L_conv0, A0_tdc, D_conv_h, Hp_face, alpha_MLT_face, Cp_face,
! chiT_face, chiRho_face, gradL_face, gradT_face, TDC_alpha_C/S/D/R/Pt/M,
! include_mlt_corr_to_TDC, mlt_Pturb_factor, and mlt_Pturb0_face.
! D_conv_h is the
! effective entropy diffusivity inferred from the radial TDC convective
! luminosity. mlt_Pturb0_face is the MESA/Kuhfuss isotropic turbulent
! pressure amplitude mlt_Pturb_factor*rho_face*mlt_vc^2/3.
!
! Requires gyre_data_schema = 130 and MLT_option = 'TDC'. GYRE must be
! updated separately before it can read this experimental schema.
! Schema 130 does not represent the harmonic TDC mixing length. If
! harmonic_dissipation_length_beta > 0, MESA writes a warning and
! exports the legacy mixing_length_alpha and Hp_face values. GYRE will
! therefore use Lambda = mixing_length_alpha*Hp_face rather than the
! harmonic length used by MESA.
!
! ::

gyre_write_tdc_lna_background = .false.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new GYRE schema is only toggled when gyre_write_tdc_lna_background = .true., and for now it defaults to false, where it just uses the older normal gyre schema.

@rhdtownsend

Copy link
Copy Markdown
Contributor

Why are we including things like chi_T and chi_rho, when these can be obtained from existing data (Gamma_1 and upsilon_T)?

@Debraheem

Copy link
Copy Markdown
Member Author

Okay, i guess this was an oversight on my end. I think you're right, the background values can be reconstructed using gamma_1 and upsilon_T and i think grada/gradL . I guess I was just staying consistent with my star_lna formulation when deciding what to output initially.

I do think exporting Chi rho and T is more direct and avoids having to deal with reconstruction on the GYRE side, but i guess if the discretization isn't a concern, it's just bloat.

For a completely correct linearization of TDC in GYRE, however, we will actually want the derivatives of chi_rho and chi_T (omitted for now). The linearization procedure produces additional purturbations to quantities like Cp, which star_lna includes but gyre does not. Keeping these terms explicit in the output schema will ensure that their later exported derivatives are also consistent with their values, but there is probably another way to do this through upsilon_T and Gamma1, and grad_ad directly by including their partial derivatives instead. I'm not sure at the moment though.

More will be clear soon, when I make the gyre pr and share a pdf of derivations and discretization where i go through the necessary terms.

@warrickball

Copy link
Copy Markdown
Contributor

If I'm not mistaken, some recent telecons have been about how people review PRs and my immediate question as a reviewer on this would be whether it can be broken up into smaller chunks. +22,578 / –10,055 lines of change across 241 files is daunting.

It's also unclear how to start reviewing given that the description is 9 bullet points.

@Debraheem

Copy link
Copy Markdown
Member Author

yes this is a monstrous pr, and I can try to break it up as much as possible. Documentation will follow.

@warrickball

Copy link
Copy Markdown
Contributor

If any PR isn't ready for review, you can mark it as draft. I think we're generally prone to requesting reviews too early because GitHub seems to automatically request them from CODEOWNERS. (I was drawn here by Rich's comment and am not a relevant CODEOWNER myself.)

@Debraheem

Debraheem commented Sep 22, 2026 •

Copy link
Copy Markdown
Member Author

Opening this pr is a first step. My plan is to attempt to percolate smaller changes downward through the commit stack, to be reviewed on their own. I apologize for the amount of changes, however this is a product of nearly the last year of work and i needed various fixes along the way to get things running. There remains a large amount of manual review still to be done by myself.

For now, I have generated a rather large pdf document (with help from an llm) which summarizes the main changes introduced:
star_LNA_manuscript.pdf

I have other documentation for the bug fixes, but I will show those outside of this pr, when I pulled them out of this pr and move them downward in the stack and into smaller prs.

@Debraheem
Debraheem marked this pull request as draft September 22, 2026 20:31
- Refine poorly resolved eigenvectors before updating their eigenvalues.
- Allow static TDC GYRE exports without an evolution timestep.
- Add a standalone RGB example, a 5M input option and mode plots.
- Clarify development controls and changelog descriptions.
- Match QHSE pressure and radius to the convection time-centering setting.
- Preserve the signed dynamical neutral gradient at the inner boundary.
- Document the time-centering behavior.
- Use P_theta for the pressure jump contribution while centering fluid velocity.
- Share the face velocity between radius motion and energy work.
- Save the starting pressure contribution before the predictor and after LNA kicks.

Validation: MESA installation and package checks, independent derivative and acoustic checks.
@Debraheem

Copy link
Copy Markdown
Member Author

One additional comment, much of the diff in this pr is dominated by the test case additions and removal. So I can split this pr into a few components to make it easier to review. Most of the source change is in the additional 3 files which are used for doing linear analysis on star.

Debraheem and others added 11 commits September 24, 2026 01:32
Retain zero inertia constraints without a diagonal pivot in the reduced eigenproblem. Continue eliminating fixed velocity and zero turbulent velocity rows.
Include the surface gravity response in pressure derivatives. Add atm_T_tau_Rho_outer with the existing default and check the L, R and M derivatives.
Use the imposed boundary pressure in conservative energy work for u_flag and v_flag. Apply the same correction in star_LNA and document it in the changelog.
Recompute the pressure stencil from current density, internal energy
and composition after earlier mesh operations invalidate Peos and lnT.
Share the EOS and turbulent pressure evaluation with trial children,
and skip it when pressure reconstruction is disabled.
Add a temperature contribution based on absolute lnT differences,
normalized by the total variation across the mesh. Use remapped
temperatures for split and merge decisions. Add controls for the
weight and normalization floor, with zero weight by default.
Squash upstream PR #997, bugfix/OPAL_SCVH_low_logP_extension, through
87f7048.

Include the corrected fallback logarithms, EOS blend fixes, and version-52
FreeEOS and OPAL/SCVH data archives. Preserve this branch's changelog and
update its atmosphere reference for the combined EOS behavior.
Extend GYRE schema 130 with EOS response derivatives and harmonic mixing-length data. Export the Cepheid background before the scheduled Star LNA velocity kick, and document the current export and harmonic-length setting.
Use the actual trial coefficient in the first quadratic backtracking estimate. Correct neighboring block and vector indices in block_multiply_xa and add dense-product and unused-boundary regression checks.
Check the final turbulent amplitude before taking the negative-Y radiative shortcut, retain the flux response at Y = 0, and evaluate the zero-discriminant limit with its derivatives. Propagate failed solves and add regression tests for these cases.
Use consistent mass overlaps and velocity differences for Newtonian wind projection, retain variance heating, and account for escaping kinetic energy without transporting it twice through eps_mdot. Start hydro from the projected velocities, preserve the starting TDC energy reference, and remove the duplicate surface adiabatic contribution.

This branch has not been deployed

No deployments
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.

3 participants