Soil Water Balance (SWB2)
Loading...
Searching...
No Matches
mass_balance__soil.F90
Go to the documentation of this file.
2
3 use iso_c_binding, only : c_float, c_double
4 implicit none
5
6 private
7
9
10contains
11
12 elemental subroutine calculate_soil_mass_balance( net_infiltration, &
13 soil_storage, &
14 actual_et_soil, &
15 runoff, &
16 delta_soil_storage, &
17 reference_et0, &
18 soil_storage_max, &
19 infiltration )
20
21 real (c_float), intent(inout) :: net_infiltration
22 real (c_double), intent(inout) :: soil_storage
23 real (c_double), intent(inout) :: actual_et_soil
24 real (c_float), intent(inout) :: runoff
25 real (c_float), intent(inout) :: delta_soil_storage
26 real (c_double), intent(in) :: reference_et0
27 real (c_float), intent(in) :: soil_storage_max
28 real (c_float), intent(in) :: infiltration
29
30 real (c_float), parameter :: near_zero = 1.0e-6_c_float
31
32
33 ! [ LOCALS ]
34 real (c_double) :: new_soil_storage
35
36 ! all of these entities have been previously corrected for pervious fraction
37 new_soil_storage = soil_storage + infiltration - actual_et_soil
38
39 ! open water cell
40 if ( soil_storage_max < near_zero ) then
41
42 actual_et_soil = min( reference_et0, infiltration )
43 net_infiltration = 0.0_c_float
44 ! **** infiltration term includes the previously calculated runoff; add this back in
45 ! before adjusting the runoff value
46 runoff = max( 0.0_c_float, infiltration + runoff - actual_et_soil )
47 soil_storage = 0.0_c_float
48 delta_soil_storage = 0.0_c_float
49
50 ! new soil storage value exceeds soil_storage_max; net infiltration event
51 elseif ( new_soil_storage > soil_storage_max ) then
52
53 net_infiltration = new_soil_storage - soil_storage_max
54
55 ! should represent a positive change in storage
56 delta_soil_storage = soil_storage_max - soil_storage
57! actual_et_soil = max( 0.0_c_float, soil_storage + infiltration - net_infiltration )
58 soil_storage = soil_storage_max
59
60 else
61
62 ! could be positive or negative
63 delta_soil_storage = new_soil_storage - soil_storage
64 soil_storage = new_soil_storage
65 net_infiltration = 0.0_c_float
66
67 endif
68
69 end subroutine calculate_soil_mass_balance
70
71end module mass_balance__soil
elemental subroutine, public calculate_soil_mass_balance(net_infiltration, soil_storage, actual_et_soil, runoff, delta_soil_storage, reference_et0, soil_storage_max, infiltration)