Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync develop into main #863

Merged
merged 16 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ subroutine SetServices ( GC, RC )
VLOCATION = MAPL_VLocationEdge, &
AVERAGING_INTERVAL = AVRGNINT, &
REFRESH_INTERVAL = RFRSHINT, &
RESTART = MAPL_RestartSkip, &
RC=STATUS )
VERIFY_(STATUS)

Expand All @@ -222,6 +223,7 @@ subroutine SetServices ( GC, RC )
VLOCATION = MAPL_VLocationEdge, &
AVERAGING_INTERVAL = AVRGNINT, &
REFRESH_INTERVAL = RFRSHINT, &
RESTART = MAPL_RestartSkip, &
RC=STATUS )
VERIFY_(STATUS)

Expand All @@ -233,6 +235,7 @@ subroutine SetServices ( GC, RC )
VLOCATION = MAPL_VLocationEdge, &
AVERAGING_INTERVAL = AVRGNINT, &
REFRESH_INTERVAL = RFRSHINT, &
RESTART = MAPL_RestartSkip, &
RC=STATUS )
VERIFY_(STATUS)

Expand Down Expand Up @@ -376,6 +379,7 @@ subroutine SetServices ( GC, RC )
VLOCATION = MAPL_VLocationCenter, &
AVERAGING_INTERVAL = AVRGNINT, &
REFRESH_INTERVAL = RFRSHINT, &
RESTART = MAPL_RestartSkip, &
RC=STATUS )
VERIFY_(STATUS)

Expand All @@ -387,6 +391,7 @@ subroutine SetServices ( GC, RC )
VLOCATION = MAPL_VLocationCenter, &
AVERAGING_INTERVAL = AVRGNINT, &
REFRESH_INTERVAL = RFRSHINT, &
RESTART = MAPL_RestartSkip, &
RC=STATUS )
VERIFY_(STATUS)

Expand All @@ -398,6 +403,7 @@ subroutine SetServices ( GC, RC )
VLOCATION = MAPL_VLocationCenter, &
AVERAGING_INTERVAL = AVRGNINT, &
REFRESH_INTERVAL = RFRSHINT, &
RESTART = MAPL_RestartSkip, &
RC=STATUS )
VERIFY_(STATUS)

Expand All @@ -409,6 +415,7 @@ subroutine SetServices ( GC, RC )
VLOCATION = MAPL_VLocationCenter, &
AVERAGING_INTERVAL = AVRGNINT, &
REFRESH_INTERVAL = RFRSHINT, &
RESTART = MAPL_RestartSkip, &
RC=STATUS )
VERIFY_(STATUS)

Expand Down Expand Up @@ -517,6 +524,7 @@ subroutine SetServices ( GC, RC )
SHORT_NAME = 'TAUOROX', &
LONG_NAME = 'surface_eastward_orographic_gravity_wave_stress', &
UNITS = 'N m-2', &
RESTART = MAPL_RestartSkip, &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, RC=STATUS )
VERIFY_(STATUS)
Expand All @@ -525,6 +533,7 @@ subroutine SetServices ( GC, RC )
SHORT_NAME = 'TAUOROY', &
LONG_NAME = 'surface_northward_orographic_gravity_wave_stress', &
UNITS = 'N m-2', &
RESTART = MAPL_RestartSkip, &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, RC=STATUS )
VERIFY_(STATUS)
Expand All @@ -534,6 +543,7 @@ subroutine SetServices ( GC, RC )
SHORT_NAME = 'OMEGA', &
LONG_NAME = 'vertical_pressure_velocity', &
UNITS = 'Pa s-1', &
RESTART = MAPL_RestartSkip, &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, RC=STATUS )
VERIFY_(STATUS)
Expand Down Expand Up @@ -570,6 +580,7 @@ subroutine SetServices ( GC, RC )
SHORT_NAME = 'DTDTDYN', &
LONG_NAME = 'tendency_of_air_temperature_due_to_dynamics', &
UNITS = 'K s-1', &
RESTART = MAPL_RestartSkip, &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, RC=STATUS )
VERIFY_(STATUS)
Expand All @@ -578,6 +589,7 @@ subroutine SetServices ( GC, RC )
SHORT_NAME = 'DQVDTDYN', &
LONG_NAME = 'tendency_of_specific_humidity_due_to_dynamics', &
UNITS = 'kg/kg/s', &
RESTART = MAPL_RestartSkip, &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, RC=STATUS )
VERIFY_(STATUS)
Expand All @@ -586,6 +598,7 @@ subroutine SetServices ( GC, RC )
SHORT_NAME = 'QV_DYN_IN', &
LONG_NAME = 'spec_humidity_at_begin_of_time_step', &
UNITS = 'kg kg-1', &
RESTART = MAPL_RestartSkip, &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, RC=STATUS )
VERIFY_(STATUS)
Expand All @@ -594,6 +607,7 @@ subroutine SetServices ( GC, RC )
SHORT_NAME = 'T_DYN_IN', &
LONG_NAME = 'temperature_at_begin_of_time_step', &
UNITS = 'K', &
RESTART = MAPL_RestartSkip, &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, RC=STATUS )
VERIFY_(STATUS)
Expand All @@ -602,6 +616,7 @@ subroutine SetServices ( GC, RC )
SHORT_NAME = 'U_DYN_IN', &
LONG_NAME = 'u_wind_at_begin_of_time_step', &
UNITS = 'm s-1', &
RESTART = MAPL_RestartSkip, &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, RC=STATUS )
VERIFY_(STATUS)
Expand All @@ -610,6 +625,7 @@ subroutine SetServices ( GC, RC )
SHORT_NAME = 'V_DYN_IN', &
LONG_NAME = 'v_wind_at_begin_of_time_step', &
UNITS = 'm s-1', &
RESTART = MAPL_RestartSkip, &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationCenter, RC=STATUS )
VERIFY_(STATUS)
Expand All @@ -618,6 +634,7 @@ subroutine SetServices ( GC, RC )
SHORT_NAME = 'PLE_DYN_IN', &
LONG_NAME = 'edge_pressure_at_begin_of_time_step', &
UNITS = 'Pa', &
RESTART = MAPL_RestartSkip, &
DIMS = MAPL_DimsHorzVert, &
VLOCATION = MAPL_VLocationEdge, RC=STATUS )
VERIFY_(STATUS)
Expand Down Expand Up @@ -711,6 +728,7 @@ subroutine SetServices ( GC, RC )
LONG_NAME = 'surface geopotential height', &
UNITS = 'm+2 s-2', &
SHORT_NAME = 'PHIS', &
RESTART = MAPL_RestartSkip, &
DIMS = MAPL_DimsHorzOnly, &
VLOCATION = MAPL_VLocationNone, &
RC=STATUS )
Expand Down Expand Up @@ -5830,7 +5848,7 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC )
if (associated(PTR3D)) PTR3D = QILS+QICN

