SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
hydro_soil.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 ! #########
6  SUBROUTINE hydro_soil(HISBA, &
7  ptstep, &
8  pletr, pleg, ppg, pevapcor, &
9  pwdrain, &
10  pc1, pc2, pc3, pc4b, pc4ref, pwgeq, &
11  pd_g2, pd_g3, pwsat, pwfc, &
12  pdwgi1, pdwgi2, plegi, pd_g1, pcg, pct, &
13  ptg, ptg2, &
14  pwg1, pwg2, pwg3, pwgi1, pwgi2, &
15  prunoff, pdrain, hksat, pwwilt )
16 ! #####################################################################
17 !
18 !!**** *HYDRO_SOIL*
19 !!
20 !! PURPOSE
21 !! -------
22 !
23 ! Calculates the evolution of the water variables, i.e., the superficial
24 ! and deep-soil volumetric water content (wg and w2), the equivalent
25 ! liquid water retained in the vegetation canopy (Wr), the equivalent
26 ! water of the snow canopy (Ws), and also of the albedo and density of
27 ! the snow (i.e., ALBS and RHOS). Also determine the runoff and drainage
28 ! into the soil.
29 !
30 !
31 !!** METHOD
32 !! ------
33 !
34 !! EXTERNAL
35 !! --------
36 !!
37 !! none
38 !!
39 !! IMPLICIT ARGUMENTS
40 !! ------------------
41 !!
42 !!
43 !!
44 !! REFERENCE
45 !! ---------
46 !!
47 !! Noilhan and Planton (1989)
48 !! Belair (1995)
49 !!
50 !! AUTHOR
51 !! ------
52 !!
53 !! S. Belair * Meteo-France *
54 !!
55 !! MODIFICATIONS
56 !! -------------
57 !!
58 !! Original 14/03/95
59 !! 31/08/98 (V. Masson and F. Habets) add Dumenil et Todini
60 !! runoff scheme
61 !! 31/08/98 (V. Masson and A. Boone) add the third soil-water
62 !! reservoir (WG3,D3)
63 !! 15/03/99 A. Boone soil ice modification: advance
64 !! soil ice and liquid water, do budget checks
65 !! 25/01/00 A. Boone : fully implicit method for WG2, WG3
66 !! 05/03/07 A. Boone : changed drainage diagnostic computation for
67 !! single bulk-soil option...i.e. for
68 !! cases when HISBA=2-L or d2>=d3 (HISBA=3-L)
69 !! for tighter water budget closure
70 !! 07/08/12 B. Decharme : Soil ice energy conservation
71 !! 04/13 B. Decharme : Apply physical limits on wg here instead of in hydro.F90
72 !-------------------------------------------------------------------------------
73 !
74 !* 0. DECLARATIONS
75 ! ------------
76 !
77 USE modd_csts, ONLY : xlvtt, xrholw, xlmtt, xlstt, xday
78 USE modd_isba_par, ONLY : xwgmin
79 !
80 !
81 USE yomhook ,ONLY : lhook, dr_hook
82 USE parkind1 ,ONLY : jprb
83 !
84 IMPLICIT NONE
85 !
86 !* 0.1 declarations of arguments
87 !
88 !
89  CHARACTER(LEN=*), INTENT(IN) :: hisba ! type of ISBA version:
90 ! ! '2-L' (default)
91 ! ! '3-L'
92 !
93 REAL, INTENT(IN) :: ptstep
94 ! timestep of the integration (s)
95 !
96 REAL, DIMENSION(:), INTENT(IN) :: pd_g1
97 ! depth of surface ice reservoir (m)
98 !
99 REAL, DIMENSION(:), INTENT(IN) :: pletr, pleg, ppg, pevapcor
100 ! PLETR = evapotranspiration of the vegetation (W m-2)
101 ! PLEG = latent heat of evaporation over the ground (W m-2)
102 ! PPG = total water reaching the ground (kg m-2 s-1)
103 ! PEVAPCOR = correction for any excess evaporation
104 ! from snow as it completely ablates (kg m-2 s-1)
105 !
106 REAL, DIMENSION(:), INTENT(IN) :: pwdrain ! minimum Wg for drainage (m3 m-3)
107 !
108 REAL, DIMENSION(:), INTENT(IN) :: pc1, pc2, pwgeq, pcg, pct
109 REAL, DIMENSION(:,:), INTENT(IN) :: pc3
110 ! soil coefficients
111 ! C1, C2 = coefficients for the moisture calculations (-)
112 ! C3 = coefficient for drainage calculation (m)
113 ! PWGEQ = equilibrium surface volumetric moisture (m3 m-3)
114 ! PCG = soil heat capacity
115 ! PCT = grid-averaged heat capacity (K m2 J-1)
116 !
117 REAL, DIMENSION(:), INTENT(IN) :: pd_g2, pd_g3, pwsat, pwfc
118 ! PD_G2 = root depth (m)
119 ! PD_G3 = depth of the soil column (m)
120 ! PWSAT = saturation volumetric water content
121 ! of the soil (m3 m-3)
122 ! PWFC = field capacity volumetric water
123 ! content (m3 m-3)
124 !
125 REAL, DIMENSION(:), INTENT(IN) :: pc4b, pc4ref
126 ! PC4REF, PC4B = fiiting soil paramter for vertical
127 ! diffusion (C4) (-)
128 !
129 REAL, DIMENSION(:), INTENT(IN) :: pdwgi1, pdwgi2, plegi
130 ! PDWGI1 = surface layer liquid water equivalent
131 ! volumetric ice content time tendency (m3 m-3)
132 ! PDWGI2 = deep-soil layer liquid water equivalent
133 ! volumetric ice content time tendency (m3 m-3)
134 ! PLEGI = surface soil ice sublimation (W m-2)
135 !
136 !
137 REAL, DIMENSION(:), INTENT(INOUT) :: ptg, ptg2
138 ! PTG = surface temperature at 't' (K)
139 ! PTG2 = soil temperature at 't' (K)
140 !
141 REAL, DIMENSION(:), INTENT(INOUT) :: pwg1, pwg2, pwg3, pwgi1, pwgi2
142 ! PWG1 = near-surface soil moisture at 't+dt' (m3 m-3)
143 ! PWG2 = bulk root-soil moisture at 't+dt' (m3 m-3)
144 ! PWG3 = bulk deep-soil moisture at 't+dt' (m3 m-3)
145 ! PWGI1 = bulk surface-soil ice at 't+dt' (m3 m-3)
146 ! PWGI2 = bulk deep-soil ice at 't+dt' (m3 m-3)
147 !
148 REAL, DIMENSION(:), INTENT(OUT) :: prunoff, pdrain
149 ! PRUNOFF = runoff (kg m-2 s-1)
150 ! PDRAIN = drainage (kg m-2 s-1)
151 !
152  CHARACTER(LEN=*), INTENT(IN) :: hksat ! soil hydraulic profil option
153 ! ! 'DEF' = ISBA homogenous soil
154 ! ! 'SGH' = ksat exponential decay
155 !
156 REAL, DIMENSION(:), INTENT(IN) :: pwwilt
157 ! PWWILT = wilting point volumetric water
158 ! content (m3 m-3)
159 !
160 !* 0.2 declarations of local variables
161 !
162 !
163 REAL, DIMENSION(SIZE(PTG)) :: zwgi1m, zwg2m, zwg3m, zwgi2m
164 ! Prognostic variables of ISBA at 't-dt'
165 ! ZWG2M = root-soil volumetric water content
166 ! ZWG3M = deep-soil volumetric water content
167 ! ZWGI1M = surface-soil volumetric ice content
168 ! ZWGI2M = deep-soil volumetric ice content
169 !
170 REAL, DIMENSION(SIZE(PTG)) :: zetr, zeg
171 ! ZETR = evapotranspiration rate
172 ! ZEG = evaporation rate from the ground
173 !
174 !
175 REAL, DIMENSION(SIZE(PTG)) :: zwsat, zwfc
176 ! ZWSAT = Wsat when ice is present
177 ! ZWFC = Wfc when ice is present
178 !
179 REAL, DIMENSION(SIZE(PWG3)) :: zc4
180 REAL, DIMENSION(SIZE(PWG3)) :: zwavg, zsink2, &
181  zfactor, zdraincf2, zdraincf3, zdrain2, &
182  zdelta2, zdelta3, zdelta22, zdelta33, &
183  zwdrain2, zwdrain3
184 !
185 REAL, DIMENSION(SIZE(PWG3)) :: zexcessf, za2, zb2, zc2, za3, zb3, zc3, zwdrain, zexcessfc
186 !
187 REAL, DIMENSION(SIZE(PWG3)) :: zwlim2, zwlim3, zwwilt
188 !
189 INTEGER :: jj
190 REAL(KIND=JPRB) :: zhook_handle
191 !-------------------------------------------------------------------------------
192 !
193 !* 0. Initialization
194 ! --------------
195 !
196 !
197 IF (lhook) CALL dr_hook('HYDRO_SOIL',0,zhook_handle)
198 zwsat(:) = 0.
199 zwfc(:) = 0.
200 zwwilt(:) = 0.
201 !
202 pdrain(:) = 0.
203 prunoff(:) = 0.
204 !
205 zdrain2(:) = 0.
206 zdraincf2(:) = 0.
207 zdraincf3(:) = 0.
208 zdelta2(:) = 0.0
209 zdelta3(:) = 0.0
210 zdelta22(:) = 0.0
211 zdelta33(:) = 0.0
212 zsink2(:) = 0.
213 zwdrain(:) = 0.0
214 zwdrain2(:) = 0.0
215 zwdrain3(:) = 0.0
216 za2(:) = 0.0
217 zb2(:) = 0.0
218 zc2(:) = 0.0
219 za3(:) = 0.0
220 zb3(:) = 0.0
221 zc3(:) = 0.0
222 !
223 zexcessf(:) = 0.0
224 !
225 ! Fields at time t-dt
226 !
227 zwg2m(:) = pwg2(:)
228 zwg3m(:) = pwg3(:)
229 zwgi1m(:) = pwgi1(:)
230 zwgi2m(:) = pwgi2(:)
231 
232 !-------------------------------------------------------------------------------
233 !
234 DO jj=1,SIZE(ptg)
235 !
236 !* 1. New Wsat
237 ! --------
238 !
239  zwsat(jj) = pwsat(jj) - zwgi2m(jj) ! per definition ZWGI2M<PWSAT-0.001
240 ! ! then ZWSAT>0.001
241 !
242  zwfc(jj) = pwfc(jj) * zwsat(jj) / pwsat(jj)
243 !
244  zwwilt(jj) = pwwilt(jj) * zwsat(jj) / pwsat(jj)
245 !
246 !
247 ! evaporation rates
248 !
249  zetr(jj) = pletr(jj) / xlvtt
250 !
251 ! Remove sublimation from total soil evaporation: this is done
252 ! because ZEG is a liquid water sink term. Sublimation
253 ! is removed from the surface ice tendency equation (below):
254 ! PLEG represents the total of sublimation and evaporation.
255 ! Also, add an additional possible correction which is used if
256 ! evaporation from the snow surface exceeds the last amount of
257 ! snow on the surface as the snow completely ablates (this
258 ! is a very small term and is generally negligible HOWEVER
259 ! it is retained here for a high order water budget):
260 !
261  zeg(jj) = pleg(jj) / xlvtt + pevapcor(jj)
262 !
263 !-------------------------------------------------------------------------------
264 !
265 !* 4. EVOLUTION OF THE SUPERFICIAL WATER CONTENT WG1
266 ! ----------------------------------------------
267 !
268 ! updated values for wg
269 !
270  pwg1(jj) = (pwg1(jj) - ptstep * (pc1(jj) * (zeg(jj) - ppg(jj)) / xrholw &
271  - pc2(jj) * pwgeq(jj) / xday) ) &
272  / (1. + ptstep * pc2(jj) / xday)
273 !
274 !
275 ENDDO
276 !
277 IF(hksat=='SGH' .OR. hksat=='EXP') THEN
278  zwlim2(:)=zwwilt(:)
279  zwlim3(:)=pwwilt(:)
280 ELSE
281  zwlim2(:)=xwgmin
282  zwlim3(:)=xwgmin
283 ENDIF
284 !
285 !-------------------------------------------------------------------------------
286 !
287 !* 5. EVOLUTION OF THE DEEP WATER CONTENT WG2 and WG3
288 ! -----------------------------------------------
289 !
290 !* 5.1 2-L ISBA version
291 ! ----------------
292 !
293 IF (hisba=='2-L') THEN
294 !
295  DO jj=1,SIZE(ptg)
296 
297 !
298  pwg2(jj) = zwg2m(jj) - ptstep*(zeg(jj) + zetr(jj) - ppg(jj)) &
299  / (pd_g2(jj) * xrholw)
300 !
301 !* 6. DRAINAGE FROM THE DEEP SOIL
302 ! ------------------
303 !
304  zwdrain(jj) = pwdrain(jj) * max(0.0, min(zwfc(jj),pwg2(jj))-zwlim2(jj))/(zwfc(jj)-zwlim2(jj))
305 
306  zdrain2(jj) = max( min(zwdrain(jj),pwg2(jj)) , pwg2(jj)-zwfc(jj) )*pc3(jj,1) &
307  / (pd_g2(jj)*xday) * ptstep
308 !
309 ! the deep-soil volumetric water content w2
310 ! is modified consequently
311 !
312  pwg2(jj) = pwg2(jj) - zdrain2(jj)
313 
314  pdrain(jj) = zdrain2(jj)*pd_g2(jj)*xrholw/ptstep ! Final output units: kg m-2 s-1
315 !
316  ENDDO
317 !
318 ELSE
319 !
320  DO jj=1,SIZE(ptg)
321 
322 !* 5.2 3-L ISBA version (with only 2 active layers)
323 ! ----------------
324 !
325  IF (pd_g2(jj) >= pd_g3(jj)) THEN
326 
327  pwg2(jj) = zwg2m(jj) - ptstep*(zeg(jj) + zetr(jj) - ppg(jj)) &
328  / (pd_g2(jj) * xrholw)
329 
330 !* 6. DRAINAGE FROM THE DEEP SOIL
331 ! ------------------
332 ! when w2 > wfc, there is drainage
333 !
334  zwdrain(jj) = pwdrain(jj) * max(0.0, min(zwfc(jj),pwg2(jj))-zwlim2(jj))/(zwfc(jj)-zwlim2(jj))
335 
336  zdrain2(jj) = max( min(zwdrain(jj),pwg2(jj)) , pwg2(jj)-zwfc(jj) )*pc3(jj,1) &
337  / (pd_g2(jj)*xday) * ptstep
338 
339  pwg2(jj) = pwg2(jj) - zdrain2(jj)
340  pwg3(jj) = pwg2(jj)
341 
342  pdrain(jj) = zdrain2(jj)*pd_g2(jj)*xrholw/ptstep ! Final output units: kg m-2 s-1
343 !
344  ELSE
345 !
346 !* 5.3 3-L ISBA version (with 3 active layers)
347 ! ----------------
348 !
349 ! Linear drainage term check (m3 m-3):
350 ! Use a linear scaling to prevent it from completely drying out the soil. This
351 ! term will, under most conditions, not result in such a drying. Until a more
352 ! rhobust (but more complicated) method is developed for maintaining a minimum river
353 ! flow under dry conditions, this method will be used.
354 !
355  zwdrain2(jj) = pwdrain(jj)* max(0.0, min(zwfc(jj),zwg2m(jj))-zwlim2(jj))/(zwfc(jj)-zwlim2(jj))
356  zwdrain3(jj) = pwdrain(jj)* max(0.0, min(pwfc(jj),zwg3m(jj))-zwlim3(jj))/(pwfc(jj)-zwlim3(jj))
357 !
358 ! Delta functions:
359 !
360  zdelta2(jj) = 0.0
361  IF ( zwg2m(jj) - zwfc(jj) > zwdrain2(jj) ) zdelta2(jj) = 1.0
362  !
363  zdelta3(jj) = 0.0
364  IF ( zwg3m(jj) - pwfc(jj) > zwdrain3(jj) ) zdelta3(jj) = 1.0
365  !
366  !
367 
368 ! evaluate inter-facial water content, grid factor, and diffusion coefficient:
369 
370  zwavg(jj) = ( ( (zwg2m(jj)**6)* pd_g2(jj) + &
371  (zwg3m(jj)**6)*(pd_g3(jj)-pd_g2(jj)) )/pd_g3(jj) )**(1./6.)
372 
373  zfactor(jj) = pd_g2(jj)/(pd_g3(jj)-pd_g2(jj))
374 
375  zc4(jj) = pc4ref(jj)*(zwavg(jj)**pc4b(jj)) &
376  *(10.**(-pc4b(jj)*pwgi2(jj)/(pwsat(jj)-xwgmin)))
377 !
378 ! calculate sources/sinks
379 !
380  zsink2(jj) = -(zeg(jj) + zetr(jj) - ppg(jj) )/(pd_g2(jj)*xrholw)
381 
382 ! Compute evolution of water content using linearized equations
383 ! (see Boone 2000, Appendix F.2 for details)
384 !
385 ! sink terms are treated explicitly, other terms are implicit
386 !
387  zdraincf2(jj) = pc3(jj,1) / (pd_g2(jj) * xday)
388  zdelta22(jj) = zdelta2(jj)*zwfc(jj) - (1.0-zdelta2(jj))*zwdrain2(jj)
389  zc2(jj) = 1.0 + ptstep*(zdelta2(jj)*zdraincf2(jj) + (zc4(jj)/xday))
390  zb2(jj) = ptstep*zc4(jj)/(xday*zc2(jj))
391  za2(jj) = ( zwg2m(jj) + ptstep*(zsink2(jj) + zdraincf2(jj)*zdelta22(jj)) )/zc2(jj)
392 !
393  zdraincf3(jj) = pc3(jj,2) / ( (pd_g3(jj)-pd_g2(jj)) * xday)
394  zdelta33(jj) = zdelta3(jj)*pwfc(jj) - (1.0-zdelta3(jj))*zwdrain3(jj)
395  zc3(jj) = 1.0 + ptstep*(zdelta3(jj)*zdraincf3(jj) + zfactor(jj)*(zc4(jj)/xday))
396  zb3(jj) = ptstep*zfactor(jj)*(zdelta2(jj)*zdraincf2(jj) + (zc4(jj)/xday) )/zc3(jj)
397  za3(jj) = ( zwg3m(jj) + ptstep*( &
398  - zfactor(jj)*zdraincf2(jj)*zdelta22(jj) &
399  + zdraincf3(jj)*zdelta33(jj)) )/zc3(jj)
400 !
401 ! Advance volumetric water content values in time:
402 ! system of 2 linear equations:
403 !
404  pwg2(jj) = ( za2(jj)+zb2(jj)*za3(jj) )/(1.0 - zb2(jj)*zb3(jj))
405  pwg3(jj) = za3(jj) + zb3(jj)*pwg2(jj)
406 !
407 ! Drainage (kg m-2 s-1): this term is implicit and is extracted directly from
408 ! the drainage computation in the above equations.
409 !
410  zwdrain(jj) = (xrholw*pc3(jj,2)/xday)* &
411  ( zdelta3(jj)*(pwg3(jj)-pwfc(jj)) + (1.0-zdelta3(jj))*zwdrain3(jj) )
412 !
413 ! As drainage is implicit, perform a check to prevent any negative drainage
414 ! (can arise rarely and is generally negligible, but to ensure a high order conservation):
415 !
416  pdrain(jj) = max(0.0, zwdrain(jj))
417  pwg3(jj) = pwg3(jj) + (pdrain(jj) - zwdrain(jj))*ptstep/((pd_g3(jj)-pd_g2(jj))*xrholw)
418 !
419  ENDIF
420  ENDDO
421 END IF
422 !
423 !-------------------------------------------------------------------------------
424 !
425 DO jj=1,SIZE(ptg)
426 !* 7. EFFECT OF THE MELTING/FREEZING ON THE SOIL WATER CONTENT
427 ! --------------------------------------------------------
428 !
429 !* 7.1 Effect on surface water liquid and ice reservoirs
430 ! -------------------------------------------------
431 !
432 ! First, advance the surface layer ice content using the time tendency
433 ! and sublimation (*heat effect* of sublimation already accounted
434 ! for in latent heat flux calculation):
435 !
436  pwgi1(jj) = zwgi1m(jj) + pdwgi1(jj) - plegi(jj)*ptstep/(xlstt*pd_g1(jj)*xrholw)
437 !
438 ! Next, update the liquid water content:
439 !
440  pwg1(jj) = pwg1(jj) - pdwgi1(jj)
441 !
442 ! Make sure that ice has not dropped below
443 ! zero due to sublimation (the ONLY way
444 ! it can drop below 0). If it has, then
445 ! freeze the needed liquid water (thus warming the
446 ! layer) to ensure sublimation is accomodated,
447 ! then extract this from liquid water store.
448 ! This is a correction used ONLY when last traces
449 ! of soil ice sublimate within a model time step.
450 !
451  zexcessfc(jj)= 0.0
452 !
453  zexcessf(jj) = max(0.0, - pwgi1(jj))
454  pwg1(jj) = pwg1(jj) - zexcessf(jj)
455  pwgi1(jj) = pwgi1(jj) + zexcessf(jj)
456  zexcessfc(jj)= zexcessfc(jj) - zexcessf(jj)
457 !
458 ! Modif H.Douville 26/08/03 (global scale)
459 ! Make sure that ice has not raised above
460 ! saturation (minus XWGMIN) due to sublimation.
461 ! If it has, then melt the needed frozen water
462 ! (thus cooling the layer) to ensure sublimation
463 ! is accomodated, then extract this from frozen water store.
464 !
465  zexcessf(jj) = min(0.0, pwsat(jj) - xwgmin - pwgi1(jj))
466  pwg1(jj) = pwg1(jj) - zexcessf(jj)
467  pwgi1(jj) = pwgi1(jj) + zexcessf(jj)
468  zexcessfc(jj)= zexcessfc(jj) - zexcessf(jj)
469 !
470 ! Make sure that liquid has not dropped below
471 ! minimum threshold: this could arise due to
472 ! evaporation and ice formation. Melt the needed water.
473 ! Normally simply a budget check, i.e. usually small but accounted
474 ! for none-the-less to assure high accuracy.
475 !
476  zexcessf(jj) = max(0.0, xwgmin - pwg1(jj))
477  pwgi1(jj) = pwgi1(jj) - zexcessf(jj)
478  pwg1(jj) = pwg1(jj) + zexcessf(jj)
479  zexcessfc(jj)= zexcessfc(jj) + zexcessf(jj)
480 !
481 ! removes very small values due to computation precision
482 !
483  IF(pwgi1(jj) < 1.0e-10) THEN
484  zexcessf(jj) = pwgi1(jj)
485  pwg1(jj) = pwg1(jj) + zexcessf(jj)
486  pwgi1(jj) = 0.0
487  zexcessfc(jj)= zexcessfc(jj) + zexcessf(jj)
488  ENDIF
489 !
490 ! Cummulative phase change for the ice/liquid budget corrections:
491 !
492  ptg(jj) = ptg(jj) - zexcessfc(jj)*xlmtt*pct(jj)*xrholw*pd_g1(jj)
493 !
494 !
495 !* 7.2 Effect on deep-soil liquid and ice reservoirs
496 ! ---------------------------------------------
497 !
498 ! Update the ice content using the ice tendency:
499 ! Since this reservoir includes surface reservoir, add
500 ! any changes in ice content due to sublimation:
501 !
502  pwgi2(jj) = zwgi2m(jj) + pdwgi2(jj) - plegi(jj)*ptstep/(xlstt*pd_g2(jj)*xrholw)
503 !
504 ! Update the liquid water content:
505 !
506  pwg2(jj) = pwg2(jj) - pdwgi2(jj)
507 !
508 ! Make sure that ice has not dropped below
509 ! zero due to sublimation (as above).
510 !
511  zexcessfc(jj)= 0.0
512 !
513  zexcessf(jj) = max(0.0, -pwgi2(jj))
514  pwg2(jj) = pwg2(jj) - zexcessf(jj)
515  pwgi2(jj) = pwgi2(jj) + zexcessf(jj)
516  zexcessfc(jj)= zexcessfc(jj) - zexcessf(jj)
517 !
518 ! Budget check of minimum threshold for liquid
519 ! water as for surface: MUCH LESS likely
520 ! to be utilized, but retained for accuracy
521 ! in energy and water balance (as above).
522 !
523  zexcessf(jj) = max(0.0, xwgmin - pwg2(jj))
524  pwgi2(jj) = pwgi2(jj) - zexcessf(jj)
525  pwg2(jj) = pwg2(jj) + zexcessf(jj)
526  zexcessfc(jj)= zexcessfc(jj) + zexcessf(jj)
527 !
528 ! removes very small values due to computation precision
529 !
530  IF (pwgi2(jj) < 1.0e-10 * ptstep) THEN
531  zexcessf(jj) = pwgi2(jj)
532  pwg2(jj) = pwg2(jj) + zexcessf(jj)
533  pwgi2(jj) = 0.
534  zexcessfc(jj)= zexcessfc(jj) + zexcessf(jj)
535  ENDIF
536 !
537 ! Cummulative phase change for the ice/liquid budget corrections:
538 !
539  ptg2(jj) = ptg2(jj) - zexcessfc(jj)*xlmtt*pcg(jj)*xrholw*pd_g2(jj)
540 !
541 !
542 ENDDO
543 !
544 !-------------------------------------------------------------------------------
545 !
546 !* 8. PHYSICAL LIMITS AND RUNOFF
547 ! --------------------------
548 !
549 ! runoff of second layer
550 !
551 prunoff(:) = max( 0., pwg2(:)+pwgi2(:)-pwsat(:) )*pd_g2(:) * xrholw / ptstep
552 !
553 ! now apply limits:
554 !
555 pwg1(:) = min( pwg1(:), pwsat(:) - pwgi1(:) )
556 pwg1(:) = max( pwg1(:), xwgmin )
557 !
558 pwg2(:) = min( pwg2(:), pwsat(:) - pwgi2(:) )
559 pwg2(:) = max( pwg2(:), xwgmin )
560 !
561 !runoff of third layer added to drainage
562 !
563 IF (hisba=='3-L') THEN
564  pdrain(:) = pdrain(:) + max( 0., pwg3(:)-pwsat(:) )* (pd_g3(:)-pd_g2(:)) * xrholw / ptstep
565  pwg3(:) = min( pwg3(:), pwsat(:) )
566  pwg3(:) = max( pwg3(:), xwgmin )
567 END IF
568 !
569 IF (lhook) CALL dr_hook('HYDRO_SOIL',1,zhook_handle)
570 !-------------------------------------------------------------------------------
571 !
572 END SUBROUTINE hydro_soil
subroutine hydro_soil(HISBA, PTSTEP, PLETR, PLEG, PPG, PEVAPCOR, PWDRAIN, PC1, PC2, PC3, PC4B, PC4REF, PWGEQ, PD_G2, PD_G3, PWSAT, PWFC, PDWGI1, PDWGI2, PLEGI, PD_G1, PCG, PCT, PTG, PTG2, PWG1, PWG2, PWG3, PWGI1, PWGI2, PRUNOFF, PDRAIN, HKSAT, PWWILT)
Definition: hydro_soil.F90:6