diff --git a/.gitmodules b/.gitmodules index 769f63a796..e625fbe2b0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,7 +25,7 @@ [submodule "MOM6"] path = MOM6-interface/MOM6 url = https://github.com/NOAA-EMC/MOM6 - branch = dev/emc + branch = GFSV17 [submodule "CICE"] path = CICE-interface/CICE url = https://github.com/NOAA-EMC/CICE diff --git a/CDEPS-interface/ufs/cdeps_share/shr_is_restart_fh_mod.F90 b/CDEPS-interface/ufs/cdeps_share/shr_is_restart_fh_mod.F90 index 71a305f7ff..234040e0f1 100644 --- a/CDEPS-interface/ufs/cdeps_share/shr_is_restart_fh_mod.F90 +++ b/CDEPS-interface/ufs/cdeps_share/shr_is_restart_fh_mod.F90 @@ -122,49 +122,81 @@ end subroutine is_restart_fh !! !> @details Write a log file for a named component when a restart file is written !! - !! @param[in] nextTime the ESMF time at the end of a ModelAdvance - !! @param[in] startTime the ESMF time at the Model Start - !! @param[in] complog the named component + !! @param[in] nextTime the ESMF time at the end of a ModelAdvance + !! @param[in] startTime the ESMF time at the Model Start + !! @param[in] complog the named component + !! @param[in] prefixtime optional, if true log filename has time prefix + !! @param[in] lastrestart optional, if present, write the time of the last restart + !! @param[in] lastoutput optional, if present, write the filename written at this FH !! @param[out] rc return code !! !> @authorDenise.Worthen@noaa.gov !> @date 04-14-2025 - subroutine log_restart_fh(nextTime, startTime, complog, rc) + subroutine log_restart_fh(myTime, startTime, complog, prefixtime, lastrestart, lastoutput, rc) use ESMF, only : ESMF_SUCCESS, ESMF_MAXSTR, ESMF_Time, ESMF_TimeInterval use ESMF, only : ESMF_TimeGet, ESMF_TimeIntervalGet use ESMF, only : operator(==), operator(-) - type(ESMF_Time), intent(in) :: nextTime, startTime - character(len=*), intent(in) :: complog - integer, intent(out) :: rc + type(ESMF_Time), intent(in) :: myTime, startTime + character(len=*), intent(in) :: complog + logical, intent(in), optional :: prefixtime + type(ESMF_Time), intent(in), optional :: lastrestart + character(len=*), intent(in), optional :: lastoutput + integer, intent(out) :: rc ! local variables type(ESMF_TimeInterval) :: elapsedTime real(ESMF_KIND_R8) :: fhour character(ESMF_MAXSTR) :: filename character(ESMF_MAXSTR) :: nexttimestring + character(ESMF_MAXSTR) :: timestring integer :: fh_logunit integer :: yr,mon,day,hour,minute,sec ! time units + logical :: lprefix + character(ESMF_MAXSTR) :: lastout character(len=*), parameter :: subname='(log_restart_fh)' !----------------------------------------------------------------------- call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO) rc = ESMF_SUCCESS - elapsedTime = nextTime - startTime + lprefix = .false. + if (present(prefixtime)) then + lprefix = prefixtime + end if + lastout = '' + if (present(lastoutput)) then + lastout = trim(lastoutput) + end if + + elapsedTime = myTime - startTime call ESMF_TimeIntervalGet(elapsedTime, h_r8=fhour,rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - - call ESMF_TimeGet(nexttime, yy=yr, mm=mon, dd=day, h=hour, m=minute, s=sec, rc=rc) + call ESMF_TimeGet(myTime, yy=yr, mm=mon, dd=day, h=hour, m=minute, s=sec, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return write(nexttimestring,'(6i8)')yr,mon,day,hour,minute,sec + if (lprefix) then + write(filename,'(i4.4,2(i2.2),A,3(i2.2),A)') yr, mon, day,'.', hour, minute, sec,'.'//trim(complog) + else + write(filename,'(a,i4.4)')'log.'//trim(complog)//'.f',int(fhour) + end if + if (present(lastrestart)) then + call ESMF_TimeGet(lastrestart, yy=yr, mm=mon, dd=day, h=hour, m=minute, s=sec, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + write(timestring,'(6i8)')yr,mon,day,hour,minute,sec + end if - write(filename,'(a,i4.4)')'log.'//trim(complog)//'.f',int(fhour) open(newunit=fh_logunit,file=trim(filename)) write(fh_logunit,'(a)')'completed: '//trim(complog) write(fh_logunit,'(a,f10.3)')'forecast hour:',fhour write(fh_logunit,'(a)')'valid time: '//trim(nexttimestring) + if (len_trim(lastout) > 0) then + write(fh_logunit,'(a)')'last output: '//trim(lastout) + end if + if (present(lastrestart)) then + write(fh_logunit,'(a)')'last restart: '//trim(timestring) + end if close(fh_logunit) end subroutine log_restart_fh diff --git a/MOM6-interface/CMakeLists.txt b/MOM6-interface/CMakeLists.txt index 99c325392a..f02344848d 100644 --- a/MOM6-interface/CMakeLists.txt +++ b/MOM6-interface/CMakeLists.txt @@ -1,6 +1,7 @@ ### MOM6 Fortran compiler flags if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -fbacktrace") + list(APPEND CDEPS_SHARE_DEFS "CPRGNU") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fdefault-double-8") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Waliasing -fcray-pointer -fconvert=big-endian -ffree-line-length-none -fno-range-check -fbacktrace") set(CMAKE_Fortran_FLAGS_RELEASE "-O2") @@ -16,6 +17,7 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal -fp-model source") endif() set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -check all -check noarg_temp_created -check nopointer -fpe0 -ftrapuv -init=snan,arrays") + list(APPEND CDEPS_SHARE_DEFS "CPRINTEL") set(CMAKE_Fortran_LINK_FLAGS "") elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(IntelLLVM)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -traceback") @@ -28,6 +30,7 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(IntelLLVM)$") endif() set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -check all -check noarg_temp_created -check nopointer -fpe0 -ftrapuv -init=snan,arrays") set(CMAKE_Fortran_LINK_FLAGS "") + list(APPEND CDEPS_SHARE_DEFS "CPRINTEL") else() message(WARNING "Fortran compiler with ID ${CMAKE_Fortran_COMPILER_ID} will be used with CMake default options") endif() @@ -43,6 +46,9 @@ include("mom6_files.cmake") add_library(mom6_obj OBJECT ${mom6_src_files}) set_target_properties(mom6_obj PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) target_include_directories(mom6_obj PRIVATE $) +target_compile_definitions(mom6_obj PRIVATE ${CDEPS_SHARE_DEFS} "DISABLE_FoX") +target_include_directories(mom6_obj PRIVATE $) +add_dependencies(mom6_obj cdeps) if(REGIONAL_MOM6) target_include_directories(mom6_obj PRIVATE $ @@ -54,7 +60,8 @@ endif() target_link_libraries(mom6_obj PRIVATE fms ESMF::ESMF stochastic_physics - NetCDF::NetCDF_Fortran) + NetCDF::NetCDF_Fortran + cdeps::cdeps) # OpenMP is disabled in MOM6 #if(OpenMP_Fortran_FOUND) # target_link_libraries(mom6_obj PRIVATE OpenMP::OpenMP_Fortran) @@ -63,6 +70,8 @@ target_link_libraries(mom6_obj PRIVATE fms add_library(mom6_nuopc_obj OBJECT ${mom6_nuopc_src_files}) set_target_properties(mom6_nuopc_obj PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mod) target_include_directories(mom6_nuopc_obj PRIVATE $) +target_include_directories(mom6_nuopc_obj PRIVATE $) +add_dependencies(mom6_nuopc_obj cdeps) if(REGIONAL_MOM6) target_include_directories(mom6_nuopc_obj PRIVATE $ $) @@ -89,7 +98,8 @@ target_include_directories(mom6 PUBLIC $ OCN :remapMethod=redist + OCN + @@[coupling_interval_fast_sec] + MED med_phases_prep_atm + MED med_phases_prep_ice + MED med_phases_prep_wav_accum + MED med_phases_prep_wav_avg + MED med_phases_prep_lnd + MED -> ATM :remapMethod=redist + MED -> ICE :remapMethod=redist + MED -> WAV :remapMethod=redist + MED -> LND :remapMethod=redist + ATM + ICE + WAV + LND + ATM -> MED :remapMethod=redist + MED med_phases_post_atm + ICE -> MED :remapMethod=redist + MED med_phases_post_ice + WAV -> MED :remapMethod=redist + MED med_phases_post_wav + LND -> MED :remapMethod=redist + MED med_phases_post_lnd + MED med_phases_ocnalb_run + MED med_phases_prep_ocn_accum + @ + OCN -> MED :remapMethod=redist + MED med_phases_post_ocn + MED med_phases_restart_write +@ +:: + +# CMEPS variables + +DRIVER_attributes:: +:: + +MED_attributes:: + ATM_model = @[atm_model] + ICE_model = @[ice_model] + OCN_model = @[ocn_model] + WAV_model = @[wav_model] + LND_model = @[lnd_model] + coupling_mode = @[CPLMODE] + pio_typename = @[CMEPS_PIO_FORMAT] + pio_numiotasks = @[CMEPS_PIO_IOTASKS] + pio_stride = @[CMEPS_PIO_STRIDE] + pio_rearranger = @[CMEPS_PIO_REARR] + pio_root = @[CMEPS_PIO_ROOT] + ocean_albedo_limit = @[ocean_albedo_limit] + mapuv_with_cart3d = @[MAPUV3D] +:: + +ALLCOMP_attributes:: + ScalarFieldCount = 3 + ScalarFieldIdxGridNX = 1 + ScalarFieldIdxGridNY = 2 + ScalarFieldIdxGridNTile = 3 + ScalarFieldName = cpl_scalars + start_type = @[RUNTYPE] + restart_dir = @[CMEPS_RESTART_DIR] + case_name = ufs.cpld + restart_n = @[RESTART_N] + restart_option = nhours + restart_ymd = -999 + write_restart_at_endofrun = @[WRITE_ENDOFRUN_RESTART] + dbug_flag = @[cap_dbug_flag] + stop_n = @[FHMAX] + stop_option = nhours + stop_ymd = -999 + orb_eccen = 1.e36 + orb_iyear = 2000 + orb_iyear_align = 2000 + orb_mode = fixed_year + orb_mvelp = 1.e36 + orb_obliq = 1.e36 +:: diff --git a/tests/tests/cpld_control_gfsv17_iau b/tests/tests/cpld_control_gfsv17_iau index 865806a036..d614bd68a2 100644 --- a/tests/tests/cpld_control_gfsv17_iau +++ b/tests/tests/cpld_control_gfsv17_iau @@ -46,7 +46,7 @@ export LIST_FILES="sfcf024.nc \ RESTART/iced.2021-03-23-43200.nc \ RESTART/ufs.cpld.cpl.r.2021-03-23-43200.nc \ ufs.cpld.ww3.r.2021-03-23-43200.nc \ - MOM6_OUTPUT/ocn_2021_03_23_09.nc \ + MOM6_OUTPUT/ocn_2021_03_23_09_00.nc \ history/iceh_06h.2021-03-23-43200.nc \ 20210323.120000.out_pnt.ww3.nc \ 20210323.120000.out_grd.ww3 "