call MAPL_GetPointer(EXPORT, PTR3D, 'QCTOT', RC=STATUS); VERIFY_(STATUS)
if (associated(PTR3D)) PTR3D = MIN(CLLS+CLCN,1.0)
if (associated(PTR3D)) PTR3D = QLLS+QLCN+QILS+QICN

! Cloud condensate exports
call MAPL_GetPointer(EXPORT, PTR3D, 'QLLSX1', RC=STATUS); VERIFY_(STATUS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def ask_questions(default_grid="Cubed-Sphere"):
"T3 -- Tripolar (MOM5-Tripolar-Ocean: $720x410$ )", \
"T4 -- Tripolar (MOM5-Tripolar-Ocean: $1440x1080$)", \
"T1MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $72x36$ )", \
"T3MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $580x458$ )", \
"T3MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $540x458$ )", \
"T4MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $1440x1080$)", \
"CS -- Cubed-Sphere Ocean (Cubed-Sphere Data-Ocean)"],
"when": lambda x: "Stretched_CS" == x['grid_type'] or "Cubed-Sphere" == x['grid_type'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_change_til_file(grid_type):
if( {TRIPOL_OCEAN} == True ) then
cat > sedfile << EOF
s/CF{NC}x6C/PE{nc}x{nc6}-CF/g
s/{OCEAN_VERSION}{DATENAME}{IMO}x{POLENAME}{JMO}-Pfafstetter/PE{imo}x{jmo}-{DATENAME}/g
s/{OCEAN_VERSION}{DATENAME}{IMO}x{POLENAME}{JMO}-Pfafstetter/PE{imo}x{jmo}-{OCEAN_VERSION}/g
EOF
sed -f sedfile {GRIDNAME}{RS}.til > tile.file
/bin/mv -f tile.file {GRIDNAME}{RS}.til
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module CICE_GEOSPlugMod
use CICE_FinalMod
use CICE_RunMod
use ice_import_export
use ice_record_mod


implicit none
Expand All @@ -33,6 +34,7 @@ module CICE_GEOSPlugMod

integer :: NUM_ICE_CATEGORIES
logical, private :: ice_grid_init2
logical, private :: running_regular_replay

contains

Expand Down Expand Up @@ -80,6 +82,7 @@ subroutine SetServices ( GC, RC )
Iam = trim(COMP_NAME) // Iam

ice_grid_init2 = .false.
running_regular_replay = .false.

call ESMF_ConfigGetAttribute(CF, NUM_ICE_CATEGORIES, Label="CICE_N_ICE_CATEGORIES:" , RC=STATUS)
VERIFY_(STATUS)
Expand All @@ -91,6 +94,7 @@ subroutine SetServices ( GC, RC )
call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN, Run, _RC)
call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_FINALIZE, Finalize, _RC)
call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_WRITERESTART, Record, _RC)
call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_READRESTART, Refresh, _RC)

