CCSM/Stage 1 meeting: Feb 24th 2006
Directors Conference Room, 2:30-4:00pm
Agenda:
- Review last meeting Feb 10
- Answer question on problem I've come up on..
- Review top level design with last weeks name changes.
Question on specific problem:
Currently the operating mode we have is...
call shr_inputinfo_SetDefaults( CCSMInit ) <--- set some values to fill, others to reasonable defaults call shr_inputinfo_ReadNL( CCSMInit... ) <---- Everything set to a reasonable default here if ( shr_inputinfo_IsRestart( CCSMInit ) )then call shr_inputinfo_ReadRestart( CCSMInit... ) <-- Read in new defaults from restart file end if
The problem is that on restarts, I want the default values to be determined by the restart file – and overridden by the namelist – values. But, I need to read in the namelist first to get the restart_filename.
Example namelists that show the problem:
&ccsm_inparm start_type = "initial" case_name = "csmrun" aqua_planet = .true. / &ccsm_inparm start_type = "branch" case_name = "csmrun_branch" aqua_planet = .false. ! This is the standard default, so it can't know that the namelist wants to change this from the restart-file default. /
Another problem is when a combination of ReadNL and ChangeValues is used to set specific values up. How do I retain the ChangeValues settings when the restart file is read again to setup the new defaults?
- Answer is that branch and continue have same behavior – you can't change anything for branch except mass-store type stuff or restart frequencies.
Top level design with name changes, and only initialization subroutine...atm_comp_esmf ! CCSM Atmosphere ESMF gridded component lnd_comp_esmf ! CCSM Land ESMF gridded component ocn_comp_esmf ! CCSM Ocean ESMF gridded component ice_comp_esmf ! CCSM sea-ice ESMF gridded component seq_esmf_mrg_x2a ! CCSM atmosphere import merger ESMF gridded component seq_esmf_mrg_x2o ! CCSM ocean import merger ESMF gridded component seq_esmf_mrg_x2i ! CCSM sea-ice import merger ESMF gridded component seq_esmf_mrg_x2l ! CCSM land import merger ESMF gridded component seq_esmf_map ! Generic coupler component shr_inputInfo_mod ! CCSM initial information module shr_timemgr_mod ! CCSM time-manager module eshr_inputInfo_mod ! Convert CCSM input-information data to ESMF State eshr_timemgr_mod ! Convert CCSM time-manager data to ESMF_State eshr_EState_mod ! Module to help deal with ESMF States Data: type(ESMF_Clock) :: ESyncClock ! ESMF CCSM synchronization clock 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) :: cs_l ! nested states: a2x_l type(ESMF_State) :: cs_i ! nested states: a2x_i, o2x_i type(ESMF_State) :: cs_o ! nested states: a2x_o, i2x_o 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_l ! Lnd export, lnd grid and decomp - defined in lnd gc type(ESMF_State) :: l2x_a ! Lnd export, atm grid and decomp - defined at top level type(ESMF_State) :: o2x_o ! Ocn export, ocn grid and decomp - defined in ocn gc type(ESMF_State) :: o2x_a ! Ocn export, atm grid and decomp - defined at top level type(ESMF_State) :: o2x_i ! Ocn export, ice grid and decomp - defined at top level type(ESMF_State) :: i2x_i ! Ice export, ice grid and decomp - defined in ice gc type(ESMF_State) :: i2x_a ! Ice export, atm grid and decomp - defined at top level type(ESMF_State) :: i2x_o ! Ice export, ocn grid and decomp - defined at top level type(ESMF_State) :: x2a_a ! Atm import, atm grid and decomp - defined in atm gc type(ESMF_State) :: x2o_o ! Ocn import, ocn grid and decomp - defined in ocn gc type(ESMF_State) :: x2i_i ! Ice import, ice grid and decomp - defined in ice gc type(ESMF_State) :: x2l_l ! Lnd import, lnd grid and decomp - defined in lnd gc type(ESMF_GridComp) :: gc_atm ! Atmosphere gridded component type(ESMF_GridComp) :: gc_lnd ! Land gridded component type(ESMF_GridComp) :: gc_ocn ! Ocean gridded component type(ESMF_GridComp) :: gc_ice ! Sea-ice gridded component type(ESMF_GridComp) :: gc_mrg_x2l ! Land import state merge/preparer gridded component type(ESMF_GridComp) :: gc_mrg_x2a ! Atmosphere import state merge/preparer gridded component type(ESMF_GridComp) :: gc_mrg_x2o ! Ocean import state merge/preparer gridded component type(ESMF_GridComp) :: gc_mrg_x2i ! Sea-ice import state merge/preparer gridded component type(ESMF_CplComp) :: cc_map_a2i ! Atmosphere to ice coupler component type(ESMF_CplComp) :: cc_map_i2a ! Ice to atmosphere coupler component type(ESMF_CplComp) :: cc_map_a2l ! Atmosphere to Land coupler component type(ESMF_CplComp) :: cc_map_l2a ! Land to atmosphere coupler component type(ESMF_CplComp) :: cc_map_a2o ! Atmosphere to Ocean coupler component type(ESMF_CplComp) :: cc_map_o2a ! Ocean to atmosphere coupler component type(ESMF_CplComp) :: cc_map_o2i ! Ocean to sea-ice coupler component type(ESMF_CplComp) :: cc_map_i2o ! Sea-Ice to ocean coupler component type(ESMF_VM) :: vm ! ESMF virtual machine type(ESMF_Alarm) :: restart ! Restart alarm associated with clock type(ESMF_Alarm) :: atm_alarm ! Alarm of when to run atmosphere model type(ESMF_Alarm) :: ice_alarm ! Alarm of when to run sea-ice model type(ESMF_Alarm) :: ocn_alarm ! Alarm of when to run ocean model type(ESMF_Alarm) :: lnd_alarm ! Alarm of when to run land model type(shr_timemgr_ClockType) :: SyncClock ! CCSM clock type(shr_timemgr_ClockInfoType):: TimeMgrInfo ! CCSM time-management information type(shr_timemgr_ClockSetupType):: ClockSetup ! CCSM time-management setup information integer :: petid ! ID of this processor logical :: masterproc ! Whether this is the master processor (petid == 1) integer :: mpicom = 1 ! MPI communicator character(len=256) :: rest_file ! Driver restart-filename (NetCDF format) character(len=), parameter :: nlfilename = seq_ccsm.namelist ! Driver namelist filename ! ! Initialization ! call ESMF_Initialize() call seq_ccsm_esmfinit() ! ! Time loop ! do while( .not. ESMF_ClockIsStopTime( ESyncClock ) ) ! ! Averaging rules components are responsible for any averaging done on within ! their coupling interval. Merger will average atmosphere fields for surface components ! and put the average on the given surface component import state. Merger will also average ! surface data to the atmosphere model coupling interval and put it on the atm import ! state ! 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 if ( shr_inputinfo_RunModel( initinfo, lnd ) .and. ESMF_AlarmIsRinging( lnd_alarm ) )then ! Note: cs_l is the composite state pointing to: a2x_l call ESMF_GridCompRun ( gc_mrg_x2l, import=cs_l, export=x2l_l, rc=rc ) call ESMF_GridCompRun( gc_lnd, import=x2l_l, export=l2x_l, ESyncClock, phase=1 ) call ESMF_GridCompRun( gc_lnd, phase=2 ) call ESMF_CplCompRun ( cc_map_l2a, import=l2x_l, export=l2x_a, rc=rc ) call ESMF_AlarmRingerOff( lnd_alarm ) end if if ( shr_inputinfo_RunModel( initinfo, ice ) .and. ESMF_AlarmIsRinging( ice_alarm ) )then ! Note: cs_i is the composite state pointing to: a2x_i, o2i_i call ESMF_GridCompRun ( gc_mrg_x2i, import=cs_i, export=x2i_i, rc=rc ) call ESMF_GridCompRun( gc_ice, import=x2i_i, export=i2x_i, ESyncClock, phase=1 ) call ESMF_GridCompRun( gc_ice, phase=2 ) call ESMF_CplCompRun ( cc_map_i2a, import=i2x_i, export=i2x_a, rc=rc ) call ESMF_CplCompRun ( cc_map_i2o, import=i2o_i, export=i2o_o, rc=rc ) call ESMF_AlarmRingerOff( ice_alarm ) end if if ( shr_inputinfo_RunModel( initinfo, ocn ) .and. ESMF_AlarmIsRinging( ocn_alarm ) )then ! Note: cs_o is the composite state pointing to: i2o_o and a2x_o call ESMF_GridCompRun ( gc_mrg_x2o, import=cs_o, export=x2o_o, rc=rc ) call ESMF_GridCompRun( gc_ocn, import=x2o_o, export=o2x_o, ESyncClock, phase=1 ) call ESMF_CplCompRun( cc_map_o2a, import=o2x_o, export=o2x_a, rc=rc) call ESMF_CplCompRun ( cc_map_o2i, import=o2x_o, export=o2x_i, rc=rc ) call ESMF_AlarmRingerOff( ocn_alarm ) end if 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 ! Advance the clock call ESMF_AdvanceClock( ESyncClock ) ! Write restart information out if ( ESMF_AlarmIsRinging( restart ) )then call shr_inputinfo_WriteRPointer( ymd, tod, mpicom, masterproc, initinfo, rest_file ) call shr_inputinfo_WriteRestart( rest_file, mpicom, masterproc, initinfo ) call shr_timemgr_WriteRestart( rest_file, mpicom, masterproc, SyncClock ) call ESMF_AlarmRingerOff( restart ) end if end do ! ! Finalization ! call ESMF_GridCompFinalize( gc_atm ) call ESMF_GridCompFinalize( gc_lnd ) call ESMF_GridCompFinalize( gc_ice ) call ESMF_GridCompFinalize( gc_ocn, ) call ESMF_GridCompFinalize( gc_mrg_x2a ) call ESMF_GridCompFinalize( gc_mrg_x2i ) call ESMF_GridCompFinalize( gc_mrg_x2l ) call ESMF_GridCompFinalize( gc_mrg_x2o ) call ESMF_CplCompFinalize( cc_map_a2i ) call ESMF_CplCompFinalize( cc_map_a2l ) call ESMF_CplCompFinalize( cc_map_a2o ) call ESMF_CplCompFinalize( cc_map_o2i ) !Destroy all import/export states call shr_inputinfo_WriteRPointer( ymd, tod, mpicom, masterproc, initinfo, rest_file ) call shr_inputinfo_WriteRestart( rest_file, mpicom, masterproc, initinfo ) call shr_timemgr_WriteRestart( rest_file, mpicom, masterproc, SyncClock ) call ESMF_Finalize contains subroutine seq_ccsmInit( ESyncClock, initinfo, TimeMgrInfo ) type(ESMF_Clock), intent(in) :: ESyncClock type(initinfo_t), intent(in) :: initinfo type(TimeMgrInfo_t), intent(in) :: TimeMgrInfo ! ! Clock rules: clocks sent to components are used read-only, information can be read ! from them, but not added. Each component has it s own internal clock ! call ESMF_VMGetGlobal( vm ) call ESMF_VMGet( vm, localpet=petid, mpicommunicator=mpicom ) masterproc = (petid == 1) call seq_ccsm_esmfPrintLogHeader() ! Read namelist on masterproc and MPI broadcast to all MPI tasks (if MPI) call shr_inputinfo_SetDefaults( initinfo ) call shr_inputinfo_ReadNL( nlfilename, initinfo, logprint=masterproc, & mastertask=masterproc, & mpicom=mpicom ) call shr_inputinfo_Get( initinfo, perpetual_run=perpetual_run, & perpetual_ymd=perpetual_ymd ) call shr_timemgr_SetDefaults( ClockSetup, perpetual_run, perpetual_ymd ) call shr_timemgr_ReadNL( nlfilename, ClockSetup, logprint=masterproc, & mastertask=masterproc, & mpicom=mpicom ) if ( shr_inputinfo_isRestart( initinfo ) )then call shr_inputinfo_ReadRPointer( mpicom, masterproc, initinfo, rest_file ) call shr_inputinfo_ReadRestart( rest_file, mpicom, masterproc, initinfo ) call shr_timemgr_ReadRestart( rest_file, SyncClock, & mpicom=mpicom, mastertask=masterproc, setup=ClockSetup ) else call shr_timemgr_SetupClock( ClockSetup, log_print=masterproc, clock_out=SyncClock ) end if call shr_timemgr_Get( SyncClock, e_clock=ESyncClock, info=TimeMgrInfo ) ! Create import/export states of all components cs_a = ESMF_StateCreate( type//"Atm composite state from each component on atm grid", rc ) cs_l = ESMF_StateCreate( type//"Lnd composite state from each component on land grid", rc ) cs_i = ESMF_StateCreate( type//"Ice composite state from each component on ice grid", rc ) cs_o = ESMF_StateCreate( type//"Ocn composite state from each component on ocean grid", rc ) a2x_a = ESMF_StateCreate( type//"Atm export on atmosphere grid/decomp export", rc ) a2x_l = ESMF_StateCreate( type//"Atm export on land grid/decomp export", rc ) a2x_i = ESMF_StateCreate( type//"Atm export on ice grid/decomp export", rc ) a2x_o = ESMF_StateCreate( type//"Atm export on ocean grid/decomp export", rc ) l2x_l = ESMF_StateCreate( type//"Lnd export on land grid/decomp export", rc ) l2x_a = ESMF_StateCreate( type//"Lnd export on atmosphere grid/decomp export", rc ) o2x_o = ESMF_StateCreate( type//"Ocn export on ocean grid/decomp export", rc ) o2x_a = ESMF_StateCreate( type//"Ocn export on atmosphere grid/decomp export", rc ) o2x_i = ESMF_StateCreate( type//"Ocn export on ice grid/decomp export", rc ) i2x_i = ESMF_StateCreate( type//"Ice export on ice grid/decomp export", rc ) i2x_a = ESMF_StateCreate( type//"Ice export on atmosphere grid/decomp export", rc ) i2x_o = ESMF_StateCreate( type//"Ice export on ocean grid/decomp export", rc ) x2a_a = ESMF_StateCreate( type//"All model output on atmosphere grid/decomp -- import to atm", rc ) x2l_o = ESMF_StateCreate( type//"All model output on ocean grid/decomp -- import to land", rc ) x2o_o = ESMF_StateCreate( type//"All model output on ocean grid/decomp -- import to ocean", rc ) x2i_i = ESMF_StateCreate( type//"All model output on ice grid/decomp -- import to ocean", rc ) ! ! Create the composite states by adding nested states to composite states ! These are pointers to the nested states, and as such when the nested states ! are updated the composite states are updated as well. ! ! Atmosphere composite state call ESMF_StateAddState(cs_a, o2x_a, rc) call ESMF_StateAddState(cs_a, l2x_a, rc) call ESMF_StateAddState(cs_a, i2x_a, rc) ! Land composite state call ESMF_StateAddState(cs_l, a2x_l, rc) ! Ice composite state call ESMF_StateAddState(cs_i, o2x_i, rc) call ESMF_StateAddState(cs_i, a2x_i, rc) ! Ocean composite state call ESMF_StateAddState(cs_o, a2x_o, rc) call ESMF_StateAddState(cs_o, i2x_o, rc) ! Create components using global VM already gotten at high level gc_atm = ESMF_GridCompCreate(vm, name="Sequential CCSM atmosphere ESMF Gridded Component", & gridcomptype=ESMF_ATM, contextFlag=ESMF_CHILD_IN_PARENT_VM, rc=rc) call ESMF_GridCompSetServices(gc_atm, atm_comp_esmf_SetServices ) gc_lnd = ESMF_GridCompCreate(vm, name="Sequential CCSM land ESMF Gridded Component", & gridcomptype=ESMF_LAND, contextFlag=ESMF_CHILD_IN_PARENT_VM, rc=rc) call ESMF_GridCompSetServices(gc_lnd, lnd_comp_esmf_SetServices ) gc_ice = ESMF_GridCompCreate(vm, name="Sequential CCSM sea-ice ESMF Gridded Component", & gridcomptype=ESMF_SEAICE, contextFlag=ESMF_CHILD_IN_PARENT_VM, rc=rc) call ESMF_GridCompSetServices(gc_ice, ice_comp_esmf_SetServices ) gc_ocn = ESMF_GridCompCreate(vm, name="Sequential CCSM ocean ESMF Gridded Component", & gridcomptype=ESMF_OCEAN, contextFlag=ESMF_CHILD_IN_PARENT_VM, rc=rc) call ESMF_GridCompSetServices(gc_ocn, ocn_comp_esmf_SetServices ) gc_mrg_x2a = ESMF_GridCompCreate(vm, name="Sequential CCSM atmosphere merger ESMF Gridded Component", & contextFlag=ESMF_CHILD_IN_PARENT_VM, rc=rc) call ESMF_GridCompSetServices(gc_mrg_x2a, seq_esmf_mrg_x2a_SetServices ) gc_mrg_x2l = ESMF_GridCompCreate(vm, name="Sequential CCSM land merger ESMF Gridded Component", & contextFlag=ESMF_CHILD_IN_PARENT_VM, rc=rc) call ESMF_GridCompSetServices(gc_mrg_x2l, seq_esmf_mrg_x2l_SetServices ) gc_mrg_x2i = ESMF_GridCompCreate(vm, name="Sequential CCSM sea-ice merger ESMF Gridded Component", & contextFlag=ESMF_CHILD_IN_PARENT_VM, rc=rc) call ESMF_GridCompSetServices(gc_mrg_x2i, seq_esmf_mrg_x2i_SetServices ) gc_mrg_x2o = ESMF_GridCompCreate(vm, name="Sequential CCSM ocean merger ESMF Gridded Component", & contextFlag=ESMF_CHILD_IN_PARENT_VM, rc=rc) call ESMF_GridCompSetServices(gc_mrg_x2o, seq_esmf_mrg_x2o_SetServices ) cc_map_a2o = ESMF_CplCompCreate(vm, name="Sequential CCSM atmosphere to ocean ESMF Coupler Component", & contextFlag=ESMF_CHILD_IN_PARENT_VM, rc=rc) call ESMF_GridCompSetServices(cc_map_a2o, seq_esmf_map_SetServices ) cc_map_o2a = ESMF_CplCompCreate(vm, name="Sequential CCSM ocean to atmosphere ESMF Coupler Component", & contextFlag=ESMF_CHILD_IN_PARENT_VM, rc=rc) call ESMF_GridCompSetServices(cc_map_o2a, seq_esmf_map_SetServices ) cc_map_a2l = ESMF_CplCompCreate(vm, name="Sequential CCSM atmosphere to land ESMF Coupler Component", & contextFlag=ESMF_CHILD_IN_PARENT_VM, rc=rc) call ESMF_GridCompSetServices(cc_map_a2l, seq_esmf_map_SetServices ) cc_map_l2a = ESMF_CplCompCreate(vm, name="Sequential CCSM land to atmosphere ESMF Coupler Component", & contextFlag=ESMF_CHILD_IN_PARENT_VM, rc=rc) call ESMF_GridCompSetServices(cc_map_l2a, seq_esmf_map_SetServices ) cc_map_a2i = ESMF_CplCompCreate(vm, name="Sequential CCSM atmosphere to sea-ice ESMF Coupler Component", & contextFlag=ESMF_CHILD_IN_PARENT_VM, rc=rc) call ESMF_GridCompSetServices(cc_map_a2i, seq_esmf_map_SetServices ) cc_map_i2a = ESMF_CplCompCreate(vm, name="Sequential CCSM sea-ice to atmosphere ESMF Coupler Component", & contextFlag=ESMF_CHILD_IN_PARENT_VM, rc=rc) call ESMF_GridCompSetServices(cc_map_i2a, seq_esmf_map_SetServices ) cc_map_o2i = ESMF_CplCompCreate(vm, name="Sequential CCSM ocean to sea-ice ESMF Coupler Component", & contextFlag=ESMF_CHILD_IN_PARENT_VM, rc=rc) call ESMF_GridCompSetServices(cc_map_o2i, seq_esmf_map_SetServices ) cc_map_i2o = ESMF_CplCompCreate(vm, name="Sequential CCSM sea-ice to ocean ESMF Coupler Component", & contextFlag=ESMF_CHILD_IN_PARENT_VM, rc=rc) call ESMF_GridCompSetServices(cc_map_i2o, seq_esmf_map_SetServices ) ! Call phase-1 initialization for each component (Setup states for each component) ! Components will also read in namelists (and possibly configuration file information) ! And they use the ESyncClock to set their internal clocks start and stop time ! They can also populate their export state with data if appropriate. ! At this stage every component is indepenent of each other. Hence ! order of the following calls is not important. ! Note that x2a_a, x2l_l, x2i_i, x2o_o will only have array control information filled in ! The fields and grids for these states will be defined in the following calls ! Add ccsm_init_data to import state as state on each import state call eshr_inputinfo_Info2EState( initinfo, x2a_a ) call eshr_inputinfo_Info2EState( initinfo, x2l_l ) call eshr_inputinfo_Info2EState( initinfo, x2i_i ) call eshr_inputinfo_Info2EState( initinfo, x2o_o ) ! 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 ) call eshr_timemgr_Info2EState( TimeMgrInfo, x2l_l ) call eshr_timemgr_Info2EState( TimeMgrInfo, x2i_i ) call eshr_timemgr_Info2EState( TimeMgrInfo, x2o_o ) if ( shr_inputinfo_RunModel( initinfo, atm ) ) & call ESMF_GridCompInitialize( gc_atm, import=x2a_a, export=a2x_a, phase=1, clock=ESyncClock, rc=rc ) if ( shr_inputinfo_RunModel( initinfo, lnd ) ) & call ESMF_GridCompInitialize( gc_lnd, import=x2l_l, export=l2x_l, phase=1, clock=ESyncClock, rc=rc ) if ( shr_inputinfo_RunModel( initinfo, ice ) ) & call ESMF_GridCompInitialize( gc_ice, import=x2i_i, export=i2x_i, phase=1, clock=ESyncClock, rc=rc ) if ( shr_inputinfo_RunModel( initinfo, ocn ) ) & call ESMF_GridCompInitialize( gc_ocn, import=x2o_o, export=o2x_o, phase=1, clock=ESyncClock, rc=rc ) ! Fill the following states (using grid and information from the input states) ! fill in a2x_l ! (this will be a2x on the atm grid on the lnd decomposition) ! get fields from a2x_a and grid from x2l_l and create a new state call eshr_EState_Create(state=a2x_a, grid=x2l_l, out=a2x_l) ! fill in a2x_i ! (this will be a2x on the ocn grid on the ice decomposition) call eshr_EState_Create(state=a2x_a, grid=x2i_i, out=a2x_i) ! fill in a2x_o ! (this will be a2x on the ocn grid on the ocn decomposition) call eshr_EState_Create(state=a2x_a, grid=x2o_o, out=a2x_o) ! fill in l2x_a (this will be l2x on the atm grid and atm decomposition) call eshr_EState_Create( state=l2x_l, grid=x2a_a, out=l2x_a ) ! fill in o2x_a (this will be o2x on the atm grid and atm decomposition) call eshr_EState_Create( state=o2x_o, grid=x2a_a, out=o2x_a ) ! fill in o2x_i (this will be o2x on the ice grid and ice decomposition) call eshr_EState_Create( state=o2x_o, grid=x2i_i, out=o2x_i ) ! fill in i2x_a (this will be i2x on the atm grid and atm decomposition) call eshr_EState_Create( state=i2x_i, grid=x2a_a, out=i2x_a ) ! fill in i2x_o (this will be i2x on the ocn grid and ocn decomposition) call eshr_EState_Create( state=i2x_i, grid=x2o_o, out=i2x_o ) ! ! Initialize couplers - note that couplers don't need a sync clock ! call ESMF_CplCompInitialize( cc_map_a2l, import=a2x_a, export=a2x_l, rc=rc ) call ESMF_CplCompInitialize( cc_map_a2o, import=a2x_a, export=a2x_o, rc=rc ) call ESMF_CplCompInitialize( cc_map_a2i, import=a2x_a, export=a2x_i, rc=rc ) call ESMF_CplCompInitialize( cc_map_o2i, import=o2x_o, export=o2x_i, rc=rc ) ! ! 2nd phase of component initialization, fill export states with data, and use import data from couplers ! if ( shr_inputinfo_RunModel( initinfo, atm ) )then call ESMF_GridCompInitialize( gc_atm, import=x2a_a, export=a2x_a, phase=2, rc=rc ) else call eshr_EState_Zero( x2a_a ) call eshr_EState_Zero( a2x_a ) end if if ( shr_inputinfo_RunModel( initinfo, lnd ) )then call ESMF_GridCompInitialize( gc_lnd, import=x2l_l, export=l2x_l, phase=2, rc=rc ) else call eshr_EState_Zero( x2l_l ) call eshr_EState_Zero( l2x_l ) end if if ( shr_inputinfo_RunModel( initinfo, ice ) )then call ESMF_GridCompInitialize( gc_ice, import=x2i_i, export=i2x_i, phase=2, rc=rc ) else call eshr_EState_Zero( x2i_i ) call eshr_EState_Zero( i2x_i ) end if if ( shr_inputinfo_RunModel( initinfo, ocn ) )then call ESMF_GridCompInitialize( gc_ocn, import=x2o_o, export=o2x_o, phase=2, rc=rc ) else call eshr_EState_Zero( x2o_o ) call eshr_EState_Zero( o2x_o ) end if ! ! Couple back ! call ESMF_CplCompInitialize( cc_map_l2a, import=l2x_l, export=l2x_a, rc=rc ) call ESMF_CplCompInitialize( cc_map_o2a, import=o2x_o, export=o2x_a, rc=rc ) call ESMF_CplCompInitialize( cc_map_i2a, import=i2x_i, export=i2a_a, rc=rc ) call ESMF_CplCompInitialize( cc_map_i2o, import=i2x_i, export=i2x_o, rc=rc ) ! ! Run mergers to merge data ! if ( shr_inputinfo_RunModel( initinfo, atm ) ) & call ESMF_GridCompInitialize( gc_mrg_x2a, import=cs_a, export=x2a_a, rc=rc ) if ( shr_inputinfo_RunModel( initinfo, lnd ) ) & call ESMF_GridCompInitialize( gc_mrg_x2l, import=cs_l, export=x2l_l, rc=rc ) if ( shr_inputinfo_RunModel( initinfo, ice ) ) & call ESMF_GridCompInitialize( gc_mrg_x2i, import=cs_i, export=x2i_i, rc=rc ) if ( shr_inputinfo_RunModel( initinfo, ocn ) ) & call ESMF_GridCompInitialize( gc_mrg_x2o, import=cs_o, export=x2o_o, rc=rc ) call ESMF_ClockGetAlarm( ESyncClock, Restart alarm , restart ) ! Get restart alarm ! For Stage-2 you would also get alarms for each component (ocn,ice,lnd, and atm) ! The run method only calls components when their alarms are ringing call ESMF_ClockGetAlarm( ESyncClock, Atmosphere component alarm , atm_alarm ) call ESMF_ClockGetAlarm( ESyncClock, Land component alarm , lnd_alarm ) call ESMF_ClockGetAlarm( ESyncClock, Oean component alarm , ocn_alarm ) call ESMF_ClockGetAlarm( ESyncClock, Sea-ice component alarm , ice_alarm ) end subroutine seq_ccsm_esmfInit end program seq_ccsm_esmf