Skip to content

Commit

Permalink
Add back flooding in the code, so @swensosc has a chance of turning i…
Browse files Browse the repository at this point in the history
…t on with code mods, this resolves #80
  • Loading branch information
ekluzek committed Jan 22, 2024
1 parent 221b953 commit d0a49a0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
6 changes: 4 additions & 2 deletions src/cpl/nuopc/rof_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down Expand Up @@ -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

!----------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion src/cpl/nuopc/rof_import_export.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 21 additions & 8 deletions src/riverroute/RtmMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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 = &
Expand All @@ -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
!
Expand All @@ -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, &
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d0a49a0

Please sign in to comment.