Skip to content

Conversation

@weiyuan-jiang
Copy link
Contributor

Initial check in to address issue #526 .

@weiyuan-jiang weiyuan-jiang added 0 diff The changes in this pull request have verified to be zero-diff with the target branch. Contingent - DNA These changes are contingent on other PRs (DNA=do not approve) labels Jan 28, 2022
@weiyuan-jiang weiyuan-jiang requested a review from a team as a code owner January 28, 2022 16:18
@weiyuan-jiang
Copy link
Contributor Author

I am not sure what is this alarm for. Maybe we should consider how to combine these two alarms. @atrayano

call MAPL_Get( STATE, IM=IM, JM=JM, LM=LM, &
RUNALARM = ALARM, &
CF = CF, &
LONS = LONS, &
LATS = LATS, &
INTERNAL_ESMF_STATE=INTERNAL, &
RC=STATUS )
VERIFY_(STATUS)
! If its time, calculate convective tendencies
! --------------------------------------------
if ( ESMF_AlarmIsRinging( ALARM, RC=status) ) then

@atrayano
Copy link
Contributor

@weiyuan-jiang My intention is noty to modify MAPL's original alarm (and we cannot use the MAPL's alarm since it ring at the last time step of run_dt). Convention in GEOS is that every componet in the system is called every time step during the main time loop. The new alarm will be used to decide whether to run or to skip calculations. It is almost identical to the alarm in MAPL except for the offset (RingTime). I cannot see how we could combine the two alarms

@weiyuan-jiang
Copy link
Contributor Author

@atrayano It is strange that this PR crashes when I set MOIST_DT as double of HEARTBEAT. I am debugging...

forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
GEOSgcm.x 000000000338847A Unknown Unknown Unknown
libpthread-2.22.s 00002AB5BDC29CE0 Unknown Unknown Unknown
GEOSgcm.x 0000000002A1D837 geos_utilsmod_mp_ 555 GEOS_Utilities.F90
GEOSgcm.x 0000000002A1D53E geos_utilsmod_mp_ 612 GEOS_Utilities.F90
GEOSgcm.x 0000000001E9E24F geos_lakegridcomp 1753 GEOS_LakeGridComp.F90
GEOSgcm.x 0000000001E98B03 geos_lakegridcomp 1441 GEOS_LakeGridComp.F90
libesmf.so 00002AB5AEE82514 _ZN5ESMCI6FTable1 Unknown Unknown
libesmf.so 00002AB5AEE8605F ESMCI_FTableCallE Unknown Unknown
libesmf.so 00002AB5AF421A8A _ZN5ESMCI3VMK5ent Unknown Unknown
libesmf.so 00002AB5AF40F285 ZN5ESMCI2VM5ente Unknown Unknown
libesmf.so 00002AB5AEE8396A c_esmc_ftablecall Unknown Unknown
libesmf.so 00002AB5AF6B686D esmf_compmod_mp_e Unknown Unknown
libesmf.so 00002AB5AF9C5C51 esmf_gridcompmod
Unknown Unknown
libMAPL.generic.s 00002AB5A9B5526B mapl_genericmod_m 1794 MAPL_Generic.F90
libesmf.so 00002AB5AEE82514 _ZN5ESMCI6FTable1 Unknown Unknown
libesmf.so 00002AB5AEE8605F ESMCI_FTableCallE Unknown Unknown
libesmf.so 00002AB5AF421A8A _ZN5ESMCI3VMK5ent Unknown Unknown
libesmf.so 00002AB5AF40F285 ZN5ESMCI2VM5ente Unknown Unknown
libesmf.so 00002AB5AEE8396A c_esmc_ftablecall Unknown Unknown
libesmf.so 00002AB5AF6B686D esmf_compmod_mp_e Unknown Unknown
libesmf.so 00002AB5AF9C5C51 esmf_gridcompmod
Unknown Unknown
GEOSgcm.x 0000000001E2260E geos_surfacegridc 8617 GEOS_SurfaceGridComp.F90
GEOSgcm.x 0000000001E06903 geos_surfacegridc 6754 GEOS_SurfaceGridComp.F90
libesmf.so 00002AB5AEE82514 _ZN5ESMCI6FTable1 Unknown Unknown
libesmf.so 00002AB5AEE8605F ESMCI_FTableCallE Unknown Unknown
libesmf.so 00002AB5AF421A8A _ZN5ESMCI3VMK5ent Unknown Unknown
libesmf.so 00002AB5AF40F285 ZN5ESMCI2VM5ente Unknown Unknown
libesmf.so 00002AB5AEE8396A c_esmc_ftablecall Unknown Unknown
libesmf.so 00002AB5AF6B686D esmf_compmod_mp_e Unknown Unknown
libesmf.so 00002AB5AF9C5C51 esmf_gridcompmod
Unknown Unknown
libMAPL.generic.s 00002AB5A9B5526B mapl_genericmod_m 1794 MAPL_Generic.F90
libesmf.so 00002AB5AEE82514 _ZN5ESMCI6FTable1 Unknown Unknown
libesmf.so 00002AB5AEE8605F ESMCI_FTableCallE Unknown Unknown
libesmf.so 00002AB5AF421A8A _ZN5ESMCI3VMK5ent Unknown Unknown
libesmf.so 00002AB5AF40F285 ZN5ESMCI2VM5ente Unknown Unknown
libesmf.so 00002AB5AEE8396A c_esmc_ftablecall Unknown Unknown
libesmf.so 00002AB5AF6B686D esmf_compmod_mp_e Unknown Unknown
libesmf.so 00002AB5AF9C5C51 esmf_gridcompmod
Unknown Unknown
GEOSgcm.x 000000000068BE7C geos_physicsgridc 2620 GEOS_PhysicsGridComp.F90