! Set the state variable specs.
! -----------------------------
Expand Down Expand Up @@ -435,6 +439,7 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC )
integer :: OGCM_NX, OGCM_NY
integer :: BLK_NX, BLK_NY
integer :: counts(7)
character(len=ESMF_MAXSTR) :: ReplayMode

! Locals with ESMF and MAPL types

Expand Down Expand Up @@ -499,6 +504,7 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC )

call MAPL_GetResource(MAPL,DT_SEAICE, Label="RUN_DT:", _RC) ! Get AGCM Heartbeat
call MAPL_GetResource(MAPL,DT_SEAICE, Label="OCEAN_DT:", DEFAULT=DT_SEAICE, _RC) ! set Default OCEAN_DT to AGCM Heartbeat
call MAPL_GetResource(MAPL, ReplayMode, 'REPLAY_MODE:', default="NoReplay", _RC)

! Set the time for CICE
!---------------------
Expand Down Expand Up @@ -574,6 +580,10 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC )
!=====================================================================================


if(adjustl(ReplayMode)=="Regular") then
running_regular_replay = .true.
call alloc_record_state
endif

call MAPL_TimerOff(MAPL,"TOTAL" )

Expand Down Expand Up @@ -943,18 +953,15 @@ subroutine Record ( GC, IMPORT, EXPORT, CLOCK, RC )

call MAPL_GetObjectFromGC ( GC, MAPL, _RC)

! Profilers
!----------

call MAPL_TimerOn(MAPL,"TOTAL")

call MAPL_GenericRecord (GC, IMPORT, EXPORT, CLOCK, _RC)


doRecord = MAPL_RecordAlarmIsRinging(MAPL, MODE=MAPL_Write2Disk, _RC)

if (doRecord) then

! Get the private internal state
!--------------------------------


call MAPL_DateStampGet(clock, timeStamp, _RC)

Expand All @@ -965,11 +972,74 @@ subroutine Record ( GC, IMPORT, EXPORT, CLOCK, RC )

end if

doRecord = MAPL_RecordAlarmIsRinging(MAPL, MODE=MAPL_Write2Ram, _RC)

if (doRecord) then

! Save thermo states for replay corrector
!-----------------

call save_record_state

end if

call MAPL_TimerOff(MAPL,"TOTAL")
RETURN_(ESMF_SUCCESS)

end subroutine Record

! !IROUTINE: Refresh -- Refresh method (regular replay)

! !INTERFACE:

subroutine Refresh ( GC, IMPORT, EXPORT, CLOCK, RC )

! !ARGUMENTS:

type(ESMF_GridComp), intent(INOUT) :: GC ! Gridded component
type(ESMF_State), intent(INOUT) :: IMPORT ! Import state
type(ESMF_State), intent(INOUT) :: EXPORT ! Export state
type(ESMF_Clock), intent(INOUT) :: CLOCK ! The supervisor clock
integer, optional, intent( OUT) :: RC ! Error code

!EOP

type(MAPL_MetaComp), pointer :: MAPL

! ErrLog Variables

character(len=ESMF_MAXSTR) :: COMP_NAME

! Locals
character(len=14) :: timeStamp
logical :: doRecord

__Iam__('Restore')

! Get the target components name and set-up traceback handle.
! -----------------------------------------------------------

call ESMF_GridCompGet( GC, NAME=COMP_NAME, _RC)
Iam = trim(COMP_NAME)//'::'//Iam

! Get my internal MAPL_Generic state
!-----------------------------------

call MAPL_GetObjectFromGC ( GC, MAPL, _RC)

call MAPL_TimerOn(MAPL,"TOTAL")

! Restore thermo states for replay corrector
!-----------------

call restore_record_state


call MAPL_TimerOff(MAPL,"TOTAL")
RETURN_(ESMF_SUCCESS)

end subroutine Refresh

!====================================================================

! !IROUTINE: Finalize -- Finalize method for CICE wrapper
Expand Down Expand Up @@ -1077,6 +1147,9 @@ subroutine thermo_coupling(state, rc)
call ice_import_grid(FRO, rc=STATUS)
VERIFY_(STATUS)
call cice_init2
if (running_regular_replay) then
call save_record_state
endif
ice_grid_init2 = .TRUE.
endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ list( APPEND CICE6_SRCS
cicecore/drivers/mapl/geos/ice_import_export.F90
cicecore/drivers/mapl/geos/ice_shr_methods.F90
cicecore/drivers/mapl/geos/ice_prescribed_mod.F90
cicecore/drivers/mapl/geos/ice_record_mod.F90
)


Expand Down