-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathsubzone.py
More file actions
51 lines (45 loc) · 2.16 KB
/
Copy pathsubzone.py
File metadata and controls
51 lines (45 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# The Spatial Processes in HYdrology (SPHY) model:
# A spatially distributed hydrological model
# Copyright (C) 2013-2026 FutureWater
# Email: sphy@futurewater.nl
#
# Authors (alphabetical order):
# P. Droogers, J. Eekhout, A. Fernandez-Rodriguez, W. Immerzeel, S. Khanal, A. Lutz, T. Schults, G. Simons, W. Terink.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# -Function to calculate capillary rise
def CapilRise(pcr, subfield, subwater, capmax, rootwater, rootsat, rootfield):
subrelwat = pcr.max(pcr.min((subwater / subfield), 1), 0)
rootrelwat = pcr.max(pcr.min((rootwater / rootfield), 1), 0)
caprise = pcr.min(subwater, capmax * (1 - rootrelwat) * subrelwat)
caprise = pcr.min(
caprise, rootsat - rootwater
) # adding caprise can not exceed saturated rootwater content
return caprise
# -Function to calculate percolation from subsoil (only if groundwater module is used)
def SubPercolation(pcr, subwater, subfield, subTT, gw, gwsat):
subperc = pcr.ifthenelse(
(gw < gwsat) & ((subwater - subfield) > 0),
(subwater - subfield) * (1 - pcr.exp(-1 / subTT)),
0,
)
return subperc
# -Function to calculate drainage from subsoil (only if groundwater module is NOT used)
def SubDrainage(pcr, subwater, subfield, subsat, drainvel, subdrainage, subTT):
subexcess = pcr.max(subwater - subfield, 0)
subexcessfrac = subexcess / (subsat - subfield)
sublateral = subexcessfrac * drainvel
subdrainage = (sublateral + subdrainage) * (1 - pcr.exp(-1 / subTT))
subdrainage = pcr.max(pcr.min(subdrainage, subwater), 0)
return subdrainage