Soil Water Balance (SWB2)
Loading...
Searching...
No Matches
daily_calculation.F90
Go to the documentation of this file.
2
7 use exceptions, only : assert
8 use iso_c_binding, only : c_short, c_int, c_float, c_double, c_bool
9
14
15 use simulation_datetime, only : sim_dt
16
17 use fstring
18 use logfiles
19
20 implicit none
21
22 private
23
25
26contains
27
28 subroutine perform_daily_calculation(cells)
29
30 class(model_domain_t), intent(inout) :: cells
31
32 ! [ LOCALS ]
33 integer (c_int) :: indx, jndx
34 integer (c_int) :: landuse_index
35
36 ! calls elemental
37 call cells%calc_GDD()
38
39 ! calls elemental
40 call cells%update_crop_coefficient()
41 call cells%update_growing_season()
42 call cells%update_rooting_depth()
43 call cells%calc_reference_et()
44
45 ! fog calculation does not explicitly consider canopy fraction
46 call cells%calc_fog()
47
48 ! interception calculation *does* reflect the canopy fraction
49 call cells%calc_interception()
50
51 ! interception term *may* be altered if interception storage is already at a maximium
52 call calculate_interception_mass_balance( interception_storage=cells%interception_storage, &
53 actual_et_interception=cells%actual_et_interception, &
54 interception=cells%interception, &
55 interception_storage_max=cells%interception_storage_max, &
56 reference_et0=cells%reference_et0 )
57
58 ! update crop evapotranspiration; crop_coefficient_kcb defaults to 1.0
59 ! there is less power to evaporate/transpire if there is active evaporation of interception
60 cells%crop_etc = real(max(cells%reference_et0 &
61 - cells%actual_et_interception, 0.0_c_double), c_float) &
62 * cells%crop_coefficient_kcb
63
64 call cells%calc_snowfall()
65
66 ! actually calculating *potential* snowmelt here; actual snowmelt determined
67 ! in 'calculate_snow_mass_balance'
68 call cells%calc_snowmelt()
69
70 call cells%calc_continuous_frozen_ground_index()
71
72 call calculate_snow_mass_balance( snow_storage=cells%snow_storage, &
73 potential_snowmelt=cells%potential_snowmelt, &
74 snowmelt=cells%snowmelt, &
75 net_snowfall=cells%net_snowfall )
76
77 cells%runon = 0.0_c_float
78 cells%runoff = 0.0_c_float
79 cells%runoff_outside = 0.0_c_float
80
81 !> if flow routing is enabled, the calculations will be made in order from upslope to downslope;
82 !! otherwise, the calculations are made in the natural packing order of the data structure
83 do jndx=1, ubound( cells%sort_order, 1 )
84
85 ! sort_order is a simple series of index values from 1 to # active cells
86 ! indx represents the index of the cell if processed in upstream to downstream order
87
88 indx = cells%sort_order( jndx )
89
90 landuse_index = cells%landuse_index( indx )
91
92 associate( &
93 net_infiltration => cells%net_infiltration( indx ), &
94 pervious_fraction => cells%pervious_fraction( indx ), &
95 irrigation => cells%irrigation( indx ), &
96 direct_net_infiltration => cells%direct_net_infiltration( indx ), &
97 direct_soil_moisture => cells%direct_soil_moisture( indx ), &
98 surface_storage => cells%surface_storage( indx ), &
99 actual_et_impervious => cells%actual_et_impervious( indx ), &
100 actual_et_soil => cells%actual_et_soil( indx ), &
101 actual_et => cells%actual_et( indx ), &
102 surface_storage_excess => cells%surface_storage_excess( indx ), &
103 surface_storage_max => cells%surface_storage_max( indx ), &
104 soil_storage_max => cells%soil_storage_max( indx ), &
105 soil_storage => cells%soil_storage( indx ), &
106 storm_drain_capture => cells%storm_drain_capture( indx ), &
107 gross_precipitation => cells%gross_precip( indx ), &
108 rainfall => cells%rainfall( indx ), &
109 net_rainfall => cells%net_rainfall( indx ), &
110 snowmelt => cells%snowmelt( indx ), &
111 snowfall => cells%snowfall( indx ), &
112 runon => cells%runon( indx ), &
113 runoff => cells%runoff( indx ), &
114 inflow => cells%inflow( indx ), &
115 delta_soil_storage => cells%delta_soil_storage( indx ), &
116 infiltration => cells%infiltration( indx ), &
117 fog => cells%fog( indx ), &
118 interception => cells%interception( indx ), &
119 reference_et0 => cells%reference_et0( indx ), &
120 actual_et_interception => cells%actual_et_interception( indx ), &
121 canopy_cover_fraction => cells%canopy_cover_fraction(indx) )
122
123 ! inflow is calculated over the entire cell (pervious + impervious) area
124 inflow = max( 0.0_c_float, runon + net_rainfall + fog + snowmelt )
125
126 call cells%calc_runoff( indx )
127
128 ! calculating irrigation here because the Hawaii Water Budget method
129 ! needs an updated monthly runoff value to accurately calculate the
130 ! estimated irrigation demand; previously this value was wrong on the
131 ! first day of each month, since the previous month's runoff value was
132 ! being used to estimate the current month's irrigation demand
133 call cells%calc_irrigation( indx )
134
135 ! this is a convoluted call: we are getting an individual capture fraction,
136 ! but supplying a pointer to the active cells so that the first time through,
137 ! gridded data (if supplied) are updated
138 call storm_drain_capture_calculate( storm_drain_capture, indx, cells%active )
139
140 ! prevent calculated runoff from exceeding the day's inflow;
141 ! this can happen when using the monthly runoff fraction method
142 !runoff = max( min( inflow, runoff ), 0.0_c_float )
143
144 ! this routine now generates *all* outputs CORRECTED FOR PERVIOUS AREA
146 surface_storage=surface_storage, &
147 actual_et_impervious=actual_et_impervious, &
148 paved_to_unpaved=surface_storage_excess, &
149 surface_storage_max=surface_storage_max, &
152 net_rainfall=net_rainfall, &
153 snowmelt=snowmelt, &
154 runon=runon, &
155 runoff=runoff, &
156 fog=fog, &
157 reference_et0=reference_et0, &
158 pervious_fraction=pervious_fraction )
159
160 ! ** this statement commented out since pervious fraction correction is
161 ! now being performed in the 'mass_balance__impervious_surface' directly
162 ! modify the surface storage in inches as if the amount calculated for the impervious area
163 ! were to be redistributed uniformly over the total area of the cell
164 !surface_storage_excess = surface_storage_excess * ( 1.0_c_float - pervious_fraction )
165
166 ! e.g. septic system discharge enters here...
167 call cells%calc_direct_soil_moisture( indx )
168
169 ! irrigation not considered to be a contributor to runoff...in addition, infiltration
170 ! term is calculated with respect to the pervious fraction of the cell
171 infiltration = max( 0.0_c_float, &
172 ( ( runon &
173 + net_rainfall &
174 + fog &
175 + snowmelt &
176 + irrigation &
177 + direct_soil_moisture &
178 - runoff ) * pervious_fraction &
179 + surface_storage_excess ) / pervious_fraction )
180
181 ! the following call updates bound variable actual_et_soil
182 call cells%calc_actual_et( indx )
183
184 ! reduce soil actual et by the amount of interception et, if any
185 !actual_et_soil = max( actual_et_soil - actual_et_interception, 0.0_c_float )
186
187 ! OK, supplying a reduced value of reference ET0 to FAO56_two_stage calc
188
189 !actual_et_soil = max( min( actual_et_soil, reference_ET0 - actual_et_interception), 0.0_c_float )
190
191 call calculate_soil_mass_balance( net_infiltration=net_infiltration, &
192 soil_storage=soil_storage, &
193 soil_storage_max=soil_storage_max, &
194 delta_soil_storage=delta_soil_storage, &
195 actual_et_soil=actual_et_soil, &
196 reference_et0=reference_et0, &
197 infiltration=infiltration, &
198 runoff=runoff )
199
200 ! actual et for the entire cell is the weighted average of the ET for pervious and impervious
201 ! fractions of the cell
202 actual_et = actual_et_soil * pervious_fraction &
203 + actual_et_impervious * ( 1.0_c_float - pervious_fraction ) &
204 + actual_et_interception * canopy_cover_fraction
205
206 call cells%calc_climatic_water_deficit( indx )
207
208 if ( runoff < 0.) &
209 call logs%write( "line "//ascharacter(__line__)//": Negative runoff, indx= " &
210 //ascharacter(indx)//" col, row= "//ascharacter(cells%col_num_1D( indx )) &
211 //", "//ascharacter( cells%row_num_1D( indx ) ) )
212
213 call cells%calc_direct_net_infiltration( indx )
214
215 ! reporting of net_infiltration and irrigation must be adjusted to account for zero
216 ! irrigation and net_infiltration associated with the impervious areas
217
218 net_infiltration = net_infiltration * pervious_fraction + direct_net_infiltration
219 irrigation = irrigation * pervious_fraction
220
221 call cells%calc_maximum_net_infiltration( indx )
222
223 ! NOTE: only way for "runon" to be positive is if D8 flow routing
224 ! is enabled.
225
226 ! rejected net_infiltration + runoff will be routed downslope if routing option is turned on
227 call cells%calc_routing( index=jndx ) !use jndx instead of indx for correct order of flow routing calculations
228
229 end associate
230
231 enddo
232
233 end subroutine perform_daily_calculation
234
235
236end module daily_calculation
elemental subroutine, public update_continuous_frozen_ground_index(fcfgi, ftmax_f, ftmin_f, fsnowcover)
Update the continuous frozen ground index (CFGI) for a cell.
subroutine, public perform_daily_calculation(cells)
Provides support for assessing the effect of irrigation on recharge values by estimating the irrigati...
Definition irrigation.F90:8
type(logfile_t), public logs
Definition logfiles.F90:62
elemental subroutine, public calculate_impervious_surface_mass_balance(surface_storage, actual_et_impervious, paved_to_unpaved, surface_storage_max, storm_drain_capture, storm_drain_capture_fraction, net_rainfall, snowmelt, runon, runoff, fog, reference_et0, pervious_fraction)
elemental subroutine, public calculate_interception_mass_balance(interception_storage, actual_et_interception, interception, interception_storage_max, reference_et0)
elemental subroutine calculate_snow_mass_balance(snow_storage, potential_snowmelt, snowmelt, net_snowfall)
elemental subroutine, public calculate_soil_mass_balance(net_infiltration, soil_storage, actual_et_soil, runoff, delta_soil_storage, reference_et0, soil_storage_max, infiltration)
type(date_range_t), public sim_dt
real(c_float), dimension(:), allocatable, public storm_drain_capture_fraction
subroutine, public storm_drain_capture_calculate(capture_fraction, indx, is_cell_active)