117 & ( nsoil, couple, icein, ffrozp, dt, zlvl, sldpth, &
118 & swdn, swnet, lwdn, sfcems, sfcprs, sfctmp, &
119 & sfcspd, prcp, q2, q2sat, dqsdt2, th2, ivegsrc, &
120 & vegtyp, soiltyp, slopetyp, shdmin, alb, snoalb, &
121 & rhonewsn, exticeden, &
124 & tbot, cmc, t1, stc, smc, sh2o, sneqv, ch, cm,z0, &
125 & nroot, shdfac, snowh, albedo, eta, sheat, ec, &
126 & edir, et, ett, esnow, drip, dew, beta, etp, ssoil, &
127 & flx1, flx2, flx3, runoff1, runoff2, runoff3, &
128 & snomlt, sncovr, rc, pc, rsmin, xlai, rcs, rct, rcq, &
129 & rcsoil, soilw, soilm, smcwlt, smcdry, smcref, smcmax, &
273 use machine ,
only : kind_phys
275 use physcons,
only : con_cp, con_rd, con_t0c, con_g, con_pi, &
276 & con_cliq, con_csol, con_hvap, con_hfus, &
287 integer,
parameter :: nsold = 4
290 real (kind=kind_phys),
parameter :: gs1 = 9.8
291 real (kind=kind_phys),
parameter :: gs2 = 9.81
292 real (kind=kind_phys),
parameter :: tfreez = con_t0c
293 real (kind=kind_phys),
parameter :: lsubc = 2.501e+6
294 real (kind=kind_phys),
parameter :: lsubf = 3.335e5
295 real (kind=kind_phys),
parameter :: lsubs = 2.83e+6
296 real (kind=kind_phys),
parameter :: elcp = 2.4888e+3
298 real (kind=kind_phys),
parameter :: rd1 = 287.04
299 real (kind=kind_phys),
parameter :: cp = con_cp
300 real (kind=kind_phys),
parameter :: cp1 = 1004.5
301 real (kind=kind_phys),
parameter :: cp2 = 1004.0
303 real (kind=kind_phys),
parameter :: cph2o1 = 4.218e+3
304 real (kind=kind_phys),
parameter :: cph2o2 = 4.2e6
305 real (kind=kind_phys),
parameter :: cpice = con_csol
306 real (kind=kind_phys),
parameter :: cpice1 = 2.106e6
308 real (kind=kind_phys),
parameter :: sigma1 = 5.67e-8
311 integer,
intent(in) :: nsoil, couple, icein, vegtyp, soiltyp, &
314 real (kind=kind_phys),
intent(in) :: ffrozp, dt, zlvl, lwdn, &
315 & sldpth(nsoil), swdn, swnet, sfcems, sfcprs, sfctmp, &
316 & sfcspd, prcp, q2, q2sat, dqsdt2, th2, shdmin, alb, snoalb, &
317 & bexpp, xlaip, rhonewsn &
319 logical,
intent(in) :: lheatstrg, exticeden
322 real (kind=kind_phys),
intent(inout) :: tbot, cmc, t1, sneqv, &
323 & stc(nsoil), smc(nsoil), sh2o(nsoil), ch, cm
326 integer,
intent(out) :: nroot
328 real (kind=kind_phys),
intent(out) :: shdfac, snowh, albedo, &
329 & eta, sheat, ec, edir, et(nsoil), ett, esnow, drip, dew, &
330 & beta, etp, ssoil, flx1, flx2, flx3, snomlt, sncovr, &
331 & runoff1, runoff2, runoff3, rc, pc, rsmin, xlai, rcs, &
332 & rct, rcq, rcsoil, soilw, soilm, smcwlt, smcdry, smcref, &
334 character(len=*),
intent(out) :: errmsg
335 integer,
intent(out) :: errflg
339 real (kind=kind_phys) :: bexp, cfactr, cmcmax, csoil, czil, &
340 & df1, df1a, dksat, dwsat, dsoil, dtot, frcsno, &
341 & frcsoi, epsca, fdown, f1, fxexp, frzx, hs, kdt, prcp1, &
342 & psisat, quartz, rch, refkdt, rr, rgl, rsmax, sndens, &
343 & sncond, sbeta, sn_new, slope, snup, salp, soilwm, soilww, &
344 & t1v, t24, t2v, th2v, topt, tsnow, zbot, z0
346 real (kind=kind_phys) :: shdfac0
347 real (kind=kind_phys),
dimension(nsold) :: rtdis, zsoil
349 logical :: frzgra, snowng
351 integer :: ice, k, kz
379 if(ivegsrc == 2)
then
380 if (vegtyp == 13)
then
386 if(ivegsrc == 1)
then
387 if (vegtyp == 15)
then
402 zsoil(kz) = -3.0 * float(kz) / float(nsoil)
411 zsoil(1) = -sldpth(1)
413 zsoil(kz) = -sldpth(kz) + zsoil(kz-1)
424 call redprm(errmsg, errflg)
427 if(ivegsrc == 1)
then
437 rsmin=400.0*(1-shdfac0)+40.0*shdfac0
439 smcmax = 0.45*(1-shdfac0)+smcmax*shdfac0
440 smcref = 0.42*(1-shdfac0)+smcref*shdfac0
441 smcwlt = 0.40*(1-shdfac0)+smcwlt*shdfac0
442 smcdry = 0.40*(1-shdfac0)+smcdry*shdfac0
467 bexp = bexp * max(1.+bexpp, 0.)
469 if( bexpp >= 0.)
then
470 bexp = bexp * min(1.+bexpp, 2.)
474 xlai = xlai * (1.+xlaip)
475 xlai = max(xlai, .75)
491 if (sneqv < 0.01)
then
497 elseif (ice == -1)
then
499 if (sneqv < 0.10)
then
523 if (sneqv .eq. 0.0)
then
528 sndens = sneqv / snowh
529 sndens = max( 0.0, min( 1.0, sndens ))
546 if (ffrozp > 0.)
then
549 if (t1 <= tfreez) frzgra = .true.
560 if (snowng .or. frzgra)
then
564 sn_new = ffrozp*prcp * dt * 0.001
565 sneqv = sneqv + sn_new
566 prcp1 = (1.-ffrozp)*prcp
570 sn_new = prcp * dt * 0.001
571 sneqv = sneqv + sn_new
615 if (sneqv == 0.0)
then
675 & ( smc(1), quartz, smcmax, sh2o(1), &
692 if((.not.lheatstrg) .and. &
693 & (ivegsrc == 1 .and. vegtyp == 13))
then
694 df1 = 3.24*(1.-shdfac) + shdfac*df1*exp(sbeta*shdfac)
696 df1 = df1 * exp( sbeta*shdfac )
705 dsoil = -0.5 * zsoil(1)
707 if (sneqv == 0.0)
then
709 ssoil = df1 * (t1 - stc(1)) / dsoil
714 frcsno = snowh / dtot
715 frcsoi = dsoil / dtot
725 df1a = frcsno*sncond + frcsoi*df1
732 df1 = df1a*sncovr + df1 *(1.0-sncovr)
738 ssoil = df1 * (t1 - stc(1)) / dtot
746 if (sncovr > 0.0)
then
760 t2v = sfctmp * (1.0 + 0.61*q2)
792 if (couple == 0)
then
797 t1v = t1 * (1.0 + 0.61 * q2)
798 th2v = th2 * (1.0 + 0.61 * q2)
838 if (shdfac > 0.)
then
858 if (sneqv .eq. 0.0)
then
900 sheat = -(ch*cp1*sfcprs) / (rd1*t2v) * (th2 - t1)
912 et(k) = et(k) * lsubc
916 esnow = esnow * lsubs
917 etp = etp * ((1.0 - sncovr)*lsubc + sncovr*lsubs)
920 eta = edir + ec + ett + esnow
944 runoff3 = runoff3 / dt
945 runoff2 = runoff2 + runoff3
954 runoff1 = snomlt / dt
960 soilm = -1.0 * smc(1) * zsoil(1)
962 soilm = soilm + smc(k)*(zsoil(k-1) - zsoil(k))
965 soilwm = -1.0 * (smcmax - smcwlt) * zsoil(1)
966 soilww = -1.0 * (smc(1) - smcwlt) * zsoil(1)
968 soilwm = soilwm + (smcmax - smcwlt) * (zsoil(k-1) - zsoil(k))
969 soilww = soilww + (smc(k) - smcwlt) * (zsoil(k-1) - zsoil(k))
972 soilw = soilww / soilwm
1037 albedo = alb + sncovr*(snoalb - alb)
1039 if (albedo > snoalb) albedo = snoalb
1145 real (kind=kind_phys) :: delta, ff, gx, rr, part(nsold)
1162 ff = 0.55 * 2.0 * swdn / (rgl*xlai)
1163 rcs = (ff + rsmin/rsmax) / (1.0 + ff)
1164 rcs = max( rcs, 0.0001 )
1169 rct = 1.0 - 0.0016 * (topt - sfctmp)**2.0
1170 rct = max( rct, 0.0001 )
1175 rcq = 1.0 / (1.0 + hs*(q2sat-q2))
1176 rcq = max( rcq, 0.01 )
1181 gx = (sh2o(1) - smcwlt) / (smcref - smcwlt)
1182 gx = max( 0.0, min( 1.0, gx ) )
1185 part(1) = (zsoil(1)/zsoil(nroot)) * gx
1192 gx = (sh2o(k) - smcwlt) / (smcref - smcwlt)
1193 gx = max( 0.0, min( 1.0, gx ) )
1196 part(k) = ((zsoil(k) - zsoil(k-1)) / zsoil(nroot)) * gx
1204 rcsoil = rcsoil + part(k)
1206 rcsoil = max( rcsoil, 0.0001 )
1214 rc = rsmin / (xlai*rcs*rct*rcq*rcsoil)
1215 rr = (4.0*sfcems*sigma1*rd1/cp1) * (sfctmp**4.0)/(sfcprs*ch) + 1.0
1216 delta = (lsubc/cp1) * dqsdt2
1218 pc = (rr + delta) / (rr*(1.0 + rc*ch) + delta)
1221 end subroutine canres
1254 real (kind=kind_phys),
parameter :: unit = 0.11631
1263 real (kind=kind_phys) :: c
1271 c = 0.328 * 10**(2.25*sndens)
1283 end subroutine csnow
1407 real (kind=kind_phys) :: df1, eta1, etp1, prcp1, yy, yynum, &
1408 & zz1, ec1, edir1, et1(nsoil), ett1
1439 & ( nsoil, nroot, cmc, cmcmax, etp1, dt, zsoil, &
1440 & sh2o, smcmax, smcwlt, smcref, smcdry, pc, &
1441 & shdfac, cfactr, rtdis, fxexp, &
1443 & eta1, edir1, ec1, et1, ett1 &
1448 & ( nsoil, dt, kdt, smcmax, smcwlt, cmcmax, prcp1, &
1449 & zsoil, slope, frzx, bexp, dksat, dwsat, shdfac, &
1450 & edir1, ec1, et1, &
1454 & runoff1, runoff2, runoff3, drip &
1471 & ( nsoil, dt, kdt, smcmax, smcwlt, cmcmax, prcp1, &
1472 & zsoil, slope, frzx, bexp, dksat, dwsat, shdfac, &
1473 & edir1, ec1, et1, &
1477 & runoff1, runoff2, runoff3, drip &
1485 edir = edir1 * 1000.0
1489 et(k) = et1(k) * 1000.0
1496 if ( etp <= 0.0 )
then
1498 if ( etp < 0.0 )
then
1511 & ( smc(1), quartz, smcmax, sh2o(1), &
1529 if((.not.lheatstrg) .and. &
1530 & (ivegsrc == 1 .and. vegtyp == 13))
then
1531 df1 = 3.24*(1.-shdfac) + shdfac*df1*exp(sbeta*shdfac)
1533 df1 = df1 * exp( sbeta*shdfac )
1539 yynum = fdown - sfcems*sigma1*t24
1540 yy = sfctmp + (yynum/rch + th2 - sfctmp - beta*epsca)/rr
1541 zz1 = df1/(-0.5*zsoil(1)*rch*rr) + 1.0
1545 & ( nsoil, smc, smcmax, dt, yy, zz1, zsoil, zbot, &
1546 & psisat, bexp, df1, ice, quartz, csoil, vegtyp, &
1547 & shdfac, lheatstrg, &
1549 & stc, t1, tbot, sh2o, &
1562 end subroutine nopac
1629 real (kind=kind_phys) :: a, delta, fnet, rad, rho
1638 delta = elcp * dqsdt2
1639 t24 = sfctmp * sfctmp * sfctmp * sfctmp
1640 rr = t24 * 6.48e-8 / (sfcprs*ch) + 1.0
1641 rho = sfcprs / (rd1*t2v)
1647 if (.not. snowng)
then
1648 if (prcp > 0.0) rr = rr + cph2o1*prcp/rch
1651 rr = rr + (cpice*ffrozp+cph2o1*(1.-ffrozp)) &
1655 fnet = fdown - sfcems*sigma1*t24 - ssoil
1661 flx2 = -lsubf * prcp
1667 rad = fnet/rch + th2 - sfctmp
1668 a = elcp * (q2sat - q2)
1669 epsca = (a*rr + rad*delta) / (delta + rr)
1670 etp = epsca * rch / lsubc
1673 end subroutine penman
1682 subroutine redprm(errmsg, errflg)
1869 character(len=*),
intent(out) :: errmsg
1870 integer,
intent(out) :: errflg
1874 real (kind=kind_phys) :: frzfact, frzk, refdk
1885 if (soiltyp > defined_soil)
then
1886 write(*,*)
'warning: too many soil types,soiltyp=',soiltyp, &
1887 &
'defined_soil=',defined_soil
1889 errmsg =
'ERROR(sflx.f): too many soil types'
1893 if (vegtyp > defined_veg)
then
1894 write(*,*)
'warning: too many veg types'
1896 errmsg =
'ERROR(sflx.f): too many veg types'
1900 if (slopetyp > defined_slope)
then
1901 write(*,*)
'warning: too many slope types'
1903 errmsg =
'ERROR(sflx.f): too many slope types'
1912 cfactr = cfactr_data
1913 cmcmax = cmcmax_data
1920 refkdt = refkdt_data
1927 dksat = satdk(soiltyp)
1928 dwsat = satdw(soiltyp)
1930 kdt = refkdt * dksat / refdk
1932 psisat = satpsi(soiltyp)
1933 quartz = qtz(soiltyp)
1934 smcdry = drysmc(soiltyp)
1935 smcmax = maxsmc(soiltyp)
1936 smcref = refsmc(soiltyp)
1937 smcwlt = wltsmc(soiltyp)
1939 frzfact = (smcmax / smcref) * (0.412 / 0.468)
1943 frzx = frzk * frzfact
1947 nroot = nroot_data(vegtyp)
1948 snup = snupx(vegtyp)
1949 rsmin = rsmtbl(vegtyp)
1951 rgl = rgltbl(vegtyp)
1955 xlai= lai_data(vegtyp)
1957 if (vegtyp == bare) shdfac = 0.0
1959 if (nroot > nsoil)
then
1961 errmsg =
'ERROR(sflx.f): too many root layers'
1969 rtdis(i) = -sldpth(i) / zsoil(nroot)
1974 slope = slope_data(slopetyp)
1977 end subroutine redprm
2019 integer,
parameter :: itrmx = 5
2020 real (kind=kind_phys),
parameter :: wwst = 1.2
2021 real (kind=kind_phys),
parameter :: wwst2 = wwst*wwst
2022 real (kind=kind_phys),
parameter :: vkrm = 0.40
2023 real (kind=kind_phys),
parameter :: excm = 0.001
2024 real (kind=kind_phys),
parameter :: beta = 1.0/270.0
2025 real (kind=kind_phys),
parameter :: btg = beta*gs1
2026 real (kind=kind_phys),
parameter :: elfc = vkrm*btg
2027 real (kind=kind_phys),
parameter :: wold = 0.15
2028 real (kind=kind_phys),
parameter :: wnew = 1.0-wold
2029 real (kind=kind_phys),
parameter :: pihf = 3.14159265/2.0
2031 real (kind=kind_phys),
parameter :: epsu2 = 1.e-4
2032 real (kind=kind_phys),
parameter :: epsust = 0.07
2033 real (kind=kind_phys),
parameter :: ztmin = -5.0
2034 real (kind=kind_phys),
parameter :: ztmax = 1.0
2035 real (kind=kind_phys),
parameter :: hpbl = 1000.0
2036 real (kind=kind_phys),
parameter :: sqvisc = 258.2
2038 real (kind=kind_phys),
parameter :: ric = 0.183
2039 real (kind=kind_phys),
parameter :: rric = 1.0/ric
2040 real (kind=kind_phys),
parameter :: fhneu = 0.8
2041 real (kind=kind_phys),
parameter :: rfc = 0.191
2042 real (kind=kind_phys),
parameter :: rfac = ric/(fhneu*rfc*rfc)
2052 real (kind=kind_phys) :: zilfc, zu, zt, rdz, cxch, dthv, du2, &
2053 & btgh, wstar2, ustar, zslu, zslt, rlogu, rlogt, rlmo, &
2054 & zetalt, zetalu, zetau, zetat, xlu4, xlt4, xu4, xt4, &
2055 & xlu, xlt, xu, xt, psmz, simm, pshz, simh, ustark, &
2058 integer :: ilech, itr
2062 real (kind=kind_phys) :: pslmu, pslms, pslhu, pslhs, zz
2063 real (kind=kind_phys) :: pspmu, pspms, psphu, psphs, xx, yy
2067 pslmu( zz ) = -0.96 * log( 1.0-4.5*zz )
2068 pslms( zz ) = zz*rric - 2.076*(1.0 - 1.0/(zz + 1.0))
2069 pslhu( zz ) = -0.96 * log( 1.0-4.5*zz )
2070 pslhs( zz ) = zz*rfac - 2.076*(1.0 - 1.0/(zz + 1.0))
2074 pspmu( xx ) = -2.0 * log( (xx + 1.0)*0.5 ) &
2075 & - log( (xx*xx + 1.0)*0.5 ) + 2.0*atan(xx) - pihf
2076 pspms( yy ) = 5.0 * yy
2077 psphu( xx ) = -2.0 * log( (xx*xx + 1.0)*0.5 )
2078 psphs( yy ) = 5.0 * yy
2091 zilfc = -czil * vkrm * sqvisc
2098 du2 = max( sfcspd*sfcspd, epsu2 )
2105 if (btgh*ch*dthv /= 0.0)
then
2106 wstar2 = wwst2 * abs( btgh*ch*dthv )**(2.0/3.0)
2111 ustar = max( sqrt( cm*sqrt( du2+wstar2 ) ), epsust )
2115 zt = exp( zilfc*sqrt( ustar*z0 ) ) * z0
2124 rlogu = log( zslu/zu )
2125 rlogt = log( zslt/zt )
2127 rlmo = elfc*ch*dthv / ustar**3
2139 zetalt = max( zslt*rlmo, ztmin )
2140 rlmo = zetalt / zslt
2141 zetalu = zslu * rlmo
2145 if (ilech == 0)
then
2147 if (rlmo < 0.0)
then
2148 xlu4 = 1.0 - 16.0 * zetalu
2149 xlt4 = 1.0 - 16.0 * zetalt
2150 xu4 = 1.0 - 16.0 * zetau
2151 xt4 = 1.0 - 16.0* zetat
2153 xlu = sqrt( sqrt( xlu4 ) )
2154 xlt = sqrt( sqrt( xlt4 ) )
2155 xu = sqrt( sqrt( xu4 ) )
2156 xt = sqrt( sqrt( xt4 ) )
2166 simm = pspmu( xlu ) - psmz + rlogu
2168 simh = psphu( xlt ) - pshz + rlogt
2170 zetalu = min( zetalu, ztmax )
2171 zetalt = min( zetalt, ztmax )
2172 psmz = pspms( zetau )
2180 simm = pspms( zetalu ) - psmz + rlogu
2181 pshz = psphs( zetat )
2182 simh = psphs( zetalt ) - pshz + rlogt
2189 if (rlmo < 0.0)
then
2190 psmz = pslmu( zetau )
2198 simm = pslmu( zetalu ) - psmz + rlogu
2199 pshz = pslhu( zetat )
2200 simh = pslhu( zetalt ) - pshz + rlogt
2202 zetalu = min( zetalu, ztmax )
2203 zetalt = min( zetalt, ztmax )
2205 psmz = pslms( zetau )
2213 simm = pslms( zetalu ) - psmz + rlogu
2214 pshz = pslhs( zetat )
2215 simh = pslhs( zetalt ) - pshz + rlogt
2222 ustar = max( sqrt( cm*sqrt( du2+wstar2 ) ), epsust )
2226 zt = exp( zilfc*sqrt( ustar*z0 ) ) * z0
2229 rlogt = log( zslt/zt )
2231 ustark = ustar * vkrm
2232 cm = max( ustark/simm, cxch )
2233 ch = max( ustark/simh, cxch )
2237 if (btgh*ch*dthv /= 0.0)
then
2238 wstar2 = wwst2 * abs(btgh*ch*dthv) ** (2.0/3.0)
2243 rlmn = elfc*ch*dthv / ustar**3
2244 rlma = rlmo*wold + rlmn*wnew
2264 end subroutine sfcdif
2307 real (kind=kind_phys) :: rsnow, z0n
2315 if (sneqv < snup)
then
2316 rsnow = sneqv / snup
2317 sncovr = 1.0 - (exp(-salp*rsnow) - rsnow*exp(-salp))
2334 end subroutine snfrac
2446 real,
parameter :: esdmin = 1.e-6
2472 real (kind=kind_phys):: denom, dsoil, dtot, etp1, ssoil1, &
2473 & snoexp, ex, t11, t12, t12a, t12b, yy, zz1, seh, t14, &
2474 & ec1, edir1, ett1, etns, etns1, esnow1, esnow2, etanrg, &
2497 prcp1 = prcp1 * 0.001
2527 etanrg = etp * ((1.0-sncovr)*lsubc + sncovr*lsubs)
2536 esnow1 = esnow * 0.001
2537 esnow2 = esnow1 * dt
2538 etanrg = esnow * lsubs
2542 if (sncovr < 1.0)
then
2546 & ( nsoil, nroot, cmc, cmcmax, etp1, dt, zsoil, &
2547 & sh2o, smcmax, smcwlt, smcref, smcdry, pc, &
2548 & shdfac, cfactr, rtdis, fxexp, &
2550 & etns1, edir1, ec1, et1, ett1 &
2553 edir1 = edir1 * (1.0 - sncovr)
2554 ec1 = ec1 * (1.0 - sncovr)
2557 et1(k) = et1(k) * (1.0 - sncovr)
2560 ett1 = ett1 * (1.0 - sncovr)
2561 etns1 = etns1 * (1.0 - sncovr)
2563 edir = edir1 * 1000.0
2567 et(k) = et1(k) * 1000.0
2571 etns = etns1 * 1000.0
2575 esnow = etp * sncovr
2577 esnow1 = esnow * 0.001
2578 esnow2 = esnow1 * dt
2579 etanrg = esnow*lsubs + etns*lsubc
2593 flx1 = (cpice* ffrozp + cph2o1*(1.-ffrozp)) &
2594 & * prcp * (t1 - sfctmp)
2596 if (prcp > 0.0) flx1 = cph2o1 * prcp * (t1 - sfctmp)
2606 dsoil = -0.5 * zsoil(1)
2607 dtot = snowh + dsoil
2608 denom = 1.0 + df1 / (dtot * rr * rch)
2612 t12a = ( (fdown - flx1 - flx2 - sfcems*sigma1*t24) / rch &
2613 & + th2 - sfctmp - etanrg/rch ) / rr
2615 t12b = df1 * stc(1) / (dtot * rr * rch)
2616 t12 = (sfctmp + t12a + t12b) / denom
2627 if (t12 <= tfreez)
then
2630 ssoil = df1 * (t1 - stc(1)) / dtot
2632 sneqv = max(0.0, sneqv-esnow2)
2657 t1 = tfreez * max(0.01,sncovr**snoexp) + &
2658 & t12 * (1.0 - max(0.01,sncovr**snoexp))
2661 ssoil = df1 * (t1 - stc(1)) / dtot
2667 if (sneqv-esnow2 <= esdmin)
then
2679 sneqv = sneqv - esnow2
2680 seh = rch * (t1 - th2)
2685 flx3 = fdown - flx1 - flx2 - sfcems*sigma1*t14 &
2686 & - ssoil - seh - etanrg
2687 if (flx3 <= 0.0) flx3 = 0.0
2689 ex = flx3 * 0.001 / lsubf
2702 if (sneqv-snomlt >= esdmin)
then
2704 sneqv = sneqv - snomlt
2711 flx3 = ex * 1000.0 * lsubf
2728 if (ice == 0) prcp1 = prcp1 + ex
2745 & ( nsoil, dt, kdt, smcmax, smcwlt, cmcmax, prcp1, &
2746 & zsoil, slope, frzx, bexp, dksat, dwsat, shdfac, &
2747 & edir1, ec1, et1, &
2751 & runoff1, runoff2, runoff3, drip &
2764 yy = stc(1) - 0.5*ssoil*zsoil(1)*zz1 / df1
2775 & ( nsoil, smc, smcmax, dt, yy, zz1, zsoil, zbot, &
2776 & psisat, bexp, df1, ice, quartz, csoil, vegtyp, &
2777 & shdfac, lheatstrg, &
2779 & stc, t11, tbot, sh2o, &
2789 if (sneqv > 0.0)
then
2793 & ( sneqv, dt, t1, yy, &
2814 elseif (ice == 1)
then
2816 if (sneqv >= 0.01)
then
2820 & ( sneqv, dt, t1, yy, &
2838 if (sneqv >= 0.10)
then
2842 & ( sneqv, dt, t1, yy, &
2862 end subroutine snopac
2906 real(kind=kind_phys) :: dsnew, snowhc, hnewc, newsnc, tempc
2913 snowhc = snowh * 100.0
2914 newsnc = sn_new * 100.0
2915 tempc = sfctmp - tfreez
2922 if(.not. exticeden)
then
2923 if (tempc <= -15.0)
then
2926 dsnew = 0.05 + 0.0017*(tempc + 15.0)**1.5
2929 dsnew = rhonewsn*0.001
2934 hnewc = newsnc / dsnew
2935 sndens = (snowhc*sndens + hnewc*dsnew) / (snowhc + hnewc)
2936 snowhc = snowhc + hnewc
2937 snowh = snowhc * 0.01
2940 end subroutine snow_new
2979 real(kind=kind_phys) :: z0s
2987 z0 = (1.0 - sncovr)*z0 + sncovr*z0s
2991 end subroutine snowz0
3001 & ( smc, qz, smcmax, sh2o, &
3051 real (kind=kind_phys),
intent(in) :: smc, qz, smcmax, sh2o
3054 real (kind=kind_phys),
intent(out) :: df
3057 real (kind=kind_phys) :: gammd, thkdry, ake, thkice, thko, &
3058 & thkqtz, thksat, thks, thkw, satratio, xu, xunfroz
3067 satratio = smc / smcmax
3078 thks = (thkqtz**qz) * (thko**(1.0-qz))
3082 xunfroz = (sh2o + 1.e-9) / (smc + 1.e-9)
3090 thksat = thks**(1.-smcmax) * thkice**(smcmax-xu) * thkw**(xu)
3094 gammd = (1.0 - smcmax) * 2700.0
3098 thkdry = (0.135*gammd + 64.7) / (2700.0 - 0.947*gammd)
3100 if ( sh2o+0.0005 < smc )
then
3107 if ( satratio > 0.1 )
then
3113 ake = log10( satratio ) + 1.0
3126 df = ake * (thksat - thkdry) + thkdry
3129 end subroutine tdfcnd
3147 & ( nsoil, nroot, cmc, cmcmax, etp1, dt, zsoil, &
3148 & sh2o, smcmax, smcwlt, smcref, smcdry, pc, &
3149 & shdfac, cfactr, rtdis, fxexp, &
3151 & eta1, edir1, ec1, et1, ett1 &
3197 integer,
intent(in) :: nsoil, nroot
3199 real (kind=kind_phys),
intent(in) :: cmc, cmcmax, etp1, dt, pc, &
3200 & smcmax, smcwlt, smcref, smcdry, shdfac, cfactr, fxexp, &
3201 & zsoil(nsoil), sh2o(nsoil), rtdis(nsoil)
3204 real (kind=kind_phys),
intent(out) :: eta1, edir1, ec1, ett1, &
3208 real (kind=kind_phys) :: cmc2ms
3226 if (etp1 > 0.0)
then
3232 if (shdfac < 1.0)
then
3236 & ( etp1, sh2o(1), shdfac, smcmax, smcdry, fxexp, &
3246 if (shdfac > 0.0)
then
3250 & ( nsoil, nroot, etp1, sh2o, smcwlt, smcref, &
3251 & cmc, cmcmax, zsoil, shdfac, pc, cfactr, rtdis, &
3257 ett1 = ett1 + et1(k)
3264 ec1 = shdfac * ( (cmc/cmcmax)**cfactr ) * etp1
3273 ec1 = min( cmc2ms, ec1 )
3280 eta1 = edir1 + ett1 + ec1
3284 end subroutine evapo
3295 & ( nsoil, smc, smcmax, dt, yy, zz1, zsoil, zbot, &
3296 & psisat, bexp, df1, ice, quartz, csoil, vegtyp, &
3297 & shdfac, lheatstrg, &
3299 & stc, t1, tbot, sh2o, &
3348 real (kind=kind_phys),
parameter :: ctfil1 = 0.5
3349 real (kind=kind_phys),
parameter :: ctfil2 = 1.0 - ctfil1
3352 integer,
intent(in) :: nsoil, ice, vegtyp
3354 real (kind=kind_phys),
intent(in) :: smc(nsoil), smcmax, dt, yy, &
3355 & zz1, zsoil(nsoil), zbot, psisat, bexp, df1, quartz, csoil, &
3358 logical,
intent(in) :: lheatstrg
3361 real (kind=kind_phys),
intent(inout) :: stc(nsoil), t1, tbot, &
3365 real (kind=kind_phys),
intent(out) :: ssoil
3368 real (kind=kind_phys) :: ai(nsold), bi(nsold), ci(nsold), oldt1, &
3369 & rhsts(nsold), stcf(nsold), stsoil(nsoil)
3389 & ( nsoil, stc, zsoil, yy, zz1, df1, ice, &
3393 & rhsts, ai, bi, ci &
3398 & ( nsoil, stc, dt, &
3400 & rhsts, ai, bi, ci, &
3411 & ( nsoil, stc, smc, smcmax, zsoil, yy, zz1, tbot, &
3412 & zbot, psisat, dt, bexp, df1, quartz, csoil,vegtyp, &
3413 & shdfac, lheatstrg, &
3417 & rhsts, ai, bi, ci &
3422 & ( nsoil, stc, dt, &
3424 & rhsts, ai, bi, ci, &
3441 t1 = (yy + (zz1 - 1.0)*stc(1)) / zz1
3442 t1 = ctfil1*t1 + ctfil2*oldt1
3445 stc(i) = ctfil1*stc(i) + ctfil2*stsoil(i)
3450 ssoil = df1*(stc(1) - t1) / (0.5*zsoil(1))
3454 end subroutine shflx
3468 & ( nsoil, dt, kdt, smcmax, smcwlt, cmcmax, prcp1, &
3469 & zsoil, slope, frzx, bexp, dksat, dwsat, shdfac, &
3470 & edir1, ec1, et1, &
3474 & runoff1, runoff2, runoff3, drip &
3524 integer,
intent(in) :: nsoil
3526 real (kind=kind_phys),
intent(in) :: dt, kdt, smcmax, smcwlt, &
3527 & cmcmax, prcp1, slope, frzx, bexp, dksat, dwsat, shdfac, &
3528 & edir1, ec1, et1(nsoil), zsoil(nsoil)
3531 real (kind=kind_phys),
intent(inout) :: cmc, sh2o(nsoil), &
3535 real (kind=kind_phys),
intent(out) :: runoff1, runoff2, &
3539 real (kind=kind_phys) :: dummy, excess, pcpdrp, rhsct, trhsct, &
3540 & rhstt(nsold), sice(nsold), sh2oa(nsold), sh2ofg(nsold), &
3541 & ai(nsold), bi(nsold), ci(nsold)
3553 rhsct = shdfac*prcp1 - ec1
3561 excess = cmc + trhsct
3563 if (excess > cmcmax) drip = excess - cmcmax
3568 pcpdrp = (1.0 - shdfac)*prcp1 + drip/dt
3573 sice(i) = smc(i) - sh2o(i)
3597 if ( (pcpdrp*dt) > (0.001*1000.0*(-zsoil(1))*smcmax) )
then
3606 & ( nsoil, edir1, et1, sh2o, sh2o, pcpdrp, zsoil, dwsat, &
3607 & dksat, smcmax, bexp, dt, smcwlt, slope, kdt, frzx, sice, &
3609 & rhstt, runoff1, runoff2, ai, bi, ci &
3614 & ( nsoil, sh2o, rhsct, dt, smcmax, cmcmax, zsoil, sice, &
3616 & dummy, rhstt, ai, bi, ci, &
3618 & sh2ofg, runoff3, smc &
3622 sh2oa(k) = (sh2o(k) + sh2ofg(k)) * 0.5
3627 & ( nsoil, edir1, et1, sh2o, sh2oa, pcpdrp, zsoil, dwsat, &
3628 & dksat, smcmax, bexp, dt, smcwlt, slope, kdt, frzx, sice, &
3630 & rhstt, runoff1, runoff2, ai, bi, ci &
3635 & ( nsoil, sh2o, rhsct, dt, smcmax, cmcmax, zsoil, sice, &
3637 & cmc, rhstt, ai, bi, ci, &
3639 & sh2o, runoff3, smc &
3646 & ( nsoil, edir1, et1, sh2o, sh2o, pcpdrp, zsoil, dwsat, &
3647 & dksat, smcmax, bexp, dt, smcwlt, slope, kdt, frzx, sice, &
3649 & rhstt, runoff1, runoff2, ai, bi, ci &
3654 & ( nsoil, sh2o, rhsct, dt, smcmax, cmcmax, zsoil, sice, &
3656 & cmc, rhstt, ai, bi, ci, &
3658 & sh2o, runoff3, smc &
3666 end subroutine smflx
3677 subroutine snowpack &
3679 & ( esd, dtsec, tsnow, tsoil, &
3713 real (kind=kind_phys),
parameter :: c1 = 0.01
3714 real (kind=kind_phys),
parameter :: c2 = 21.0
3717 real (kind=kind_phys),
intent(in) :: esd, dtsec, tsnow, tsoil
3720 real (kind=kind_phys),
intent(inout) :: snowh, sndens
3723 real (kind=kind_phys) :: bfac, dsx, dthr, dw, snowhc, pexp, &
3724 & tavgc, tsnowc, tsoilc, esdc, esdcx
3732 snowhc = snowh * 100.0
3734 dthr = dtsec / 3600.0
3735 tsnowc = tsnow - tfreez
3736 tsoilc = tsoil - tfreez
3740 tavgc = 0.5 * (tsnowc + tsoilc)
3750 if (esdc > 1.e-2)
then
3756 bfac = dthr*c1 * exp(0.08*tavgc - c2*sndens)
3781 pexp = (1.0 + pexp)*bfac*esdcx/real(j+1)
3806 dsx = max( min( dsx, 0.40 ), 0.05 )
3813 if (tsnowc >= 0.0)
then
3814 dw = 0.13 * dthr / 24.0
3815 sndens = sndens*(1.0 - dw) + dw
3816 if (sndens > 0.40) sndens = 0.40
3822 snowhc = esdc / sndens
3823 snowh = snowhc * 0.01
3827 end subroutine snowpack
3841 & ( etp1, smc, shdfac, smcmax, smcdry, fxexp, &
3871 real (kind=kind_phys),
intent(in) :: etp1, smc, shdfac, smcmax, &
3875 real (kind=kind_phys),
intent(out) :: edir1
3878 real (kind=kind_phys) :: fx, sratio
3887 sratio = (smc - smcdry) / (smcmax - smcdry)
3889 if (sratio > 0.0)
then
3891 fx = max( min( fx, 1.0 ), 0.0 )
3898 edir1 = fx * ( 1.0 - shdfac ) * etp1
3901 end subroutine devap
3920 & ( tkelv, smc, sh2o, smcmax, bexp, psis, &
3960 real (kind=kind_phys),
parameter :: ck = 8.0
3962 real (kind=kind_phys),
parameter :: blim = 5.5
3963 real (kind=kind_phys),
parameter :: error = 0.005
3966 real (kind=kind_phys),
intent(in) :: tkelv, smc, sh2o, smcmax, &
3970 real (kind=kind_phys),
intent(out) :: liqwat
3973 real (kind=kind_phys) :: bx, denom, df, dswl, fk, swl, swlk
3975 integer :: nlog, kcount
3984 if (bexp > blim) bx = blim
3993 if (tkelv > (tfreez-1.e-3))
then
4010 swl = max( min( swl, smc-0.02 ), 0.0 )
4014 do while ( (nlog < 10) .and. (kcount == 0) )
4017 df = log( (psis*gs2/lsubf) * ( (1.0 + ck*swl)**2.0 ) &
4018 & * (smcmax/(smc-swl))**bx ) - log(-(tkelv-tfreez)/tkelv)
4020 denom = 2.0*ck/(1.0 + ck*swl) + bx/(smc - swl)
4021 swlk = swl - df/denom
4025 swlk = max( min( swlk, smc-0.02 ), 0.0 )
4029 dswl = abs(swlk - swl)
4035 if ( dswl <= error )
then
4050 if (kcount == 0)
then
4051 fk = ( ( (lsubf/(gs2*(-psis))) &
4052 & * ((tkelv-tfreez)/tkelv) )**(-1/bx) ) * smcmax
4054 fk = max( fk, 0.02 )
4056 liqwat = min( fk, smc )
4062 end subroutine frh2o
4074 & ( nsoil, stc, smc, smcmax, zsoil, yy, zz1, tbot, &
4075 & zbot, psisat, dt, bexp, df1, quartz, csoil, vegtyp, &
4076 & shdfac, lheatstrg, &
4080 & rhsts, ai, bi, ci &
4129 integer,
intent(in) :: nsoil, vegtyp
4131 real (kind=kind_phys),
intent(in) :: stc(nsoil), smc(nsoil), &
4132 & smcmax, zsoil(nsoil), yy, zz1, tbot, zbot, psisat, dt, &
4133 & bexp, df1, quartz, csoil, shdfac
4135 logical,
intent(in) :: lheatstrg
4138 real (kind=kind_phys),
intent(inout) :: sh2o(nsoil)
4141 real (kind=kind_phys),
intent(out) :: rhsts(nsoil), ai(nsold), &
4142 & bi(nsold), ci(nsold)
4145 real (kind=kind_phys) :: ddz, ddz2, denom, df1n, df1k, dtsdz, &
4146 & dtsdz2, hcpct, qtot, ssoil, sice, tavg, tbk, tbk1, &
4147 & tsnsr, tsurf, csoil_loc
4158 if (.not.lheatstrg .and. ivegsrc == 1)
then
4163 if( vegtyp == 13 )
then
4165 csoil_loc=3.0e6*(1.-shdfac)+csoil*shdfac
4178 hcpct = sh2o(1)*cph2o2 + (1.0 - smcmax)*csoil_loc &
4179 & + (smcmax - smc(1))*cp2 + (smc(1) - sh2o(1))*cpice1
4183 ddz = 1.0 / ( -0.5*zsoil(2) )
4185 ci(1) = (df1*ddz) / ( zsoil(1)*hcpct )
4186 bi(1) = -ci(1) + df1 / ( 0.5*zsoil(1)*zsoil(1)*hcpct*zz1 )
4193 dtsdz = (stc(1) - stc(2)) / (-0.5*zsoil(2))
4194 ssoil = df1 * (stc(1) - yy) / (0.5*zsoil(1)*zz1)
4195 rhsts(1) = (df1*dtsdz - ssoil) / (zsoil(1)*hcpct)
4201 qtot = ssoil - df1*dtsdz
4214 tsurf = (yy + (zz1-1)*stc(1)) / zz1
4218 & ( stc(1), stc(2), zsoil, zbot, 1, nsoil, &
4227 sice = smc(1) - sh2o(1)
4234 if ( (sice > 0.0) .or. (tsurf < tfreez) .or. &
4235 & (stc(1) < tfreez) .or. (tbk < tfreez) )
then
4241 & ( tsurf, stc(1), tbk, zsoil, nsoil, 1, &
4254 & ( nsoil, 1, tavg, smc(1), smcmax, psisat, bexp, dt, &
4263 rhsts(1) = rhsts(1) - tsnsr / ( zsoil(1)*hcpct )
4282 hcpct = sh2o(k)*cph2o2 + (1.0 - smcmax)*csoil_loc &
4283 & + (smcmax - smc(k))*cp2 + (smc(k) - sh2o(k))*cpice1
4285 if (k /= nsoil)
then
4292 & ( smc(k), quartz, smcmax, sh2o(k), &
4304 if((.not.lheatstrg) .and.
4305 & (ivegsrc == 1 .and. vegtyp == 13))
then
4306 df1n = 3.24*(1.-shdfac) + shdfac*df1n
4311 denom = 0.5 * (zsoil(k-1) - zsoil(k+1))
4312 dtsdz2 = (stc(k) - stc(k+1)) / denom
4316 ddz2 = 2.0 / (zsoil(k-1) - zsoil(k+1))
4317 ci(k) = -df1n*ddz2 / ((zsoil(k-1) - zsoil(k)) * hcpct)
4326 & ( stc(k), stc(k+1), zsoil, zbot, k, nsoil, &
4340 & ( smc(k), quartz, smcmax, sh2o(k), &
4352 if((.not.lheatstrg) .and.
4353 & (ivegsrc == 1 .and. vegtyp == 13))
then
4354 df1n = 3.24*(1.-shdfac) + shdfac*df1n
4359 denom = 0.5 * (zsoil(k-1) + zsoil(k)) - zbot
4360 dtsdz2 = (stc(k) - tbot) / denom
4373 & ( stc(k), tbot, zsoil, zbot, k, nsoil, &
4384 denom = (zsoil(k) - zsoil(k-1)) * hcpct
4385 rhsts(k) = ( df1n*dtsdz2 - df1k*dtsdz ) / denom
4387 qtot = -1.0 * denom * rhsts(k)
4388 sice = smc(k) - sh2o(k)
4390 if ( (sice > 0.0) .or. (tbk < tfreez) .or. &
4391 & (stc(k) < tfreez) .or. (tbk1 < tfreez) )
then
4397 & ( tbk, stc(k), tbk1, zsoil, nsoil, k, &
4408 & ( nsoil, k, tavg, smc(k), smcmax, psisat, bexp, dt, &
4416 rhsts(k) = rhsts(k) - tsnsr/denom
4421 ai(k) = - df1 * ddz / ((zsoil(k-1) - zsoil(k)) * hcpct)
4422 bi(k) = -(ai(k) + ci(k))
4446 & ( nsoil, stc, zsoil, yy, zz1, df1, ice, &
4450 & rhsts, ai, bi, ci &
4489 integer,
intent(in) :: nsoil, ice
4491 real (kind=kind_phys),
intent(in) :: stc(nsoil), zsoil(nsoil), &
4495 real (kind=kind_phys),
intent(inout) :: tbot
4498 real (kind=kind_phys),
intent(out) :: rhsts(nsoil), ai(nsold), &
4499 & bi(nsold), ci(nsold)
4502 real (kind=kind_phys) :: ddz, ddz2, denom, dtsdz, dtsdz2, &
4503 & hcpct, ssoil, zbot
4545 ddz = 1.0 / (-0.5*zsoil(2))
4547 ci(1) = (df1*ddz) / (zsoil(1)*hcpct)
4548 bi(1) = -ci(1) + df1 / (0.5*zsoil(1)*zsoil(1)*hcpct*zz1)
4554 dtsdz = (stc(1) - stc(2)) / (-0.5*zsoil(2))
4555 ssoil = df1 * (stc(1) - yy) / (0.5*zsoil(1)*zz1)
4556 rhsts(1) = (df1*dtsdz - ssoil) / (zsoil(1)*hcpct)
4566 if (k /= nsoil)
then
4570 denom = 0.5 * (zsoil(k-1) - zsoil(k+1))
4571 dtsdz2 = (stc(k) - stc(k+1)) / denom
4575 ddz2 = 2.0 / (zsoil(k-1) - zsoil(k+1))
4576 ci(k) = -df1*ddz2 / ((zsoil(k-1) - zsoil(k))*hcpct)
4582 dtsdz2 = (stc(k) - tbot) &
4583 & / (0.5*(zsoil(k-1) + zsoil(k)) - zbot)
4593 denom = (zsoil(k) - zsoil(k-1)) * hcpct
4594 rhsts(k) = (df1*dtsdz2 - df1*dtsdz) / denom
4598 ai(k) = - df1*ddz / ((zsoil(k-1) - zsoil(k)) * hcpct)
4599 bi(k) = -(ai(k) + ci(k))
4609 end subroutine hrtice
4618 & ( nsoil, stcin, dt, &
4620 & rhsts, ai, bi, ci, &
4652 integer,
intent(in) :: nsoil
4654 real (kind=kind_phys),
intent(in) :: stcin(nsoil), dt
4657 real (kind=kind_phys),
intent(inout) :: rhsts(nsoil), &
4658 & ai(nsold), bi(nsold), ci(nsold)
4661 real (kind=kind_phys),
intent(out) :: stcout(nsoil)
4666 real (kind=kind_phys) :: ciin(nsold), rhstsin(nsoil)
4674 rhsts(k) = rhsts(k) * dt
4676 bi(k) = 1.0 + bi(k)*dt
4683 rhstsin(k) = rhsts(k)
4694 & ( nsoil, ai, bi, rhstsin, &
4704 stcout(k) = stcin(k) + ci(k)
4708 end subroutine hstep
4717 & ( nsoil, a, b, d, &
4765 integer,
intent(in) :: nsoil
4767 real (kind=kind_phys),
dimension(nsoil),
intent(in) :: a, b, d
4770 real (kind=kind_phys),
dimension(nsoil),
intent(inout) :: c
4773 real (kind=kind_phys),
dimension(nsoil),
intent(out) :: p, delta
4788 delta(1) = d(1) / b(1)
4793 p(k) = -c(k) * ( 1.0 / (b(k) + a(k)*p(k-1)) )
4794 delta(k) = (d(k) - a(k)*delta(k-1)) &
4795 & * ( 1.0 / (b(k) + a(k)*p(k-1)) )
4800 p(nsoil) = delta(nsoil)
4806 p(kk) = p(kk)*p(kk+1) + delta(kk)
4810 end subroutine rosr12
4819 & ( nsoil, k, tavg, smc, smcmax, psisat, bexp, dt, &
4859 real (kind=kind_phys),
parameter :: dh2o = 1.0000e3
4862 integer,
intent(in) :: nsoil, k
4864 real (kind=kind_phys),
intent(in) :: tavg, smc, smcmax, psisat, &
4865 & bexp, dt, qtot, zsoil(nsoil)
4868 real (kind=kind_phys),
intent(inout) :: sh2o
4871 real (kind=kind_phys),
intent(out) :: tsrc
4874 real (kind=kind_phys) :: dz, free, xh2o
4884 dz = zsoil(k-1) - zsoil(k)
4897 & ( tavg, smc, sh2o, smcmax, bexp, psisat, &
4911 xh2o = sh2o + qtot*dt / (dh2o*lsubf*dz)
4917 if ( xh2o < sh2o .and. xh2o < free)
then
4918 if ( free > sh2o )
then
4929 if ( xh2o > sh2o .and. xh2o > free )
then
4930 if ( free < sh2o )
then
4937 xh2o = max( min( xh2o, smc ), 0.0 )
4942 tsrc = -dh2o * lsubf * dz * (xh2o - sh2o) / dt
4946 end subroutine snksrc
4958 & ( nsoil, edir, et, sh2o, sh2oa, pcpdrp, zsoil, dwsat, &
4959 & dksat, smcmax, bexp, dt, smcwlt, slope, kdt, frzx, sice, &
4961 & rhstt, runoff1, runoff2, ai, bi, ci &
5006 integer,
intent(in) :: nsoil
5008 real (kind=kind_phys),
dimension(nsoil),
intent(in) :: et, &
5009 & sh2o, sh2oa, zsoil, sice
5011 real (kind=kind_phys),
intent(in) :: edir, pcpdrp, dwsat, dksat, &
5012 & smcmax, smcwlt, bexp, dt, slope, kdt, frzx
5015 real (kind=kind_phys),
intent(out) :: runoff1, runoff2, &
5016 & rhstt(nsoil), ai(nsold), bi(nsold), ci(nsold)
5020 real (kind=kind_phys) :: acrt, dd, ddt, ddz, ddz2, denom, denom2, &
5021 & dice, dsmdz, dsmdz2, dt1, fcr, infmax, mxsmc, mxsmc2, px, &
5022 & numer, pddum, sicemax, slopx, smcav, sstt, sum, val, wcnd, &
5023 & wcnd2, wdf, wdf2, dmax(nsold)
5025 integer :: cvfrz, ialp1, iohinf, j, jj, k, ks
5038 parameter(cvfrz = 3)
5040c ----------------------------------------------------------------------
5052 if (sice(ks) > sicemax) sicemax = sice(ks)
5060 if (pcpdrp /= 0.0)
then
5065 smcav = smcmax - smcwlt
5066 dmax(1) = -zsoil(1) * smcav
5070 dice = -zsoil(1) * sice(1)
5072 dmax(1) = dmax(1)*(1.0 - (sh2oa(1)+sice(1)-smcwlt)/smcav)
5079 dice = dice + ( zsoil(ks-1) - zsoil(ks) ) * sice(ks)
5081 dmax(ks) = (zsoil(ks-1)-zsoil(ks))*smcav
5082 dmax(ks) = dmax(ks)*(1.0 - (sh2oa(ks)+sice(ks)-smcwlt)/smcav)
5089 val = 1.0 - exp(-kdt*dt1)
5093 if (px < 0.0) px = 0.0
5095 infmax = (px*(ddt/(px+ddt)))/dt
5102 if (dice > 1.e-2)
then
5103 acrt = cvfrz * frzx / dice
5114 sum = sum + (acrt**( cvfrz-j)) / float(k)
5117 fcr = 1.0 - exp(-acrt) * sum
5120 infmax = infmax * fcr
5131 & ( mxsmc, smcmax, bexp, dksat, dwsat, sicemax, &
5136 infmax = max( infmax, wcnd )
5137 infmax = min( infmax, px )
5139 if (pcpdrp > infmax)
then
5140 runoff1 = pcpdrp - infmax
5154 & ( mxsmc, smcmax, bexp, dksat, dwsat, sicemax, &
5161 ddz = 1.0 / ( -.5*zsoil(2) )
5163 bi(1) = wdf * ddz / ( -zsoil(1) )
5169 dsmdz = ( sh2o(1) - sh2o(2) ) / ( -.5*zsoil(2) )
5170 rhstt(1) = (wdf*dsmdz + wcnd - pddum + edir + et(1)) / zsoil(1)
5171 sstt = wdf * dsmdz + wcnd + edir + et(1)
5180 denom2 = (zsoil(k-1) - zsoil(k))
5182 if (k /= nsoil)
then
5193 & ( mxsmc2, smcmax, bexp, dksat, dwsat, sicemax, &
5200 denom = (zsoil(k-1) - zsoil(k+1))
5201 dsmdz2 = (sh2o(k) - sh2o(k+1)) / (denom * 0.5)
5206 ci(k) = -wdf2 * ddz2 / denom2
5219 & ( sh2oa(nsoil), smcmax, bexp, dksat, dwsat, sicemax, &
5235 numer = wdf2*dsmdz2 + slopx*wcnd2 - wdf*dsmdz - wcnd + et(k)
5236 rhstt(k) = numer / (-denom2)
5240 ai(k) = -wdf * ddz / denom2
5241 bi(k) = -( ai(k) + ci(k) )
5246 if (k == nsoil)
then
5247 runoff2 = slopx * wcnd2
5250 if (k /= nsoil)
then
5269 & ( nsoil, sh2oin, rhsct, dt, smcmax, cmcmax, zsoil, sice, &
5271 & cmc, rhstt, ai, bi, ci, &
5273 & sh2oout, runoff3, smc &
5311 integer,
intent(in) :: nsoil
5313 real (kind=kind_phys),
dimension(nsoil),
intent(in) :: sh2oin, &
5316 real (kind=kind_phys),
intent(in) :: rhsct, dt, smcmax, cmcmax
5319 real (kind=kind_phys),
intent(inout) :: cmc, rhstt(nsoil), &
5320 & ai(nsold), bi(nsold), ci(nsold)
5323 real (kind=kind_phys),
intent(out) :: sh2oout(nsoil), runoff3, &
5327 real (kind=kind_phys) :: ciin(nsold), rhsttin(nsoil), ddz, stot, &
5330 integer :: i, k, kk11
5338 rhstt(k) = rhstt(k) * dt
5340 bi(k) = 1. + bi(k) * dt
5347 rhsttin(k) = rhstt(k)
5358 & ( nsoil, ai, bi, rhsttin, &
5374 if (k /= 1) ddz = zsoil(k - 1) - zsoil(k)
5376 sh2oout(k) = sh2oin(k) + ci(k) + wplus/ddz
5378 stot = sh2oout(k) + sice(k)
5379 if (stot > smcmax)
then
5384 ddz = -zsoil(k) + zsoil(kk11)
5387 wplus = (stot - smcmax) * ddz
5392 smc(k) = max( min( stot, smcmax ), 0.02 )
5393 sh2oout(k) = max( smc(k)-sice(k), 0.0 )
5401 cmc = cmc + dt*rhsct
5402 if (cmc < 1.e-20) cmc = 0.0
5403 cmc = min( cmc, cmcmax )
5406 end subroutine sstep
5416 & ( tu, tb, zsoil, zbot, k, nsoil, &
5445 integer,
intent(in) :: k, nsoil
5447 real (kind=kind_phys),
intent(in) :: tu, tb, zbot, zsoil(nsoil)
5450 real (kind=kind_phys),
intent(out) :: tbnd1
5453 real (kind=kind_phys) :: zb, zup
5466 if (k == nsoil)
then
5467 zb = 2.0*zbot - zsoil(k)
5474 tbnd1 = tu + (tb-tu)*(zup-zsoil(k))/(zup-zb)
5490 & ( tup, tm, tdn, zsoil, nsoil, k, &
5522 integer,
intent(in) :: nsoil, k
5524 real (kind=kind_phys),
intent(in) :: tup, tm, tdn, zsoil(nsoil)
5527 real (kind=kind_phys),
intent(out) :: tavg
5530 real (kind=kind_phys) :: dz, dzh, x0, xdn, xup
5537 dz = zsoil(k-1) - zsoil(k)
5542 if (tup < tfreez)
then
5544 if (tm < tfreez)
then
5545 if (tdn < tfreez)
then
5546 tavg = (tup + 2.0*tm + tdn) / 4.0
5548 x0 = (tfreez - tm) * dzh / (tdn - tm)
5549 tavg = 0.5*(tup*dzh + tm*(dzh+x0)+tfreez*(2.*dzh-x0)) / dz
5552 if (tdn < tfreez)
then
5553 xup = (tfreez-tup) * dzh / (tm-tup)
5554 xdn = dzh - (tfreez-tm) * dzh / (tdn-tm)
5555 tavg = 0.5*(tup*xup + tfreez*(2.*dz-xup-xdn)+tdn*xdn) / dz
5557 xup = (tfreez-tup) * dzh / (tm-tup)
5558 tavg = 0.5*(tup*xup + tfreez*(2.*dz-xup)) / dz
5564 if (tm < tfreez)
then
5565 if (tdn < tfreez)
then
5566 xup = dzh - (tfreez-tup) * dzh / (tm-tup)
5567 tavg = 0.5*(tfreez*(dz-xup) + tm*(dzh+xup)+tdn*dzh) / dz
5569 xup = dzh - (tfreez-tup) * dzh / (tm-tup)
5570 xdn = (tfreez-tm) * dzh / (tdn-tm)
5571 tavg = 0.5 * (tfreez*(2.*dz-xup-xdn) + tm*(xup+xdn)) / dz
5574 if (tdn < tfreez)
then
5575 xdn = dzh - (tfreez-tm) * dzh / (tdn-tm)
5576 tavg = (tfreez*(dz-xdn) + 0.5*(tfreez+tdn)*xdn) / dz
5578 tavg = (tup + 2.0*tm + tdn) / 4.0
5585 end subroutine tmpavg
5594 & ( nsoil, nroot, etp1, smc, smcwlt, smcref, &
5595 & cmc, cmcmax, zsoil, shdfac, pc, cfactr, rtdis, &
5630 integer,
intent(in) :: nsoil, nroot
5632 real (kind=kind_phys),
intent(in) :: etp1, smcwlt, smcref, &
5633 & cmc, cmcmax, shdfac, pc, cfactr
5635 real (kind=kind_phys),
dimension(nsoil),
intent(in) :: smc, &
5639 real (kind=kind_phys),
dimension(nsoil),
intent(out) :: et1
5642 real (kind=kind_phys) :: denom, etp1a, rtx, sgx, gx(7)
5660 if (cmc /= 0.0)
then
5661 etp1a = shdfac * pc * etp1 * (1.0 - (cmc /cmcmax) ** cfactr)
5663 etp1a = shdfac * pc * etp1
5668 gx(i) = ( smc(i) - smcwlt ) / ( smcref - smcwlt )
5669 gx(i) = max( min( gx(i), 1.0 ), 0.0 )
5676 rtx = rtdis(i) + gx(i) - sgx
5677 gx(i) = gx(i) * max( rtx, 0.0 )
5678 denom = denom + gx(i)
5680 if (denom <= 0.0) denom = 1.0
5683 et1(i) = etp1a * gx(i) / denom
5717 end subroutine transp
5727 & ( smc, smcmax, bexp, dksat, dwsat, sicemax, &
5757 real (kind=kind_phys),
intent(in) :: smc, smcmax, bexp, dksat, &
5761 real (kind=kind_phys),
intent(out) :: wdf, wcnd
5764 real (kind=kind_phys) :: expon, factr1, factr2, vkwgt
5770 factr1 = min(1.0, max(0.0, 0.2/smcmax))
5771 factr2 = min(1.0, max(0.0, smc/smcmax))
5776 wdf = dwsat * factr2 ** expon
5789 if (sicemax > 0.0)
then
5790 vkwgt = 1.0 / (1.0 + (500.0*sicemax)**3.0)
5791 wdf = vkwgt*wdf + (1.0- vkwgt)*dwsat*factr1**expon
5796 expon = (2.0 * bexp) + 3.0
5797 wcnd = dksat * factr2 ** expon
5800 end subroutine wdfcnd