@@ -123,6 +123,7 @@ module MOM_cap_mod
123123integer :: export_slice = 1
124124character (len= 256 ) :: tmpstr
125125logical :: write_diagnostics = .false.
126+ logical :: overwrite_timeslice = .false.
126127character (len= 32 ) :: runtype ! < run type
127128integer :: logunit ! < stdout logging unit number
128129logical :: profile_memory = .true.
@@ -278,6 +279,21 @@ subroutine InitializeP0(gcomp, importState, exportState, clock, rc)
278279 file= __FILE__)) &
279280 return
280281
282+ overwrite_timeslice = .false.
283+ call NUOPC_CompAttributeGet(gcomp, name= " OverwriteSlice" , value= value, &
284+ isPresent= isPresent, isSet= isSet, rc= rc)
285+ if (ESMF_LogFoundError(rcToCheck= rc, msg= ESMF_LOGERR_PASSTHRU, &
286+ line= __LINE__, &
287+ file= __FILE__)) &
288+ return
289+ if (isPresent .and. isSet) overwrite_timeslice= (trim (value)==" true" )
290+ write (logmsg,* ) overwrite_timeslice
291+ call ESMF_LogWrite(' MOM_cap:OverwriteSlice = ' // trim (logmsg), ESMF_LOGMSG_INFO, rc= rc)
292+ if (ESMF_LogFoundError(rcToCheck= rc, msg= ESMF_LOGERR_PASSTHRU, &
293+ line= __LINE__, &
294+ file= __FILE__)) &
295+ return
296+
281297 profile_memory = .false.
282298 call NUOPC_CompAttributeGet(gcomp, name= " ProfileMemory" , value= value, &
283299 isPresent= isPresent, isSet= isSet, rc= rc)
@@ -741,7 +757,13 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
741757 file= __FILE__)) &
742758 return ! bail out
743759
760+ if (len_trim (scalar_field_name) > 0 ) then
761+ call fld_list_add(fldsToOcn_num, fldsToOcn, trim (scalar_field_name), " will_provide" )
762+ call fld_list_add(fldsFrOcn_num, fldsFrOcn, trim (scalar_field_name), " will_provide" )
763+ end if
764+
744765 if (cesm_coupled) then
766+ ! TODO: check if still needed
745767 if (len_trim (scalar_field_name) > 0 ) then
746768 call fld_list_add(fldsToOcn_num, fldsToOcn, trim (scalar_field_name), " will_provide" )
747769 call fld_list_add(fldsFrOcn_num, fldsFrOcn, trim (scalar_field_name), " will_provide" )
@@ -1488,13 +1510,11 @@ subroutine DataInitialize(gcomp, rc)
14881510 ocean_state = > ocean_internalstate% ptr% ocean_state_type_ptr
14891511 call get_ocean_grid(ocean_state, ocean_grid)
14901512
1491- if (cesm_coupled) then
1492- call mom_export(ocean_public, ocean_grid, ocean_state, exportState, clock, rc= rc)
1493- if (ESMF_LogFoundError(rcToCheck= rc, msg= ESMF_LOGERR_PASSTHRU, &
1494- line= __LINE__, &
1495- file= __FILE__)) &
1496- return ! bail out
1497- endif
1513+ call mom_export(ocean_public, ocean_grid, ocean_state, exportState, clock, rc= rc)
1514+ if (ESMF_LogFoundError(rcToCheck= rc, msg= ESMF_LOGERR_PASSTHRU, &
1515+ line= __LINE__, &
1516+ file= __FILE__)) &
1517+ return ! bail out
14981518
14991519 call ESMF_StateGet(exportState, itemCount= fieldCount, rc= rc)
15001520 if (ESMF_LogFoundError(rcToCheck= rc, msg= ESMF_LOGERR_PASSTHRU, &
@@ -1537,7 +1557,7 @@ subroutine DataInitialize(gcomp, rc)
15371557
15381558 if (write_diagnostics) then
15391559 call NUOPC_Write(exportState, fileNamePrefix= ' field_init_ocn_export_' , &
1540- timeslice= import_slice, relaxedFlag= .true. , rc= rc)
1560+ overwrite = overwrite_timeslice, timeslice= import_slice, relaxedFlag= .true. , rc= rc)
15411561 if (ESMF_LogFoundError(rcToCheck= rc, msg= ESMF_LOGERR_PASSTHRU, &
15421562 line= __LINE__, &
15431563 file= __FILE__)) &
@@ -1691,7 +1711,7 @@ subroutine ModelAdvance(gcomp, rc)
16911711
16921712 if (write_diagnostics) then
16931713 call NUOPC_Write(importState, fileNamePrefix= ' field_ocn_import_' , &
1694- timeslice= import_slice, relaxedFlag= .true. , rc= rc)
1714+ overwrite = overwrite_timeslice, timeslice= import_slice, relaxedFlag= .true. , rc= rc)
16951715 if (ESMF_LogFoundError(rcToCheck= rc, msg= ESMF_LOGERR_PASSTHRU, &
16961716 line= __LINE__, &
16971717 file= __FILE__)) &
@@ -1847,7 +1867,7 @@ subroutine ModelAdvance(gcomp, rc)
18471867
18481868 if (write_diagnostics) then
18491869 call NUOPC_Write(exportState, fileNamePrefix= ' field_ocn_export_' , &
1850- timeslice= export_slice, relaxedFlag= .true. , rc= rc)
1870+ overwrite = overwrite_timeslice, timeslice= export_slice, relaxedFlag= .true. , rc= rc)
18511871 if (ESMF_LogFoundError(rcToCheck= rc, msg= ESMF_LOGERR_PASSTHRU, &
18521872 line= __LINE__, &
18531873 file= __FILE__)) &
0 commit comments