Skip to content

Commit cdc7690

Browse files
authored
Merge pull request mom-ocean#54 from DeniseWorthen/feature/optmesh
Allow MOM6 to use a mesh optionally
2 parents d531a32 + a34ebb1 commit cdc7690

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.
@@ -135,6 +136,7 @@ module MOM_cap_mod
135136
logical :: profile_memory = .true.
136137
logical :: grid_attach_area = .false.
137138
logical :: use_coldstart = .true.
139+
logical :: use_mommesh = .false.
138140
character(len=128) :: scalar_field_name = ''
139141
integer :: scalar_field_count = 0
140142
integer :: scalar_field_idx_grid_nx = 0
@@ -147,7 +149,7 @@ module MOM_cap_mod
147149
type(ESMF_GeomType_Flag) :: geomtype = ESMF_GEOMTYPE_MESH
148150
#else
149151
logical :: cesm_coupled = .false.
150-
type(ESMF_GeomType_Flag) :: geomtype = ESMF_GEOMTYPE_GRID
152+
type(ESMF_GeomType_Flag) :: geomtype
151153
#endif
152154
character(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+
350371
end subroutine
351372

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

0 commit comments

Comments
 (0)