Skip to content

Commit a4c0411

Browse files
committed
Merge remote-tracking branch 'upstream/dev/emc' into ocn_stoch
2 parents 689a73f + cdc7690 commit a4c0411

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

config_src/nuopc_driver/mom_cap.F90

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ module MOM_cap_mod
7575
use ESMF, only: ESMF_AlarmCreate, ESMF_ClockGetAlarmList, ESMF_AlarmList_Flag
7676
use ESMF, only: ESMF_AlarmGet, ESMF_AlarmIsCreated, ESMF_ALARMLIST_ALL, ESMF_AlarmIsEnabled
7777
use ESMF, only: ESMF_STATEITEM_NOTFOUND, ESMF_FieldWrite
78+
use ESMF, only: ESMF_END_ABORT, ESMF_Finalize
7879
use 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
136137
logical :: profile_memory = .true.
137138
logical :: grid_attach_area = .false.
138139
logical :: use_coldstart = .true.
140+
logical :: use_mommesh = .false.
139141
character(len=128) :: scalar_field_name = ''
140142
integer :: scalar_field_count = 0
141143
integer :: scalar_field_idx_grid_nx = 0
@@ -148,7 +150,7 @@ module MOM_cap_mod
148150
type(ESMF_GeomType_Flag) :: geomtype = ESMF_GEOMTYPE_MESH
149151
#else
150152
logical :: cesm_coupled = .false.
151-
type(ESMF_GeomType_Flag) :: geomtype = ESMF_GEOMTYPE_GRID
153+
type(ESMF_GeomType_Flag) :: geomtype
152154
#endif
153155
character(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+
351372
end subroutine
352373

353374
!> Called by NUOPC to advertise import and export fields. "Advertise"

0 commit comments

Comments
 (0)