Use allocatable arrays in predictive_mixing
- Dominant language
- Fortran
- Stars
- 249
- Forks
- 82
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 3
Description
On the distillation branch, Rob pointed out to me that there's a risk of stack overflow when using explicit shape automatic arrays, for example to declare an extra array for saving the composition in case it needs to be reset. (See discussion at https://github.com/MESAHub/mesa/commit/a31cb38ff3b647f4cdeb501d22c5322b318e870c#r117329563.)
This was a construction I had copied over from predictive mixing, which makes even more extensive use of such automatic arrays:
https://github.com/MESAHub/mesa/blob/c3e28ef8279e6f56a62239a8ce6e8f822fab10ec/star/private/predictive_mix.f90#L719-L735
@rhdtownsend do you think it would be worthwhile to refactor this code to use something more like the `saved_data` construction with allocatable arrays like in `conv_premix`?
Contributor guide
Research direction
Start by reading predictive_mix.f90 around lines 719-735 and compare its automatic-array handling with the saved_data construction in conv_premix. Check the linked discussion for the stack-overflow concern and determine whether the predictive_mixing arrays should follow that pattern. Done means the refactor is agreed, implemented, and verified without changing predictive-mixing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fortran
- Domain
- hpc, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100