Skip to content

Brunt_N2 could report invalid or old values from set_no_mix - #1116

Merged
Debraheem merged 1 commit into
mainfrom
EbF/bugfix/set_gradTsuba_when_no_mix
Nov 16, 2026
Merged

Debraheem merged 1 commit into
mainfrom
EbF/bugfix/set_gradTsuba_when_no_mix

Conversation

@Debraheem

Copy link
Copy Markdown
Member

There is a small bug in set_no_mixing that affects do_brunt_N2.

MESA computes the Brunt–Väisälä frequency squared at face k as

$$ N_k^2 = f_k\left[B_k + \nabla_{\mathrm{ad},k} - \nabla_k\right]. $$

s% brunt_N2(k) = f*(s% brunt_B(k) - s% gradT_sub_grada(k))

However, if sticky gradr or phase seperation or any other routine calls set_no_mixing , it will set s% gradT(k) to the radiative gradient but forgets to set s% gradT_sub_grada(k). This means Brunt_N2 can use whatever is left sitting in the s% gradT_sub_grada array, or if nonfinite this number will be it would be zeroed out in do_brunt_N2.

In the specific scenario in which a nonfinite value is returned to do_brunt_N2, brunt_B, brunt_N2, and brunt_N2_composition_term all get set to zero at that face. I don't know if or when this happens in practice out side of when one directly sets fill_arrays_with_NaNs = .true., but it's still a bit concerning, since brunt_B is used by mlt/tdc.

Either way, this mistake will affect pulsation outputs and should be corrected. This pr fixes this issue by ensuring set_no_mixing updates s% gradT_sub_grada.

see do_brunt_N2 in star/private/brunt.f90:169

and set_no_mixing in star/private/turb_info.f90:310

@Debraheem Debraheem added the bug Something isn't working label Nov 12, 2026
@Debraheem
Debraheem merged commit 790efa1 into main Nov 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant