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
Run in reverse to support adjoint calculation #12
Conversation
This commit adds code to allow the CapGridComp to run in reverse while maintaining the ability to trigger history alarms. This may also require a small bugfix in the ESMF 8.0 code.
GMAO doesn't like preprocessor defines so I removed most of them but had forgotten to do the step_reverse function. This change fixes that.
Thanks @TerribleNews. I will bring this into the next GEOS-Chem version (13.3). |
Great news! Thank you @lizziel. I have also started merging these same changes into the develop branch of GEOS-ESM/MAPL and I should be able to fire that pull request off this week sometime. |
@TerribleNews, are there are any PRs on other repos you plan on making in the near future to go along with these changes for GCHP adjoint? |
There's geoschem/HEMCO#97 and geoschem/geos-chem#797, but apart from that I don't have anything right now. I know there will be more adjoint code changes over the next few weeks, so it depends on the timeline; what do you mean by "near future"? |
We are planning the next version code freeze for last week in September. All three of these PRs can be brought in before then. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. @TerribleNews could you confirm whether or not we should retain the commented-out blocks?
I'll merge and test with the associated PRs after that.
! call ESMF_ClockGetAlarmList(cap%clock, ESMF_ALARMLIST_ALL, & | ||
! alarmList=alarm, alarmCount=alarmCount, rc = status ) | ||
! _VERIFY(STATUS) | ||
|
||
! call ESMF_ClockGetAlarmList(cap%clock_hist, ESMF_ALARMLIST_ALL, & | ||
! alarmList=hist_alarm, alarmCount=hist_alarmCount, rc = status ) | ||
! _VERIFY(STATUS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this meant to be left commented out? If so, is there a reason to retain it?
! WRITE(*,1003) 'clock', alarmCount | ||
|
||
! WRITE(*,1003) 'clock_hist', hist_alarmCount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here (do these need to be retained?)
! call ESMF_GridCompWriteRestart(this%gcs(this%root_id), importstate = this%child_imports(this%root_id), & | ||
! exportstate = this%child_exports(this%root_id), & | ||
! clock = this%clock_hist, userrc = status) | ||
! _VERIFY(status) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we retain this?
! if(list(n)%mode == "instantaneous" .or. list(n)%ForceOffsetZero) then | ||
! sec = 0 | ||
! else | ||
! IntState%average(n) = .true. | ||
! sec = MAPL_nsecf(list(n)%acc_interval) / 2 | ||
! endif | ||
! call ESMF_TimeIntervalSet( INTSTATE%STAMPOFFSET(n), S=sec, rc=status ) | ||
! _VERIFY(STATUS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we retain this?
I think it's safe to drop all those comments. They're mostly debug printing and one is about a part of the clock system that has changed. Thanks! |
Sounds good. Thanks! |
Description
Added functionality to run MAPL_CapGridCap in reverse and supporting changes to History GridComp to fix alarms in reverse.
Related Issue
This is a new feature
Motivation and Context
This is necessary to allow for the adjoint calculations to be run in reverse mode.
How Has This Been Tested?
This shouldn't change anything unless ADJOINT mode is turned on in GCHP.rc. Otherwise everything should behave exactly as before. I have compiled and run on pleiades but I have done limited testing. I'd be happy to perform more tests as requested by the GCST.
Types of changes
Checklist: