Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions source/src/sfincs_data.f90
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ module sfincs_data
character*256 :: thdfile
character*256 :: weirfile
character*256 :: qinffile
character*256 :: runofffile
character*256 :: netbndbzsbzifile
character*256 :: netsrcdisfile
character*256 :: netamuamvfile
Expand Down
79 changes: 75 additions & 4 deletions source/src/sfincs_infiltration.f90
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ subroutine initialize_infiltration()
!
character*256 :: varname
!
character(len=3), parameter :: allowed_types(5) = &
['c2d', 'cna', 'cnb', 'gai', 'hor']
character(len=3), parameter :: allowed_types(6) = &
['c2d', 'cna', 'cnb', 'gai', 'hor', 'r2d']

logical :: inftype_exists
!
Expand All @@ -32,7 +32,7 @@ subroutine initialize_infiltration()
infiltration = .false.
netcdf_infiltration = .false.
!
! Four options for infiltration:
! Seven options for infiltration:
!
! 1) Spatially-uniform constant infiltration
! Requires: -
Expand All @@ -46,6 +46,8 @@ subroutine initialize_infiltration()
! Requires: qinfmap, qinffield, ksfield, GA_head, GA_sigma_max, GA_Lu
! 6) Spatially-varying infiltration with the modified Horton Equation
! Requires: qinfmap, qinffield, horton_fc, horton_f0
! 7) Spatially-varying constant run-off (specified as a percentage)
! Requires: qinfmap, qinffield, cuminf
!
! cumprcp and cuminf are stored in the netcdf output if store_cumulative_precipitation == .true. which is the default
!
Expand Down Expand Up @@ -83,7 +85,7 @@ subroutine initialize_infiltration()
!
else
!
write(logstr,*)'Error : infiltration input type ',trim(inftype),' is not part of supported types c2d cna cnb gai hor !'
write(logstr,*)'Error : infiltration input type ',trim(inftype),' is not part of supported types c2d cna cnb gai hor r2d!'
call stop_sfincs(trim(logstr), 1)
!
end if
Expand Down Expand Up @@ -132,6 +134,13 @@ subroutine initialize_infiltration()
infiltration = .true.
store_meteo = .true.
!
elseif (runofffile /= 'none') then
!
! Spatially-varying constant run off
!
inftype = 'r2d'
infiltration = .true.
!
endif
!
! 2) We need cumprcp and cuminf
Expand Down Expand Up @@ -591,6 +600,23 @@ subroutine initialize_infiltration()
allocate(rain_T1(np))
rain_T1 = 0.0
!
elseif (inftype == 'r2d') then

!
write(logstr,'(a)')'Info : turning on spatially-varying constant run-off'
call write_log(logstr, 0)
!
write(logstr,'(a,a)')'Info : reading runoff file ', trim(runofffile)
call write_log(logstr, 0)
!
ok = check_file_exists(runofffile, 'Runoff file', .true.)
!
allocate(qinffield(np))
open(unit = 500, file = trim(runofffile), form = 'unformatted', access = 'stream')
read(500)qinffield
close(500)
!

endif
!
else
Expand Down Expand Up @@ -618,6 +644,7 @@ subroutine update_infiltration_map(dt, tloop)
real*4 :: I
real*4 :: hh_local, a
real*4 :: dt
real*4 :: infil_frac
!
integer :: count0
integer :: count1
Expand Down Expand Up @@ -1024,6 +1051,50 @@ subroutine update_infiltration_map(dt, tloop)
!$omp end parallel
!$acc end parallel
!
elseif (inftype == 'r2d') then
!
! Run-off coefficient map
!
!$omp parallel &
!$omp private ( nm, infil_frac)
!$omp do
!$acc parallel present( qinfmap, qinffield, z_volume, zs, zb, netprcp, cuminf )
!$acc loop independent gang vector private( infil_frac )
do nm = 1, np
!
qinfmap(nm) = qinffield(nm)
!
! No infiltration if there is no water
!
if (subgrid) then
if (z_volume(nm)<=0.0) then
qinfmap(nm) = 100.0
endif
else
if (zs(nm)<=zb(nm)) then
qinfmap(nm) = 100.0
endif
endif
!
! Fraction of net precip that infiltrates
!
infil_frac = 1.0 - qinfmap(nm)/100.0
!
if (store_cumulative_precipitation) then
!
! Compute cumulative infiltration (using net precip BEFORE it is reduced)
!
cuminf(nm) = cuminf(nm) + infil_frac * netprcp(nm) * dt
!
endif
netprcp(nm) = netprcp(nm) - infil_frac * netprcp(nm)
!
enddo
!$omp end do
!$omp end parallel
!$acc end parallel
!

endif
!
call system_clock(count1, count_rate, count_max)
Expand Down
1 change: 1 addition & 0 deletions source/src/sfincs_input.f90
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ subroutine read_sfincs_input()
call read_char_input(500,'amprfile',amprfile,'none')
call read_char_input(500,'z0lfile',z0lfile,'none')
call read_char_input(500,'qinffile',qinffile,'none')
call read_char_input(500,'runofffile',runofffile,'none')
! Curve Number files
call read_char_input(500,'scsfile',scsfile,'none')
call read_char_input(500,'smaxfile',smaxfile,'none')
Expand Down