@atrayano
Copy link
Contributor

atrayano commented Feb 1, 2022

@weiyuan-jiang When you create the new alarm (iMoistAlarm n Initialize), you need to explicitly set it to ringing. Although your ringTime is the same as currTime, the state of alarm will be changed only during the call ESMF_ClockAdvance (in Cap). So, just add this call as soon as the alarm is created
call ESMF_AlarmSet(MoistAlarm, ringing=.true., RC)
Otherwise the very first step the alarm is not ringing, and then as a result, moist skips the run method, all exports are not touched, they stay 0, and the code dies in the QSAT calculation in one of the children of Physics (lake in your case)

@weiyuan-jiang
Copy link
Contributor Author

@weiyuan-jiang When you create the new alarm (iMoistAlarm n Initialize), you need to explicitly set it to ringing. Although your ringTime is the same as currTime, the state of alarm will be changed only during the call ESMF_ClockAdvance (in Cap). So, just add this call as soon as the alarm is created
call ESMF_AlarmSet(MoistAlarm, ringing=.true., RC)
Otherwise the very first step the alarm is not ringing, and then as a result, moist skips the run method, all exports are not touched, they stay 0, and the code dies in the QSAT calculation in one of the children of Physics (lake in your case)

call ESMF_AlarmSet(MoistAlarm, ringing=.true., RC)

Even without above call, the moist run at the first time. After I added, there is no difference and it still crashed at the same point.

@weiyuan-jiang
Copy link
Contributor Author

@atrayano I know why it crashes. When I set MOIST_DT = HEARTBEAT, it runs and the old alarm rings. If I set MOIST_DT = 2*HEARTBEAT, at the first time, the old alarm doesn't ring. So there is interference of the MoistAlarm and Alarm .

if ( ESMF_AlarmIsRinging( ALARM, RC=status) ) then
VERIFY_(STATUS)
call ESMF_AlarmRingerOff(ALARM, RC=STATUS)
VERIFY_(STATUS)
call MAPL_TimerOn(STATE,"DRIVER")
call MOIST_DRIVER(IM,JM,LM, RC=STATUS)
VERIFY_(STATUS)
call MAPL_TimerOff(STATE,"DRIVER")
endif

@weiyuan-jiang
Copy link
Contributor Author

weiyuan-jiang commented Feb 3, 2022

After talking to @atrayano , this PR now runs as expected. ( runs at time 0 and every Moist_DT). But I am still confused why the new MoistAlarm affects the ringing time of the old ALARM in 5414 ( commented out now) @bena-nasa @tclune

call ESMF_ClockGetAlarm(CLOCK, 'MoistAlarm', MoistAlarm, rc=status)

@weiyuan-jiang
Copy link
Contributor Author

After @bena-nasa walked me through the codes, I now understand why my new MoistAlarm affects the old generic ALARM. It is the parameter name "MOIST_DT" that gets into the generic call and changes the generic alarm's interval. ( it checks "DT", and eventually checks "MOIST_DT") . That really eases my mind and I am confident that this MoistAlarm will not change other components' alarms. @atrayano @tclune

@weiyuan-jiang
Copy link
Contributor Author

@wmputman , This is a branch you can try with longer time step for Moisture grid comp. Just add parameter "MOIST_DT:" to AGCM.rc. The run alarm will ring at time 0 and every moist_dt. If you are happy with this approach, we can move onto other grid comps. @atrayano @tclune

@sdrabenh
Copy link
Collaborator

@weiyuan-jiang is this PR finalized? I'm unsure since this still has the DNA label.

@weiyuan-jiang
Copy link
Contributor Author

weiyuan-jiang commented Mar 17, 2022

We can use this PR [https://github.com/GEOS-ESM/MAPL/pull/1369] in MAPL to achieve the same function @atrayano @tclune

@sdrabenh
Copy link
Collaborator

sdrabenh commented May 3, 2022

@weiyuan-jiang there haven't been any updates to this PR in quite some time. Is this ready for merging? If not, could you please convert this to a draft PR or close it if no longer being pursued.

@weiyuan-jiang
Copy link
Contributor Author

Do you have opinion on the PR in MAPL ? ( GEOS-ESM/MAPL#1369 ) ? We need to choose one. @tclune @bena-nasa @atrayano

@tclune
Copy link
Collaborator

tclune commented May 3, 2022

I have not looked closely at this ticket. If there are choices, I would largely defer to @atrayano as to the preferred path.

@sdrabenh
Copy link
Collaborator

sdrabenh commented Sep 8, 2022

@weiyuan-jiang can we close this now? There has been no movement for quite some time and things looks stale. I would like to clear out stagnant PRs that are just cluttering the queue.

@weiyuan-jiang
Copy link
Contributor Author

OK, let me close it for now. I will reopen it when we need it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0 diff The changes in this pull request have verified to be zero-diff with the target branch. Contingent - DNA These changes are contingent on other PRs (DNA=do not approve)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants