MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
uzf-et.f90
Go to the documentation of this file.
1!> @brief Evapotranspiration from the unsaturated and saturated zones
2!<
3submodule(uzfcellgroupmodule) uzfcellgroupet
4contains
5
6 !> @brief Subtract aet from pet to calculate residual et for gw
7 !<
8 module procedure setgwpet
9 ! -- modules
10 use tdismodule, only: delt
11 ! -- local
12 real(DP) :: pet
13 !
14 pet = dzero
15 !
16 ! -- reduce pet for gw by uzet
17 pet = this%pet(icell) - this%et_uz(icell) / delt
18 if (pet < dzero) pet = dzero
19 this%gw_pet(icell) = pet
20 end procedure setgwpet
21
22 !> @brief Subtract aet from pet to calculate residual et for deeper cells
23 !<
24 module procedure setbelowpet
25 ! -- modules
26 use tdismodule, only: delt
27 ! -- local
28 real(DP) :: pet
29 !
30 pet = dzero
31 !
32 ! -- transfer unmet pet to lower cell
33 !
34 if (this%ext_depth_uz(jbelow) > dem3) then
35 pet = this%pet(icell) - this%et_uz(icell) / delt - &
36 this%gwet(icell) / this%uzfarea(icell)
37 if (pet < dzero) pet = dzero
38 end if
39 this%pet(jbelow) = pet
40 end procedure setbelowpet
41
42 !> @brief Calculate gwf et using residual uzf pet
43 !<
44 module procedure simgwet
45 ! -- local
46 real(DP) :: s, x, c, b, et
47 !
48 this%gwet(icell) = dzero
49 trhs = dzero
50 thcof = dzero
51 det = dzero
52 s = this%landtop(icell)
53 x = this%ext_depth(icell)
54 c = this%gw_pet(icell)
55 b = this%celbot(icell)
56 if (b > hgwf) return
57 if (x < dem6) return
58 if (igwetflag == 1) then
59 et = etfunc_lin(s, x, c, det, trhs, thcof, hgwf, &
60 this%celtop(icell), this%celbot(icell))
61 else if (igwetflag == 2) then
62 et = etfunc_nlin(s, x, c, det, trhs, thcof, hgwf)
63 end if
64 ! this%gwet(icell) = et * this%uzfarea(icell)
65 trhs = trhs * this%uzfarea(icell)
66 thcof = thcof * this%uzfarea(icell)
67 this%gwet(icell) = trhs - (thcof * hgwf)
68 ! write(99,*)'in group', icell, this%gwet(icell)
69 end procedure simgwet
70
71 !> @brief Remove water from uz due to et
72 !<
73 module procedure uzet
74 ! -- local
75 real(DP) :: diff
76 real(DP) :: thetaout
77 real(DP) :: fm
78 real(DP) :: st
79 real(DP) :: dtheta_inv
80 real(DP) :: epsfksthts
81 real(DP) :: fmp
82 real(DP) :: fktho
83 real(DP) :: theta1
84 real(DP) :: theta2
85 real(DP) :: flux1
86 real(DP) :: flux2
87 real(DP) :: hcap
88 real(DP) :: factor
89 real(DP) :: tho
90 real(DP) :: depth
91 real(DP) :: extwc1
92 real(DP) :: theta_min
93 real(DP) :: sat
94 real(DP) :: petsub
95 integer(I4B) :: j
96 integer(I4B) :: jext
97 integer(I4B) :: jwet
98 integer(I4B) :: found
99 integer(I4B) :: numadd
100 integer(I4B) :: k
101 integer(I4B) :: nwv
102 integer(I4B) :: itest
103 real(DP) :: fluxprev
104 logical(LGP) :: hasprev
105 !
106 this%et_uz(icell) = dzero
107 if (this%ext_depth_uz(icell) < dem7) return
108 petsub = this%root_act(icell) * this%pet(icell) * &
109 this%ext_depth_uz(icell) / this%ext_depth(icell)
110 thetaout = delt * petsub / this%ext_depth(icell)
111 if (ietflag == 1) thetaout = delt * this%pet(icell) / this%ext_depth(icell)
112 if (thetaout < dem10) return
113 depth = this%wave_depth(1, icell)
114 st = this%unsat_stor(icell, depth)
115 if (st < dem4) return
116 !
117 ! -- store original wave characteristics so the aet-to-pet loop can retry
118 nwv = this%nwaves(icell)
119 itest = 0
120 call this%store_waves(icell, this%etsav)
121 factor = done
122 this%et_uz(icell) = dzero
123 if (this%theta_sat(icell) - this%theta_res(icell) < dem7) then
124 dtheta_inv = 1.0 / dem7
125 else
126 dtheta_inv = done / (this%theta_sat(icell) - this%theta_res(icell))
127 end if
128 epsfksthts = this%bc_eps(icell) * this%vks(icell) * dtheta_inv
129 this%et_uz(icell) = dzero
130 fmp = dzero
131 extwc1 = this%theta_ext(icell) - this%theta_res(icell)
132 if (extwc1 < dem6) extwc1 = dem7
133 !
134 ! -- lowest water content et can draw a wave down to. Formed from extwc1
135 ! rather than from theta_ext directly, because extwc1 is clamped above.
136 theta_min = this%theta_res(icell) + extwc1
137 numadd = 0
138 fm = st
139 k = 0
140 !
141 ! -- loop for reducing aet to pet when et is head dependent
142 do while (itest == 0)
143 k = k + 1
144 if (k > 1 .AND. abs(fmp - petsub) > dem5 * petsub) then
145 factor = factor / (fm / petsub)
146 end if
147 !
148 ! -- one wave shallower than extdp
149 if (this%nwaves(icell) == 1 .AND. &
150 this%wave_depth(1, icell) <= this%ext_depth_uz(icell)) then
151 if (ietflag == 2) then
152 tho = this%wave_theta(1, icell)
153 fktho = this%wave_flux(1, icell)
154 hcap = this%caph(icell, tho)
155 thetaout = this%rate_et_z(icell, factor, fktho, hcap)
156 end if
157 if ((this%wave_theta(1, icell) - thetaout) > theta_min) then
158 this%wave_theta(1, icell) = this%wave_theta(1, icell) - thetaout
159 sat = (this%wave_theta(1, icell) - this%theta_res(icell)) * dtheta_inv
160 this%wave_flux(1, icell) = this%vks(icell) * (sat**this%bc_eps(icell))
161 else if (this%wave_theta(1, icell) > theta_min) then
162 this%wave_theta(1, icell) = theta_min
163 sat = (this%wave_theta(1, icell) - this%theta_res(icell)) * dtheta_inv
164 this%wave_flux(1, icell) = this%vks(icell) * (sat**this%bc_eps(icell))
165 end if
166 !
167 ! -- all waves shallower than extinction depth
168 else if (this%nwaves(icell) > 1 .AND. &
169 this%wave_depth(this%nwaves(icell), &
170 icell) > this%ext_depth_uz(icell)) then
171 if (ietflag == 2) then
172 tho = this%wave_theta(this%nwaves(icell), icell)
173 fktho = this%wave_flux(this%nwaves(icell), icell)
174 hcap = this%caph(icell, tho)
175 thetaout = this%rate_et_z(icell, factor, fktho, hcap)
176 end if
177 if (this%nwaves(icell) + 1 > this%nwaves_max) then
178 !
179 ! -- too many waves error
180 ierr = 1
181 goto 500
182 end if
183 if (this%wave_theta(this%nwaves(icell), icell) - thetaout > &
184 theta_min) then
185 this%wave_theta(this%nwaves(icell) + 1, icell) = &
186 this%wave_theta(this%nwaves(icell), icell) - thetaout
187 numadd = 1
188 else if (this%wave_theta(this%nwaves(icell), icell) > &
189 theta_min) then
190 this%wave_theta(this%nwaves(icell) + 1, icell) = theta_min
191 numadd = 1
192 end if
193 if (numadd == 1) then
194 this%wave_flux(this%nwaves(icell) + 1, icell) = &
195 this%vks(icell) * &
196 (((this%wave_theta(this%nwaves(icell) + 1, icell) - &
197 this%theta_res(icell)) * dtheta_inv)**this%bc_eps(icell))
198 theta2 = this%wave_theta(this%nwaves(icell) + 1, icell)
199 flux2 = this%wave_flux(this%nwaves(icell) + 1, icell)
200 flux1 = this%wave_flux(this%nwaves(icell), icell)
201 theta1 = this%wave_theta(this%nwaves(icell), icell)
202 this%wave_speed(this%nwaves(icell) + 1, icell) = &
203 leadspeed(theta1, theta2, flux1, flux2, this%theta_sat(icell), &
204 this%theta_res(icell), this%bc_eps(icell), this%vks(icell))
205 this%wave_depth(this%nwaves(icell) + 1, icell) = this%ext_depth_uz(icell)
206 this%nwaves(icell) = this%nwaves(icell) + 1
207 if (this%nwaves(icell) > this%nwaves_max) then
208 !
209 ! -- too many waves error
210 ierr = 1
211 goto 500
212 end if
213 else
214 numadd = 0
215 end if
216 !
217 ! -- one wave below extinction depth
218 else if (this%nwaves(icell) == 1) then
219 if (this%nwaves(icell) + 1 > this%nwaves_max) then
220 !
221 ! -- too many waves error
222 ierr = 1
223 goto 500
224 end if
225 if (ietflag == 2) then
226 tho = this%wave_theta(1, icell)
227 fktho = this%wave_flux(1, icell)
228 hcap = this%caph(icell, tho)
229 thetaout = this%rate_et_z(icell, factor, fktho, hcap)
230 end if
231 if ((this%wave_theta(1, icell) - thetaout) > theta_min) then
232 if (thetaout > dem30) then
233 this%wave_theta(2, icell) = this%wave_theta(1, icell) - thetaout
234 sat = (this%wave_theta(2, icell) - this%theta_res(icell)) * dtheta_inv
235 this%wave_flux(2, icell) = this%vks(icell) * (sat**this%bc_eps(icell))
236 this%wave_depth(2, icell) = this%ext_depth_uz(icell)
237 theta2 = this%wave_theta(2, icell)
238 flux2 = this%wave_flux(2, icell)
239 flux1 = this%wave_flux(1, icell)
240 theta1 = this%wave_theta(1, icell)
241 this%wave_speed(2, icell) = &
242 leadspeed(theta1, theta2, flux1, flux2, this%theta_sat(icell), &
243 this%theta_res(icell), this%bc_eps(icell), this%vks(icell))
244 this%nwaves(icell) = this%nwaves(icell) + 1
245 if (this%nwaves(icell) > this%nwaves_max) then
246 !
247 ! -- too many waves error
248 ierr = 1
249 goto 500
250 end if
251 end if
252 else if (this%wave_theta(1, icell) > theta_min) then
253 if (thetaout > dem30) then
254 this%wave_theta(2, icell) = theta_min
255 sat = (this%wave_theta(2, icell) - this%theta_res(icell)) * dtheta_inv
256 this%wave_flux(2, icell) = this%vks(icell) * (sat**this%bc_eps(icell))
257 this%wave_depth(2, icell) = this%ext_depth_uz(icell)
258 theta2 = this%wave_theta(2, icell)
259 flux2 = this%wave_flux(2, icell)
260 flux1 = this%wave_flux(1, icell)
261 theta1 = this%wave_theta(1, icell)
262 this%wave_speed(2, icell) = &
263 leadspeed(theta1, theta2, flux1, flux2, this%theta_sat(icell), &
264 this%theta_res(icell), this%bc_eps(icell), this%vks(icell))
265 this%nwaves(icell) = this%nwaves(icell) + 1
266 if (this%nwaves(icell) > this%nwaves_max) then
267 !
268 ! -- too many waves error
269 ierr = 1
270 goto 500
271 end if
272 end if
273 end if
274 else
275 !
276 ! -- extinction depth splits waves
277 if (this%wave_depth(1, icell) - this%ext_depth_uz(icell) > dem7) then
278 jext = 2
279 found = 0
280 !
281 ! -- locate extinction depth between waves
282 do while (found == 0)
283 diff = this%wave_depth(jext, icell) - this%ext_depth_uz(icell)
284 if (diff > dzero) then
285 jext = jext + 1
286 else
287 found = 1
288 end if
289 end do
290 j = jext
291 if (this%wave_theta(jext, icell) > theta_min) then
292 !
293 ! -- create a wave at extinction depth
294 if (abs(diff) > dem5) then
295 if (this%nwaves(icell) + 1 > this%nwaves_max) then
296 !
297 ! -- too many waves error
298 ierr = 1
299 goto 500
300 end if
301 call this%shift_waves(icell, -1, &
302 this%nwaves(icell) + 1, jext, -1)
303 this%wave_depth(jext, icell) = this%ext_depth_uz(icell)
304 this%nwaves(icell) = this%nwaves(icell) + 1
305 if (this%nwaves(icell) > this%nwaves_max) then
306 !
307 ! -- too many waves error
308 ierr = 1
309 goto 500
310 end if
311 end if
312 j = jext
313 else
314 jwet = this%nwaves(icell)
315 j = jext + 1
316 do while (j < this%nwaves(icell))
317 if (this%wave_theta(j, icell) > theta_min) then
318 jwet = j
319 j = this%nwaves(icell) + 1
320 end if
321 j = j + 1
322 end do
323 jext = jwet
324 j = jwet
325 end if
326 else
327 j = 1
328 end if
329 !
330 ! -- all waves above extinction depth. fluxprev holds the flux
331 ! -- just computed for wave j - 1, if any, so it isn't recomputed.
332 hasprev = .false.
333 do while (j <= this%nwaves(icell))
334 if (ietflag == 2) then
335 tho = this%wave_theta(j, icell)
336 fktho = this%wave_flux(j, icell)
337 hcap = this%caph(icell, tho)
338 thetaout = this%rate_et_z(icell, factor, fktho, hcap)
339 end if
340 if (this%wave_theta(j, icell) > theta_min) then
341 if (this%wave_theta(j, icell) - thetaout > &
342 theta_min) then
343 this%wave_theta(j, icell) = this%wave_theta(j, icell) - thetaout
344 else if (this%wave_theta(j, icell) > theta_min) then
345 this%wave_theta(j, icell) = theta_min
346 end if
347 if (j == 1) then
348 this%wave_flux(j, icell) = &
349 this%vks(icell) * &
350 (((this%wave_theta(j, icell) - &
351 this%theta_res(icell)) * dtheta_inv)**this%bc_eps(icell))
352 fluxprev = this%wave_flux(j, icell)
353 end if
354 if (j > 1) then
355 if (hasprev) then
356 flux1 = fluxprev
357 else
358 sat = (this%wave_theta(j - 1, icell) - this%theta_res(icell)) * &
359 dtheta_inv
360 flux1 = this%vks(icell) * sat**this%bc_eps(icell)
361 end if
362 sat = (this%wave_theta(j, icell) - this%theta_res(icell)) * dtheta_inv
363 flux2 = this%vks(icell) * sat**this%bc_eps(icell)
364 this%wave_flux(j, icell) = flux2
365 fluxprev = flux2
366 theta2 = this%wave_theta(j, icell)
367 theta1 = this%wave_theta(j - 1, icell)
368 this%wave_speed(j, icell) = &
369 leadspeed(theta1, theta2, flux1, flux2, this%theta_sat(icell), &
370 this%theta_res(icell), this%bc_eps(icell), &
371 this%vks(icell))
372 end if
373 hasprev = .true.
374 else
375 hasprev = .false.
376 end if
377 j = j + 1
378 end do
379 end if
380 !
381 ! -- calculate aet
382 j = 1
383 do while (j <= this%nwaves(icell) - 1)
384 if (abs(this%wave_theta(j, icell) - this%wave_theta(j + 1, &
385 icell)) < dem6) then
386 call this%shift_waves(icell, 1, j + 1, &
387 this%nwaves(icell) - 1, 1)
388 j = j - 1
389 this%nwaves(icell) = this%nwaves(icell) - 1
390 end if
391 j = j + 1
392 end do
393 depth = this%wave_depth(1, icell)
394 fm = this%unsat_stor(icell, depth)
395 this%et_uz(icell) = st - fm
396 fm = this%et_uz(icell) / delt
397 if (this%et_uz(icell) < dzero) then
398 call this%load_waves(icell, this%etsav)
399 this%nwaves(icell) = nwv
400 this%et_uz(icell) = dzero
401 elseif (petsub - fm < -dem15 .AND. ietflag == 2) then
402 !
403 ! -- aet greater than pet, reset and try again
404 call this%load_waves(icell, this%etsav)
405 this%nwaves(icell) = nwv
406 this%et_uz(icell) = dzero
407 else
408 itest = 1
409 end if
410 !
411 ! -- end aet-pet loop for head dependent et
412 fmp = fm
413 if (k > 100) then
414 itest = 1
415 elseif (ietflag < 2) then
416 fmp = petsub
417 itest = 1
418 end if
419 end do
420500 continue
421 end procedure uzet
422
423 !> @brief Calculate capillary pressure head from B-C equation
424 !<
425 module procedure caph
426 ! -- local
427 real(DP) :: lambda
428 real(DP) :: star
429 !
430 caph = -dem6
431 star = (tho - this%theta_res(icell)) / &
432 (this%theta_sat(icell) - this%theta_res(icell))
433 if (star < dem15) star = dem15
434 lambda = dtwo / (this%bc_eps(icell) - dthree)
435 if (star > dem15) then
436 if (tho - this%theta_sat(icell) < dem15) then
437 caph = this%air_entry(icell) * star**(-done / lambda)
438 else
439 caph = dzero
440 end if
441 end if
442 end procedure caph
443
444 !> @brief Calculate capillary pressure-based uz et
445 !<
446 module procedure rate_et_z
447 rate_et_z = factor * fktho * (h - this%root_pot(icell))
448 if (rate_et_z < dzero) rate_et_z = dzero
449 end procedure rate_et_z
450
451end submodule uzfcellgroupet
real(dp), pointer, public delt
length of the current time step
Definition tdis.f90:32
Unsaturated zone flow by the method of characteristics.