@@ -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.
@@ -136,6 +137,7 @@ module MOM_cap_mod
136137logical :: profile_memory = .true.
137138logical :: grid_attach_area = .false.
138139logical :: use_coldstart = .true.
140+ logical :: use_mommesh = .false.
139141character (len= 128 ) :: scalar_field_name = ' '
140142integer :: scalar_field_count = 0
141143integer :: scalar_field_idx_grid_nx = 0
@@ -148,7 +150,7 @@ module MOM_cap_mod
148150type (ESMF_GeomType_Flag) :: geomtype = ESMF_GEOMTYPE_MESH
149151#else
150152logical :: cesm_coupled = .false.
151- type (ESMF_GeomType_Flag) :: geomtype = ESMF_GEOMTYPE_GRID
153+ type (ESMF_GeomType_Flag) :: geomtype
152154#endif
153155character (len= 8 ) :: restart_mode = ' alarms'
154156
@@ -348,6 +350,25 @@ subroutine InitializeP0(gcomp, importState, exportState, clock, rc)
348350 write (logmsg,* ) use_coldstart
349351 call ESMF_LogWrite(' MOM_cap:use_coldstart = ' // trim (logmsg), ESMF_LOGMSG_INFO)
350352
353+ use_mommesh = .false.
354+ call NUOPC_CompAttributeGet(gcomp, name= " use_mommesh" , value= value, &
355+ isPresent= isPresent, isSet= isSet, rc= rc)
356+ if (ChkErr(rc,__LINE__,u_FILE_u)) return
357+ if (isPresent .and. isSet) use_mommesh= (trim (value)==" true" )
358+ write (logmsg,* ) use_mommesh
359+ call ESMF_LogWrite(' MOM_cap:use_mommesh = ' // trim (logmsg), ESMF_LOGMSG_INFO)
360+
361+ if (use_mommesh)then
362+ geomtype = ESMF_GEOMTYPE_MESH
363+ call NUOPC_CompAttributeGet(gcomp, name= ' mesh_ocn' , isPresent= isPresent, isSet= isSet, rc= rc)
364+ if (.not. isPresent .and. .not. isSet) then
365+ call ESMF_LogWrite(' geomtype set to mesh but mesh_ocn is not specified' , ESMF_LOGMSG_INFO)
366+ call ESMF_Finalize(endflag= ESMF_END_ABORT)
367+ endif
368+ else
369+ geomtype = ESMF_GEOMTYPE_GRID
370+ endif
371+
351372end subroutine
352373
353374! > Called by NUOPC to advertise import and export fields. "Advertise"
0 commit comments