From d0a49a0c36a27457ae4d8f902d6a1e5f6d690a71 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 22 Jan 2024 02:26:14 -0700 Subject: [PATCH] Add back flooding in the code, so @swensosc has a chance of turning it on with code mods, this resolves #80 --- src/cpl/nuopc/rof_comp_nuopc.F90 | 6 ++++-- src/cpl/nuopc/rof_import_export.F90 | 3 ++- src/riverroute/RtmMod.F90 | 29 +++++++++++++++++++++-------- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/cpl/nuopc/rof_comp_nuopc.F90 b/src/cpl/nuopc/rof_comp_nuopc.F90 index f716a54..d97d2b7 100644 --- a/src/cpl/nuopc/rof_comp_nuopc.F90 +++ b/src/cpl/nuopc/rof_comp_nuopc.F90 @@ -55,6 +55,8 @@ module rof_comp_nuopc integer :: flds_scalar_index_nx = 0 integer :: flds_scalar_index_ny = 0 integer :: flds_scalar_index_nextsw_cday = 0._r8 + + logical :: do_rtmflood ! If flooding is active integer :: nthrds integer , parameter :: debug = 1 character(*), parameter :: modName = "(rof_comp_nuopc)" @@ -413,13 +415,13 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! - need to compute areas where they are not defined in input file ! - Initialize runoff datatype (rtmCTL) - call MOSART_read_namelist() + call MOSART_read_namelist(do_rtmflood) !---------------------------------------------------------------------------- ! Now advertise fields !---------------------------------------------------------------------------- - call advertise_fields(gcomp, flds_scalar_name, rc) + call advertise_fields(gcomp, flds_scalar_name, do_rtmflood, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return !---------------------------------------------------------------------------- diff --git a/src/cpl/nuopc/rof_import_export.F90 b/src/cpl/nuopc/rof_import_export.F90 index 08fd822..fd66a67 100644 --- a/src/cpl/nuopc/rof_import_export.F90 +++ b/src/cpl/nuopc/rof_import_export.F90 @@ -53,11 +53,12 @@ module rof_import_export contains !=============================================================================== - subroutine advertise_fields(gcomp, flds_scalar_name, rc) + subroutine advertise_fields(gcomp, flds_scalar_name, do_rtmflood, rc) ! input/output variables type(ESMF_GridComp) :: gcomp character(len=*) , intent(in) :: flds_scalar_name + logical , intent(in) :: do_rtmflood ! Flooding is active integer , intent(out) :: rc ! local variables diff --git a/src/riverroute/RtmMod.F90 b/src/riverroute/RtmMod.F90 index 1c74f68..b435b2a 100644 --- a/src/riverroute/RtmMod.F90 +++ b/src/riverroute/RtmMod.F90 @@ -82,6 +82,8 @@ module RtmMod real(r8),pointer :: rlonw(:) ! longitude of 1d west grid cell edge (deg) real(r8),pointer :: rlone(:) ! longitude of 1d east grid cell edge (deg) + logical :: do_rtmflood ! Turn flooding on + character(len=256) :: nlfilename_rof = 'mosart_in' character(len=256) :: fnamer ! name of netcdf restart file character(*), parameter :: u_FILE_u = & @@ -91,7 +93,10 @@ module RtmMod contains !----------------------------------------------------------------------- - subroutine MOSART_read_namelist() + subroutine MOSART_read_namelist(flood_active) + ! Read and distribute mosart namelist + ! + logical, intent(out) :: flood_active ! ! Read and distribute mosart namelist ! @@ -108,7 +113,7 @@ subroutine MOSART_read_namelist() ! Read in mosart namelist !------------------------------------------------------- - namelist /mosart_inparm / ice_runoff, & + namelist /mosart_inparm / ice_runoff, do_rtmflood, & frivinp_rtm, finidat_rtm, nrevsn_rtm, coupling_period, & rtmhist_ndens, rtmhist_mfilt, rtmhist_nhtfrq, & rtmhist_fincl1, rtmhist_fincl2, rtmhist_fincl3, & @@ -155,6 +160,7 @@ subroutine MOSART_read_namelist() call mpi_bcast (decomp_option , len(decomp_option) , MPI_CHARACTER, 0, mpicom_rof, ier) call mpi_bcast (bypass_routing_option , len(bypass_routing_option) , MPI_CHARACTER, 0, mpicom_rof, ier) call mpi_bcast (qgwl_runoff_option , len(qgwl_runoff_option) , MPI_CHARACTER, 0, mpicom_rof, ier) + call mpi_bcast (do_rtmflood, 1, MPI_LOGICAL, 0, mpicom_rof, ier) call mpi_bcast (ice_runoff, 1, MPI_LOGICAL, 0, mpicom_rof, ier) @@ -189,6 +195,8 @@ subroutine MOSART_read_namelist() end if endif + flood_active = do_rtmflood + if (frivinp_rtm == ' ') then call shr_sys_abort( subname//' ERROR: frivinp_rtm NOT set' ) else @@ -893,13 +901,18 @@ subroutine MOSART_init1() ! Initialize mosart flood - rtmCTL%fthresh and evel !------------------------------------------------------- - effvel(:) = effvel0 ! downstream velocity (m/s) - rtmCTL%fthresh(:) = abs(spval) - do nt = 1,nt_rtm - do nr = rtmCTL%begr,rtmCTL%endr - evel(nr,nt) = effvel(nt) + if (do_rtmflood) then + write(iulog,*) subname,' Flood not validated in this version, abort' + call shr_sys_abort(subname//' Flood feature unavailable') + else + effvel(:) = effvel0 ! downstream velocity (m/s) + rtmCTL%fthresh(:) = abs(spval) + do nt = 1,nt_rtm + do nr = rtmCTL%begr,rtmCTL%endr + evel(nr,nt) = effvel(nt) + enddo enddo - enddo + end if !------------------------------------------------------- ! Initialize runoff data type