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

Remove IPD steps 3 and 5 (cleanup preprocessor directives) #50

Merged
merged 9 commits into from
Jan 14, 2021

Conversation

climbfuji
Copy link

@climbfuji climbfuji commented Jan 8, 2021

This PR is part of the removal process of IPD from the UFS and addresses steps 3 and 5 in NOAA-EMC/fv3atm#214.

Changes:

  • Remove all preprocessor directives that were introduced to "switch" between CCPP fast physics and the original fast physics implementation, alongside with the non-CCPP fast physics code.
  • Replace imports of of IPD types and containers (IPD_) with the corresponding GFS types/containers (GFS_) if preprocessor directive GFS_TYPES is set (in fv3atm's top-level CMakeLists.txt)

This PR fixes #29.

Associated PRs:

#50
NCAR/ccpp-physics#547
NOAA-EMC/fv3atm#224
NOAA-EMC/NEMS#87
ufs-community/ufs-weather-model#357

For regression testing, see ufs-community/ufs-weather-model#357.

@climbfuji
Copy link
Author

@junwang-noaa please assign reviewers when it is convenient for you, thanks.

@@ -299,17 +299,6 @@ subroutine fv_subgrid_z( isd, ied, jsd, jed, is, ie, js, je, km, nq, dt, &
enddo
elseif ( nwat==4 ) then
do i=is,ie
#ifndef CCPP
q_liq = q0(i,k,liq_wat) + q0(i,k,rainwat)
#ifdef MULTI_GASES
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am curious what is the impact of the code changes to MULTI_GASES?

Copy link
Author

Choose a reason for hiding this comment

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

None, because it is inside the #ifndef CCPP block.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just wondering if ccpp is the default now, what does "ifndef ccpp" mean?

Copy link
Author

Choose a reason for hiding this comment

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

Just wondering if ccpp is the default now, what does "ifndef ccpp" mean?

Until now, we pass -DCCPP to the compiler when compiling the dycore code (and all the other model code). The PRs listed above remove this -DCCPP since it is now the only option. We thus need to make sure that only the code blocks that currently correspond to #ifdef CCPP or the #else option in #ifndef CCPP blocks are executed.

tools/fv_iau_mod.F90 Outdated Show resolved Hide resolved
@bensonr
Copy link
Collaborator

bensonr commented Jan 12, 2021 via email

@climbfuji
Copy link
Author

The IPD data types are removed entirely from the code base. They are actually not more generic, at least not the way they are in fv3atm now, because all they do is pass through the GFS data types one by one.
The layer of indirection comes from the IPD design taking a different approach than the CCPP. The IPD approach was that each physics suite, consisting of a group of parameterizations and a driver, could be imported independently by creating an IPD-compliant translation layer. The CCPP adopted a method of aggregating parameterizations, creating interstitials when needed, and auto-generating a driver. Each design has pros and cons.

Thanks, Rusty, and I totally agree with your assessment. Given that the UFS has decided to adopt the CCPP going forward and remove the IPD from the codebase, do you agree to make the changes I propose here or do you think we should keep the IPD data types in the model? (for what reason?)

@bensonr
Copy link
Collaborator

bensonr commented Jan 12, 2021 via email

@junwang-noaa
Copy link
Collaborator

junwang-noaa commented Jan 12, 2021 via email

@climbfuji
Copy link
Author

Please understand we also need to sync back the dycore change to GFDL's central repo, from what I understanding since the dycore is shared by several host models, it is arguable not to add host model specifics in the shared code, otherwise we may have to stick to our specific dycore version from GFDL's release version. I really don't see how the discussion here can lead to "you want to keep the door open to remove CCPP again and reintroduce the IPD", such a statement is not rational to me.

I'll reply to your various comments in one go. When you say CIME, I assume you mean CESM? CIME is not a model (it is a workflow). Does CESM use IPD? I don't know, but if it doesn't then it would either have to define the IPD or the GFS data types, same amount of work.

Dycore interoperability requires using either the IPD data types or the GFS data types (with my changes), but in dev/emc it also requires using CCPP. Given the amount of changes between the GFDL branch and dev/emc, how easy is it to sync code back and forth? @bensonr what is your take on this? Do we need some larger discussion on how to maintain compatibility between the different dycore branches?

If you think that retaining the "generality" of the IPD data types helps, then we can do one of the following, or something else if there is a better suggestion.

  1. Keep a stripped-down version of the current IPD abstraction layer in fv3atm that simply passes the GFS types as IPD types to the dycore. You still have all of the other CCPP changes from this PR, though. And, by the way, the current code in dev/emc already uses the GFS data types (in tools/external_ic.F90), so I don't know how interoperable that part is. Maybe that file is just not (supposed to be) used outside the UFS.

  2. Easier, but less elegant, in those few places where the IPD imports are replaced by GFS imports, have preprocessor directives that do something like the following code snippet. This is basically the same what the current IPD abstraction layer in fv3atm does.

#ifdef UFS
use GFS_typedefs, only : IPD_data => GFS_data
#else
use IPD_typedefs, only : IPD_data
#endif

Finally, note that @bensonr is ok with the changes proposed here. I am not married to them, but I am wondering about the overall strategy, and maybe this should have been discussed earlier on.

@DusanJovic-NOAA
Copy link
Collaborator

@climbfuji I would say remove as much code as possible while maintaining all the functionality we currently have. Less code, less bugs.

@climbfuji
Copy link
Author

climbfuji commented Jan 13, 2021

@junwang-noaa I came up with a compromise that minimizes the changes in this PR and allows for using either the GFS data types or the IPD data types in the dycore, depending on the presence of the GFS_TYPES preprocessor directive. With this, I can revert all the local changes from IPD_data to GFS_data etc. in driver/fvGFS/atmosphere.F90 and tools/fv_iau_mod.F90.

Please see 0e59620 and the additional preprocessor flag for the dycore in NOAA-EMC/fv3atm@52a4652. These two commits can be reverted or replaced if the suggested solution is not acceptable.

@junwang-noaa
Copy link
Collaborator

junwang-noaa commented Jan 13, 2021 via email

@climbfuji
Copy link
Author

Dom, thanks to making the interfaces to dycore more general, this abstract layer (currently IPD data types) removes the dependence of the dycore code to GFS data and the dycore code can be still shared/extended to other host models.

Thanks, @junwang-noaa . I will wait for your fv3atm review before kicking off the regression tests.

Copy link
Collaborator

@junwang-noaa junwang-noaa left a comment

Choose a reason for hiding this comment

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

CCPP version of fast physics becomes default in this PR, the GFDL version of fast process of GFDL MP fv3_cmp.F90 is removed. The future syncing dev/emc to GFDL dycore release has been discussed and recorded in issue #54. CCPP group may need to provide support in the future merge when there is fast physics updates.

@climbfuji
Copy link
Author

@bensonr @XiaqiongZhou-NOAA This PR is ready, all regression tests passed against the existing baselines.

@climbfuji
Copy link
Author

CCPP version of fast physics becomes default in this PR, the GFDL version of fast process of GFDL MP fv3_cmp.F90 is removed. The future syncing dev/emc to GFDL dycore release has been discussed and recorded in issue #54.

Thanks for the summary.

CCPP group may need to provide support in the future merge when there is fast physics updates.

And sure we will!

@junwang-noaa junwang-noaa removed the request for review from HenryJuang-NOAA January 14, 2021 18:26
Copy link
Collaborator

@XiaqiongZhou-NOAA XiaqiongZhou-NOAA left a comment

Choose a reason for hiding this comment

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

Reviewed. It looks fine to me.

@junwang-noaa junwang-noaa merged commit 00397ef into NOAA-EMC:dev/emc Jan 14, 2021
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.

Passing unallocated array dtdt (dtdt_m) to subroutine Lagrangian_to_Eulerian
5 participants