Skip to content

Commit

Permalink
Merge branch 'develop' into feature/mods4coastalapp
Browse files Browse the repository at this point in the history
  • Loading branch information
DeniseWorthen committed Dec 12, 2024
2 parents c31603f + 30b6967 commit b42472c
Show file tree
Hide file tree
Showing 56 changed files with 5,125 additions and 3,514 deletions.
1 change: 1 addition & 0 deletions CDEPS-interface/cdeps_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ list(APPEND ufs_cdeps_share_files
ufs/cdeps_share/shr_assert_mod.F90
ufs/cdeps_share/shr_frz_mod.F90
ufs/cdeps_share/shr_infnan_mod.F90
ufs/cdeps_share/shr_is_restart_fh_mod.F90
)

list(APPEND cdeps_share_files
Expand Down
137 changes: 137 additions & 0 deletions CDEPS-interface/ufs/cdeps_share/shr_is_restart_fh_mod.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
module shr_is_restart_fh_mod

! Common methods for components to check if it's time to write forecast hour-based restarts

!use dshr_methods_mod , only : chkerr
use ESMF, only : ESMF_ConfigCreate, ESMF_ConfigDestroy, ESMF_ConfigLoadFile, &
ESMF_ConfigGetLen, ESMF_ConfigGetAttribute, ESMF_TimePrint, &
ESMF_LOGMSG_INFO, ESMF_LogWrite, ESMF_TimeInterval, &
ESMF_Time, ESMF_KIND_R8, ESMF_Config, ESMF_Clock, &
ESMF_TimeIntervalSet, ESMF_TimePrint, operator(+), operator(==), &
ESMF_LogFoundError, ESMF_LOGERR_PASSTHRU

implicit none
private

type :: is_restart_fh_type
logical :: write_restartfh = .false.
type(ESMF_Time), allocatable :: restartFhTimes(:)
end type is_restart_fh_type

public :: init_is_restart_fh, is_restart_fh, finalize_restart_fh, is_restart_fh_type

contains

!-----------------------------------------------------------------------
subroutine init_is_restart_fh(currentTime, dtime, lLog, restartfh_info)
!
! !DESCRIPTION:
! Process restart_fh attribute from model_configure in UFS
!
! !USES:
!
! !ARGUMENTS:
type(ESMF_Time), intent(in) :: currentTime
integer, intent(in) :: dtime ! time step (s)
logical, intent(in) :: lLog ! If true, this task logs restart_fh info
type(is_restart_fh_type), intent(out) :: restartfh_info !restart_fh info for each task
!
! !LOCAL VARIABLES:
character(len=256) :: timestr
integer :: n, nfh, fh_s, rc
logical :: isPresent
real(kind=ESMF_KIND_R8), allocatable :: restart_fh(:)
type(ESMF_TimeInterval) :: fhInterval
type(ESMF_Config) :: CF_mc
!-----------------------------------------------------------------------

! set up Times to write non-interval restarts
inquire(FILE='model_configure', EXIST=isPresent)
if (isPresent) then !model_configure exists. this is ufs run
CF_mc = ESMF_ConfigCreate(rc=rc)
call ESMF_ConfigLoadFile(config=CF_mc,filename='model_configure' ,rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

nfh = ESMF_ConfigGetLen(config=CF_mc, label ='restart_fh:',rc=rc)
if (nfh .gt. 0) then
allocate(restart_fh(1:nfh))
allocate(restartfh_info%restartFhTimes(1:nfh)) !not deallocated here

call ESMF_ConfigGetAttribute(CF_mc,valueList=restart_fh,label='restart_fh:', rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
! create a list of times at each restart_fh
do n = 1,nfh
fh_s = NINT(3600*restart_fh(n))
call ESMF_TimeIntervalSet(fhInterval, s=fh_s, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
restartfh_info%restartFhTimes(n) = currentTime + fhInterval
call ESMF_TimePrint(restartfh_info%restartFhTimes(n), options="string", &
preString="restart_fh at ", unit=timestr, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
if (lLog) then
if (mod(fh_s,dtime) /= 0) then
call ESMF_LogWrite('restart time NOT to be written for '//trim(timestr), ESMF_LOGMSG_INFO)
else
call ESMF_LogWrite('restart time to be written for '//trim(timestr), ESMF_LOGMSG_INFO)
end if
end if
end do
deallocate(restart_fh)
end if !nfh>0
call ESMF_ConfigDestroy(CF_mc, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
end if !model_configure

end subroutine init_is_restart_fh

subroutine is_restart_fh(clock, restartfh_info, lWrite)
!
! !DESCRIPTION:
! True/false if time to write restart
!
! !USES:
use ESMF, only : ESMF_ClockGetNextTime

!
! !ARGUMENTS:
type(ESMF_Clock), intent(in) :: clock
type(is_restart_fh_type), intent(inout) :: restartfh_info
logical, intent(out) :: lWrite ! time to write?
!
! !LOCAL VARIABLES:
integer :: nfh, rc
type(ESMF_Time) :: nextTime
!-----------------------------------------------------------------------

restartfh_info%write_restartfh = .false.
if (allocated(restartfh_info%restartFhTimes)) then
! check if next time is == to any restartfhtime
do nfh = 1,size(restartfh_info%restartFhTimes)
call ESMF_ClockGetNextTime(clock, nextTime=nexttime, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
if (nextTime == restartfh_info%restartFhTimes(nfh)) restartfh_info%write_restartfh = .true.
end do
end if

lWrite = restartfh_info%write_restartfh

end subroutine is_restart_fh

subroutine finalize_restart_fh(restartfh_info)
!
! !DESCRIPTION:
! Clean-up...release allocated memory
!
! !USES:
!
! !ARGUMENTS:
type(is_restart_fh_type), intent(inout) :: restartfh_info
!
! !LOCAL VARIABLES:
!-----------------------------------------------------------------------

if (allocated(restartfh_info%restartFhTimes)) deallocate(restartfh_info%restartFhTimes)

end subroutine finalize_restart_fh

end module shr_is_restart_fh_mod
2 changes: 1 addition & 1 deletion CICE-interface/CICE
Submodule CICE updated 36 files
+2 −4 cicecore/cicedyn/general/ice_flux.F90
+0 −2 cicecore/cicedyn/general/ice_forcing.F90
+18 −8 cicecore/cicedyn/general/ice_init.F90
+12 −17 cicecore/cicedyn/general/ice_step_mod.F90
+1 −2 cicecore/cicedyn/infrastructure/ice_domain.F90
+142 −192 cicecore/cicedyn/infrastructure/ice_grid.F90
+49 −106 cicecore/cicedyn/infrastructure/ice_read_write.F90
+1 −1 cicecore/cicedyn/infrastructure/io/io_netcdf/ice_restart.F90
+6 −0 cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90
+22 −0 cicecore/cicedyn/infrastructure/io/io_pio2/ice_pio.F90
+13 −4 cicecore/cicedyn/infrastructure/io/io_pio2/ice_restart.F90
+10 −12 cicecore/drivers/mct/cesm1/CICE_InitMod.F90
+1 −3 cicecore/drivers/mct/cesm1/ice_prescribed_mod.F90
+4 −4 cicecore/drivers/nuopc/cmeps/CICE_InitMod.F90
+51 −32 cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90
+10 −1 cicecore/drivers/nuopc/cmeps/ice_shr_methods.F90
+4 −4 cicecore/drivers/nuopc/dmi/CICE_InitMod.F90
+4 −4 cicecore/drivers/standalone/cice/CICE_InitMod.F90
+4 −4 cicecore/drivers/unittest/gridavgchk/CICE_InitMod.F90
+4 −4 cicecore/drivers/unittest/halochk/CICE_InitMod.F90
+4 −4 cicecore/drivers/unittest/opticep/CICE_InitMod.F90
+1 −4 cicecore/drivers/unittest/opticep/ice_init_column.F90
+13 −18 cicecore/drivers/unittest/opticep/ice_step_mod.F90
+4 −4 cicecore/drivers/unittest/sumchk/CICE_InitMod.F90
+1 −4 cicecore/shared/ice_init_column.F90
+1 −1 cicecore/version.txt
+11 −0 configuration/scripts/cice.batch.csh
+0 −1 configuration/scripts/ice_in
+2 −2 configuration/scripts/machines/Macros.gadi_intel
+8 −0 configuration/scripts/options/set_nml.histhrly
+9 −13 configuration/scripts/tests/base_suite.ts
+3 −0 configuration/scripts/tests/io_suite.ts
+2 −2 doc/source/conf.py
+0 −1 doc/source/user_guide/ug_case_settings.rst
+17 −8 doc/source/user_guide/ug_implementation.rst
+1 −1 icepack
2 changes: 1 addition & 1 deletion CICE-interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ list(APPEND lib_src_files
${icepack_files}
${cice_mpi_comm_files}
${cice_nuopc_cmeps_driver_files}
${cice_cdeps_inline_files})
${cice_cdeps_share_files})

list(APPEND _cice_defs FORTRANUNDERSCORE
coupled)
Expand Down
7 changes: 5 additions & 2 deletions CICE-interface/cice_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ list(APPEND cice_nuopc_cmeps_driver_files
CICE/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90
)

#-- Using ice prescribed ifndef cesmcoupled
list(APPEND cice_cdeps_inline_files
list(APPEND cice_cdeps_share_files
#-- Using ice prescribed ifndef cesmcoupled
${PROJECT_SOURCE_DIR}/CDEPS-interface/CDEPS/share/shr_orb_mod.F90
${PROJECT_SOURCE_DIR}/CDEPS-interface/CDEPS/share/shr_const_mod.F90
${PROJECT_SOURCE_DIR}/CDEPS-interface/CDEPS/share/shr_abort_mod.F90
Expand All @@ -168,4 +168,7 @@ list(APPEND cice_cdeps_inline_files
${PROJECT_SOURCE_DIR}/CDEPS-interface/CDEPS/streams/dshr_stream_mod.F90
${PROJECT_SOURCE_DIR}/CDEPS-interface/CDEPS/streams/dshr_methods_mod.F90
${PROJECT_SOURCE_DIR}/CDEPS-interface/CDEPS/dshr/dshr_mod.F90

#restart_fh
${PROJECT_SOURCE_DIR}/CDEPS-interface/ufs/cdeps_share/shr_is_restart_fh_mod.F90
)
2 changes: 1 addition & 1 deletion CMEPS-interface/CMEPS
3 changes: 2 additions & 1 deletion CMEPS-interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ list(APPEND _ufs_util_files
${PROJECT_SOURCE_DIR}/CDEPS-interface/CDEPS/share/shr_sys_mod.F90
${PROJECT_SOURCE_DIR}/CDEPS-interface/CDEPS/share/shr_kind_mod.F90
${PROJECT_SOURCE_DIR}/CDEPS-interface/ufs/cdeps_share/shr_assert_mod.F90
${PROJECT_SOURCE_DIR}/CDEPS-interface/ufs/cdeps_share/shr_infnan_mod.F90)
${PROJECT_SOURCE_DIR}/CDEPS-interface/ufs/cdeps_share/shr_infnan_mod.F90
${PROJECT_SOURCE_DIR}/CDEPS-interface/ufs/cdeps_share/shr_is_restart_fh_mod.F90)

list(APPEND _mediator_files
CMEPS/mediator/med_phases_restart_mod.F90
Expand Down
2 changes: 1 addition & 1 deletion MOM6-interface/MOM6
4 changes: 4 additions & 0 deletions MOM6-interface/mom6_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ list(APPEND mom6_nuopc_src_files
MOM6/config_src/drivers/timing_tests/time_MOM_EOS.F90
)

list(APPEND mom6_nuopc_src_files
${PROJECT_SOURCE_DIR}/CDEPS-interface/ufs/cdeps_share/shr_is_restart_fh_mod.F90
)

list(APPEND mom6_solo_src_files
MOM6/config_src/drivers/solo_driver/MESO_surface_forcing.F90
MOM6/config_src/drivers/solo_driver/MOM_driver.F90
Expand Down
1 change: 1 addition & 0 deletions NOAHMP-interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ list(APPEND _noahmp_cap_files noahmp/drivers/nuopc/lnd_comp_kind.F90

# CCPP interface
list(APPEND _noahmp_ccpp_files noahmp/drivers/ccpp/noahmpdrv.F90
noahmp/drivers/ccpp/lnd_iau_mod.F90
noahmp/drivers/ccpp/sfc_diff.f
noahmp/drivers/ccpp/machine.F
noahmp/drivers/ccpp/noahmp_tables.f90
Expand Down
8 changes: 3 additions & 5 deletions doc/UsersGuide/source/BuildingAndRunning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ Running the Model

.. attention::
Although the following discussions are general, users may not be able to execute the script successfully "as is" unless they are on a
`Tier-1 platform <https://github.com/ufs-community/ ufs-weather-model/wiki/Regression-Test-Policy-for-Weather-Model-Platforms-and-Compilers>`__.
:wm-wiki:`Tier-1 platform <Regression-Test-Policy-for-Weather-Model-Platforms-and-Compilers>`.

.. _UsingRegressionTest:

Expand Down Expand Up @@ -504,8 +504,7 @@ or (2) create a new file (e.g., ``my_rt.conf``), add the tests, and execute ``./
On NOAA RDHPCS
------------------

On `Tier-1 platforms <https://github.com/ufs-community/ufs-weather-model/wiki
/Regression-Test-Policy-for-Weather-Model-Platforms-and-Compilers>`__, users can run
On :wm-wiki:`Tier-1 platforms <Regression-Test-Policy-for-Weather-Model-Platforms-and-Compilers>`, users can run
regression tests by editing the ``rt.conf`` file and executing:

.. code-block:: console
Expand Down Expand Up @@ -733,8 +732,7 @@ operational requirement test. The only difference is that the ``opnReqTest`` scr
The ``tests/opnReqTests`` directory contains
opnReqTest-specific lower-level scripts used to set up run configurations.

On `Tier-1 platforms <https://github.com/ufs-community/ ufs-weather-model/wiki
/Regression-Test-Policy-for-Weather-Model-Platforms-and-Compilers>`_, tests can
On :wm-wiki:`Tier-1 platforms <Regression-Test-Policy-for-Weather-Model-Platforms-and-Compilers>`, tests can
be run by invoking

.. code-block:: console
Expand Down
Loading

0 comments on commit b42472c

Please sign in to comment.