MESAHub/mesa

Add pgstar decorator to mark solver progress in Trho profiles + Kippenhahn diagrams

Opened this issue · 1 comments

In an effort to make MESA's solver struggles more transparent to normal users, I think it would be appropriate to add 1, 2, or 3 dots using a pgstar Decorator to the TRho_profile in pgstar to mark the top 1, 2, or 3 locations where the solver has spent most if its iterations, or where the residuals are largest. These dots would be similar to the current function of 'show_TRho_Profile_mass_locs'

A first step would probably involve looking at https://docs.mesastar.org/en/release-r24.03.1/reference/pgstar.html#trho-profile-window to see what current decorators are implemented.

With the goal of implementing a decorator for solver iterations similar to show_TRho_Profile_mass_locs, we can then look closer at how this is done.

We probably should check out and modify:
$MESA_DIR/star/private/pgstar_ctrls_io.f90, where this is toggled
$MESA_DIR/star/private/pgstar_trho_profile.f90, where this would be called from the the show_profile_line subroutine.

And we would need to modify the implementation of the subroutine show_profile_line in $MESA_DIR/star/private/pgstar_support.f90 to achieve this.

Information on solver progress is typically printed out to the terminal when "report_solver_progress =.true.", which sets dbg_msg = .true. in $MESA_DIR/star/private/star_solver.f90, so we want to pipe some of this information into pgstar if possible to inform the user where the solver is struggling or where the residuals are highest in a given timestep.

Bonus points for implementing this in the Kippenhahn diagrams as well

I've been wanting this feature lately, so thanks for suggesting it. It'd also be nice to be able to include this any profile plot panel, either as a vertical line or as a marker along the x-axis (like how we can show mixing summaries on the x-axis). I haven't done a similar amount of background searching to see how feasible that would be, though.