From 7671d3118d8408fb7987c6406e63b15d55797214 Mon Sep 17 00:00:00 2001 From: alperaltuntas Date: Fri, 3 May 2019 14:58:52 -0600 Subject: [PATCH] get calendar from CESM --- config_src/nuopc_driver/mom_cap.F90 | 31 ++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/config_src/nuopc_driver/mom_cap.F90 b/config_src/nuopc_driver/mom_cap.F90 index 9cf16c8a40..740e16cea2 100644 --- a/config_src/nuopc_driver/mom_cap.F90 +++ b/config_src/nuopc_driver/mom_cap.F90 @@ -754,6 +754,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) integer :: userRc character(len=512) :: restartfile ! Path/Name of restart file character(len=*), parameter :: subname='(mom_cap:InitializeAdvertise)' + character(len=32) :: calendar !-------------------------------- rc = ESMF_SUCCESS @@ -805,7 +806,35 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call fms_init(mpi_comm_mom) call constants_init call field_manager_init - call set_calendar_type (JULIAN) + + ! determine the calendar + if (cesm_coupled) then + call NUOPC_CompAttributeGet(gcomp, name="calendar", value=cvalue, & + isPresent=isPresent, isSet=isSet, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, & + line=__LINE__, & + file=__FILE__)) & + return ! bail out + if (isPresent .and. isSet) then + read(cvalue,*) calendar + select case (trim(calendar)) + case ("NO_LEAP") + call set_calendar_type (NOLEAP) + case ("GREGORIAN") + call set_calendar_type (GREGORIAN) + case default + call ESMF_LogSetError(ESMF_RC_ARG_BAD, & + msg=subname//": Calendar not supported in MOM6: "//trim(calendar), & + line=__LINE__, file=__FILE__, rcToReturn=rc) + end select + else + call set_calendar_type (NOLEAP) + endif + + else + call set_calendar_type (JULIAN) + endif + call diag_manager_init ! this ocean connector will be driven at set interval