Smoother Delta_Pg
- Dominant language
- Fortran
- Stars
- 249
- Forks
- 82
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 3
Description
When looking at the evolution of delta_Pg (with the previous implementation optimized for solar-like oscillators not the new traditional option included in the release candidate) there can be discontinuities in the evolution which seem to be related to the mesh. Here's an example of a 0.8Msol RGB where the blue line shows the MESA default and the orange line shows my attempt at solving this issue. You can clearly see a jump in the MESA value around the dashed grey line.
To see what is happening, I've plotted (very zoomed in) propagation diagrams for the models on either side of this discontinuity, where the points on the $N^2$ line show the MESA grid points.
These show that the discontinuity is due to the value of $\omega_{max}$ crossing to the next grid point and expanding the integration area used to calculate delta_Pg. I saw similar behavior at the outer turning point as well. To try and smooth out these jumps, I've written some code that interpolates the exact point where $N^2 = \omega_{max}^2$ and begins and ends the integral there:
```
delta_Pi1 = 0._dp
if (.not. s% calculate_Brunt_N2) return
entered_g_mode_cavity = .false.
k = 0
r = 0._dp
N2 = 0._dp
S2 = 0._dp
dr = 0._dp
rho = 0._dp
omega_max2 = pow2(2*pi*s% nu_max/1d6)
! Modifed slightly to include partial cell with face at actual inner turning point to avoid jumps due to mesh points
! Find k of turning point
k_tpu = 0
k_tpl = 0
do k = s% nz, 2, -1
N2 = s% brunt_N2(k) ! brunt_N2 at cell face
S2 = 2*pow2(s% csound_face(k)/s% r(k)) ! l=1 Lamb Freq ^2 at cell face
if ((omega_max2 < N2) .and. (omega_max2
Contributor guide
Research direction
Locate the Fortran routine that computes delta_Pi1 and reproduce the 0.8Msol RGB example described in the issue. Compare the existing mesh-face and rmid integration with the proposed interpolated turning points, especially the dr calculation. Done means the delta_Pg evolution no longer jumps when omega_max crosses a grid point and the turning-point integration is validated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fortran
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100