Joint CCSM/ESMF meeting

Tuesday May 16th, 3:00-4:00pm

Directors Conference room

Attending: Cecelia, Erik, Mariana, Don

  • Review last meeting
  • Peggy has files now – progress? Doing ok!
  • Is Brian E. happy enough? Wait for ESMF_2_3_0.
  • What does our design look like again?
  • We now have ESMF_Initialize in our codes (CAM, CLM)
  • Is it ok to have ESMF_Initialize but not ESMF_Finalize? (CCSM has it's own finalize that shuts down MPI and this conflicts with the ESMF_Finalize). Could we make shutting down MPI an option to ESMF_Finalize?
  • Erik with Ed and/or Gerhard on configure script – in July (maybe 2nd week of July for a week or so)
  • ESMF2_2_2 – Right now for coding
  • ESMF2_3_0 – Changes without structure changes (August 15th or so)
  • ESMF3_0_0 – Gerhards huge change
    Cecelia would like us to use ESMF_2_3_0 for Stage-1.

    CCSM Objects being used at driver and passed to all components

  • We are wrapping ESMF clocks into a CCSM shared clock.
  • We have a CCSM Initialization object read in at the driver level and passed to all components.
  • Both of these objects are converted into data on ESMF state and then extracted out by a component which then reconstructs them for it's internal use (so it can use the object methods for handling the data).

    Time-manager wrapping we are doing:

    shr_timemgr_mod

Clock object (based on ESMF clock, has a restart alarm standard, and extra info)

(The EClock has a pointer to the restart alarm in it, added here so the object can reference the alarm directly without having to go through the clock)
(later we will also have alarms for each component model: lnd, ice, ocn, and atm)

   type shr_timemgr_clockType
      private            ! This is an opaque type
      ! ------------------------------------------------------------------------
      ! ----------- Information saved on restart -------------------------------
      ! ------------------------------------------------------------------------
 {color:red}type(ESMF_Clock)               :: EClock     ! Time information
      type(ESMF_Alarm)               :: restart    ! Restart alarm
{color}
      type(shr_timemgr_clockInfoType) :: info      ! Misc. Info: perpetual mode, orbit
      ! ------------------------------------------------------------------------
      ! Variables that are written out to restart file from above
      ! ------------------------------------------------------------------------
      type(shr_ncio_descripType) :: var(NClockVars)
   end type shr_timemgr_clockType

Clock information type

(Contains perpetual date, misc info, as well as orbital information. Orbital information is included so that the orbit can potentially be kept up to date with the clock).

   type shr_timemgr_clockInfoType
      ! CCSM time information: perpetual mode info and orbital information
      private            ! This is an opaque type
      ! ------------------------------------------------------------------------
      ! ----------- Information saved on restart -------------------------------
      ! ------------------------------------------------------------------------
      ! Description of this clock
      character(len=SHR_KIND_CL) :: desc
      ! If this is a master synchronization clock or not
      logical                    :: MasterSyncClock
      ! Calendar type
      character(len=SHR_KIND_CS) :: calendar
      ! Perpetual date information
      logical              :: perpetual_run = .false.   ! If running in perpetual mode
 {color:red}type(ESMF_Time)      :: perpetual_time            ! Time/date of perpetual mode{color}
      ! Orbital information to set: either year or all of rest
      integer(SHR_KIND_IN) :: orb_mode     = SHR_ORB_UNDEF_INT  ! Orbit mode
      integer(SHR_KIND_IN) :: orb_iyear_AD = SHR_ORB_UNDEF_INT  ! year for orbit
      real(SHR_KIND_R8)    :: orb_obliq    = SHR_ORB_UNDEF_REAL ! Obliquity of orbit
      real(SHR_KIND_R8)    :: orb_eccen    = SHR_ORB_UNDEF_REAL ! Eccentricity of orbit
      real(SHR_KIND_R8)    :: orb_mvelp    = SHR_ORB_UNDEF_REAL ! Locatn of vernal equinox
      ! ------------------------------------------------------------------------
      ! ----------- Information not saved on restart ---------------------------
      ! ------------------------------------------------------------------------
      ! If wish to turn restarts off
      logical              :: NoRestarts   = .false.
      ! Orbital information derived from above
      real(SHR_KIND_R8)    :: orb_obliqr   = SHR_ORB_UNDEF_REAL
      real(SHR_KIND_R8)    :: orb_lambm0   = SHR_ORB_UNDEF_REAL
      real(SHR_KIND_R8)    :: orb_mvelpp   = SHR_ORB_UNDEF_REAL
      !------------------------------------------------------------------------
      ! Variables that are written out to restart file from above
      !-------------------------------------------------------------------------
      type(shr_ncio_descripType) :: var(NInfoVars)
   end type shr_timemgr_clockInfoType

Initialization information object we use at the driver level and in components:

shr_inputInfo_mod

   type shr_inputInfo_initType
      private     ! This type is opaque
      !-----------------------------------------------------------------------------
      ! Information shared by all model components
      !-----------------------------------------------------------------------------
      ! ----------- Information not saved on restart --------------------
      ! Start type: startup, branch or continue
      character(SHR_KIND_CL)  :: start_type        ! Type of startup
      ! ----------- Information saved on restart ------------------------
      ! Case description and name (save these on restart)
      character(SHR_KIND_CL)          :: case_desc  ! Long description of this case
      character(SHR_KIND_CS)          :: case_name  ! Short case identification
      ! Special configurations (save these on restart)
      logical                 :: atm_adiabatic  ! No surface models and atm adiabatic mode
      logical                 :: atm_ideal_phys ! No surface models and atm ideal-physics
      logical                 :: aqua_planet    ! No ice/lnd, analytic ocn, perpetual time
      ! MSS information needed for CAM now, but not in the future? (save these on restart)
      integer                 :: mss_irt        ! MSS retention period
      character(SHR_KIND_CL)  :: mss_wpass      ! MSS write password
             
      ! Information ONLY used by the top level application driver.
      ! ----------- Information not saved on restart --------------------
      ! Restart file info
      character(SHR_KIND_CL)  :: restart_pfile         ! Restart pointer file
      character(SHR_KIND_CL)  :: restart_file          ! Full archive path to restart file
      character(SHR_KIND_CL)  :: archive_dir           ! Directory to archive to...
      character(SHR_KIND_CL)  :: restart_file_override ! List to override on restart file
      logical :: brnch_retain_casename                 ! If branch and can use same casename
      !-----------------------------------------------------------------------------
      ! Variables that are written out to restart file from above
      !-----------------------------------------------------------------------------
      type(shr_ncio_descripType) :: var(NVars)
   end type shr_inputInfo_InitType

So what does that look like in the initialization part of the code?

  type(InitInfo_t) :: InitInfo ! CCSM initialization information
  ! note -the set of fields in the following states are determined in the prefix
  ! and can be obtained from cpl_fields_mod.F90
  ! note- the suffix (_a etc.) determines the grid and decomp of the fields and is
  ! defined in the gc that contains those grids
  type(ESMF_State) :: cs_a !  nested states: l2x_a, i2x_a, o2x_a
  type(ESMF_State) :: a2x_a ! Atm export, atm grid and decomp - defined in atm gc
  type(ESMF_State) :: a2x_l ! Atm export, lnd grid and decomp - defined at top level
  type(ESMF_State) :: a2x_i ! Atm export, ice grid and decomp - defined at top level
  type(ESMF_State) :: a2x_o ! Atm export, ocn grid and decomp - defined at top level
  type(ESMF_State) :: l2x_a ! Lnd export, atm grid and decomp - defined at top level
  type(ESMF_State) :: o2x_a ! Ocn export, atm grid and decomp - defined at top level
  type(ESMF_State) :: i2x_a ! Ice export, atm grid and decomp - defined at top level
  type(ESMF_State) :: x2a_a ! Atm import, atm grid and decomp - defined in atm gc
  type(ESMF_GridComp) :: gc_atm                 ! Atmosphere gridded component
  type(ESMF_GridComp) :: gc_mrg_x2a             ! Atmosphere import state merge/preparer gridded component
  type(shr_timemgr_ClockType) :: SyncClock      ! CCSM clock
  type(shr_timemgr_ClockInfoType):: TimeMgrInfo ! CCSM time-management information
 type(shr_timemgr_ClockSetupType):: ClockSetup ! CCSM time-management 
.
.
.
  ! Add ccsm_init_data to import state as state on each import state
  call eshr_inputinfo_Info2EState( InitInfo, x2a_a )
.
.
.
  ! Each component is given it s coupling frequency by querying the alarms setup for each component
  ! Each component will create it s own internal clock, using ESyncClock to set start,
  ! stop, calendar  and ref time, as well as using the restart alarm
  call eshr_timemgr_Info2EState( TimeMgrInfo, x2a_a )
.
.
.
  if ( shr_inputinfo_RunModel( InitInfo,  atm  ) ) &
     call ESMF_GridCompInitialize( gc_atm, import=x2a_a, export=a2x_a, phase=1, clock=ESyncClock, rc=rc )
.
.
.

What does the run loop look like?

 do while ( .not. ESMF_IsStopTime( EClock ) )
   if ( shr_inputinfo_RunModel( InitInfo,  atm  ) .and. ESMF_AlarmIsRinging( atm_alarm ) )then   
        call ESMF_GridCompRun( gc_atm,     import=x2a_a, export=a2x_a, ESyncClock, phase=1 )
        call ESMF_CplCompRun ( cc_map_a2l, import=a2x_a, export=a2x_l, rc=rc )
        call ESMF_CplCompRun ( cc_map_a2i, import=a2x_a, export=a2x_i, rc=rc )
        call ESMF_CplCompRun ( cc_map_a2o, import=a2x_a, export=a2x_o, rc=rc )
   end if
   ! Similarily call the surface components...
.
.
.
   if ( shr_inputinfo_RunModel( InitInfo,  atm  ) .and. ESMF_AlarmIsRinging( atm_alarm ) )then
       ! Note: cs_a is the composite state pointing to: l2x_a, i2x_a, and o2x_a
       call ESMF_GridCompRun( gc_mrg_x2a, import=cs_a, export=x2a_a, rc=rc )
       call ESMF_GridCompRun(	gc_atm,     import=x2a_a,               phase=2 )
       call ESMF_AlarmRingerOff( atm_alarm )
   end if
   call ESMF_ClockAdvance( EClock )
 end do
  • No labels