Skip to content

NUOPC restart change #412

Description

@cacraigucar

From email from Jim Edwards:

In PR ESCOMP/CMEPS#221 I added support for the REST_OPTION=end and for writing restart files at the
end of the run in any case except when REST_OPTION = none or never.

Each component model will need updates in the xxx_comp_nuopc.F90 file order to implement this change. Please consider making this change in your next component tag. Let me know if you have any questions or concerns. thanks

Here are the changes I made in the ctsm lnd_comp_nuopc.F90 file:

(Declare a module variable)

logical :: write_restart_at_endofrun = .false.

(Initialize the variable in InitializeRealize)

+    call NUOPC_CompAttributeGet(gcomp, name="write_restart_at_endofrun", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
+    if (ChkErr(rc,__LINE__,u_FILE_u)) return
+    if (isPresent .and. isSet) then
+       if (trim(cvalue) .eq. '.true.') write_restart_at_endofrun = .true.
+    end if

(Check the variable in ModelAdvance - Note here that this comes after the alarm_stop)

   !--------------------------------                                                                                                              
   ! Determine if time to stop                                                                                                                    
   !--------------------------------                                                                                                              
                                                                                                                                                 
   call ESMF_ClockGetAlarm(clock, alarmname='alarm_stop', alarm=alarm, rc=rc)                                                                    
   if (ChkErr(rc,__LINE__,u_FILE_u)) return                                                                                                      
                                                                                                                                                 
   if (ESMF_AlarmIsRinging(alarm, rc=rc)) then                                                                                                    
      if (ChkErr(rc,__LINE__,u_FILE_u)) return                                                                                                    
      nlend = .true.                                                                                                                              
      call ESMF_AlarmRingerOff( alarm, rc=rc )                                                                                                    
      if (ChkErr(rc,__LINE__,u_FILE_u)) return                                                                                                    
   else                                                                                                                                          
      nlend = .false.                                                                                                                            
   endif                                                                                                                                          
                                                                                                                                                 
   !--------------------------------                                                                                                              
   ! Determine if time to write restart                                                                                                          
   !--------------------------------                                                                                                              
   rstwr = .false.                                                                                                                                
   if (nlend .and. write_restart_at_endofrun) then                                                                                                
      rstwr = .true.                                                                                                                              
   else                                                                                                                                          
      call ESMF_ClockGetAlarm(clock, alarmname='alarm_restart', alarm=alarm, rc=rc)                                                              
      if (ChkErr(rc,__LINE__,u_FILE_u)) return                                                                                                    
      if (ESMF_AlarmIsCreated(alarm, rc=rc)) then                                                                                                
         if (ESMF_AlarmIsRinging(alarm, rc=rc)) then                                                                                              
            if (ChkErr(rc,__LINE__,u_FILE_u)) return                                                                                              
            rstwr = .true.                                                                                                                        
            call ESMF_AlarmRingerOff( alarm, rc=rc )                                                                                              
            if (ChkErr(rc,__LINE__,u_FILE_u)) return                                                                                              
         endif                                                                                                                                    
      endif                                                                                                                                      
   end if                                                                                                                                        

Metadata

Metadata

Assignees

No one assigned

    Labels

    CoupledEval3next releaseRequired to be in next CESM Releasenext tagThis issue is ready to be fixed in the next CAM tag

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions