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

Update GFS_rrtmg_setup.F90 #1036

Merged
merged 2 commits into from
Jan 25, 2024
Merged

Conversation

michalakes
Copy link
Contributor

Move statement testing the is_initialized variable until after control variables in the argument list have been set. This is needed to make sure that the control variables are set for multiple instances of physics. This is related to the previously addressed issue #999 "Allow multiple instances of CCPP physics in single executable for ensemble DA".

The GFS_rrtmg_setup had not been a problem when #999 was being addressed, even though it has a heap-stored latch variable, because iaerflg andother control flags were also stored as module data in the physparam module and use-associated through the GFS_rrtmg_setup module. Since that time, GFS_rrtmg_setup was changed and these control variables are now passed in through the argument list of GFS_rrtmg_setup_init, where the are set only after the test to see if is_initialized is .true.

The error showed up in testing as NRL updated to the newer version of ccpp-physics.

 Move statement testing the is_initialized variable until after control variables in the argument list have been set. This is needed to make sure that the control variables are set for multiple instances of physics.
Copy link
Collaborator

@dustinswales dustinswales left a comment

Choose a reason for hiding this comment

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

@michalakes This looks fine to me.
Would you mind adding the same change to GFS_rrtmgp_setup.F90?

Moved is_initialized test to after the input flags have been set
@michalakes
Copy link
Contributor Author

@michalakes This looks fine to me. Would you mind adding the same change to GFS_rrtmgp_setup.F90?

I made the same change to GFS_rrtmgp_setup.F90

@michalakes
Copy link
Contributor Author

One additional comment. This fix will work as long as each instance of the physics wants the same radiation flags set. That's probably okay for us at NRL. If we want to allow for different instances to have different radiation flags set, it'll be necessary to do what we've done with other physics that has an initialization latch variable: make is_initialized an array and index by ccpp_instance.

@dustinswales
Copy link
Collaborator

@michalakes Thanks for making that change.
(Sometime in the not so distant future I plan on cleaning up and unifying the G/GP radiation GFS interstitials. As part of a larger cleanup effort to make the schemes "stateless" and host-agnostic)

@grantfirl
Copy link
Collaborator

@michalakes I'm pulling these changes into #1037 to save testing time on our part.

@grantfirl grantfirl merged commit 644be8d into NCAR:main Jan 25, 2024
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.

4 participants