mesa icon indicating copy to clipboard operation
mesa copied to clipboard

Adding a new hook other_pressure_implicit

Open adamjermyn opened this issue 3 years ago • 2 comments

Will Schultz (@wcschultz) and I have been working to implement some of the results from his recent paper analyzing 3D RHD simulations (https://arxiv.org/abs/2009.01238) in MESA, and are doing this through the other_pressure hook.

We've noticed that the other_pressure hook doesn't provide a way to pass through partial derivatives, and I think we could improve this pretty easily and provide an other_pressure_implicit hook.

The basic idea is to promote extra_pressure from real(dp) to auto_diff_real_star_order1. Then the user can set partials with respect to any of the solver variables, and those will get passed right along into the solver, allowing a fully implicit hook.

I think the way we'd implement this is with a new hook, which gets called in calc_Ptot_ad_tw in star_utils.f90. That's the only place we assemble the total pressure, so that should automatically capture all the places we'd need to evaluate an implicit other pressure.

Any thoughts/suggestions/objections before we give this a whirl?

adamjermyn avatar Feb 10 '22 16:02 adamjermyn

Implemented on the branch other_pressure_implicit. I just changed other_pressure to support partials. Users can omit them if they wish (to recover the non-implicit version).

adamjermyn avatar Mar 01 '22 18:03 adamjermyn

We'll try it out for a bit before merging.

adamjermyn avatar Mar 01 '22 18:03 adamjermyn

Did anything ever come of this? The branch other_pressure_implicit is actually still OK to merge and passed when it last ran, though over a year ago. So if someone is still interested it could probably be nudged into a PR and probably merged.

warrickball avatar May 19 '23 08:05 warrickball

No, modifying this branch did not resolve our problems. It is probably a good idea for other_pressure to support partials for more complicated pressure additions, but I don't know if this constitutes a need to merge this branch into a PR.

wcschultz avatar May 19 '23 15:05 wcschultz