Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pgstar inlist arrays #552

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open

Pgstar inlist arrays #552

wants to merge 29 commits into from

Conversation

matthiasfabry
Copy link
Contributor

Large refactor of the pgstar infrastructure (put as draft for now).

The main change is to have the windows with multiple entries (Text_Summary(1-9), History_track(1-9), History_panels(1-9), Color_magnitude(1-9), Grid(1-9)). be (mostly) handled in arrays, in the spirit of #368. This reduces the required defaults by several thousands of lines, and cleans up the *.f90 files of the affected windows, aiding code maintenance.

Only thing that isn't yet possible is having procedure pointers in an array, which means that the decorator pointers are unaffected. As a matter of fact, I would like to push for dropping support for these functions; if users want custom plotting/annotations, I feel like they are much better off using their own library. This would further simplify our pgstar implementation.

I need help again however from the sed wizards for devising clever substitution scripts, where not only Grid2_* is changed to Grid_*(2), but also Grid2_*(1) to Grid_*(2, 1), etc.

@fxt44
Copy link
Member

fxt44 commented Jun 13, 2023

is

setenv MESA_FORCE_PGSTAR_FLAG true

sufficient for these changes get tested within the test suite?

@matthiasfabry matthiasfabry self-assigned this May 29, 2024
@matthiasfabry matthiasfabry marked this pull request as ready for review May 29, 2024 13:06
@matthiasfabry
Copy link
Contributor Author

Promoted this out of draft status.
What remains to do is check whether all seds have been done correctly. The test suite seems to pick up some of them

Comment on lines +419 to +421
show_History_Track_annotation1(:) = .false.
show_History_Track_annotation2(:) = .false.
show_History_Track_annotation3(:) = .false.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we want this to become a 2d array (I.e. show_History_Track_annotation(:,:) = .false.)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know exactly? Philosophically, these are different, as there aren't pgstar_array_length of them, only 3. I'd leave this as is.

@warrickball
Copy link
Contributor

warrickball commented May 31, 2024

Do you have a list of the regular expressions/find+replace commands you used to make the changes? I've set up a little sandbox to start experimenting but figured I'd just be reinventing what you've already done if you used regexes in the first place.

@matthiasfabry
Copy link
Contributor Author

I have not, I used the find and replace feature of my IDE to do most of the renaming. @mjoyceGR sent me a good starting point to also get into seding:

s/Grid\(.\)_*(/Grid_*(\1, /g
s/Grid\([^_]\)_*/Grid_*(\1)/g

If this covers everything, then what remains is to repeat this for Profile_Panels, History_Panels, History_Track, Text_Summary, Color_Magnitude, including entries in pgbinary.

@warrickball
Copy link
Contributor

That's helpful, thanks! I've just been experimenting with that in my sandbox and currently have

sed -E \
    -e 's/(History_Track|Grid|Profile_Panels|History_Panels|Text_Summary)([1-9])([_a-zA-Z]*) = /\1\3\(\2\) = /' \
    -e 's/(History_Track|Grid|Profile_Panels|History_Panels|Text_Summary)([1-9])([_a-zA-Z]*)\(/\1\3\(\2\,/' \
    inlist_original > inlist_modified

where inlist_original is the inlist that you want to change. I haven't tested this but it seems to catch basically everything. I generated test data by dumping everything in */test_suite/*/inlist_pgstar to a couple of files and, though there are a bunch of changes on main, I didn't see anything obvious left.

I'll try to construct my test data a bit more carefully and iterate again in the next few days but I think this covers most cases.

@pmocz
Copy link
Member

pmocz commented Aug 23, 2024

What is the status of this PR? Is it nearly ready to go?

I can help fix conflicts with main (a lot of it is due to removing unused variables in star, or updates and formatting to inlists) and check the seds

@pmocz pmocz self-assigned this Aug 23, 2024
@warrickball
Copy link
Contributor

I think it's worth fixing the conflicts with main because this is a change we should implement at some point.

My previous comment is as far as I got with sed commands to fix existing inlists. If a sure-fire way of updating inlists is the blocker, I can prioritise this (though that doesn't mean "do it soon").

It's probably worth a look now that we've just made a release. We should have at least a few months to bash our own heads against this before it becomes part of another release.

@pmocz pmocz requested a review from aurimontem as a code owner August 25, 2024 14:32
@pmocz
Copy link
Member

pmocz commented Aug 25, 2024

I think it's worth fixing the conflicts with main because this is a change we should implement at some point.

My previous comment is as far as I got with sed commands to fix existing inlists. If a sure-fire way of updating inlists is the blocker, I can prioritise this (though that doesn't mean "do it soon").

It's probably worth a look now that we've just made a release. We should have at least a few months to bash our own heads against this before it becomes part of another release.

I fixed conflicts with main. And applied seds to inlists I could find with grepping. Perhaps we could merge into main after we take another look for outstanding inlists and add an sed script to help users change their inlists, + online documentation, so that it can start being tested before next release?

@warrickball
Copy link
Contributor

I'm getting a little bit of MESA momentum back but will be under some time pressure until at least October 10. What are the specific actions here? I'm guessing I can test the sed completeness with something like:

  1. Checkout out this branch.
  2. Checkout all the inlist_pgstar and inlist_pgbinary files from main.
  3. Run the sed script on all of them.
  4. Run the test suite.

If there are failures, we can then fix them, rinse and repeat. If not, we're basically most of the way we can get in terms of how well the test suite currently covers all the PGstar options, at which point I think we're okay to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants