@@ -75,6 +75,7 @@ module MOM_cap_mod
7575use ESMF, only: ESMF_AlarmCreate, ESMF_ClockGetAlarmList, ESMF_AlarmList_Flag
7676use ESMF, only: ESMF_AlarmGet, ESMF_AlarmIsCreated, ESMF_ALARMLIST_ALL, ESMF_AlarmIsEnabled
7777use ESMF, only: ESMF_STATEITEM_NOTFOUND, ESMF_FieldWrite
78+ use ESMF, only: ESMF_END_ABORT, ESMF_Finalize
7879use ESMF, only: operator (==), operator (/= ), operator (+ ), operator (- )
7980
8081! TODO ESMF_GridCompGetInternalState does not have an explicit Fortran interface.
@@ -135,6 +136,7 @@ module MOM_cap_mod
135136logical :: profile_memory = .true.
136137logical :: grid_attach_area = .false.
137138logical :: use_coldstart = .true.
139+ logical :: use_mommesh = .false.
138140character (len= 128 ) :: scalar_field_name = ' '
139141integer :: scalar_field_count = 0
140142integer :: scalar_field_idx_grid_nx = 0
@@ -147,7 +149,7 @@ module MOM_cap_mod
147149type (ESMF_GeomType_Flag) :: geomtype = ESMF_GEOMTYPE_MESH
148150#else
149151logical :: cesm_coupled = .false.
150- type (ESMF_GeomType_Flag) :: geomtype = ESMF_GEOMTYPE_GRID
152+ type (ESMF_GeomType_Flag) :: geomtype
151153#endif
152154character (len= 8 ) :: restart_mode = ' alarms'
153155
@@ -347,6 +349,25 @@ subroutine InitializeP0(gcomp, importState, exportState, clock, rc)
347349 write (logmsg,* ) use_coldstart
348350 call ESMF_LogWrite(' MOM_cap:use_coldstart = ' // trim (logmsg), ESMF_LOGMSG_INFO)
349351
352+ use_mommesh = .false.
353+ call NUOPC_CompAttributeGet(gcomp, name= " use_mommesh" , value= value, &
354+ isPresent= isPresent, isSet= isSet, rc= rc)
355+ if (ChkErr(rc,__LINE__,u_FILE_u)) return
356+ if (isPresent .and. isSet) use_mommesh= (trim (value)==" true" )
357+ write (logmsg,* ) use_mommesh
358+ call ESMF_LogWrite(' MOM_cap:use_mommesh = ' // trim (logmsg), ESMF_LOGMSG_INFO)
359+
360+ if (use_mommesh)then
361+ geomtype = ESMF_GEOMTYPE_MESH
362+ call NUOPC_CompAttributeGet(gcomp, name= ' mesh_ocn' , isPresent= isPresent, isSet= isSet, rc= rc)
363+ if (.not. isPresent .and. .not. isSet) then
364+ call ESMF_LogWrite(' geomtype set to mesh but mesh_ocn is not specified' , ESMF_LOGMSG_INFO)
365+ call ESMF_Finalize(endflag= ESMF_END_ABORT)
366+ endif
367+ else
368+ geomtype = ESMF_GEOMTYPE_GRID
369+ endif
370+
350371end subroutine
351372
352373! > Called by NUOPC to advertise import and export fields. "Advertise"
0 commit comments