CCPP SciDoc v7.0.x  v7.0.0
Common Community Physics Package Developed at DTC
 
Loading...
Searching...
No Matches
sflx.f
1
3
5 module sflx
6 contains
116 subroutine gfssflx &! --- inputs:
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, &
122 & bexpp, xlaip, & ! sfc-perts, mgehne
123 & lheatstrg, &! --- input/outputs:
124 & tbot, cmc, t1, stc, smc, sh2o, sneqv, ch, cm,z0, &! --- outputs:
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, &
130 & errmsg, errflg )
131
132! ===================================================================== !
133! description: !
134! !
135! subroutine sflx - version 2.7: !
136! sub-driver for "noah/osu lsm" family of physics subroutines for a !
137! soil/veg/snowpack land-surface model to update soil moisture, soil !
138! ice, soil temperature, skin temperature, snowpack water content, !
139! snowdepth, and all terms of the surface energy balance and surface !
140! water balance (excluding input atmospheric forcings of downward !
141! radiation and precip) !
142! !
143! usage: !
144! !
145! call sflx !
146! --- inputs: !
147! ( nsoil, couple, icein, ffrozp, dt, zlvl, sldpth, !
148! swdn, swnet, lwdn, sfcems, sfcprs, sfctmp, !
149! sfcspd, prcp, q2, q2sat, dqsdt2, th2,ivegsrc, !
150! vegtyp, soiltyp, slopetyp, shdmin, alb, snoalb, !
151! --- input/outputs: !
152! tbot, cmc, t1, stc, smc, sh2o, sneqv, ch, cm, !
153! --- outputs: !
154! nroot, shdfac, snowh, albedo, eta, sheat, ec, !
155! edir, et, ett, esnow, drip, dew, beta, etp, ssoil, !
156! flx1, flx2, flx3, runoff1, runoff2, runoff3, !
157! snomlt, sncovr, rc, pc, rsmin, xlai, rcs, rct, rcq, !
158! rcsoil, soilw, soilm, smcwlt, smcdry, smcref, smcmax ) !
159! !
160! !
161! subprograms called: redprm, snow_new, csnow, snfrac, alcalc, !
162! tdfcnd, snowz0, sfcdif, penman, canres, nopac, snopac. !
163! !
164! !
165! program history log: !
166! jun 2003 -- k. mitchell et. al -- created version 2.7 !
167! 200x -- sarah lu modified the code including: !
168! added passing argument, couple; replaced soldn !
169! and solnet by radflx; call sfcdif if couple=0; !
170! apply time filter to stc and tskin; and the !
171! way of namelist inport. !
172! feb 2004 -- m. ek noah v2.7.1 non-linear weighting of snow vs !
173! non-snow covered portions of gridbox !
174! apr 2009 -- y.-t. hou added lw surface emissivity effect, !
175! streamlined and reformatted the code, and !
176! consolidated constents/parameters by using !
177! module physcons, and added program documentation!
178! sep 2009 -- s. moorthi minor fixes !
179! !
180! ==================== defination of variables ==================== !
181! !
182! inputs: size !
183! nsoil - integer, number of soil layers (>=2 but <=nsold) 1 !
184! couple - integer, =0:uncoupled (land model only) 1 !
185! =1:coupled with parent atmos model !
186! icein - integer, sea-ice flag (=1: sea-ice, =0: land) 1 !
187! ffrozp - real, fractional snow/rain 1 !
188! dt - real, time step (<3600 sec) 1 !
189! zlvl - real, height abv atmos ground forcing vars (m) 1 !
190! sldpth - real, thickness of each soil layer (m) nsoil !
191! swdn - real, downward sw radiation flux (w/m**2) 1 !
192! swnet - real, downward sw net (dn-up) flux (w/m**2) 1 !
193! lwdn - real, downward lw radiation flux (w/m**2) 1 !
194! sfcems - real, sfc lw emissivity (fractional) 1 !
195! sfcprs - real, pressure at height zlvl abv ground(pascals) 1 !
196! sfctmp - real, air temp at height zlvl abv ground (k) 1 !
197! sfcspd - real, wind speed at height zlvl abv ground (m/s) 1 !
198! prcp - real, precip rate (kg m-2 s-1) 1 !
199! q2 - real, mixing ratio at hght zlvl abv grnd (kg/kg) 1 !
200! q2sat - real, sat mixing ratio at zlvl abv grnd (kg/kg) 1 !
201! dqsdt2 - real, slope of sat specific humidity curve at 1 !
202! t=sfctmp (kg kg-1 k-1) !
203! th2 - real, air potential temp at zlvl abv grnd (k) 1 !
204! ivegsrc - integer, sfc veg type data source umd or igbp !
205! vegtyp - integer, vegetation type (integer index) 1 !
206! soiltyp - integer, soil type (integer index) 1 !
207! slopetyp - integer, class of sfc slope (integer index) 1 !
208! shdmin - real, min areal coverage of green veg (fraction) 1 !
209! alb - real, bkground snow-free sfc albedo (fraction) 1 !
210! snoalb - real, max albedo over deep snow (fraction) 1 !
211! lheatstrg- logical, flag for canopy heat storage 1 !
212! parameterization !
213! !
214! input/outputs: !
215! tbot - real, bottom soil temp (k) 1 !
216! (local yearly-mean sfc air temp) !
217! cmc - real, canopy moisture content (m) 1 !
218! t1 - real, ground/canopy/snowpack eff skin temp (k) 1 !
219! stc - real, soil temp (k) nsoil !
220! smc - real, total soil moisture (vol fraction) nsoil !
221! sh2o - real, unfrozen soil moisture (vol fraction) nsoil !
222! note: frozen part = smc-sh2o !
223! sneqv - real, water-equivalent snow depth (m) 1 !
224! note: snow density = snwqv/snowh !
225! ch - real, sfc exchange coeff for heat & moisture (m/s)1 !
226! note: conductance since it's been mult by wind !
227! cm - real, sfc exchange coeff for momentum (m/s) 1 !
228! note: conductance since it's been mult by wind !
229! !
230! outputs: !
231! nroot - integer, number of root layers 1 !
232! shdfac - real, aeral coverage of green veg (fraction) 1 !
233! snowh - real, snow depth (m) 1 !
234! albedo - real, sfc albedo incl snow effect (fraction) 1 !
235! eta - real, downward latent heat flux (w/m2) 1 !
236! sheat - real, downward sensible heat flux (w/m2) 1 !
237! ec - real, canopy water evaporation (w/m2) 1 !
238! edir - real, direct soil evaporation (w/m2) 1 !
239! et - real, plant transpiration (w/m2) nsoil !
240! ett - real, total plant transpiration (w/m2) 1 !
241! esnow - real, sublimation from snowpack (w/m2) 1 !
242! drip - real, through-fall of precip and/or dew in excess 1 !
243! of canopy water-holding capacity (m) !
244! dew - real, dewfall (or frostfall for t<273.15) (m) 1 !
245! beta - real, ratio of actual/potential evap 1 !
246! etp - real, potential evaporation (w/m2) 1 !
247! ssoil - real, upward soil heat flux (w/m2) 1 !
248! flx1 - real, precip-snow sfc flux (w/m2) 1 !
249! flx2 - real, freezing rain latent heat flux (w/m2) 1 !
250! flx3 - real, phase-change heat flux from snowmelt (w/m2) 1 !
251! snomlt - real, snow melt (m) (water equivalent) 1 !
252! sncovr - real, fractional snow cover 1 !
253! runoff1 - real, surface runoff (m/s) not infiltrating sfc 1 !
254! runoff2 - real, sub sfc runoff (m/s) (baseflow) 1 !
255! runoff3 - real, excess of porosity for a given soil layer 1 !
256! rc - real, canopy resistance (s/m) 1 !
257! pc - real, plant coeff (fraction) where pc*etp=transpi 1 !
258! rsmin - real, minimum canopy resistance (s/m) 1 !
259! xlai - real, leaf area index (dimensionless) 1 !
260! rcs - real, incoming solar rc factor (dimensionless) 1 !
261! rct - real, air temp rc factor (dimensionless) 1 !
262! rcq - real, atoms vapor press deficit rc factor 1 !
263! rcsoil - real, soil moisture rc factor (dimensionless) 1 !
264! soilw - real, available soil mois in root zone 1 !
265! soilm - real, total soil column mois (frozen+unfrozen) (m)1 !
266! smcwlt - real, wilting point (volumetric) 1 !
267! smcdry - real, dry soil mois threshold (volumetric) 1 !
268! smcref - real, soil mois threshold (volumetric) 1 !
269! smcmax - real, porosity (sat val of soil mois) 1 !
270! !
271! ==================== end of description ===================== !
272!
273 use machine , only : kind_phys
274!
275 use physcons, only : con_cp, con_rd, con_t0c, con_g, con_pi, &
276 & con_cliq, con_csol, con_hvap, con_hfus, &
277 & con_sbc
278!
279 implicit none
280
281! --- constant parameters:
282! *** note: some of the constants are different in subprograms and need to
283! be consolidated with the standard def in module physcons at sometime
284! at the present time, those diverse values are kept temperately to
285! provide the same result as the original codes. -- y.t.h. may09
286
287 integer, parameter :: nsold = 4
288
289! real (kind=kind_phys), parameter :: gs = con_g !< con_g =9.80665
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 ! ? in sflx, snopac
296 real (kind=kind_phys), parameter :: elcp = 2.4888e+3 ! ? in penman
297! real (kind=kind_phys), parameter :: rd = con_rd ! con_rd =287.05
298 real (kind=kind_phys), parameter :: rd1 = 287.04 ! con_rd in sflx, penman, canres
299 real (kind=kind_phys), parameter :: cp = con_cp ! con_cp =1004.6
300 real (kind=kind_phys), parameter :: cp1 = 1004.5 ! con_cp in sflx, canres
301 real (kind=kind_phys), parameter :: cp2 = 1004.0 ! con_cp in htr
302! real (kind=kind_phys), parameter :: cph2o = con_cliq ! con_cliq=4.1855e+3
303 real (kind=kind_phys), parameter :: cph2o1 = 4.218e+3 ! con_cliq in penman, snopac
304 real (kind=kind_phys), parameter :: cph2o2 = 4.2e6 ! con_cliq in hrt *unit diff!
305 real (kind=kind_phys), parameter :: cpice = con_csol ! con_csol=2.106e+3
306 real (kind=kind_phys), parameter :: cpice1 = 2.106e6 ! con_csol in hrt *unit diff!
307! real (kind=kind_phys), parameter :: sigma = con_sbc ! con_sbc=5.6704e-8
308 real (kind=kind_phys), parameter :: sigma1 = 5.67e-8 ! con_sbc in penman, nopac, snopac
309
310! --- inputs:
311 integer, intent(in) :: nsoil, couple, icein, vegtyp, soiltyp, &
312 & slopetyp, ivegsrc
313
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 & !sfc-perts, mgehne
318
319 logical, intent(in) :: lheatstrg, exticeden
320
321! --- input/outputs:
322 real (kind=kind_phys), intent(inout) :: tbot, cmc, t1, sneqv, &
323 & stc(nsoil), smc(nsoil), sh2o(nsoil), ch, cm
324
325! --- outputs:
326 integer, intent(out) :: nroot
327
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, &
333 & smcmax
334 character(len=*), intent(out) :: errmsg
335 integer, intent(out) :: errflg
336
337! --- locals:
338! real (kind=kind_phys) :: df1h,
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
345
346 real (kind=kind_phys) :: shdfac0
347 real (kind=kind_phys), dimension(nsold) :: rtdis, zsoil
348
349 logical :: frzgra, snowng
350
351 integer :: ice, k, kz
352!
353!===> ... begin here
354!
355! Initialize CCPP error-handling
356 errflg = 0
357 errmsg = ''
358
359! --- ... initialization
360
361 runoff1 = 0.0
362 runoff2 = 0.0
363 runoff3 = 0.0
364 snomlt = 0.0
365 rc = 0.0
366
367! --- ... define local variable ice to achieve:
368! sea-ice case, ice = 1
369! non-glacial land, ice = 0
370! glacial-ice land, ice = -1
371! if vegtype=15 (glacial-ice), re-set ice flag = -1 (glacial-ice)
372! note - for open-sea, sflx should *not* have been called. set green
373! vegetation fraction (shdfac) = 0.
374
376 shdfac0 = shdfac
377 ice = icein
378
379 if(ivegsrc == 2) then
380 if (vegtyp == 13) then
381 ice = -1
382 shdfac = 0.0
383 endif
384 endif
385
386 if(ivegsrc == 1) then
387 if (vegtyp == 15) then
388 ice = -1
389 shdfac = 0.0
390 endif
391 endif
392
394 if (ice == 1) then
395
396 shdfac = 0.0
397
400
401 do kz = 1, nsoil
402 zsoil(kz) = -3.0 * float(kz) / float(nsoil)
403 enddo
404
405 else
406
409! note - sign of zsoil is negative (denoting below ground)
410
411 zsoil(1) = -sldpth(1)
412 do kz = 2, nsoil
413 zsoil(kz) = -sldpth(kz) + zsoil(kz-1)
414 end do
415
416 endif ! end if_ice_block
417
418! --- ... next is crucial call to set the land-surface parameters,
419! including soil-type and veg-type dependent parameters.
420! set shdfac=0.0 for bare soil surfaces
421
424 call redprm(errmsg, errflg)
425 if(errflg/=0) return
426
427 if(ivegsrc == 1) then
428!only igbp type has urban
429!urban
430 if(vegtyp == 13)then
431! shdfac=0.05
432! rsmin=400.0
433! smcmax = 0.45
434! smcref = 0.42
435! smcwlt = 0.40
436! smcdry = 0.40
437 rsmin=400.0*(1-shdfac0)+40.0*shdfac0 ! gvf
438 shdfac=shdfac0 ! gvf
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
443 endif
444 endif
445
446! --- inputs: !
447! ( nsoil, vegtyp, soiltyp, slopetyp, sldpth, zsoil, !
448! --- outputs: !
449! cfactr, cmcmax, rsmin, rsmax, topt, refkdt, kdt, !
450! sbeta, shdfac, rgl, hs, zbot, frzx, psisat, slope, !
451! snup, salp, bexp, dksat, dwsat, smcmax, smcwlt, !
452! smcref, smcdry, f1, quartz, fxexp, rtdis, nroot, !
453! z0, czil, xlai, csoil ) !
454
455! --- ... bexp sfc-perts, mgehne
465
466 if( bexpp < 0.) then
467 bexp = bexp * max(1.+bexpp, 0.)
468 endif
469 if( bexpp >= 0.) then
470 bexp = bexp * min(1.+bexpp, 2.)
471 endif
472! --- ... lai sfc-perts, mgehne
474 xlai = xlai * (1.+xlaip)
475 xlai = max(xlai, .75)
476
478
479 snowng = .false.
480 frzgra = .false.
481
486! note - runoff2 is then a negative value (as a flag) over sea-ice or
487! glacial-ice, in order to achieve water balance.
488
489 if (ice == 1) then
490
491 if (sneqv < 0.01) then
492 sneqv = 0.01
493 snowh = 0.10
494! snowh = sneqv / sndens
495 endif
496
497 elseif (ice == -1) then
498
499 if (sneqv < 0.10) then
500! sndens = sneqv / snowh
501! runoff2 = -(0.10 - sneqv) / dt
502 sneqv = 0.10
503 snowh = 1.00
504! snowh = sneqv / sndens
505 endif
506
507 endif ! end if_ice_block
508
511
512 if (ice /= 0) then
513 do kz = 1, nsoil
514 smc(kz) = 1.0
515 sh2o(kz) = 1.0
516 enddo
517 endif
518
521! (note that csnow is a function subroutine)
522
523 if (sneqv .eq. 0.0) then
524 sndens = 0.0
525 snowh = 0.0
526 sncond = 1.0
527 else
528 sndens = sneqv / snowh
529 sndens = max( 0.0, min( 1.0, sndens )) ! added by moorthi
530
531 call csnow
532! --- inputs: !
533! ( sndens, !
534! --- outputs: !
535! sncond ) !
536
537 endif
538
544
545 if (prcp > 0.0) then
546 if (ffrozp > 0.) then
547 snowng = .true.
548 else
549 if (t1 <= tfreez) frzgra = .true.
550 endif
551 endif
552
554! determine new snowfall (converting precipitation rate from
555! \f$kg m^{-2} s^{-1}\f$ to a liquid equiv snow depth in meters)
556! and add it to the existing snowpack.
559
560 if (snowng .or. frzgra) then
561
562! snowfall
563 if (snowng) then
564 sn_new = ffrozp*prcp * dt * 0.001
565 sneqv = sneqv + sn_new
566 prcp1 = (1.-ffrozp)*prcp
567 endif
568! freezing rain
569 if (frzgra) then
570 sn_new = prcp * dt * 0.001
571 sneqv = sneqv + sn_new
572 prcp1 = 0.0
573 endif
574
577 call snow_new
578! --- inputs: !
579! ( sfctmp, sn_new, rhonewsn, exticeden, !
580! --- input/outputs: !
581! snowh, sndens ) !
582
584 call csnow
585! --- inputs: !
586! ( sndens, !
587! --- outputs: !
588! sncond ) !
589
590 else
591
595
596 prcp1 = prcp
597
598 endif ! end if_snowng_block
599
602
603 if (ice /= 0) then
604
605! --- ... snow cover, albedo over sea-ice, glacial-ice
606
607 sncovr = 1.0
608 albedo = 0.65
609
610 else
611
612! --- ... non-glacial land
613! if snow depth=0, set snowcover fraction=0, albedo=snow free albedo.
614
615 if (sneqv == 0.0) then
616
617 sncovr = 0.0
618 albedo = alb
619
620 else
621
622! --- ... determine snow fraction cover.
623! determine surface albedo modification due to snowdepth state.
625 call snfrac
626! --- inputs: !
627! ( sneqv, snup, salp, snowh, !
628! --- outputs: !
629! sncovr ) !
630
633 call alcalc
634! --- inputs: !
635! ( alb, snoalb, shdfac, shdmin, sncovr, tsnow, !
636! --- outputs: !
637! albedo ) !
638
639 endif ! end if_sneqv_block
640
641 endif ! end if_ice_block
642
643! --- ... thermal conductivity for sea-ice case, glacial-ice case
646
647 if (ice /= 0) then
648
649 df1 = 2.2
650
651 else
654
655! --- ... next calculate the subsurface heat flux, which first requires
656! calculation of the thermal diffusivity. treatment of the
657! latter follows that on pages 148-149 from "heat transfer in
658! cold climates", by v. j. lunardini (published in 1981
659! by van nostrand reinhold co.) i.e. treatment of two contiguous
660! "plane parallel" mediums (namely here the first soil layer
661! and the snowpack layer, if any). this diffusivity treatment
662! behaves well for both zero and nonzero snowpack, including the
663! limit of very thin snowpack. this treatment also eliminates
664! the need to impose an arbitrary upper bound on subsurface
665! heat flux when the snowpack becomes extremely thin.
666
667! --- ... first calculate thermal diffusivity of top soil layer, using
668! both the frozen and liquid soil moisture, following the
669! soil thermal diffusivity function of peters-lidard et al.
670! (1998,jas, vol 55, 1209-1224), which requires the specifying
671! the quartz content of the given soil class (see routine redprm)
672
673 call tdfcnd &
674! --- inputs:
675 & ( smc(1), quartz, smcmax, sh2o(1), &
676! --- outputs:
677 & df1 &
678 & )
679! if(ivegsrc == 1) then
680!only igbp type has urban
681!urban
682! if ( vegtyp == 13 ) df1=3.24
683! endif
684
688!wz only urban for igbp type
689!
690!jhan urban canopy heat storage effect is included in pbl scheme
691!
692 if((.not.lheatstrg) .and. &
693 & (ivegsrc == 1 .and. vegtyp == 13)) then
694 df1 = 3.24*(1.-shdfac) + shdfac*df1*exp(sbeta*shdfac)
695 else
696 df1 = df1 * exp( sbeta*shdfac )
697 endif
698
699 endif ! end if_ice_block
700
701! --- ... finally "plane parallel" snowpack effect following
702! v.j. linardini reference cited above. note that dtot is
703! combined depth of snowdepth and thickness of first soil layer
704
705 dsoil = -0.5 * zsoil(1)
706
707 if (sneqv == 0.0) then
708
709 ssoil = df1 * (t1 - stc(1)) / dsoil
710
711 else
712
713 dtot = snowh + dsoil
714 frcsno = snowh / dtot
715 frcsoi = dsoil / dtot
716
717! --- ... 1. harmonic mean (series flow)
718
719! df1 = (sncond*df1) / (frcsoi*sncond + frcsno*df1)
720! df1h = (sncond*df1) / (frcsoi*sncond + frcsno*df1)
721
722! --- ... 2. arithmetic mean (parallel flow)
723
724! df1 = frcsno*sncond + frcsoi*df1
725 df1a = frcsno*sncond + frcsoi*df1
726
727! --- ... 3. geometric mean (intermediate between harmonic and arithmetic mean)
728
729! df1 = (sncond**frcsno) * (df1**frcsoi)
730! df1 = df1h*sncovr + df1a*(1.0-sncovr)
731! df1 = df1h*sncovr + df1 *(1.0-sncovr)
732 df1 = df1a*sncovr + df1 *(1.0-sncovr)
733
737
738 ssoil = df1 * (t1 - stc(1)) / dtot
739
740 endif ! end if_sneqv_block
741
744
745! if (couple == 0) then ! uncoupled mode
746 if (sncovr > 0.0) then
747
748 call snowz0
749! --- inputs: !
750! ( sncovr, !
751! --- input/outputs: !
752! z0 ) !
753
754 endif
755! endif
756
759
760 t2v = sfctmp * (1.0 + 0.61*q2)
761
762! --- ... next call routine sfcdif to calculate the sfc exchange coef (ch)
763! for heat and moisture.
764! note - comment out call sfcdif, if sfcdif already called in calling
765! program (such as in coupled atmospheric model).
766! - do not call sfcdif until after above call to redprm, in case
767! alternative values of roughness length (z0) and zilintinkevich
768! coef (czil) are set there via namelist i/o.
769! - routine sfcdif returns a ch that represents the wind spd times
770! the "original" nondimensional "ch" typical in literature. hence
771! the ch returned from sfcdif has units of m/s. the important
772! companion coefficient of ch, carried here as "rch", is the ch
773! from sfcdif times air density and parameter "cp". "rch" is
774! computed in "call penman". rch rather than ch is the coeff
775! usually invoked later in eqns.
776! - sfcdif also returns the surface exchange coefficient for momentum,
777! cm, also known as the surface drage coefficient, but cm is not
778! used here.
779
780! --- ... key required radiation term is the total downward radiation
781! (fdown) = net solar (swnet) + downward longwave (lwdn),
782! for use in penman ep calculation (penman) and other surface
783! energy budget calcuations. also need downward solar (swdn)
784! for canopy resistance routine (canres).
785! note - fdown, swdn are derived differently in the uncoupled and
786! coupled modes.
787
791
792 if (couple == 0) then !......uncoupled mode
793
794! --- ... uncoupled mode:
795! compute surface exchange coefficients
796
797 t1v = t1 * (1.0 + 0.61 * q2)
798 th2v = th2 * (1.0 + 0.61 * q2)
799
800 call sfcdif
801! --- inputs: !
802! ( zlvl, z0, t1v, th2v, sfcspd, czil, !
803! --- input/outputs: !
804! cm, ch ) !
805
806! swnet = net solar radiation into the ground (w/m2; dn-up) from input
807! fdown = net solar + downward lw flux at sfc (w/m2)
808
809 fdown = swnet + lwdn
810
811 else !......coupled mode
812
813! --- ... coupled mode (couple .ne. 0):
814! surface exchange coefficients computed externally and passed in,
815! hence subroutine sfcdif not called.
816
817! swnet = net solar radiation into the ground (w/m2; dn-up) from input
818! fdown = net solar + downward lw flux at sfc (w/m2)
819
820 fdown = swnet + lwdn
821
822 endif ! end if_couple_block
823
827
828 call penman
829! --- inputs: !
830! ( sfctmp, sfcprs, sfcems, ch, t2v, th2, prcp, fdown, !
831! ssoil, q2, q2sat, dqsdt2, snowng, frzgra, !
832! --- outputs: !
833! t24, etp, rch, epsca, rr, flx2 ) !
834
837
838 if (shdfac > 0.) then
839
840! --- ... frozen ground extension: total soil water "smc" was replaced
841! by unfrozen soil water "sh2o" in call to canres below
842
843 call canres
844! --- inputs: !
845! ( nsoil, nroot, swdn, ch, q2, q2sat, dqsdt2, sfctmp, !
846! sfcprs, sfcems, sh2o, smcwlt, smcref, zsoil, rsmin, !
847! rsmax, topt, rgl, hs, xlai, !
848! --- outputs: !
849! rc, pc, rcs, rct, rcq, rcsoil ) !
850
851 endif
852
855
856 esnow = 0.0
857
858 if (sneqv .eq. 0.0) then
862 call nopac
863! --- inputs: !
864! ( nsoil, nroot, etp, prcp, smcmax, smcwlt, smcref, !
865! smcdry, cmcmax, dt, shdfac, sbeta, sfctmp, sfcems, !
866! t24, th2, fdown, epsca, bexp, pc, rch, rr, cfactr, !
867! slope, kdt, frzx, psisat, zsoil, dksat, dwsat, !
868! zbot, ice, rtdis, quartz, fxexp, csoil, lheatstrg, !
869! --- input/outputs: !
870! cmc, t1, stc, sh2o, tbot, !
871! --- outputs: !
872! eta, smc, ssoil, runoff1, runoff2, runoff3, edir, !
873! ec, et, ett, beta, drip, dew, flx1, flx3 ) !
874
875 else
876
878 call snopac
879! --- inputs: !
880! ( nsoil, nroot, etp, prcp, smcmax, smcwlt, smcref, smcdry, !
881! cmcmax, dt, df1, sfcems, sfctmp, t24, th2, fdown, epsca, !
882! bexp, pc, rch, rr, cfactr, slope, kdt, frzx, psisat, !
883! zsoil, dwsat, dksat, zbot, shdfac, ice, rtdis, quartz, !
884! fxexp, csoil, flx2, snowng, lheatstrg, !
885! --- input/outputs: !
886! prcp1, cmc, t1, stc, sncovr, sneqv, sndens, snowh, !
887! sh2o, tbot, beta, !
888! --- outputs: !
889! smc, ssoil, runoff1, runoff2, runoff3, edir, ec, et, !
890! ett, snomlt, drip, dew, flx1, flx3, esnow ) !
891
892! run-total accumulated snow based on snowfall and snowmelt in [m]
893
894 endif
895
896
899
900 sheat = -(ch*cp1*sfcprs) / (rd1*t2v) * (th2 - t1)
901
904! convert eta from kg m-2 s-1 to w m-2
905! eta = eta * lsubc
906! etp = etp * lsubc
907
908 edir = edir * lsubc
909 ec = ec * lsubc
910
911 do k = 1, 4
912 et(k) = et(k) * lsubc
913 enddo
914
915 ett = ett * lsubc
916 esnow = esnow * lsubs
917 etp = etp * ((1.0 - sncovr)*lsubc + sncovr*lsubs)
918
919 if (etp > 0.) then
920 eta = edir + ec + ett + esnow
921 else
922 eta = etp
923 endif
924
925 if (etp == 0.0) then
926 beta = 0.0
927 else
928 beta = eta/etp
929 endif
930
934
935 ssoil = -1.0 * ssoil
936
937 if (ice == 0) then
938
943
944 runoff3 = runoff3 / dt
945 runoff2 = runoff2 + runoff3
946
947 else
948
953
954 runoff1 = snomlt / dt
955 endif
956
959
960 soilm = -1.0 * smc(1) * zsoil(1)
961 do k = 2, nsoil
962 soilm = soilm + smc(k)*(zsoil(k-1) - zsoil(k))
963 enddo
964
965 soilwm = -1.0 * (smcmax - smcwlt) * zsoil(1)
966 soilww = -1.0 * (smc(1) - smcwlt) * zsoil(1)
967 do k = 2, nroot
968 soilwm = soilwm + (smcmax - smcwlt) * (zsoil(k-1) - zsoil(k))
969 soilww = soilww + (smc(k) - smcwlt) * (zsoil(k-1) - zsoil(k))
970 enddo
971
972 soilw = soilww / soilwm
973!
974 return
975
976
977! =================
978 contains
979! =================
980
981!*************************************!
982! section-1 1st level subprograms !
983!*************************************!
984
985!-----------------------------------
988 subroutine alcalc
989!...................................
990! --- inputs:
991! & ( alb, snoalb, shdfac, shdmin, sncovr, tsnow, &
992! --- outputs:
993! & albedo &
994! & )
995
996! ===================================================================== !
997! description: !
998! !
999! subroutine alcalc calculates albedo including snow effect (0 -> 1) !
1000! !
1001! subprogram called: none !
1002! !
1003! !
1004! ==================== defination of variables ==================== !
1005! !
1006! inputs from calling program: size !
1007! alb - real, snowfree albedo 1 !
1008! snoalb - real, maximum (deep) snow albedo 1 !
1009! shdfac - real, areal fractional coverage of green veg. 1 !
1010! shdmin - real, minimum areal coverage of green veg. 1 !
1011! sncovr - real, fractional snow cover 1 !
1012! tsnow - real, snow surface temperature (k) 1 !
1013! !
1014! outputs to calling program: !
1015! albedo - real, surface albedo including snow effect 1 !
1016! !
1017! ==================== end of description ===================== !
1018!
1019! --- inputs:
1020! real (kind=kind_phys), intent(in) :: alb, snoalb, shdfac, &
1021! & shdmin, sncovr, tsnow
1022
1023! --- outputs:
1024! real (kind=kind_phys), intent(out) :: albedo
1025
1026! --- locals: (none)
1027
1028!
1029!===> ... begin here
1030!
1031! --- ... snoalb is argument representing maximum albedo over deep snow,
1032! as passed into sflx, and adapted from the satellite-based
1033! maximum snow albedo fields provided by d. robinson and g. kukla
1034! (1985, jcam, vol 24, 402-411)
1035
1036! albedo = alb + (1.0-(shdfac-shdmin))*sncovr*(snoalb-alb)
1037 albedo = alb + sncovr*(snoalb - alb)
1038
1039 if (albedo > snoalb) albedo = snoalb
1040
1041! --- ... base formulation (dickinson et al., 1986, cogley et al., 1990)
1042
1043! if (tsnow <= 263.16) then
1044! albedo = snoalb
1045! else
1046! if (tsnow < 273.16) then
1047! tm = 0.1 * (tsnow - 263.16)
1048! albedo = 0.5 * ((0.9 - 0.2*(tm**3)) + (0.8 - 0.16*(tm**3)))
1049! else
1050! albedo = 0.67
1051! endif
1052! endif
1053
1054! --- ... isba formulation (verseghy, 1991; baker et al., 1990)
1055
1056! if (tsnow < 273.16) then
1057! albedo = snoalb - 0.008*dt/86400
1058! else
1059! albedo = (snoalb - 0.5) * exp( -0.24*dt/86400 ) + 0.5
1060! endif
1061
1062!
1063!...................................
1064 end subroutine alcalc
1065!-----------------------------------
1066
1067
1068!-----------------------------------
1074 subroutine canres
1075! --- inputs:
1076! & ( nsoil, nroot, swdn, ch, q2, q2sat, dqsdt2, sfctmp, &
1077! & sfcprs, sfcems, sh2o, smcwlt, smcref, zsoil, rsmin, &
1078! & rsmax, topt, rgl, hs, xlai, &
1079! --- outputs:
1080! & rc, pc, rcs, rct, rcq, rcsoil &
1081! & )
1082
1083! ===================================================================== !
1084! description: !
1085! !
1086! subroutine canres calculates canopy resistance which depends on !
1087! incoming solar radiation, air temperature, atmospheric water vapor !
1088! pressure deficit at the lowest model level, and soil moisture !
1089! (preferably unfrozen soil moisture rather than total) !
1090! !
1091! source: jarvis (1976), noilhan and planton (1989, mwr), jacquemin !
1092! and noilhan (1990, blm) !
1093! see also: chen et al (1996, jgr, vol 101(d3), 7251-7268), eqns !
1094! 12-14 and table 2 of sec. 3.1.2 !
1095! !
1096! subprogram called: none !
1097! !
1098! !
1099! ==================== defination of variables ==================== !
1100! !
1101! inputs from calling program: size !
1102! nsoil - integer, no. of soil layers 1 !
1103! nroot - integer, no. of soil layers in root zone (<nsoil) 1 !
1104! swdn - real, incoming solar radiation 1 !
1105! ch - real, sfc exchange coeff for heat and moisture 1 !
1106! q2 - real, air humidity at 1st level above ground 1 !
1107! q2sat - real, sat. air humidity at 1st level abv ground 1 !
1108! dqsdt2 - real, slope of sat. humidity function wrt temp 1 !
1109! sfctmp - real, sfc temperature at 1st level above ground 1 !
1110! sfcprs - real, sfc pressure 1 !
1111! sfcems - real, sfc emissivity for lw radiation 1 !
1112! sh2o - real, volumetric soil moisture nsoil !
1113! smcwlt - real, wilting point 1 !
1114! smcref - real, reference soil moisture 1 !
1115! zsoil - real, soil depth (negative sign, as below grd) nsoil !
1116! rsmin - real, mimimum stomatal resistance 1 !
1117! rsmax - real, maximum stomatal resistance 1 !
1118! topt - real, optimum transpiration air temperature 1 !
1119! rgl - real, canopy resistance func (in solar rad term) 1 !
1120! hs - real, canopy resistance func (vapor deficit term) 1 !
1121! xlai - real, leaf area index 1 !
1122! !
1123! outputs to calling program: !
1124! rc - real, canopy resistance 1 !
1125! pc - real, plant coefficient 1 !
1126! rcs - real, incoming solar rc factor 1 !
1127! rct - real, air temp rc factor 1 !
1128! rcq - real, atoms vapor press deficit rc factor 1 !
1129! rcsoil - real, soil moisture rc factor 1 !
1130! !
1131! ==================== end of description ===================== !
1132!
1133! --- inputs:
1134! integer, intent(in) :: nsoil, nroot
1135
1136! real (kind=kind_phys), intent(in) :: swdn, ch, q2, q2sat, &
1137! & dqsdt2, sfctmp, sfcprs, sfcems, smcwlt, smcref, rsmin, &
1138! & rsmax, topt, rgl, hs, xlai, sh2o(nsoil), zsoil(nsoil)
1139
1140! --- outputs:
1141! real (kind=kind_phys), intent(out) :: rc, pc, rcs, rct, rcq, &
1142! & rcsoil
1143
1144! --- locals:
1145 real (kind=kind_phys) :: delta, ff, gx, rr, part(nsold)
1146
1147 integer :: k
1148
1149!
1150!===> ... begin here
1151!
1152! --- ... initialize canopy resistance multiplier terms.
1153
1154 rcs = 0.0
1155 rct = 0.0
1156 rcq = 0.0
1157 rcsoil = 0.0
1158 rc = 0.0
1159
1160! --- ... contribution due to incoming solar radiation
1161
1162 ff = 0.55 * 2.0 * swdn / (rgl*xlai)
1163 rcs = (ff + rsmin/rsmax) / (1.0 + ff)
1164 rcs = max( rcs, 0.0001 )
1165
1166! --- ... contribution due to air temperature at first model level above ground
1167! rct expression from noilhan and planton (1989, mwr).
1168
1169 rct = 1.0 - 0.0016 * (topt - sfctmp)**2.0
1170 rct = max( rct, 0.0001 )
1171
1172! --- ... contribution due to vapor pressure deficit at first model level.
1173! rcq expression from ssib
1174
1175 rcq = 1.0 / (1.0 + hs*(q2sat-q2))
1176 rcq = max( rcq, 0.01 )
1177
1178! --- ... contribution due to soil moisture availability.
1179! determine contribution from each soil layer, then add them up.
1180
1181 gx = (sh2o(1) - smcwlt) / (smcref - smcwlt)
1182 gx = max( 0.0, min( 1.0, gx ) )
1183
1184! --- ... use soil depth as weighting factor
1185 part(1) = (zsoil(1)/zsoil(nroot)) * gx
1186
1187! --- ... use root distribution as weighting factor
1188! part(1) = rtdis(1) * gx
1189
1190 do k = 2, nroot
1191
1192 gx = (sh2o(k) - smcwlt) / (smcref - smcwlt)
1193 gx = max( 0.0, min( 1.0, gx ) )
1194
1195! --- ... use soil depth as weighting factor
1196 part(k) = ((zsoil(k) - zsoil(k-1)) / zsoil(nroot)) * gx
1197
1198! --- ... use root distribution as weighting factor
1199! part(k) = rtdis(k) * gx
1200
1201 enddo
1202
1203 do k = 1, nroot
1204 rcsoil = rcsoil + part(k)
1205 enddo
1206 rcsoil = max( rcsoil, 0.0001 )
1207
1208! --- ... determine canopy resistance due to all factors. convert canopy
1209! resistance (rc) to plant coefficient (pc) to be used with
1210! potential evap in determining actual evap. pc is determined by:
1211! pc * linerized penman potential evap = penman-monteith actual
1212! evaporation (containing rc term).
1213
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
1217
1218 pc = (rr + delta) / (rr*(1.0 + rc*ch) + delta)
1219!
1220!...................................
1221 end subroutine canres
1222!-----------------------------------
1223
1224
1225!-----------------------------------
1228 subroutine csnow
1229!...................................
1230! --- inputs:
1231! & ( sndens, &
1232! --- outputs:
1233! & sncond &
1234! & )
1235
1236! ===================================================================== !
1237! description: !
1238! !
1239! subroutine csnow calculates snow termal conductivity !
1240! !
1241! subprogram called: none !
1242! !
1243! ==================== defination of variables ==================== !
1244! !
1245! inputs from the calling program: size !
1246! sndens - real, snow density 1 !
1247! !
1248! outputs to the calling program: !
1249! sncond - real, snow termal conductivity 1 !
1250! !
1251! ==================== end of description ===================== !
1252!
1253! --- constant parameters:
1254 real (kind=kind_phys), parameter :: unit = 0.11631
1255
1256! --- inputs:
1257! real (kind=kind_phys), intent(in) :: sndens
1258
1259! --- outputs:
1260! real (kind=kind_phys), intent(out) :: sncond
1261
1262! --- locals:
1263 real (kind=kind_phys) :: c
1264
1265!
1266!===> ... begin here
1267!
1268! --- ... sncond in units of cal/(cm*hr*c), returned in w/(m*c)
1269! basic version is dyachkova equation (1960), for range 0.1-0.4
1270
1271 c = 0.328 * 10**(2.25*sndens)
1272 sncond = unit * c
1273
1274! --- ... de vaux equation (1933), in range 0.1-0.6
1275
1276! sncond = 0.0293 * (1.0 + 100.0*sndens**2)
1277
1278! --- ... e. andersen from flerchinger
1279
1280! sncond = 0.021 + 2.51 * sndens**2
1281!
1282!...................................
1283 end subroutine csnow
1284!-----------------------------------
1285
1286
1287!-----------------------------------
1292 subroutine nopac
1293!...................................
1294! --- inputs:
1295! & ( nsoil, nroot, etp, prcp, smcmax, smcwlt, smcref, &
1296! & smcdry, cmcmax, dt, shdfac, sbeta, sfctmp, sfcems, &
1297! & t24, th2, fdown, epsca, bexp, pc, rch, rr, cfactr, &
1298! & slope, kdt, frzx, psisat, zsoil, dksat, dwsat, &
1299! & zbot, ice, rtdis, quartz, fxexp, csoil, lheatstrg, &
1300! --- input/outputs:
1301! & cmc, t1, stc, sh2o, tbot, &
1302! --- outputs:
1303! & eta, smc, ssoil, runoff1, runoff2, runoff3, edir, &
1304! & ec, et, ett, beta, drip, dew, flx1, flx3 &
1305! & )
1306
1307! ===================================================================== !
1308! description: !
1309! !
1310! subroutine nopac calculates soil moisture and heat flux values and !
1311! update soil moisture content and soil heat content values for the !
1312! case when no snow pack is present. !
1313! !
1314! !
1315! subprograms called: evapo, smflx, tdfcnd, shflx !
1316! !
1317! ==================== defination of variables ==================== !
1318! !
1319! inputs from calling program: size !
1320! nsoil - integer, number of soil layers 1 !
1321! nroot - integer, number of root layers 1 !
1322! etp - real, potential evaporation 1 !
1323! prcp - real, precip rate 1 !
1324! smcmax - real, porosity (sat val of soil mois) 1 !
1325! smcwlt - real, wilting point 1 !
1326! smcref - real, soil mois threshold 1 !
1327! smcdry - real, dry soil mois threshold 1 !
1328! cmcmax - real, maximum canopy water parameters 1 !
1329! dt - real, time step 1 !
1330! shdfac - real, aeral coverage of green veg 1 !
1331! sbeta - real, param to cal veg effect on soil heat flux 1 !
1332! sfctmp - real, air temp at height zlvl abv ground 1 !
1333! sfcems - real, sfc lw emissivity 1 !
1334! t24 - real, sfctmp**4 1 !
1335! th2 - real, air potential temp at zlvl abv grnd 1 !
1336! fdown - real, net solar + downward lw flux at sfc 1 !
1337! epsca - real, 1 !
1338! bexp - real, soil type "b" parameter 1 !
1339! pc - real, plant coeff 1 !
1340! rch - real, companion coefficient of ch 1 !
1341! rr - real, 1 !
1342! cfactr - real, canopy water parameters 1 !
1343! slope - real, linear reservoir coefficient 1 !
1344! kdt - real, 1 !
1345! frzx - real, frozen ground parameter 1 !
1346! psisat - real, saturated soil potential 1 !
1347! zsoil - real, soil layer depth below ground (negative) nsoil !
1348! dksat - real, saturated soil hydraulic conductivity 1 !
1349! dwsat - real, saturated soil diffusivity 1 !
1350! zbot - real, specify depth of lower bd soil 1 !
1351! ice - integer, sea-ice flag (=1: sea-ice, =0: land) 1 !
1352! rtdis - real, root distribution nsoil !
1353! quartz - real, soil quartz content 1 !
1354! fxexp - real, bare soil evaporation exponent 1 !
1355! csoil - real, soil heat capacity 1 !
1356! lheatstrg- logical, flag for canopy heat storage 1 !
1357! parameterization !
1358! !
1359! input/outputs from and to the calling program: !
1360! cmc - real, canopy moisture content 1 !
1361! t1 - real, ground/canopy/snowpack eff skin temp 1 !
1362! stc - real, soil temp nsoil !
1363! sh2o - real, unfrozen soil moisture nsoil !
1364! tbot - real, bottom soil temp 1 !
1365! !
1366! outputs to the calling program: !
1367! eta - real, downward latent heat flux 1 !
1368! smc - real, total soil moisture nsoil !
1369! ssoil - real, upward soil heat flux 1 !
1370! runoff1 - real, surface runoff not infiltrating sfc 1 !
1371! runoff2 - real, sub surface runoff (baseflow) 1 !
1372! runoff3 - real, excess of porosity 1 !
1373! edir - real, direct soil evaporation 1 !
1374! ec - real, canopy water evaporation 1 !
1375! et - real, plant transpiration nsoil !
1376! ett - real, total plant transpiration 1 !
1377! beta - real, ratio of actual/potential evap 1 !
1378! drip - real, through-fall of precip and/or dew 1 !
1379! dew - real, dewfall (or frostfall) 1 !
1380! flx1 - real, precip-snow sfc flux 1 !
1381! flx3 - real, phase-change heat flux from snowmelt 1 !
1382! !
1383! ==================== end of description ===================== !
1384!
1385! --- inputs:
1386! integer, intent(in) :: nsoil, nroot, ice
1387
1388! real (kind=kind_phys), intent(in) :: etp, prcp, smcmax, &
1389! & smcwlt, smcref, smcdry, cmcmax, dt, shdfac, sbeta, &
1390! & sfctmp, sfcems, t24, th2, fdown, epsca, bexp, pc, &
1391! & rch, rr, cfactr, slope, kdt, frzx, psisat, &
1392! & zsoil(nsoil), dksat, dwsat, zbot, rtdis(nsoil), &
1393! & quartz, fxexp, csoil
1394
1395! logical, intent(in) :: lheatstrg
1396
1397! --- input/outputs:
1398! real (kind=kind_phys), intent(inout) :: cmc, t1, stc(nsoil), &
1399! & sh2o(nsoil), tbot
1400
1401! --- outputs:
1402! real (kind=kind_phys), intent(out) :: eta, smc(nsoil), ssoil, &
1403! & runoff1, runoff2, runoff3, edir, ec, et(nsoil), ett, &
1404! & beta, drip, dew, flx1, flx3
1405
1406! --- locals:
1407 real (kind=kind_phys) :: df1, eta1, etp1, prcp1, yy, yynum, &
1408 & zz1, ec1, edir1, et1(nsoil), ett1
1409
1410 integer :: k
1411
1412!
1413!===> ... begin here
1414!
1415! --- ... convert etp from kg m-2 s-1 to ms-1 and initialize dew.
1416
1417 prcp1= prcp * 0.001
1418 etp1 = etp * 0.001
1419 dew = 0.0
1420 edir = 0.0
1421 edir1= 0.0
1422 ec = 0.0
1423 ec1 = 0.0
1424
1425 do k = 1, nsoil
1426 et(k) = 0.0
1427 et1(k) = 0.0
1428 enddo
1429
1430 ett = 0.0
1431 ett1 = 0.0
1432
1433 if (etp > 0.0) then
1434
1435! --- ... convert prcp from 'kg m-2 s-1' to 'm s-1'.
1436
1437 call evapo &
1438! --- inputs:
1439 & ( nsoil, nroot, cmc, cmcmax, etp1, dt, zsoil, &
1440 & sh2o, smcmax, smcwlt, smcref, smcdry, pc, &
1441 & shdfac, cfactr, rtdis, fxexp, &
1442! --- outputs:
1443 & eta1, edir1, ec1, et1, ett1 &
1444 & )
1445
1446 call smflx &
1447! --- inputs:
1448 & ( nsoil, dt, kdt, smcmax, smcwlt, cmcmax, prcp1, &
1449 & zsoil, slope, frzx, bexp, dksat, dwsat, shdfac, &
1450 & edir1, ec1, et1, &
1451! --- input/outputs:
1452 & cmc, sh2o, smc, &
1453! --- outputs:
1454 & runoff1, runoff2, runoff3, drip &
1455 & )
1456
1457 else
1458
1459! --- ... if etp < 0, assume dew forms (transform etp1 into dew and
1460! reinitialize etp1 to zero).
1461
1462 eta1 = 0.0
1463 dew = -etp1
1464
1465! --- ... convert prcp from 'kg m-2 s-1' to 'm s-1' and add dew amount.
1466
1467 prcp1 = prcp1 + dew
1468
1469 call smflx &
1470! --- inputs:
1471 & ( nsoil, dt, kdt, smcmax, smcwlt, cmcmax, prcp1, &
1472 & zsoil, slope, frzx, bexp, dksat, dwsat, shdfac, &
1473 & edir1, ec1, et1, &
1474! --- input/outputs:
1475 & cmc, sh2o, smc, &
1476! --- outputs:
1477 & runoff1, runoff2, runoff3, drip &
1478 & )
1479
1480 endif ! end if_etp_block
1481
1482! --- ... convert modeled evapotranspiration fm m s-1 to kg m-2 s-1
1483
1484 eta = eta1 * 1000.0
1485 edir = edir1 * 1000.0
1486 ec = ec1 * 1000.0
1487
1488 do k = 1, nsoil
1489 et(k) = et1(k) * 1000.0
1490 enddo
1491
1492 ett = ett1 * 1000.0
1493
1494! --- ... based on etp and e values, determine beta
1495
1496 if ( etp <= 0.0 ) then
1497 beta = 0.0
1498 if ( etp < 0.0 ) then
1499 beta = 1.0
1500 endif
1501 else
1502 beta = eta / etp
1503 endif
1504
1505! --- ... get soil thermal diffuxivity/conductivity for top soil lyr,
1506! calc. adjusted top lyr soil temp and adjusted soil flux, then
1507! call shflx to compute/update soil heat flux and soil temps.
1508
1509 call tdfcnd &
1510! --- inputs:
1511 & ( smc(1), quartz, smcmax, sh2o(1), &
1512! --- outputs:
1513 & df1 &
1514 & )
1515! if(ivegsrc == 1) then
1516!urban
1517! if ( vegtyp == 13 ) df1=3.24
1518! endif
1519
1520! --- ... vegetation greenness fraction reduction in subsurface heat
1521! flux via reduction factor, which is convenient to apply here
1522! to thermal diffusivity that is later used in hrt to compute
1523! sub sfc heat flux (see additional comments on veg effect
1524! sub-sfc heat flx in routine sflx)
1525!wz only urban for igbp type
1526!
1527!jhan urban canopy heat storage effect is included in pbl scheme
1528!
1529 if((.not.lheatstrg) .and. &
1530 & (ivegsrc == 1 .and. vegtyp == 13)) then
1531 df1 = 3.24*(1.-shdfac) + shdfac*df1*exp(sbeta*shdfac)
1532 else
1533 df1 = df1 * exp( sbeta*shdfac )
1534 endif
1535
1536! --- ... compute intermediate terms passed to routine hrt (via routine
1537! shflx below) for use in computing subsurface heat flux in hrt
1538
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
1542
1543 call shflx &
1544! --- inputs:
1545 & ( nsoil, smc, smcmax, dt, yy, zz1, zsoil, zbot, &
1546 & psisat, bexp, df1, ice, quartz, csoil, vegtyp, &
1547 & shdfac, lheatstrg, &
1548! --- input/outputs:
1549 & stc, t1, tbot, sh2o, &
1550! --- outputs:
1551 & ssoil &
1552 & )
1553
1554! --- ... set flx1 and flx3 (snopack phase change heat fluxes) to zero since
1555! they are not used here in snopac. flx2 (freezing rain heat flux)
1556! was similarly initialized in the penman routine.
1557
1558 flx1 = 0.0
1559 flx3 = 0.0
1560!
1561!...................................
1562 end subroutine nopac
1563!-----------------------------------
1564
1565
1566!-----------------------------------
1571 subroutine penman
1572!...................................
1573! --- inputs:
1574! & ( sfctmp, sfcprs, sfcems, ch, t2v, th2, prcp, fdown, &
1575! & ssoil, q2, q2sat, dqsdt2, snowng, frzgra, &
1576! --- outputs:
1577! & t24, etp, rch, epsca, rr, flx2 &
1578! & )
1579
1580! ===================================================================== !
1581! description: !
1582! !
1583! subroutine penman calculates potential evaporation for the current !
1584! point. various partial sums/products are also calculated and passed !
1585! back to the calling routine for later use. !
1586! !
1587! !
1588! subprogram called: none !
1589! !
1590! ==================== defination of variables ==================== !
1591! !
1592! inputs: size !
1593! sfctmp - real, sfc temperature at 1st level above ground 1 !
1594! sfcprs - real, sfc pressure 1 !
1595! sfcems - real, sfc emissivity for lw radiation 1 !
1596! ch - real, sfc exchange coeff for heat & moisture 1 !
1597! t2v - real, sfc virtual temperature 1 !
1598! th2 - real, air potential temp at zlvl abv grnd 1 !
1599! prcp - real, precip rate 1 !
1600! fdown - real, net solar + downward lw flux at sfc 1 !
1601! ssoil - real, upward soil heat flux 1 !
1602! q2 - real, mixing ratio at hght zlvl abv ground 1 !
1603! q2sat - real, sat mixing ratio at zlvl abv ground 1 !
1604! dqsdt2 - real, slope of sat specific humidity curve 1 !
1605! snowng - logical, snow flag 1 !
1606! frzgra - logical, freezing rain flag 1 !
1607! !
1608! outputs: !
1609! t24 - real, sfctmp**4 1 !
1610! etp - real, potential evaporation 1 !
1611! rch - real, companion coefficient of ch 1 !
1612! epsca - real, 1 !
1613! rr - real, 1 !
1614! flx2 - real, freezing rain latent heat flux 1 !
1615! !
1616! ==================== end of description ===================== !
1617!
1618! --- inputs:
1619! real (kind=kind_phys), intent(in) :: sfctmp, sfcprs, sfcems, &
1620! & ch, t2v, th2, prcp, fdown, ssoil, q2, q2sat, dqsdt2
1621
1622! logical, intent(in) :: snowng, frzgra
1623
1624! --- outputs:
1625! real (kind=kind_phys), intent(out) :: t24, etp, rch, epsca, &
1626! & rr, flx2
1627
1628! --- locals:
1629 real (kind=kind_phys) :: a, delta, fnet, rad, rho
1630
1631!
1632!===> ... begin here
1633!
1634 flx2 = 0.0
1635
1636! --- ... prepare partial quantities for penman equation.
1637
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)
1642 rch = rho * cp * ch
1643
1644! --- ... adjust the partial sums / products with the latent heat
1645! effects caused by falling precipitation.
1646
1647 if (.not. snowng) then
1648 if (prcp > 0.0) rr = rr + cph2o1*prcp/rch
1649 else
1650! ---- ... fractional snowfall/rainfall
1651 rr = rr + (cpice*ffrozp+cph2o1*(1.-ffrozp)) &
1652 & *prcp/rch
1653 endif
1654
1655 fnet = fdown - sfcems*sigma1*t24 - ssoil
1656
1657! --- ... include the latent heat effects of frzng rain converting to ice
1658! on impact in the calculation of flx2 and fnet.
1659
1660 if (frzgra) then
1661 flx2 = -lsubf * prcp
1662 fnet = fnet - flx2
1663 endif
1664
1665! --- ... finish penman equation calculations.
1666
1667 rad = fnet/rch + th2 - sfctmp
1668 a = elcp * (q2sat - q2)
1669 epsca = (a*rr + rad*delta) / (delta + rr)
1670 etp = epsca * rch / lsubc
1671!
1672!...................................
1673 end subroutine penman
1674!-----------------------------------
1675
1676
1677!-----------------------------------
1682 subroutine redprm(errmsg, errflg)
1683!...................................
1684! --- inputs:
1685! & ( nsoil, vegtyp, soiltyp, slopetyp, sldpth, zsoil, &
1686! --- outputs:
1687! & cfactr, cmcmax, rsmin, rsmax, topt, refkdt, kdt, &
1688! & sbeta, shdfac, rgl, hs, zbot, frzx, psisat, slope, &
1689! & snup, salp, bexp, dksat, dwsat, smcmax, smcwlt, &
1690! & smcref, smcdry, f1, quartz, fxexp, rtdis, nroot, &
1691! & z0, czil, xlai, csoil &
1692! & )
1693
1694! ===================================================================== !
1695! description: !
1696! !
1697! subroutine redprm internally sets(default valuess), or optionally !
1698! read-in via namelist i/o, all soil and vegetation parameters !
1699! required for the execusion of the noah lsm. !
1700! !
1701! optional non-default parameters can be read in, accommodating up to !
1702! 30 soil, veg, or slope classes, if the default max number of soil, !
1703! veg, and/or slope types is reset. !
1704! !
1705! future upgrades of routine redprm must expand to incorporate some !
1706! of the empirical parameters of the frozen soil and snowpack physics !
1707! (such as in routines frh2o, snowpack, and snow_new) not yet set in !
1708! this redprm routine, but rather set in lower level subroutines. !
1709! !
1710! all soil, veg, slope, and universal parameters values are defined !
1711! externally (in subroutine "set_soilveg.f") and then accessed via !
1712! "use namelist_soilveg" (below) and then set here. !
1713! !
1714! soil types zobler (1986) cosby et al (1984) (quartz cont.(1)) !
1715! 1 coarse loamy sand (0.82) !
1716! 2 medium silty clay loam (0.10) !
1717! 3 fine light clay (0.25) !
1718! 4 coarse-medium sandy loam (0.60) !
1719! 5 coarse-fine sandy clay (0.52) !
1720! 6 medium-fine clay loam (0.35) !
1721! 7 coarse-med-fine sandy clay loam (0.60) !
1722! 8 organic loam (0.40) !
1723! 9 glacial land ice loamy sand (na using 0.82)!
1724! 13: <old>- glacial land ice -<old> !
1725! 13: glacial-ice (no longer use these parameters), now !
1726! treated as ice-only surface and sub-surface !
1727! (in subroutine hrtice) !
1728! upgraded to statsgo (19-type)
1729! 1: sand
1730! 2: loamy sand
1731! 3: sandy loam
1732! 4: silt loam
1733! 5: silt
1734! 6:loam
1735! 7:sandy clay loam
1736! 8:silty clay loam
1737! 9:clay loam
1738! 10:sandy clay
1739! 11: silty clay
1740! 12: clay
1741! 13: organic material
1742! 14: water
1743! 15: bedrock
1744! 16: other (land-ice)
1745! 17: playa
1746! 18: lava
1747! 19: white sand
1748! !
1749! ssib vegetation types (dorman and sellers, 1989; jam) !
1750! 1: broadleaf-evergreen trees (tropical forest) !
1751! 2: broadleaf-deciduous trees !
1752! 3: broadleaf and needleleaf trees (mixed forest) !
1753! 4: needleleaf-evergreen trees !
1754! 5: needleleaf-deciduous trees (larch) !
1755! 6: broadleaf trees with groundcover (savanna) !
1756! 7: groundcover only (perennial) !
1757! 8: broadleaf shrubs with perennial groundcover !
1758! 9: broadleaf shrubs with bare soil !
1759! 10: dwarf trees and shrubs with groundcover (tundra) !
1760! 11: bare soil !
1761! 12: cultivations (the same parameters as for type 7) !
1762! 13: <old>- glacial (the same parameters as for type 11) -<old> !
1763! 13: glacial-ice (no longer use these parameters), now treated as !
1764! ice-only surface and sub-surface (in subroutine hrtice) !
1765! upgraded to IGBP (20-type)
1766! 1:Evergreen Needleleaf Forest
1767! 2:Evergreen Broadleaf Forest
1768! 3:Deciduous Needleleaf Forest
1769! 4:Deciduous Broadleaf Forest
1770! 5:Mixed Forests
1771! 6:Closed Shrublands
1772! 7:Open Shrublands
1773! 8:Woody Savannas
1774! 9:Savannas
1775! 10:Grasslands
1776! 11:Permanent wetlands
1777! 12:Croplands
1778! 13:Urban and Built-Up
1779! 14:Cropland/natural vegetation mosaic
1780! 15:Snow and Ice
1781! 16:Barren or Sparsely Vegetated
1782! 17:Water
1783! 18:Wooded Tundra
1784! 19:Mixed Tundra
1785! 20:Bare Ground Tundra
1786! !
1787! slopetyp is to estimate linear reservoir coefficient slope to the !
1788! baseflow runoff out of the bottom layer. lowest class (slopetyp=0) !
1789! means highest slope parameter = 1. !
1790! !
1791! slope class percent slope !
1792! 1 0-8 !
1793! 2 8-30 !
1794! 3 > 30 !
1795! 4 0-30 !
1796! 5 0-8 & > 30 !
1797! 6 8-30 & > 30 !
1798! 7 0-8, 8-30, > 30 !
1799! 9 glacial ice !
1800! blank ocean/sea !
1801! !
1802! note: class 9 from zobler file should be replaced by 8 and 'blank' 9 !
1803! !
1804! !
1805! subprogram called: none !
1806! !
1807! ==================== defination of variables ==================== !
1808! !
1809! inputs from calling program: size !
1810! nsoil - integer, number of soil layers 1 !
1811! vegtyp - integer, vegetation type (integer index) 1 !
1812! soiltyp - integer, soil type (integer index) 1 !
1813! slopetyp - integer, class of sfc slope (integer index) 1 !
1814! sldpth - integer, thickness of each soil layer (m) nsoil !
1815! zsoil - integer, soil depth (negative sign) (m) nsoil !
1816! !
1817! outputs to the calling program: !
1818! cfactr - real, canopy water parameters 1 !
1819! cmcmax - real, maximum canopy water parameters 1 !
1820! rsmin - real, mimimum stomatal resistance 1 !
1821! rsmax - real, maximum stomatal resistance 1 !
1822! topt - real, optimum transpiration air temperature 1 !
1823! refkdt - real, =2.e-6 the sat. dk. val for soil type 2 1 !
1824! kdt - real, 1 !
1825! sbeta - real, param to cal veg effect on soil heat flux 1 !
1826! shdfac - real, vegetation greenness fraction 1 !
1827! rgl - real, canopy resistance func (in solar rad term) 1 !
1828! hs - real, canopy resistance func (vapor deficit term) 1 !
1829! zbot - real, specify depth of lower bd soil temp (m) 1 !
1830! frzx - real, frozen ground parameter, ice content 1 !
1831! threshold above which frozen soil is impermeable !
1832! psisat - real, saturated soil potential 1 !
1833! slope - real, linear reservoir coefficient 1 !
1834! snup - real, threshold snow depth (water equi m) 1 !
1835! salp - real, snow cover shape parameter 1 !
1836! from anderson's hydro-17 best fit salp = 2.6 !
1837! bexp - real, the 'b' parameter 1 !
1838! dksat - real, saturated soil hydraulic conductivity 1 !
1839! dwsat - real, saturated soil diffusivity 1 !
1840! smcmax - real, max soil moisture content (porosity) 1 !
1841! smcwlt - real, wilting pt soil moisture contents 1 !
1842! smcref - real, reference soil moisture (onset stress) 1 !
1843! smcdry - real, air dry soil moist content limits 1 !
1844! f1 - real, used to comp soil diffusivity/conductivity 1 !
1845! quartz - real, soil quartz content 1 !
1846! fxexp - real, bare soil evaporation exponent 1 !
1847! rtdis - real, root distribution nsoil !
1848! nroot - integer, number of root layers 1 !
1849! z0 - real, roughness length (m) 1 !
1850! czil - real, param to cal roughness length of heat 1 !
1851! xlai - real, leaf area index 1 !
1852! csoil - real, soil heat capacity (j m-3 k-1) 1 !
1853! !
1854! ==================== end of description ===================== !
1855!
1857
1858! --- input:
1859! integer, intent(in) :: nsoil, vegtyp, soiltyp, slopetyp
1860
1861! real (kind=kind_phys), intent(in) :: sldpth(nsoil), zsoil(nsoil)
1862
1863! --- outputs:
1864! real (kind=kind_phys), intent(out) :: cfactr, cmcmax, rsmin, &
1865! & rsmax, topt, refkdt, kdt, sbeta, shdfac, rgl, hs, zbot, &
1866! & frzx, psisat, slope, snup, salp, bexp, dksat, dwsat, &
1867! & smcmax, smcwlt, smcref, smcdry, f1, quartz, fxexp, z0, &
1868! & czil, xlai, csoil, rtdis(nsoil)
1869 character(len=*), intent(out) :: errmsg
1870 integer, intent(out) :: errflg
1871! integer, intent(out) :: nroot
1872
1873! --- locals:
1874 real (kind=kind_phys) :: frzfact, frzk, refdk
1875
1876 integer :: i
1877
1878!
1879!===> ... begin here
1880!
1881! Initialize CCPP error-handling
1882 errflg = 0
1883 errmsg = ''
1884
1885 if (soiltyp > defined_soil) then
1886 write(*,*) 'warning: too many soil types,soiltyp=',soiltyp, &
1887 & 'defined_soil=',defined_soil
1888 errflg = 1
1889 errmsg = 'ERROR(sflx.f): too many soil types'
1890 return
1891 endif
1892
1893 if (vegtyp > defined_veg) then
1894 write(*,*) 'warning: too many veg types'
1895 errflg = 1
1896 errmsg = 'ERROR(sflx.f): too many veg types'
1897 return
1898 endif
1899
1900 if (slopetyp > defined_slope) then
1901 write(*,*) 'warning: too many slope types'
1902 errflg = 1
1903 errmsg = 'ERROR(sflx.f): too many slope types'
1904 return
1905 endif
1906
1907! --- ... set-up universal parameters (not dependent on soiltyp, vegtyp
1908! or slopetyp)
1909
1910 zbot = zbot_data
1911 salp = salp_data
1912 cfactr = cfactr_data
1913 cmcmax = cmcmax_data
1914 sbeta = sbeta_data
1915 rsmax = rsmax_data
1916 topt = topt_data
1917 refdk = refdk_data
1918 frzk = frzk_data
1919 fxexp = fxexp_data
1920 refkdt = refkdt_data
1921 czil = czil_data
1922 csoil = csoil_data
1923
1924! --- ... set-up soil parameters
1925
1926 bexp = bb(soiltyp)
1927 dksat = satdk(soiltyp)
1928 dwsat = satdw(soiltyp)
1929 f1 = f11(soiltyp)
1930 kdt = refkdt * dksat / refdk
1931
1932 psisat = satpsi(soiltyp)
1933 quartz = qtz(soiltyp)
1934 smcdry = drysmc(soiltyp)
1935 smcmax = maxsmc(soiltyp)
1936 smcref = refsmc(soiltyp)
1937 smcwlt = wltsmc(soiltyp)
1938
1939 frzfact = (smcmax / smcref) * (0.412 / 0.468)
1940
1941! --- ... to adjust frzk parameter to actual soil type: frzk * frzfact
1942
1943 frzx = frzk * frzfact
1944
1945! --- ... set-up vegetation parameters
1946
1947 nroot = nroot_data(vegtyp)
1948 snup = snupx(vegtyp)
1949 rsmin = rsmtbl(vegtyp)
1950
1951 rgl = rgltbl(vegtyp)
1952 hs = hstbl(vegtyp)
1953! roughness lengthe is defined in sfcsub
1954! z0 = z0_data(vegtyp)
1955 xlai= lai_data(vegtyp)
1956
1957 if (vegtyp == bare) shdfac = 0.0
1958
1959 if (nroot > nsoil) then
1960 errflg = 1
1961 errmsg = 'ERROR(sflx.f): too many root layers'
1962 return
1963 endif
1964
1965! --- ... calculate root distribution. present version assumes uniform
1966! distribution based on soil layer depths.
1967
1968 do i = 1, nroot
1969 rtdis(i) = -sldpth(i) / zsoil(nroot)
1970 enddo
1971
1972! --- ... set-up slope parameter
1973
1974 slope = slope_data(slopetyp)
1975!
1976!...................................
1977 end subroutine redprm
1978!-----------------------------------
1979
1980
1981!-----------------------------------
1985 subroutine sfcdif
1986!...................................
1987! --- inputs:
1988! & ( zlvl, z0, t1v, th2v, sfcspd, czil, &
1989! --- input/outputs:
1990! & cm, ch &
1991! & )
1992
1993! ===================================================================== !
1994! description: !
1995! !
1996! subroutine sfcdif calculates surface layer exchange coefficients !
1997! via iterative process. see chen et al (1997, blm) !
1998! !
1999! subprogram called: none !
2000! !
2001! !
2002! ==================== defination of variables ==================== !
2003! !
2004! inputs from the calling program: size !
2005! zlvl - real, height abv atmos ground forcing vars (m) 1 !
2006! z0 - real, roughness length (m) 1 !
2007! t1v - real, surface exchange coefficient 1 !
2008! th2v - real, surface exchange coefficient 1 !
2009! sfcspd - real, wind speed at height zlvl abv ground (m/s) 1 !
2010! czil - real, param to cal roughness length of heat 1 !
2011! !
2012! input/outputs from and to the calling program: !
2013! cm - real, sfc exchange coeff for momentum (m/s) 1 !
2014! ch - real, sfc exchange coeff for heat & moisture (m/s)1 !
2015! !
2016! ==================== end of description ===================== !
2017!
2018! --- constant parameters:
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 ! con_pi/2.0
2030
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
2037
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)
2043
2044! --- inputs:
2045! real (kind=kind_phys), intent(in) :: zlvl, z0, t1v, th2v, &
2046! & sfcspd, czil
2047
2048! --- input/outputs:
2049! real (kind=kind_phys), intent(inout) :: cm, ch
2050
2051! --- locals:
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, &
2056 & rlmn, rlma
2057
2058 integer :: ilech, itr
2059
2060! --- define local in-line functions:
2061
2062 real (kind=kind_phys) :: pslmu, pslms, pslhu, pslhs, zz
2063 real (kind=kind_phys) :: pspmu, pspms, psphu, psphs, xx, yy
2064
2065! ... 1) lech's surface functions
2066
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))
2071
2072! ... 2) paulson's surface functions
2073
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
2079
2080!
2081!===> ... begin here
2082!
2083! --- ... this routine sfcdif can handle both over open water (sea, ocean) and
2084! over solid surface (land, sea-ice).
2085
2086 ilech = 0
2087
2088! --- ... ztfc: ratio of zoh/zom less or equal than 1
2089! czil: constant c in zilitinkevich, s. s.1995,:note about zt
2090
2091 zilfc = -czil * vkrm * sqvisc
2092
2093 zu = z0
2094
2095 rdz = 1.0 / zlvl
2096 cxch = excm * rdz
2097 dthv = th2v - t1v
2098 du2 = max( sfcspd*sfcspd, epsu2 )
2099
2100! --- ... beljars correction of ustar
2101
2102 btgh = btg * hpbl
2103
2104! --- ... if statements to avoid tangent linear problems near zero
2105 if (btgh*ch*dthv /= 0.0) then
2106 wstar2 = wwst2 * abs( btgh*ch*dthv )**(2.0/3.0)
2107 else
2108 wstar2 = 0.0
2109 endif
2110
2111 ustar = max( sqrt( cm*sqrt( du2+wstar2 ) ), epsust )
2112
2113! --- ... zilitinkevitch approach for zt
2114
2115 zt = exp( zilfc*sqrt( ustar*z0 ) ) * z0
2116
2117 zslu = zlvl + zu
2118 zslt = zlvl + zt
2119
2120! print*,'zslt=',zslt
2121! print*,'zlvl=',zvll
2122! print*,'zt=',zt
2123
2124 rlogu = log( zslu/zu )
2125 rlogt = log( zslt/zt )
2126
2127 rlmo = elfc*ch*dthv / ustar**3
2128
2129! print*,'rlmo=',rlmo
2130! print*,'elfc=',elfc
2131! print*,'ch=',ch
2132! print*,'dthv=',dthv
2133! print*,'ustar=',ustar
2134
2135 do itr = 1, itrmx
2136
2137! --- ... 1./ monin-obukkhov length-scale
2138
2139 zetalt = max( zslt*rlmo, ztmin )
2140 rlmo = zetalt / zslt
2141 zetalu = zslu * rlmo
2142 zetau = zu * rlmo
2143 zetat = zt * rlmo
2144
2145 if (ilech == 0) then
2146
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
2152
2153 xlu = sqrt( sqrt( xlu4 ) )
2154 xlt = sqrt( sqrt( xlt4 ) )
2155 xu = sqrt( sqrt( xu4 ) )
2156 xt = sqrt( sqrt( xt4 ) )
2157
2158 psmz = pspmu(xu)
2159
2160! print*,'-----------1------------'
2161! print*,'psmz=',psmz
2162! print*,'pspmu(zetau)=',pspmu( zetau )
2163! print*,'xu=',xu
2164! print*,'------------------------'
2165
2166 simm = pspmu( xlu ) - psmz + rlogu
2167 pshz = psphu( xt )
2168 simh = psphu( xlt ) - pshz + rlogt
2169 else
2170 zetalu = min( zetalu, ztmax )
2171 zetalt = min( zetalt, ztmax )
2172 psmz = pspms( zetau )
2173
2174! print*,'-----------2------------'
2175! print*,'psmz=',psmz
2176! print*,'pspms(zetau)=',pspms( zetau )
2177! print*,'zetau=',zetau
2178! print*,'------------------------'
2179
2180 simm = pspms( zetalu ) - psmz + rlogu
2181 pshz = psphs( zetat )
2182 simh = psphs( zetalt ) - pshz + rlogt
2183 endif ! end if_rlmo_block
2184
2185 else
2186
2187! --- ... lech's functions
2188
2189 if (rlmo < 0.0) then
2190 psmz = pslmu( zetau )
2191
2192! print*,'-----------3------------'
2193! print*,'psmz=',psmz
2194! print*,'pslmu(zetau)=',pslmu( zetau )
2195! print*,'zetau=',zetau
2196! print*,'------------------------'
2197
2198 simm = pslmu( zetalu ) - psmz + rlogu
2199 pshz = pslhu( zetat )
2200 simh = pslhu( zetalt ) - pshz + rlogt
2201 else
2202 zetalu = min( zetalu, ztmax )
2203 zetalt = min( zetalt, ztmax )
2204
2205 psmz = pslms( zetau )
2206
2207! print*,'-----------4------------'
2208! print*,'psmz=',psmz
2209! print*,'pslms(zetau)=',pslms( zetau )
2210! print*,'zetau=',zetau
2211! print*,'------------------------'
2212
2213 simm = pslms( zetalu ) - psmz + rlogu
2214 pshz = pslhs( zetat )
2215 simh = pslhs( zetalt ) - pshz + rlogt
2216 endif ! end if_rlmo_block
2217
2218 endif ! end if_ilech_block
2219
2220! --- ... beljaars correction for ustar
2221
2222 ustar = max( sqrt( cm*sqrt( du2+wstar2 ) ), epsust )
2223
2224! --- ... zilitinkevitch fix for zt
2225
2226 zt = exp( zilfc*sqrt( ustar*z0 ) ) * z0
2227
2228 zslt = zlvl + zt
2229 rlogt = log( zslt/zt )
2230
2231 ustark = ustar * vkrm
2232 cm = max( ustark/simm, cxch )
2233 ch = max( ustark/simh, cxch )
2234
2235! --- ... if statements to avoid tangent linear problems near zero
2236
2237 if (btgh*ch*dthv /= 0.0) then
2238 wstar2 = wwst2 * abs(btgh*ch*dthv) ** (2.0/3.0)
2239 else
2240 wstar2 = 0.0
2241 endif
2242
2243 rlmn = elfc*ch*dthv / ustar**3
2244 rlma = rlmo*wold + rlmn*wnew
2245
2246 rlmo = rlma
2247
2248 enddo ! end do_itr_loop
2249
2250! print*,'----------------------------'
2251! print*,'sfcdif output ! ! ! ! ! ! ! ! ! ! ! !'
2252!
2253! print*,'zlvl=',zlvl
2254! print*,'z0=',z0
2255! print*,'t1v=',t1v
2256! print*,'th2v=',th2v
2257! print*,'sfcspd=',sfcspd
2258! print*,'czil=',czil
2259! print*,'cm=',cm
2260! print*,'ch=',ch
2261! print*,'----------------------------'
2262!
2263!...................................
2264 end subroutine sfcdif
2265!-----------------------------------
2266
2267
2268!-----------------------------------
2271 subroutine snfrac
2272!...................................
2273! --- inputs:
2274! & ( sneqv, snup, salp, snowh, &
2275! --- outputs:
2276! & sncovr &
2277! & )
2278
2279! ===================================================================== !
2280! description: !
2281! !
2282! subroutine snfrac calculatexsnow fraction (0 -> 1) !
2283! !
2284! subprogram called: none !
2285! !
2286! !
2287! ==================== defination of variables ==================== !
2288! !
2289! inputs from the calling program: size !
2290! sneqv - real, snow water equivalent (m) 1 !
2291! snup - real, threshold sneqv depth above which sncovr=1 1 !
2292! salp - real, tuning parameter 1 !
2293! snowh - real, snow depth (m) 1 !
2294! !
2295! outputs to the calling program: !
2296! sncovr - real, fractional snow cover 1 !
2297! !
2298! ==================== end of description ===================== !
2299!
2300! --- inputs:
2301! real (kind=kind_phys), intent(in) :: sneqv, snup, salp, snowh
2302
2303! --- outputs:
2304! real (kind=kind_phys), intent(out) :: sncovr
2305
2306! --- locals:
2307 real (kind=kind_phys) :: rsnow, z0n
2308
2309!
2310!===> ... begin here
2311!
2312! --- ... snup is veg-class dependent snowdepth threshhold (set in routine
2313! redprm) above which snocvr=1.
2314
2315 if (sneqv < snup) then
2316 rsnow = sneqv / snup
2317 sncovr = 1.0 - (exp(-salp*rsnow) - rsnow*exp(-salp))
2318 else
2319 sncovr = 1.0
2320 endif
2321
2322 z0n = 0.035
2323
2324! --- ... formulation of dickinson et al. 1986
2325
2326! sncovr = snowh / (snowh + 5.0*z0n)
2327
2328! --- ... formulation of marshall et al. 1994
2329
2330! sncovr = sneqv / (sneqv + 2.0*z0n)
2331
2332!
2333!...................................
2334 end subroutine snfrac
2335!-----------------------------------
2336
2337
2338!-----------------------------------
2343 subroutine snopac
2344!...................................
2345! --- inputs:
2346! & ( nsoil, nroot, etp, prcp, smcmax, smcwlt, smcref, smcdry, &
2347! & cmcmax, dt, df1, sfcems, sfctmp, t24, th2, fdown, epsca, &
2348! & bexp, pc, rch, rr, cfactr, slope, kdt, frzx, psisat, &
2349! & zsoil, dwsat, dksat, zbot, shdfac, ice, rtdis, quartz, &
2350! & fxexp, csoil, flx2, snowng, lheatstrg, &
2351! --- input/outputs:
2352! & prcp1, cmc, t1, stc, sncovr, sneqv, sndens, snowh, &
2353! & sh2o, tbot, beta, &
2354! --- outputs:
2355! & smc, ssoil, runoff1, runoff2, runoff3, edir, ec, et, &
2356! & ett, snomlt, drip, dew, flx1, flx3, esnow &
2357! & )
2358
2359! ===================================================================== !
2360! description: !
2361! !
2362! subroutine snopac calculates soil moisture and heat flux values and !
2363! update soil moisture content and soil heat content values for the !
2364! case when a snow pack is present. !
2365! !
2366! !
2367! subprograms called: evapo, smflx, shflx, snowpack
2368! !
2369! ==================== defination of variables ==================== !
2370! !
2371! inputs from the calling program: size !
2372! nsoil - integer, number of soil layers 1 !
2373! nroot - integer, number of root layers 1 !
2374! etp - real, potential evaporation 1 !
2375! prcp - real, precip rate 1 !
2376! smcmax - real, porosity 1 !
2377! smcwlt - real, wilting point 1 !
2378! smcref - real, soil mois threshold 1 !
2379! smcdry - real, dry soil mois threshold 1 !
2380! cmcmax - real, maximum canopy water parameters 1 !
2381! dt - real, time step 1 !
2382! df1 - real, thermal diffusivity m !
2383! sfcems - real, lw surface emissivity 1 !
2384! sfctmp - real, sfc temperature 1 !
2385! t24 - real, sfctmp**4 1 !
2386! th2 - real, sfc air potential temperature 1 !
2387! fdown - real, net solar + downward lw flux at sfc 1 !
2388! epsca - real, 1 !
2389! bexp - real, soil type "b" parameter 1 !
2390! pc - real, plant coeff 1 !
2391! rch - real, companion coefficient of ch 1 !
2392! rr - real, 1 !
2393! cfactr - real, canopy water parameters 1 !
2394! slope - real, linear reservoir coefficient 1 !
2395! kdt - real, 1 !
2396! frzx - real, frozen ground parameter 1 !
2397! psisat - real, saturated soil potential 1 !
2398! zsoil - real, soil layer depth below ground (negative) nsoil !
2399! dwsat - real, saturated soil diffusivity 1 !
2400! dksat - real, saturated soil hydraulic conductivity 1 !
2401! zbot - real, specify depth of lower bd soil 1 !
2402! shdfac - real, aeral coverage of green vegetation 1 !
2403! ice - integer, sea-ice flag (=1: sea-ice, =0: land) 1 !
2404! rtdis - real, root distribution nsoil !
2405! quartz - real, soil quartz content 1 !
2406! fxexp - real, bare soil evaporation exponent 1 !
2407! csoil - real, soil heat capacity 1 !
2408! flx2 - real, freezing rain latent heat flux 1 !
2409! snowng - logical, snow flag 1 !
2410! lheatstrg- logical, flag for canopy heat storage 1 !
2411! parameterization !
2412! !
2413! input/outputs from and to the calling program: !
2414! prcp1 - real, effective precip 1 !
2415! cmc - real, canopy moisture content 1 !
2416! t1 - real, ground/canopy/snowpack eff skin temp 1 !
2417! stc - real, soil temperature nsoil !
2418! sncovr - real, snow cover 1 !
2419! sneqv - real, water-equivalent snow depth 1 !
2420! sndens - real, snow density 1 !
2421! snowh - real, snow depth 1 !
2422! sh2o - real, unfrozen soil moisture nsoil !
2423! tbot - real, bottom soil temperature 1 !
2424! beta - real, ratio of actual/potential evap 1 !
2425! !
2426! outputs to the calling program: !
2427! smc - real, total soil moisture nsoil !
2428! ssoil - real, upward soil heat flux 1 !
2429! runoff1 - real, surface runoff not infiltrating sfc 1 !
2430! runoff2 - real, sub surface runoff 1 !
2431! runoff3 - real, excess of porosity for a given soil layer 1 !
2432! edir - real, direct soil evaporation 1 !
2433! ec - real, canopy water evaporation 1 !
2434! et - real, plant transpiration nsoil !
2435! ett - real, total plant transpiration 1 !
2436! snomlt - real, snow melt water equivalent 1 !
2437! drip - real, through-fall of precip 1 !
2438! dew - real, dewfall (or frostfall) 1 !
2439! flx1 - real, precip-snow sfc flux 1 !
2440! flx3 - real, phase-change heat flux from snowmelt 1 !
2441! esnow - real, sublimation from snowpack 1 !
2442! !
2443! ==================== end of description ===================== !
2444!
2445! --- constant parameters:
2446 real, parameter :: esdmin = 1.e-6
2447
2448! --- inputs:
2449! integer, intent(in) :: nsoil, nroot, ice
2450
2451! real (kind=kind_phys), intent(in) :: etp, prcp, smcmax, smcref, &
2452! & smcwlt, smcdry, cmcmax, dt, df1, sfcems, sfctmp, t24, &
2453! & th2, fdown, epsca, bexp, pc, rch, rr, cfactr, slope, kdt, &
2454! & frzx, psisat, dwsat, dksat, zbot, shdfac, quartz, &
2455! & csoil, fxexp, flx2, zsoil(nsoil), rtdis(nsoil)
2456
2457! logical, intent(in) :: snowng
2458!
2459! logical, intent(in) :: lheatstrg
2460!
2461
2462! --- input/outputs:
2463! real (kind=kind_phys), intent(inout) :: prcp1, t1, sncovr, sneqv, &
2464! & sndens, snowh, cmc, tbot, beta, sh2o(nsoil), stc(nsoil)
2465
2466! --- outputs:
2467! real (kind=kind_phys), intent(out) :: ssoil, runoff1, runoff2, &
2468! & runoff3, edir, ec, et(nsoil), ett, snomlt, drip, dew, &
2469! & flx1, flx3, esnow, smc(nsoil)
2470
2471! --- locals:
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, &
2475 & et1(nsoil)
2476
2477 integer k
2478
2479! data snoexp /1.0/ !!! <----- for noah v2.7
2480 data snoexp /2.0/ !!! <----- for noah v2.7.1
2481
2482! --- ... convert potential evap (etp) from kg m-2 s-1 to m s-1 and then to an
2483! amount (m) given timestep (dt) and call it an effective snowpack
2484! reduction amount, esnow2 (m) for a snowcover fraction = 1.0. this is
2485! the amount the snowpack would be reduced due to sublimation from the
2486! snow sfc during the timestep. sublimation will proceed at the
2487! potential rate unless the snow depth is less than the expected
2488! snowpack reduction. for snowcover fraction = 1.0, 0=edir=et=ec, and
2489! hence total evap = esnow = sublimation (potential evap rate)
2490
2491! --- ... if sea-ice (ice=1) or glacial-ice (ice=-1), snowcover fraction = 1.0,
2492! and sublimation is at the potential rate.
2493! for non-glacial land (ice=0), if snowcover fraction < 1.0, total
2494! evaporation < potential due to non-potential contribution from
2495! non-snow covered fraction.
2496
2497 prcp1 = prcp1 * 0.001
2498
2499 edir = 0.0
2500 edir1 = 0.0
2501
2502 ec = 0.0
2503 ec1 = 0.0
2504
2505 do k = 1, nsoil
2506 et(k) = 0.0
2507 et1(k) = 0.0
2508 enddo
2509
2510 ett = 0.0
2511 ett1 = 0.0
2512 etns = 0.0
2513 etns1 = 0.0
2514 esnow = 0.0
2515 esnow1= 0.0
2516 esnow2= 0.0
2517
2518 dew = 0.0
2519 etp1 = etp * 0.001
2520
2521 if (etp < 0.0) then
2522
2523! --- ... if etp<0 (downward) then dewfall (=frostfall in this case).
2524
2525 dew = -etp1
2526 esnow2 = etp1 * dt
2527 etanrg = etp * ((1.0-sncovr)*lsubc + sncovr*lsubs)
2528
2529 else
2530
2531! --- ... etp >= 0, upward moisture flux
2532
2533 if (ice /= 0) then ! for sea-ice and glacial-ice case
2534
2535 esnow = etp
2536 esnow1 = esnow * 0.001
2537 esnow2 = esnow1 * dt
2538 etanrg = esnow * lsubs
2539
2540 else ! for non-glacial land case
2541
2542 if (sncovr < 1.0) then
2543
2544 call evapo &
2545! --- inputs:
2546 & ( nsoil, nroot, cmc, cmcmax, etp1, dt, zsoil, &
2547 & sh2o, smcmax, smcwlt, smcref, smcdry, pc, &
2548 & shdfac, cfactr, rtdis, fxexp, &
2549! --- outputs:
2550 & etns1, edir1, ec1, et1, ett1 &
2551 & )
2552
2553 edir1 = edir1 * (1.0 - sncovr)
2554 ec1 = ec1 * (1.0 - sncovr)
2555
2556 do k = 1, nsoil
2557 et1(k) = et1(k) * (1.0 - sncovr)
2558 enddo
2559
2560 ett1 = ett1 * (1.0 - sncovr)
2561 etns1 = etns1 * (1.0 - sncovr)
2562
2563 edir = edir1 * 1000.0
2564 ec = ec1 * 1000.0
2565
2566 do k = 1, nsoil
2567 et(k) = et1(k) * 1000.0
2568 enddo
2569
2570 ett = ett1 * 1000.0
2571 etns = etns1 * 1000.0
2572
2573 endif ! end if_sncovr_block
2574
2575 esnow = etp * sncovr
2576! esnow1 = etp * 0.001
2577 esnow1 = esnow * 0.001
2578 esnow2 = esnow1 * dt
2579 etanrg = esnow*lsubs + etns*lsubc
2580
2581 endif ! end if_ice_block
2582
2583 endif ! end if_etp_block
2584
2585! --- ... if precip is falling, calculate heat flux from snow sfc to newly
2586! accumulating precip. note that this reflects the flux appropriate for
2587! the not-yet-updated skin temperature (t1). assumes temperature of the
2588! snowfall striking the gound is =sfctmp (lowest model level air temp).
2589
2590 flx1 = 0.0
2591 if ( snowng ) then
2592! --- ... fractional snowfall/rainfall
2593 flx1 = (cpice* ffrozp + cph2o1*(1.-ffrozp)) &
2594 & * prcp * (t1 - sfctmp)
2595 else
2596 if (prcp > 0.0) flx1 = cph2o1 * prcp * (t1 - sfctmp)
2597 endif
2598
2599! --- ... calculate an 'effective snow-grnd sfc temp' (t12) based on heat
2600! fluxes between the snow pack and the soil and on net radiation.
2601! include flx1 (precip-snow sfc) and flx2 (freezing rain latent
2602! heat) fluxes.
2603! flx2 reflects freezing rain latent heat flux using t1 calculated
2604! in penman.
2605
2606 dsoil = -0.5 * zsoil(1)
2607 dtot = snowh + dsoil
2608 denom = 1.0 + df1 / (dtot * rr * rch)
2609
2610! t12a = ( (fdown - flx1 - flx2 - sigma1*t24) / rch &
2611! & + th2 - sfctmp - beta*epsca ) / rr
2612 t12a = ( (fdown - flx1 - flx2 - sfcems*sigma1*t24) / rch &
2613 & + th2 - sfctmp - etanrg/rch ) / rr
2614
2615 t12b = df1 * stc(1) / (dtot * rr * rch)
2616 t12 = (sfctmp + t12a + t12b) / denom
2617
2618! --- ... if the 'effective snow-grnd sfc temp' is at or below freezing, no snow
2619! melt will occur. set the skin temp to this effective temp. reduce
2620! (by sublimination ) or increase (by frost) the depth of the snowpack,
2621! depending on sign of etp.
2622! update soil heat flux (ssoil) using new skin temperature (t1)
2623! since no snowmelt, set accumulated snowmelt to zero, set 'effective'
2624! precip from snowmelt to zero, set phase-change heat flux from snowmelt
2625! to zero.
2626
2627 if (t12 <= tfreez) then
2628
2629 t1 = t12
2630 ssoil = df1 * (t1 - stc(1)) / dtot
2631!wz ssoil = (t1 - stc (1)) * max(7.0, df1/dtot)
2632 sneqv = max(0.0, sneqv-esnow2)
2633 flx3 = 0.0
2634 ex = 0.0
2635 snomlt = 0.0
2636
2637 else
2638
2639! --- ... if the 'effective snow-grnd sfc temp' is above freezing, snow melt
2640! will occur. call the snow melt rate,ex and amt, snomlt. revise the
2641! effective snow depth. revise the skin temp because it would have chgd
2642! due to the latent heat released by the melting. calc the latent heat
2643! released, flx3. set the effective precip, prcp1 to the snow melt rate,
2644! ex for use in smflx. adjustment to t1 to account for snow patches.
2645! calculate qsat valid at freezing point. note that esat (saturation
2646! vapor pressure) value of 6.11e+2 used here is that valid at frzzing
2647! point. note that etp from call penman in sflx is ignored here in
2648! favor of bulk etp over 'open water' at freezing temp.
2649! update soil heat flux (s) using new skin temperature (t1)
2650
2651! --- ... noah v2.7.1 mek feb2004
2652! non-linear weighting of snow vs non-snow covered portions of gridbox
2653! so with snoexp = 2.0 (>1), surface skin temperature is higher than
2654! for the linear case (snoexp = 1).
2655
2656! t1 = tfreez * sncovr**snoexp + t12 * (1.0 - sncovr**snoexp)
2657 t1 = tfreez * max(0.01,sncovr**snoexp) + &
2658 & t12 * (1.0 - max(0.01,sncovr**snoexp))
2659
2660 beta = 1.0
2661 ssoil = df1 * (t1 - stc(1)) / dtot
2662
2663! --- ... if potential evap (sublimation) greater than depth of snowpack.
2664! beta<1
2665! snowpack has sublimated away, set depth to zero.
2666
2667 if (sneqv-esnow2 <= esdmin) then
2668
2669 sneqv = 0.0
2670 ex = 0.0
2671 snomlt = 0.0
2672 flx3 = 0.0
2673
2674 else
2675
2676! --- ... potential evap (sublimation) less than depth of snowpack, retain
2677! beta=1.
2678
2679 sneqv = sneqv - esnow2
2680 seh = rch * (t1 - th2)
2681
2682 t14 = t1 * t1
2683 t14 = t14 * t14
2684
2685 flx3 = fdown - flx1 - flx2 - sfcems*sigma1*t14 &
2686 & - ssoil - seh - etanrg
2687 if (flx3 <= 0.0) flx3 = 0.0
2688
2689 ex = flx3 * 0.001 / lsubf
2690
2691! --- ... snowmelt reduction depending on snow cover
2692! if snow cover less than 5% no snowmelt reduction
2693! note: does 'if' below fail to match the melt water with the melt
2694! energy?
2695
2696! if (sncovr > 0.05) ex = ex * sncovr
2697 snomlt = ex * dt
2698
2699! --- ... esdmin represents a snowpack depth threshold value below which we
2700! choose not to retain any snowpack, and instead include it in snowmelt.
2701
2702 if (sneqv-snomlt >= esdmin) then
2703
2704 sneqv = sneqv - snomlt
2705
2706 else
2707
2708! --- ... snowmelt exceeds snow depth
2709
2710 ex = sneqv / dt
2711 flx3 = ex * 1000.0 * lsubf
2712 snomlt = sneqv
2713 sneqv = 0.0
2714
2715 endif ! end if_sneqv-snomlt_block
2716
2717 endif ! end if_sneqv-esnow2_block
2718
2719! prcp1 = prcp1 + ex
2720
2721! --- ... if non-glacial land, add snowmelt rate (ex) to precip rate to be used
2722! in subroutine smflx (soil moisture evolution) via infiltration.
2723
2724! --- ... for sea-ice and glacial-ice, the snowmelt will be added to subsurface
2725! runoff/baseflow later near the end of sflx (after return from call to
2726! subroutine snopac)
2727
2728 if (ice == 0) prcp1 = prcp1 + ex
2729
2730 endif ! end if_t12<=tfreez_block
2731
2732! --- ... final beta now in hand, so compute evaporation. evap equals etp
2733! unless beta<1.
2734
2735! eta = beta * etp
2736
2737! --- ... smflx returns updated soil moisture values for non-glacial land.
2738! if sea-ice (ice=1) or glacial-ice (ice=-1), skip call to smflx, since
2739! no soil medium for sea-ice or glacial-ice
2740
2741 if (ice == 0) then
2742
2743 call smflx &
2744! --- inputs:
2745 & ( nsoil, dt, kdt, smcmax, smcwlt, cmcmax, prcp1, &
2746 & zsoil, slope, frzx, bexp, dksat, dwsat, shdfac, &
2747 & edir1, ec1, et1, &
2748! --- input/outputs:
2749 & cmc, sh2o, smc, &
2750! --- outputs:
2751 & runoff1, runoff2, runoff3, drip &
2752 & )
2753
2754 endif
2755
2756! --- ... before call shflx in this snowpack case, set zz1 and yy arguments to
2757! special values that ensure that ground heat flux calculated in shflx
2758! matches that already computed for below the snowpack, thus the sfc
2759! heat flux to be computed in shflx will effectively be the flux at the
2760! snow top surface. t11 is a dummy arguement so we will not use the
2761! skin temp value as revised by shflx.
2762
2763 zz1 = 1.0
2764 yy = stc(1) - 0.5*ssoil*zsoil(1)*zz1 / df1
2765 t11 = t1
2766
2767! --- ... shflx will calc/update the soil temps. note: the sub-sfc heat flux
2768! (ssoil1) and the skin temp (t11) output from this shflx call are not
2769! used in any subsequent calculations. rather, they are dummy variables
2770! here in the snopac case, since the skin temp and sub-sfc heat flux are
2771! updated instead near the beginning of the call to snopac.
2772
2773 call shflx &
2774! --- inputs:
2775 & ( nsoil, smc, smcmax, dt, yy, zz1, zsoil, zbot, &
2776 & psisat, bexp, df1, ice, quartz, csoil, vegtyp, &
2777 & shdfac, lheatstrg, &
2778! --- input/outputs:
2779 & stc, t11, tbot, sh2o, &
2780! --- outputs:
2781 & ssoil1 &
2782 & )
2783
2784! --- ... snow depth and density adjustment based on snow compaction. yy is
2785! assumed to be the soil temperture at the top of the soil column.
2786
2787 if (ice == 0) then ! for non-glacial land
2788
2789 if (sneqv > 0.0) then
2790
2791 call snowpack &
2792! --- inputs:
2793 & ( sneqv, dt, t1, yy, &
2794! --- input/outputs:
2795 & snowh, sndens &
2796 & )
2797
2798 else
2799
2800 sneqv = 0.0
2801 snowh = 0.0
2802 sndens = 0.0
2803! sncond = 1.0
2804 sncovr = 0.0
2805
2806 endif ! end if_sneqv_block
2807
2808! --- ... over sea-ice or glacial-ice, if s.w.e. (sneqv) below threshold lower
2809! bound (0.01 m for sea-ice, 0.10 m for glacial-ice), then set at
2810! lower bound and store the source increment in subsurface runoff/
2811! baseflow (runoff2). note: runoff2 is then a negative value (as
2812! a flag) over sea-ice or glacial-ice, in order to achieve water balance.
2813
2814 elseif (ice == 1) then ! for sea-ice
2815
2816 if (sneqv >= 0.01) then
2817
2818 call snowpack &
2819! --- inputs:
2820 & ( sneqv, dt, t1, yy, &
2821! --- input/outputs:
2822 & snowh, sndens &
2823 & )
2824
2825 else
2826
2827! sndens = sneqv / snowh
2828! runoff2 = -(0.01 - sneqv) / dt
2829 sneqv = 0.01
2830 snowh = 0.05
2831 sncovr = 1.0
2832! snowh = sneqv / sndens
2833
2834 endif ! end if_sneqv_block
2835
2836 else ! for glacial-ice
2837
2838 if (sneqv >= 0.10) then
2839
2840 call snowpack &
2841! --- inputs:
2842 & ( sneqv, dt, t1, yy, &
2843! --- input/outputs:
2844 & snowh, sndens &
2845 & )
2846
2847 else
2848
2849! sndens = sneqv / snowh
2850! runoff2 = -(0.10 - sneqv) / dt
2851 sneqv = 0.10
2852 snowh = 0.50
2853 sncovr = 1.0
2854! snowh = sneqv / sndens
2855
2856 endif ! end if_sneqv_block
2857
2858 endif ! end if_ice_block
2859
2860!
2861!...................................
2862 end subroutine snopac
2863!-----------------------------------
2864
2865
2866!-----------------------------------
2870 subroutine snow_new
2871!...................................
2872! --- inputs:
2873! & ( sfctmp, sn_new, rhonewsn, exticeden, &
2874! --- input/outputs:
2875! & snowh, sndens &
2876! & )
2877
2878! ===================================================================== !
2879! description: !
2880! !
2881! subroutine snow_new calculates snow depth and densitity to account !
2882! for the new snowfall. new values of snow depth & density returned. !
2883! !
2884! subprogram called: none !
2885! !
2886! ==================== defination of variables ==================== !
2887! !
2888! inputs from the calling program: size !
2889! sfctmp - real, surface air temperature (k) 1 !
2890! sn_new - real, new snowfall (m) 1 !
2891! !
2892! input/outputs from and to the calling program: !
2893! snowh - real, snow depth (m) 1 !
2894! sndens - real, snow density 1 !
2895! (g/cm3=dimensionless fraction of h2o density) !
2896! !
2897! ==================== end of description ===================== !
2898!
2899! --- inputs:
2900! real(kind=kind_phys), intent(in) :: sfctmp, sn_new
2901
2902! --- input/outputs:
2903! real(kind=kind_phys), intent(inout) :: snowh, sndens
2904
2905! --- locals:
2906 real(kind=kind_phys) :: dsnew, snowhc, hnewc, newsnc, tempc
2907
2908!
2909!===> ... begin here
2910!
2911! --- ... conversion into simulation units
2912
2913 snowhc = snowh * 100.0
2914 newsnc = sn_new * 100.0
2915 tempc = sfctmp - tfreez
2916
2917! --- ... calculating new snowfall density depending on temperature
2918! equation from gottlib l. 'a general runoff model for
2919! snowcovered and glacierized basin', 6th nordic hydrological
2920! conference, vemadolen, sweden, 1980, 172-177pp.
2921
2922 if(.not. exticeden) then
2923 if (tempc <= -15.0) then
2924 dsnew = 0.05
2925 else
2926 dsnew = 0.05 + 0.0017*(tempc + 15.0)**1.5
2927 endif
2928 else
2929 dsnew = rhonewsn*0.001
2930 endif
2931
2932! --- ... adjustment of snow density depending on new snowfall
2933
2934 hnewc = newsnc / dsnew
2935 sndens = (snowhc*sndens + hnewc*dsnew) / (snowhc + hnewc)
2936 snowhc = snowhc + hnewc
2937 snowh = snowhc * 0.01
2938!
2939!...................................
2940 end subroutine snow_new
2941!-----------------------------------
2942
2943
2944!-----------------------------------
2947 subroutine snowz0
2948!...................................
2949! --- inputs:
2950! & ( sncovr, &
2951! --- input/outputs:
2952! & z0 &
2953! & )
2954
2955! ===================================================================== !
2956! description: !
2957! !
2958! subroutine snowz0 calculates total roughness length over snow !
2959! !
2960! subprogram called: none !
2961! !
2962! ==================== defination of variables ==================== !
2963! !
2964! inputs from the calling program: size !
2965! sncovr - real, fractional snow cover 1 !
2966! !
2967! input/outputs from and to the calling program: !
2968! z0 - real, roughness length (m) 1 !
2969! !
2970! ==================== end of description ===================== !
2971!
2972! --- inputs:
2973! real(kind=kind_phys), intent(in) :: sncovr
2974
2975! --- input/outputs:
2976! real(kind=kind_phys), intent(inout) :: z0
2977
2978! --- locals:
2979 real(kind=kind_phys) :: z0s
2980!
2981!===> ... begin here
2982!
2983! z0s = 0.001 ! snow roughness length:=0.001 (m)
2984! --- ... current noah lsm condition - mbek, 09-oct-2001
2985 z0s = z0
2986
2987 z0 = (1.0 - sncovr)*z0 + sncovr*z0s
2988
2989!
2990!...................................
2991 end subroutine snowz0
2992!-----------------------------------
2993
2994
2995!-----------------------------------
2999 subroutine tdfcnd &
3000! --- inputs:
3001 & ( smc, qz, smcmax, sh2o, &
3002! --- outputs:
3003 & df &
3004 & )
3005
3006! ===================================================================== !
3007! description: !
3008! !
3009! subroutine tdfcnd calculates thermal diffusivity and conductivity !
3010! of the soil for a given point and time. !
3011! !
3012! peters-lidard approach (peters-lidard et al., 1998) !
3013! june 2001 changes: frozen soil condition. !
3014! !
3015! subprogram called: none !
3016! !
3017! use as in peters-lidard, 1998 (modif. from johansen, 1975). !
3018! pablo grunmann, 08/17/98 !
3019! refs.: !
3020! farouki, o.t.,1986: thermal properties of soils. series on rock !
3021! and soil mechanics, vol. 11, trans tech, 136 pp. !
3022! johansen, o., 1975: thermal conductivity of soils. ph.d. thesis, !
3023! university of trondheim, !
3024! peters-lidard, c. d., et al., 1998: the effect of soil thermal !
3025! conductivity parameterization on surface energy fluxes !
3026! and temperatures. journal of the atmospheric sciences, !
3027! vol. 55, pp. 1209-1224. !
3028! !
3029! ==================== defination of variables ==================== !
3030! !
3031! inputs: size !
3032! smc - real, top layer total soil moisture 1 !
3033! qz - real, quartz content (soil type dependent) 1 !
3034! smcmax - real, porosity 1 !
3035! sh2o - real, top layer unfrozen soil moisture 1 !
3036! !
3037! outputs: !
3038! df - real, soil thermal diffusivity and conductivity 1 !
3039! !
3040! locals: !
3041! thkw - water thermal conductivity 1 !
3042! thkqtz - thermal conductivity for quartz 1 !
3043! thko - thermal conductivity for other soil components 1 !
3044! thkqtz - thermal conductivity for the solids combined 1 !
3045! thkice - ice thermal conductivity 1 !
3046! !
3047! !
3048! ==================== end of description ===================== !
3049!
3050! --- input:
3051 real (kind=kind_phys), intent(in) :: smc, qz, smcmax, sh2o
3052
3053! --- output:
3054 real (kind=kind_phys), intent(out) :: df
3055
3056! --- locals:
3057 real (kind=kind_phys) :: gammd, thkdry, ake, thkice, thko, &
3058 & thkqtz, thksat, thks, thkw, satratio, xu, xunfroz
3059!
3060!===> ... begin here
3061!
3062! --- ... if the soil has any moisture content compute a partial sum/product
3063! otherwise use a constant value which works well with most soils
3064
3065! --- ... saturation ratio:
3066
3067 satratio = smc / smcmax
3068
3069! --- ... parameters w/(m.k)
3070 thkice = 2.2
3071 thkw = 0.57
3072 thko = 2.0
3073! if (qz <= 0.2) thko = 3.0
3074 thkqtz = 7.7
3075
3076! --- ... solids' conductivity
3077
3078 thks = (thkqtz**qz) * (thko**(1.0-qz))
3079
3080! --- ... unfrozen fraction (from 1., i.e., 100%liquid, to 0. (100% frozen))
3081
3082 xunfroz = (sh2o + 1.e-9) / (smc + 1.e-9)
3083
3084! --- ... unfrozen volume for saturation (porosity*xunfroz)
3085
3086 xu=xunfroz*smcmax
3087
3088! --- ... saturated thermal conductivity
3089
3090 thksat = thks**(1.-smcmax) * thkice**(smcmax-xu) * thkw**(xu)
3091
3092! --- ... dry density in kg/m3
3093
3094 gammd = (1.0 - smcmax) * 2700.0
3095
3096! --- ... dry thermal conductivity in w.m-1.k-1
3097
3098 thkdry = (0.135*gammd + 64.7) / (2700.0 - 0.947*gammd)
3099
3100 if ( sh2o+0.0005 < smc ) then ! frozen
3101
3102 ake = satratio
3103
3104 else ! unfrozen
3105
3106! --- ... range of validity for the kersten number (ake)
3107 if ( satratio > 0.1 ) then
3108
3109! --- ... kersten number (using "fine" formula, valid for soils containing
3110! at least 5% of particles with diameter less than 2.e-6 meters.)
3111! (for "coarse" formula, see peters-lidard et al., 1998).
3112
3113 ake = log10( satratio ) + 1.0
3114
3115 else
3116
3117! --- ... use k = kdry
3118 ake = 0.0
3119
3120 endif ! end if_satratio_block
3121
3122 endif ! end if_sh2o+0.0005_block
3123
3124! --- ... thermal conductivity
3125
3126 df = ake * (thksat - thkdry) + thkdry
3127!
3128!...................................
3129 end subroutine tdfcnd
3130!-----------------------------------
3131
3132
3133!*********************************************!
3134! section-2 2nd level subprograms !
3135!*********************************************!
3136
3137
3138!-----------------------------------
3145 subroutine evapo &
3146! --- inputs:
3147 & ( nsoil, nroot, cmc, cmcmax, etp1, dt, zsoil, &
3148 & sh2o, smcmax, smcwlt, smcref, smcdry, pc, &
3149 & shdfac, cfactr, rtdis, fxexp, &
3150! --- outputs:
3151 & eta1, edir1, ec1, et1, ett1 &
3152 & )
3153
3154! ===================================================================== !
3155! description: !
3156! !
3157! subroutine evapo calculates soil moisture flux. the soil moisture !
3158! content (smc - a per unit volume measurement) is a dependent variable!
3159! that is updated with prognostic eqns. the canopy moisture content !
3160! (cmc) is also updated. frozen ground version: new states added: !
3161! sh2o, and frozen ground correction factor, frzfact and parameter !
3162! slope. !
3163! !
3164! !
3165! subprogram called: devap, transp !
3166! !
3167! ==================== defination of variables ==================== !
3168! !
3169! inputs from calling program: size !
3170! nsoil - integer, number of soil layers 1 !
3171! nroot - integer, number of root layers 1 !
3172! cmc - real, canopy moisture content 1 !
3173! cmcmax - real, maximum canopy water parameters 1 !
3174! etp1 - real, potential evaporation 1 !
3175! dt - real, time step 1 !
3176! zsoil - real, soil layer depth below ground nsoil !
3177! sh2o - real, unfrozen soil moisture nsoil !
3178! smcmax - real, porosity 1 !
3179! smcwlt - real, wilting point 1 !
3180! smcref - real, soil mois threshold 1 !
3181! smcdry - real, dry soil mois threshold 1 !
3182! pc - real, plant coeff 1 !
3183! cfactr - real, canopy water parameters 1 !
3184! rtdis - real, root distribution nsoil !
3185! fxexp - real, bare soil evaporation exponent 1 !
3186! !
3187! outputs to calling program: !
3188! eta1 - real, latent heat flux 1 !
3189! edir1 - real, direct soil evaporation 1 !
3190! ec1 - real, canopy water evaporation 1 !
3191! et1 - real, plant transpiration nsoil !
3192! ett1 - real, total plant transpiration 1 !
3193! !
3194! ==================== end of description ===================== !
3195!
3196! --- inputs:
3197 integer, intent(in) :: nsoil, nroot
3198
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)
3202
3203! --- outputs:
3204 real (kind=kind_phys), intent(out) :: eta1, edir1, ec1, ett1, &
3205 & et1(nsoil)
3206
3207! --- locals:
3208 real (kind=kind_phys) :: cmc2ms
3209
3210 integer :: i, k
3211
3212!
3213!===> ... begin here
3214!
3215! --- ... executable code begins here if the potential evapotranspiration
3216! is greater than zero.
3217
3218 edir1 = 0.0
3219 ec1 = 0.0
3220
3221 do k = 1, nsoil
3222 et1(k) = 0.0
3223 enddo
3224 ett1 = 0.0
3225
3226 if (etp1 > 0.0) then
3227
3228! --- ... retrieve direct evaporation from soil surface. call this function
3229! only if veg cover not complete.
3230! frozen ground version: sh2o states replace smc states.
3231
3232 if (shdfac < 1.0) then
3233
3234 call devap &
3235! --- inputs:
3236 & ( etp1, sh2o(1), shdfac, smcmax, smcdry, fxexp, &
3237! --- outputs:
3238 & edir1 &
3239 & )
3240
3241 endif
3242
3243! --- ... initialize plant total transpiration, retrieve plant transpiration,
3244! and accumulate it for all soil layers.
3245
3246 if (shdfac > 0.0) then
3247
3248 call transp &
3249! --- inputs:
3250 & ( nsoil, nroot, etp1, sh2o, smcwlt, smcref, &
3251 & cmc, cmcmax, zsoil, shdfac, pc, cfactr, rtdis, &
3252! --- outputs:
3253 & et1 &
3254 & )
3255
3256 do k = 1, nsoil
3257 ett1 = ett1 + et1(k)
3258 enddo
3259
3260! --- ... calculate canopy evaporation.
3261! if statements to avoid tangent linear problems near cmc=0.0.
3262
3263 if (cmc > 0.0) then
3264 ec1 = shdfac * ( (cmc/cmcmax)**cfactr ) * etp1
3265 else
3266 ec1 = 0.0
3267 endif
3268
3269! --- ... ec should be limited by the total amount of available water
3270! on the canopy. -f.chen, 18-oct-1994
3271
3272 cmc2ms = cmc / dt
3273 ec1 = min( cmc2ms, ec1 )
3274 endif
3275
3276 endif ! end if_etp1_block
3277
3278! --- ... total up evap and transp types to obtain actual evapotransp
3279
3280 eta1 = edir1 + ett1 + ec1
3281
3282!
3283!...................................
3284 end subroutine evapo
3285!-----------------------------------
3286
3287
3288!-----------------------------------
3293 subroutine shflx &
3294! --- inputs:
3295 & ( nsoil, smc, smcmax, dt, yy, zz1, zsoil, zbot, &
3296 & psisat, bexp, df1, ice, quartz, csoil, vegtyp, &
3297 & shdfac, lheatstrg, &
3298! --- input/outputs:
3299 & stc, t1, tbot, sh2o, &
3300! --- outputs:
3301 & ssoil &
3302 & )
3303
3304! ===================================================================== !
3305! description: !
3306! !
3307! subroutine shflx updates the temperature state of the soil column !
3308! based on the thermal diffusion equation and update the frozen soil !
3309! moisture content based on the temperature. !
3310! !
3311! subprogram called: hstep, hrtice, hrt !
3312! !
3313! !
3314! ==================== defination of variables ==================== !
3315! !
3316! inputs: size !
3317! nsoil - integer, number of soil layers 1 !
3318! smc - real, total soil moisture nsoil !
3319! smcmax - real, porosity (sat val of soil mois) 1 !
3320! dt - real, time step 1 !
3321! yy - real, soil temperature at the top of column 1 !
3322! zz1 - real, 1 !
3323! zsoil - real, soil layer depth below ground (negative) nsoil !
3324! zbot - real, specify depth of lower bd soil 1 !
3325! psisat - real, saturated soil potential 1 !
3326! bexp - real, soil type "b" parameter 1 !
3327! df1 - real, thermal diffusivity and conductivity 1 !
3328! ice - integer, sea-ice flag (=1: sea-ice, =0: land) 1 !
3329! quartz - real, soil quartz content 1 !
3330! csoil - real, soil heat capacity 1 !
3331! vegtyp - integer, vegtation type 1 !
3332! shdfac - real, aeral coverage of green vegetation 1 !
3333! lheatstrg- logical, flag for canopy heat storage 1 !
3334! parameterization !
3335! !
3336! input/outputs: !
3337! stc - real, soil temp nsoil !
3338! t1 - real, ground/canopy/snowpack eff skin temp 1 !
3339! tbot - real, bottom soil temp 1 !
3340! sh2o - real, unfrozen soil moisture nsoil !
3341! !
3342! outputs: !
3343! ssoil - real, upward soil heat flux 1 !
3344! !
3345! ==================== end of description ===================== !
3346!
3347! --- parameter constants:
3348 real (kind=kind_phys), parameter :: ctfil1 = 0.5
3349 real (kind=kind_phys), parameter :: ctfil2 = 1.0 - ctfil1
3350
3351! --- inputs:
3352 integer, intent(in) :: nsoil, ice, vegtyp
3353
3354 real (kind=kind_phys), intent(in) :: smc(nsoil), smcmax, dt, yy, &
3355 & zz1, zsoil(nsoil), zbot, psisat, bexp, df1, quartz, csoil, &
3356 & shdfac
3357
3358 logical, intent(in) :: lheatstrg
3359
3360! --- input/outputs:
3361 real (kind=kind_phys), intent(inout) :: stc(nsoil), t1, tbot, &
3362 & sh2o(nsoil)
3363
3364! --- outputs:
3365 real (kind=kind_phys), intent(out) :: ssoil
3366
3367! --- locals:
3368 real (kind=kind_phys) :: ai(nsold), bi(nsold), ci(nsold), oldt1, &
3369 & rhsts(nsold), stcf(nsold), stsoil(nsoil)
3370
3371 integer :: i
3372
3373!
3374!===> ... begin here
3375!
3376 oldt1 = t1
3377 do i = 1, nsoil
3378 stsoil(i) = stc(i)
3379 enddo
3380
3381! --- ... hrt routine calcs the right hand side of the soil temp dif eqn
3382
3383 if (ice /= 0) then
3384
3385! --- ... sea-ice case, glacial-ice case
3386
3387 call hrtice &
3388! --- inputs:
3389 & ( nsoil, stc, zsoil, yy, zz1, df1, ice, &
3390! --- input/outputs:
3391 & tbot, &
3392! --- outputs:
3393 & rhsts, ai, bi, ci &
3394 & )
3395
3396 call hstep &
3397! --- inputs:
3398 & ( nsoil, stc, dt, &
3399! --- input/outputs:
3400 & rhsts, ai, bi, ci, &
3401! --- outputs:
3402 & stcf &
3403 & )
3404
3405 else
3406
3407! --- ... land-mass case
3408
3409 call hrt &
3410! --- inputs:
3411 & ( nsoil, stc, smc, smcmax, zsoil, yy, zz1, tbot, &
3412 & zbot, psisat, dt, bexp, df1, quartz, csoil,vegtyp, &
3413 & shdfac, lheatstrg, &
3414! --- input/outputs:
3415 & sh2o, &
3416! --- outputs:
3417 & rhsts, ai, bi, ci &
3418 & )
3419
3420 call hstep &
3421! --- inputs:
3422 & ( nsoil, stc, dt, &
3423! --- input/outputs:
3424 & rhsts, ai, bi, ci, &
3425! --- outputs:
3426 & stcf &
3427 & )
3428
3429 endif
3430
3431 do i = 1, nsoil
3432 stc(i) = stcf(i)
3433 enddo
3434
3435! --- ... in the no snowpack case (via routine nopac branch,) update the grnd
3436! (skin) temperature here in response to the updated soil temperature
3437! profile above. (note: inspection of routine snopac shows that t1
3438! below is a dummy variable only, as skin temperature is updated
3439! differently in routine snopac)
3440
3441 t1 = (yy + (zz1 - 1.0)*stc(1)) / zz1
3442 t1 = ctfil1*t1 + ctfil2*oldt1
3443
3444 do i = 1, nsoil
3445 stc(i) = ctfil1*stc(i) + ctfil2*stsoil(i)
3446 enddo
3447
3448! --- ... calculate surface soil heat flux
3449
3450 ssoil = df1*(stc(1) - t1) / (0.5*zsoil(1))
3451
3452!
3453!...................................
3454 end subroutine shflx
3455!-----------------------------------
3456
3457
3458
3459!-----------------------------------
3466 subroutine smflx &
3467! --- inputs:
3468 & ( nsoil, dt, kdt, smcmax, smcwlt, cmcmax, prcp1, &
3469 & zsoil, slope, frzx, bexp, dksat, dwsat, shdfac, &
3470 & edir1, ec1, et1, &
3471! --- input/outputs:
3472 & cmc, sh2o, smc, &
3473! --- outputs:
3474 & runoff1, runoff2, runoff3, drip &
3475 & )
3476
3477! ===================================================================== !
3478! description: !
3479! !
3480! subroutine smflx calculates soil moisture flux. the soil moisture !
3481! content (smc - a per unit volume measurement) is a dependent variable!
3482! that is updated with prognostic eqns. the canopy moisture content !
3483! (cmc) is also updated. frozen ground version: new states added: sh2o!
3484! and frozen ground correction factor, frzx and parameter slope. !
3485! !
3486! !
3487! subprogram called: srt, sstep !
3488! !
3489! ==================== defination of variables ==================== !
3490! !
3491! inputs: size !
3492! nsoil - integer, number of soil layers 1 !
3493! dt - real, time step 1 !
3494! kdt - real, 1 !
3495! smcmax - real, porosity 1 !
3496! smcwlt - real, wilting point 1 !
3497! cmcmax - real, maximum canopy water parameters 1 !
3498! prcp1 - real, effective precip 1 !
3499! zsoil - real, soil layer depth below ground (negative) nsoil !
3500! slope - real, linear reservoir coefficient 1 !
3501! frzx - real, frozen ground parameter 1 !
3502! bexp - real, soil type "b" parameter 1 !
3503! dksat - real, saturated soil hydraulic conductivity 1 !
3504! dwsat - real, saturated soil diffusivity 1 !
3505! shdfac - real, aeral coverage of green veg 1 !
3506! edir1 - real, direct soil evaporation 1 !
3507! ec1 - real, canopy water evaporation 1 !
3508! et1 - real, plant transpiration nsoil !
3509! !
3510! input/outputs: !
3511! cmc - real, canopy moisture content 1 !
3512! sh2o - real, unfrozen soil moisture nsoil !
3513! smc - real, total soil moisture nsoil !
3514! !
3515! outputs: !
3516! runoff1 - real, surface runoff not infiltrating sfc 1 !
3517! runoff2 - real, sub surface runoff (baseflow) 1 !
3518! runoff3 - real, excess of porosity 1 !
3519! drip - real, through-fall of precip and/or dew 1 !
3520! !
3521! ==================== end of description ===================== !
3522!
3523! --- inputs:
3524 integer, intent(in) :: nsoil
3525
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)
3529
3530! --- input/outputs:
3531 real (kind=kind_phys), intent(inout) :: cmc, sh2o(nsoil), &
3532 & smc(nsoil)
3533
3534! --- outputs:
3535 real (kind=kind_phys), intent(out) :: runoff1, runoff2, &
3536 & runoff3, drip
3537
3538! --- locals:
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)
3542
3543 integer :: i, k
3544!
3545!===> ... begin here
3546!
3547! --- ... executable code begins here.
3548
3549 dummy = 0.0
3550
3551! --- ... compute the right hand side of the canopy eqn term ( rhsct )
3552
3553 rhsct = shdfac*prcp1 - ec1
3554
3555! --- ... convert rhsct (a rate) to trhsct (an amount) and add it to
3556! existing cmc. if resulting amt exceeds max capacity, it becomes
3557! drip and will fall to the grnd.
3558
3559 drip = 0.0
3560 trhsct = dt * rhsct
3561 excess = cmc + trhsct
3562
3563 if (excess > cmcmax) drip = excess - cmcmax
3564
3565! --- ... pcpdrp is the combined prcp1 and drip (from cmc) that goes into
3566! the soil
3567
3568 pcpdrp = (1.0 - shdfac)*prcp1 + drip/dt
3569
3570! --- ... store ice content at each soil layer before calling srt & sstep
3571
3572 do i = 1, nsoil
3573 sice(i) = smc(i) - sh2o(i)
3574 enddo
3575
3576! --- ... call subroutines srt and sstep to solve the soil moisture
3577! tendency equations.
3578
3579! --- if the infiltrating precip rate is nontrivial,
3580! (we consider nontrivial to be a precip total over the time step
3581! exceeding one one-thousandth of the water holding capacity of
3582! the first soil layer)
3583! then call the srt/sstep subroutine pair twice in the manner of
3584! time scheme "f" (implicit state, averaged coefficient)
3585! of section 2 of kalnay and kanamitsu (1988, mwr, vol 116,
3586! pages 1945-1958)to minimize 2-delta-t oscillations in the
3587! soil moisture value of the top soil layer that can arise because
3588! of the extreme nonlinear dependence of the soil hydraulic
3589! diffusivity coefficient and the hydraulic conductivity on the
3590! soil moisture state
3591! otherwise call the srt/sstep subroutine pair once in the manner of
3592! time scheme "d" (implicit state, explicit coefficient)
3593! of section 2 of kalnay and kanamitsu
3594! pcpdrp is units of kg/m**2/s or mm/s, zsoil is negative depth in m
3595
3596! if ( pcpdrp .gt. 0.0 ) then
3597 if ( (pcpdrp*dt) > (0.001*1000.0*(-zsoil(1))*smcmax) ) then
3598
3599! --- ... frozen ground version:
3600! smc states replaced by sh2o states in srt subr. sh2o & sice states
3601! included in sstep subr. frozen ground correction factor, frzx
3602! added. all water balance calculations using unfrozen water
3603
3604 call srt &
3605! --- inputs:
3606 & ( nsoil, edir1, et1, sh2o, sh2o, pcpdrp, zsoil, dwsat, &
3607 & dksat, smcmax, bexp, dt, smcwlt, slope, kdt, frzx, sice, &
3608! --- outputs:
3609 & rhstt, runoff1, runoff2, ai, bi, ci &
3610 & )
3611
3612 call sstep &
3613! --- inputs:
3614 & ( nsoil, sh2o, rhsct, dt, smcmax, cmcmax, zsoil, sice, &
3615! --- input/outputs:
3616 & dummy, rhstt, ai, bi, ci, &
3617! --- outputs:
3618 & sh2ofg, runoff3, smc &
3619 & )
3620
3621 do k = 1, nsoil
3622 sh2oa(k) = (sh2o(k) + sh2ofg(k)) * 0.5
3623 enddo
3624
3625 call srt &
3626! --- inputs:
3627 & ( nsoil, edir1, et1, sh2o, sh2oa, pcpdrp, zsoil, dwsat, &
3628 & dksat, smcmax, bexp, dt, smcwlt, slope, kdt, frzx, sice, &
3629! --- outputs:
3630 & rhstt, runoff1, runoff2, ai, bi, ci &
3631 & )
3632
3633 call sstep &
3634! --- inputs:
3635 & ( nsoil, sh2o, rhsct, dt, smcmax, cmcmax, zsoil, sice, &
3636! --- input/outputs:
3637 & cmc, rhstt, ai, bi, ci, &
3638! --- outputs:
3639 & sh2o, runoff3, smc &
3640 & )
3641
3642 else
3643
3644 call srt &
3645! --- inputs:
3646 & ( nsoil, edir1, et1, sh2o, sh2o, pcpdrp, zsoil, dwsat, &
3647 & dksat, smcmax, bexp, dt, smcwlt, slope, kdt, frzx, sice, &
3648! --- outputs:
3649 & rhstt, runoff1, runoff2, ai, bi, ci &
3650 & )
3651
3652 call sstep &
3653! --- inputs:
3654 & ( nsoil, sh2o, rhsct, dt, smcmax, cmcmax, zsoil, sice, &
3655! --- input/outputs:
3656 & cmc, rhstt, ai, bi, ci, &
3657! --- outputs:
3658 & sh2o, runoff3, smc &
3659 & )
3660
3661 endif
3662
3663! runof = runoff
3664!
3665!...................................
3666 end subroutine smflx
3667!-----------------------------------
3668
3669
3670!-----------------------------------
3677 subroutine snowpack &
3678! --- inputs:
3679 & ( esd, dtsec, tsnow, tsoil, &
3680! --- input/outputs:
3681 & snowh, sndens &
3682 & )
3683
3684! ===================================================================== !
3685! description: !
3686! !
3687! subroutine snowpack calculates compaction of snowpack under !
3688! conditions of increasing snow density, as obtained from an !
3689! approximate solution of e. anderson's differential equation (3.29),!
3690! noaa technical report nws 19, by victor koren, 03/25/95. !
3691! subroutine will return new values of snowh and sndens !
3692! !
3693! !
3694! subprogram called: none !
3695! !
3696! !
3697! ==================== defination of variables ==================== !
3698! !
3699! inputs: size !
3700! esd - real, water equivalent of snow (m) 1 !
3701! dtsec - real, time step (sec) 1 !
3702! tsnow - real, snow surface temperature (k) 1 !
3703! tsoil - real, soil surface temperature (k) 1 !
3704! !
3705! input/outputs: !
3706! snowh - real, snow depth (m) 1 !
3707! sndens - real, snow density 1 !
3708! (g/cm3=dimensionless fraction of h2o density) !
3709! !
3710! ==================== end of description ===================== !
3711!
3712! --- parameter constants:
3713 real (kind=kind_phys), parameter :: c1 = 0.01
3714 real (kind=kind_phys), parameter :: c2 = 21.0
3715
3716! --- inputs:
3717 real (kind=kind_phys), intent(in) :: esd, dtsec, tsnow, tsoil
3718
3719! --- input/outputs:
3720 real (kind=kind_phys), intent(inout) :: snowh, sndens
3721
3722! --- locals:
3723 real (kind=kind_phys) :: bfac, dsx, dthr, dw, snowhc, pexp, &
3724 & tavgc, tsnowc, tsoilc, esdc, esdcx
3725
3726 integer :: ipol, j
3727!
3728!===> ... begin here
3729!
3730! --- ... conversion into simulation units
3731
3732 snowhc = snowh * 100.0
3733 esdc = esd * 100.0
3734 dthr = dtsec / 3600.0
3735 tsnowc = tsnow - tfreez
3736 tsoilc = tsoil - tfreez
3737
3738! --- ... calculating of average temperature of snow pack
3739
3740 tavgc = 0.5 * (tsnowc + tsoilc)
3741
3742! --- ... calculating of snow depth and density as a result of compaction
3743! sndens=ds0*(exp(bfac*esd)-1.)/(bfac*esd)
3744! bfac=dthr*c1*exp(0.08*tavgc-c2*ds0)
3745! note: bfac*esd in sndens eqn above has to be carefully treated
3746! numerically below:
3747! c1 is the fractional increase in density (1/(cm*hr))
3748! c2 is a constant (cm3/g) kojima estimated as 21 cms/g
3749
3750 if (esdc > 1.e-2) then
3751 esdcx = esdc
3752 else
3753 esdcx = 1.e-2
3754 endif
3755
3756 bfac = dthr*c1 * exp(0.08*tavgc - c2*sndens)
3757
3758! dsx = sndens * ((dexp(bfac*esdc)-1.0) / (bfac*esdc))
3759
3760! --- ... the function of the form (e**x-1)/x imbedded in above expression
3761! for dsx was causing numerical difficulties when the denominator "x"
3762! (i.e. bfac*esdc) became zero or approached zero (despite the fact
3763! that the analytical function (e**x-1)/x has a well defined limit
3764! as "x" approaches zero), hence below we replace the (e**x-1)/x
3765! expression with an equivalent, numerically well-behaved
3766! polynomial expansion.
3767
3768! --- ... number of terms of polynomial expansion, and hence its accuracy,
3769! is governed by iteration limit "ipol".
3770! ipol greater than 9 only makes a difference on double
3771! precision (relative errors given in percent %).
3772! ipol=9, for rel.error <~ 1.6 e-6 % (8 significant digits)
3773! ipol=8, for rel.error <~ 1.8 e-5 % (7 significant digits)
3774! ipol=7, for rel.error <~ 1.8 e-4 % ...
3775
3776 ipol = 4
3777 pexp = 0.0
3778
3779 do j = ipol, 1, -1
3780! pexp = (1.0 + pexp)*bfac*esdc /real(j+1)
3781 pexp = (1.0 + pexp)*bfac*esdcx/real(j+1)
3782 enddo
3783 pexp = pexp + 1.
3784
3785 dsx = sndens * pexp
3786
3787! --- ... above line ends polynomial substitution
3788! end of koren formulation
3789
3790!! --- ... base formulation (cogley et al., 1990)
3791! convert density from g/cm3 to kg/m3
3792
3793!! dsm = sndens * 1000.0
3794
3795!! dsx = dsm + dtsec*0.5*dsm*gs2*esd / &
3796!! & (1.e7*exp(-0.02*dsm + kn/(tavgc+273.16)-14.643))
3797
3798!! --- ... convert density from kg/m3 to g/cm3
3799
3800!! dsx = dsx / 1000.0
3801
3802!! --- ... end of cogley et al. formulation
3803
3804! --- ... set upper/lower limit on snow density
3805
3806 dsx = max( min( dsx, 0.40 ), 0.05 )
3807 sndens = dsx
3808
3809! --- ... update of snow depth and density depending on liquid water
3810! during snowmelt. assumed that 13% of liquid water can be
3811! stored in snow per day during snowmelt till snow density 0.40.
3812
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
3817 endif
3818
3819! --- ... calculate snow depth (cm) from snow water equivalent and snow
3820! density. change snow depth units to meters
3821
3822 snowhc = esdc / sndens
3823 snowh = snowhc * 0.01
3824
3825!
3826!...................................
3827 end subroutine snowpack
3828!-----------------------------------
3829
3830
3831!*********************************************!
3832! section-3 3rd or lower level subprograms !
3833!*********************************************!
3834
3835
3836!-----------------------------------
3839 subroutine devap &
3840! --- inputs:
3841 & ( etp1, smc, shdfac, smcmax, smcdry, fxexp, &
3842! --- outputs:
3843 & edir1 &
3844 & )
3845
3846! ===================================================================== !
3847! description: !
3848! !
3849! subroutine devap calculates direct soil evaporation !
3850! !
3851! !
3852! subprogram called: none !
3853! !
3854! !
3855! ==================== defination of variables ==================== !
3856! !
3857! inputs: size !
3858! etp1 - real, potential evaporation 1 !
3859! smc - real, unfrozen soil moisture 1 !
3860! shdfac - real, aeral coverage of green vegetation 1 !
3861! smcmax - real, porosity (sat val of soil mois) 1 !
3862! smcdry - real, dry soil mois threshold 1 !
3863! fxexp - real, bare soil evaporation exponent 1 !
3864! !
3865! outputs: !
3866! edir1 - real, direct soil evaporation 1 !
3867! !
3868! ==================== end of description ===================== !
3869!
3870! --- inputs:
3871 real (kind=kind_phys), intent(in) :: etp1, smc, shdfac, smcmax, &
3872 & smcdry, fxexp
3873
3874! --- outputs:
3875 real (kind=kind_phys), intent(out) :: edir1
3876
3877! --- locals:
3878 real (kind=kind_phys) :: fx, sratio
3879!
3880!===> ... begin here
3881!
3882! --- ... direct evap a function of relative soil moisture availability,
3883! linear when fxexp=1.
3884! fx > 1 represents demand control
3885! fx < 1 represents flux control
3886
3887 sratio = (smc - smcdry) / (smcmax - smcdry)
3888
3889 if (sratio > 0.0) then
3890 fx = sratio**fxexp
3891 fx = max( min( fx, 1.0 ), 0.0 )
3892 else
3893 fx = 0.0
3894 endif
3895
3896! --- ... allow for the direct-evap-reducing effect of shade
3897
3898 edir1 = fx * ( 1.0 - shdfac ) * etp1
3899!
3900!...................................
3901 end subroutine devap
3902!-----------------------------------
3903
3904
3905!-----------------------------------
3918 subroutine frh2o &
3919! --- inputs:
3920 & ( tkelv, smc, sh2o, smcmax, bexp, psis, &
3921! --- outputs:
3922 & liqwat &
3923 & )
3924
3925! ===================================================================== !
3926! description: !
3927! !
3928! subroutine frh2o calculates amount of supercooled liquid soil water !
3929! content if temperature is below 273.15k (t0). requires newton-type !
3930! iteration to solve the nonlinear implicit equation given in eqn 17 !
3931! of koren et al (1999, jgr, vol 104(d16), 19569-19585). !
3932! !
3933! new version (june 2001): much faster and more accurate newton !
3934! iteration achieved by first taking log of eqn cited above -- less !
3935! than 4 (typically 1 or 2) iterations achieves convergence. also, !
3936! explicit 1-step solution option for special case of parameter ck=0, !
3937! which reduces the original implicit equation to a simpler explicit !
3938! form, known as the "flerchinger eqn". improved handling of solution !
3939! in the limit of freezing point temperature t0. !
3940! !
3941! subprogram called: none !
3942! !
3943! !
3944! ==================== defination of variables ==================== !
3945! !
3946! inputs: size !
3947! tkelv - real, temperature (k) 1 !
3948! smc - real, total soil moisture content (volumetric) 1 !
3949! sh2o - real, liquid soil moisture content (volumetric) 1 !
3950! smcmax - real, saturation soil moisture content 1 !
3951! bexp - real, soil type "b" parameter 1 !
3952! psis - real, saturated soil matric potential 1 !
3953! !
3954! outputs: !
3955! liqwat - real, supercooled liquid water content 1 !
3956! !
3957! ==================== end of description ===================== !
3958!
3959! --- constant parameters:
3960 real (kind=kind_phys), parameter :: ck = 8.0
3961! real (kind=kind_phys), parameter :: ck = 0.0
3962 real (kind=kind_phys), parameter :: blim = 5.5
3963 real (kind=kind_phys), parameter :: error = 0.005
3964
3965! --- inputs:
3966 real (kind=kind_phys), intent(in) :: tkelv, smc, sh2o, smcmax, &
3967 & bexp, psis
3968
3969! --- outputs:
3970 real (kind=kind_phys), intent(out) :: liqwat
3971
3972! --- locals:
3973 real (kind=kind_phys) :: bx, denom, df, dswl, fk, swl, swlk
3974
3975 integer :: nlog, kcount
3976!
3977!===> ... begin here
3978!
3979! --- ... limits on parameter b: b < 5.5 (use parameter blim)
3980! simulations showed if b > 5.5 unfrozen water content is
3981! non-realistically high at very low temperatures.
3982
3983 bx = bexp
3984 if (bexp > blim) bx = blim
3985
3986! --- ... initializing iterations counter and iterative solution flag.
3987
3988 nlog = 0
3989 kcount= 0
3990
3991! --- ... if temperature not significantly below freezing (t0), sh2o = smc
3992
3993 if (tkelv > (tfreez-1.e-3)) then
3994
3995 liqwat = smc
3996
3997 else
3998
3999 if (ck /= 0.0) then
4000
4001! --- ... option 1: iterated solution for nonzero ck
4002! in koren et al, jgr, 1999, eqn 17
4003
4004! --- ... initial guess for swl (frozen content)
4005
4006 swl = smc - sh2o
4007
4008! --- ... keep within bounds.
4009
4010 swl = max( min( swl, smc-0.02 ), 0.0 )
4011
4012! --- ... start of iterations
4013
4014 do while ( (nlog < 10) .and. (kcount == 0) )
4015 nlog = nlog + 1
4016
4017 df = log( (psis*gs2/lsubf) * ( (1.0 + ck*swl)**2.0 ) &
4018 & * (smcmax/(smc-swl))**bx ) - log(-(tkelv-tfreez)/tkelv)
4019
4020 denom = 2.0*ck/(1.0 + ck*swl) + bx/(smc - swl)
4021 swlk = swl - df/denom
4022
4023! --- ... bounds useful for mathematical solution.
4024
4025 swlk = max( min( swlk, smc-0.02 ), 0.0 )
4026
4027! --- ... mathematical solution bounds applied.
4028
4029 dswl = abs(swlk - swl)
4030 swl = swlk
4031
4032! --- ... if more than 10 iterations, use explicit method (ck=0 approx.)
4033! when dswl less or eq. error, no more iterations required.
4034
4035 if ( dswl <= error ) then
4036 kcount = kcount + 1
4037 endif
4038 enddo ! end do_while_loop
4039
4040! --- ... bounds applied within do-block are valid for physical solution.
4041
4042 liqwat = smc - swl
4043
4044 endif ! end if_ck_block
4045
4046! --- ... option 2: explicit solution for flerchinger eq. i.e. ck=0
4047! in koren et al., jgr, 1999, eqn 17
4048! apply physical bounds to flerchinger solution
4049
4050 if (kcount == 0) then
4051 fk = ( ( (lsubf/(gs2*(-psis))) &
4052 & * ((tkelv-tfreez)/tkelv) )**(-1/bx) ) * smcmax
4053
4054 fk = max( fk, 0.02 )
4055
4056 liqwat = min( fk, smc )
4057 endif
4058
4059 endif ! end if_tkelv_block
4060!
4061!...................................
4062 end subroutine frh2o
4063!-----------------------------------
4064
4065
4066!-----------------------------------
4072 subroutine hrt &
4073! --- inputs:
4074 & ( nsoil, stc, smc, smcmax, zsoil, yy, zz1, tbot, &
4075 & zbot, psisat, dt, bexp, df1, quartz, csoil, vegtyp, &
4076 & shdfac, lheatstrg, &
4077! --- input/outputs:
4078 & sh2o, &
4079! --- outputs:
4080 & rhsts, ai, bi, ci &
4081 & )
4082
4083! ===================================================================== !
4084! description: !
4085! !
4086! subroutine hrt calculates the right hand side of the time tendency !
4087! term of the soil thermal diffusion equation. also to compute !
4088! (prepare) the matrix coefficients for the tri-diagonal matrix of !
4089! the implicit time scheme. !
4090! !
4091! subprogram called: tbnd, snksrc, tmpavg !
4092! !
4093! !
4094! ==================== defination of variables ==================== !
4095! !
4096! inputs: size !
4097! nsoil - integer, number of soil layers 1 !
4098! stc - real, soil temperature nsoil !
4099! smc - real, total soil moisture nsoil !
4100! smcmax - real, porosity 1 !
4101! zsoil - real, soil layer depth below ground (negative) nsoil !
4102! yy - real, 1 !
4103! zz1 - real, soil temperture at the top soil column 1 !
4104! tbot - real, bottom soil temp 1 !
4105! zbot - real, specify depth of lower bd soil 1 !
4106! psisat - real, saturated soil potential 1 !
4107! dt - real, time step 1 !
4108! bexp - real, soil type "b" parameter 1 !
4109! df1 - real, thermal diffusivity 1 !
4110! quartz - real, soil quartz content 1 !
4111! csoil - real, soil heat capacity 1 !
4112! vegtyp - integer, vegetation type 1 !
4113! shdfac - real, aeral coverage of green vegetation 1 !
4114! lheatstrg- logical, flag for canopy heat storage 1 !
4115! parameterization !
4116! !
4117! input/outputs: !
4118! sh2o - real, unfrozen soil moisture nsoil !
4119! !
4120! outputs: !
4121! rhsts - real, time tendency of soil thermal diffusion nsoil !
4122! ai - real, matrix coefficients nsold !
4123! bi - real, matrix coefficients nsold !
4124! ci - real, matrix coefficients nsold !
4125! !
4126! ==================== end of description ===================== !
4127!
4128! --- inputs:
4129 integer, intent(in) :: nsoil, vegtyp
4130
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
4134
4135 logical, intent(in) :: lheatstrg
4136
4137! --- input/outputs:
4138 real (kind=kind_phys), intent(inout) :: sh2o(nsoil)
4139
4140! --- outputs:
4141 real (kind=kind_phys), intent(out) :: rhsts(nsoil), ai(nsold), &
4142 & bi(nsold), ci(nsold)
4143
4144! --- locals:
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
4148
4149 integer :: i, k
4150
4151 logical :: itavg
4152
4153!
4154!===> ... begin here
4155!
4156 csoil_loc=csoil
4157
4158 if (.not.lheatstrg .and. ivegsrc == 1)then
4159!urban
4160!
4161!jhan urban canopy heat storage effect is included in pbl scheme
4162!
4163 if( vegtyp == 13 ) then
4164! csoil_loc=3.0e6
4165 csoil_loc=3.0e6*(1.-shdfac)+csoil*shdfac ! gvf
4166 endif
4167 endif
4168
4169! --- ... initialize logical for soil layer temperature averaging.
4170
4171 itavg = .true.
4172! itavg = .false.
4173
4174! === begin section for top soil layer
4175
4176! --- ... calc the heat capacity of the top soil layer
4177
4178 hcpct = sh2o(1)*cph2o2 + (1.0 - smcmax)*csoil_loc &
4179 & + (smcmax - smc(1))*cp2 + (smc(1) - sh2o(1))*cpice1
4180
4181! --- ... calc the matrix coefficients ai, bi, and ci for the top layer
4182
4183 ddz = 1.0 / ( -0.5*zsoil(2) )
4184 ai(1) = 0.0
4185 ci(1) = (df1*ddz) / ( zsoil(1)*hcpct )
4186 bi(1) = -ci(1) + df1 / ( 0.5*zsoil(1)*zsoil(1)*hcpct*zz1 )
4187
4188! --- ... calculate the vertical soil temp gradient btwn the 1st and 2nd soil
4189! layers. then calculate the subsurface heat flux. use the temp
4190! gradient and subsfc heat flux to calc "right-hand side tendency
4191! terms", or "rhsts", for top soil layer.
4192
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)
4196
4197! --- ... next capture the vertical difference of the heat flux at top and
4198! bottom of first soil layer for use in heat flux constraint applied to
4199! potential soil freezing/thawing in routine snksrc.
4200
4201 qtot = ssoil - df1*dtsdz
4202
4203! --- ... if temperature averaging invoked (itavg=true; else skip):
4204! set temp "tsurf" at top of soil column (for use in freezing soil
4205! physics later in subroutine snksrc). if snowpack content is
4206! zero, then tsurf expression below gives tsurf = skin temp. if
4207! snowpack is nonzero (hence argument zz1=1), then tsurf expression
4208! below yields soil column top temperature under snowpack. then
4209! calculate temperature at bottom interface of 1st soil layer for use
4210! later in subroutine snksrc
4211
4212 if (itavg) then
4213
4214 tsurf = (yy + (zz1-1)*stc(1)) / zz1
4215
4216 call tbnd &
4217! --- inputs:
4218 & ( stc(1), stc(2), zsoil, zbot, 1, nsoil, &
4219! --- outputs:
4220 & tbk &
4221 & )
4222
4223 endif
4224
4225! --- ... calculate frozen water content in 1st soil layer.
4226
4227 sice = smc(1) - sh2o(1)
4228
4229! --- ... if frozen water present or any of layer-1 mid-point or bounding
4230! interface temperatures below freezing, then call snksrc to
4231! compute heat source/sink (and change in frozen water content)
4232! due to possible soil water phase change
4233
4234 if ( (sice > 0.0) .or. (tsurf < tfreez) .or. &
4235 & (stc(1) < tfreez) .or. (tbk < tfreez) ) then
4236
4237 if (itavg) then
4238
4239 call tmpavg &
4240! --- inputs:
4241 & ( tsurf, stc(1), tbk, zsoil, nsoil, 1, &
4242! --- outputs:
4243 & tavg &
4244 & )
4245
4246 else
4247
4248 tavg = stc(1)
4249
4250 endif ! end if_itavg_block
4251
4252 call snksrc &
4253! --- inputs:
4254 & ( nsoil, 1, tavg, smc(1), smcmax, psisat, bexp, dt, &
4255 & qtot, zsoil, &
4256! --- input/outputs:
4257 & sh2o(1), &
4258! --- outputs:
4259 & tsnsr &
4260 & )
4261
4262
4263 rhsts(1) = rhsts(1) - tsnsr / ( zsoil(1)*hcpct )
4264
4265 endif ! end if_sice_block
4266
4267! === this ends section for top soil layer.
4268
4269! --- ... initialize ddz2
4270
4271 ddz2 = 0.0
4272
4273! --- ... loop thru the remaining soil layers, repeating the above process
4274! (except subsfc or "ground" heat flux not repeated in lower layers)
4275
4276 df1k = df1
4277
4278 do k = 2, nsoil
4279
4280! --- ... calculate heat capacity for this soil layer.
4281
4282 hcpct = sh2o(k)*cph2o2 + (1.0 - smcmax)*csoil_loc &
4283 & + (smcmax - smc(k))*cp2 + (smc(k) - sh2o(k))*cpice1
4284
4285 if (k /= nsoil) then
4286
4287! --- ... this section for layer 2 or greater, but not last layer.
4288! calculate thermal diffusivity for this layer.
4289
4290 call tdfcnd &
4291! --- inputs:
4292 & ( smc(k), quartz, smcmax, sh2o(k), &
4293! --- outputs:
4294 & df1n &
4295 & )
4296!urban
4297! if (ivegsrc == 1)then
4298! if ( vegtyp == 13 ) df1n = 3.24
4299! endif
4300!wz only urban for igbp type
4301!
4302!jhan urban canopy heat storage effect is included in pbl scheme
4303!
4304 if((.not.lheatstrg) .and.
4305 & (ivegsrc == 1 .and. vegtyp == 13)) then
4306 df1n = 3.24*(1.-shdfac) + shdfac*df1n
4307 endif
4308
4309! --- ... calc the vertical soil temp gradient thru this layer
4310
4311 denom = 0.5 * (zsoil(k-1) - zsoil(k+1))
4312 dtsdz2 = (stc(k) - stc(k+1)) / denom
4313
4314! --- ... calc the matrix coef, ci, after calc'ng its partial product
4315
4316 ddz2 = 2.0 / (zsoil(k-1) - zsoil(k+1))
4317 ci(k) = -df1n*ddz2 / ((zsoil(k-1) - zsoil(k)) * hcpct)
4318
4319! --- ... if temperature averaging invoked (itavg=true; else skip):
4320! calculate temp at bottom of layer.
4321
4322 if (itavg) then
4323
4324 call tbnd &
4325! --- inputs:
4326 & ( stc(k), stc(k+1), zsoil, zbot, k, nsoil, &
4327! --- outputs:
4328 & tbk1 &
4329 & )
4330
4331 endif
4332
4333 else
4334
4335! --- ... special case of bottom soil layer: calculate thermal diffusivity
4336! for bottom layer.
4337
4338 call tdfcnd &
4339! --- inputs:
4340 & ( smc(k), quartz, smcmax, sh2o(k), &
4341! --- outputs:
4342 & df1n &
4343 & )
4344!urban
4345! if (ivegsrc == 1)then
4346! if ( vegtyp == 13 ) df1n = 3.24
4347! endif
4348!wz only urban for igbp type
4349!
4350!jhan urban canopy heat storage effect is included in pbl scheme
4351!
4352 if((.not.lheatstrg) .and.
4353 & (ivegsrc == 1 .and. vegtyp == 13)) then
4354 df1n = 3.24*(1.-shdfac) + shdfac*df1n
4355 endif
4356
4357! --- ... calc the vertical soil temp gradient thru bottom layer.
4358
4359 denom = 0.5 * (zsoil(k-1) + zsoil(k)) - zbot
4360 dtsdz2 = (stc(k) - tbot) / denom
4361
4362! --- ... set matrix coef, ci to zero if bottom layer.
4363
4364 ci(k) = 0.0
4365
4366! --- ... if temperature averaging invoked (itavg=true; else skip):
4367! calculate temp at bottom of last layer.
4368
4369 if (itavg) then
4370
4371 call tbnd &
4372! --- inputs:
4373 & ( stc(k), tbot, zsoil, zbot, k, nsoil, &
4374! --- outputs:
4375 & tbk1 &
4376 & )
4377
4378 endif
4379
4380 endif ! end if_k_block
4381
4382! --- ... calculate rhsts for this layer after calc'ng a partial product.
4383
4384 denom = (zsoil(k) - zsoil(k-1)) * hcpct
4385 rhsts(k) = ( df1n*dtsdz2 - df1k*dtsdz ) / denom
4386
4387 qtot = -1.0 * denom * rhsts(k)
4388 sice = smc(k) - sh2o(k)
4389
4390 if ( (sice > 0.0) .or. (tbk < tfreez) .or. &
4391 & (stc(k) < tfreez) .or. (tbk1 < tfreez) ) then
4392
4393 if (itavg) then
4394
4395 call tmpavg &
4396! --- inputs:
4397 & ( tbk, stc(k), tbk1, zsoil, nsoil, k, &
4398! --- outputs:
4399 & tavg &
4400 & )
4401
4402 else
4403 tavg = stc(k)
4404 endif
4405
4406 call snksrc &
4407! --- inputs:
4408 & ( nsoil, k, tavg, smc(k), smcmax, psisat, bexp, dt, &
4409 & qtot, zsoil, &
4410! --- input/outputs:
4411 & sh2o(k), &
4412! --- outputs:
4413 & tsnsr &
4414 & )
4415
4416 rhsts(k) = rhsts(k) - tsnsr/denom
4417 endif
4418
4419! --- ... calc matrix coefs, ai, and bi for this layer.
4420
4421 ai(k) = - df1 * ddz / ((zsoil(k-1) - zsoil(k)) * hcpct)
4422 bi(k) = -(ai(k) + ci(k))
4423
4424! --- ... reset values of df1, dtsdz, ddz, and tbk for loop to next soil layer.
4425
4426 tbk = tbk1
4427 df1k = df1n
4428 dtsdz = dtsdz2
4429 ddz = ddz2
4430
4431 enddo ! end do_k_loop
4432
4433!
4434!...................................
4435 end subroutine hrt
4436!-----------------------------------
4437
4438
4439!-----------------------------------
4444 subroutine hrtice &
4445! --- inputs:
4446 & ( nsoil, stc, zsoil, yy, zz1, df1, ice, &
4447! --- input/outputs:
4448 & tbot, &
4449! --- outputs:
4450 & rhsts, ai, bi, ci &
4451 & )
4452
4453! ===================================================================== !
4454! description: !
4455! !
4456! subroutine hrtice calculates the right hand side of the time tendency!
4457! term of the soil thermal diffusion equation for sea-ice (ice = 1) or !
4458! glacial-ice (ice). compute (prepare) the matrix coefficients for the !
4459! tri-diagonal matrix of the implicit time scheme. !
4460! (note: this subroutine only called for sea-ice or glacial ice, but !
4461! not for non-glacial land (ice = 0). !
4462! !
4463! subprogram called: none !
4464! !
4465! !
4466! ==================== defination of variables ==================== !
4467! !
4468! inputs: size !
4469! nsoil - integer, number of soil layers 1 !
4470! stc - real, soil temperature nsoil !
4471! zsoil - real, soil depth (negative sign, as below grd) nsoil !
4472! yy - real, soil temperature at the top of column 1 !
4473! zz1 - real, 1 !
4474! df1 - real, thermal diffusivity and conductivity 1 !
4475! ice - integer, sea-ice flag (=1: sea-ice, =0: land) 1 !
4476! !
4477! input/outputs: !
4478! tbot - real, bottom soil temperature 1 !
4479! !
4480! outputs: !
4481! rhsts - real, time tendency of soil thermal diffusion nsoil !
4482! ai - real, matrix coefficients nsold !
4483! bi - real, matrix coefficients nsold !
4484! ci - real, matrix coefficients nsold !
4485! !
4486! ==================== end of description ===================== !
4487!
4488! --- inputs:
4489 integer, intent(in) :: nsoil, ice
4490
4491 real (kind=kind_phys), intent(in) :: stc(nsoil), zsoil(nsoil), &
4492 & yy, zz1, df1
4493
4494! --- input/outputs:
4495 real (kind=kind_phys), intent(inout) :: tbot
4496
4497! --- outputs:
4498 real (kind=kind_phys), intent(out) :: rhsts(nsoil), ai(nsold), &
4499 & bi(nsold), ci(nsold)
4500
4501! --- locals:
4502 real (kind=kind_phys) :: ddz, ddz2, denom, dtsdz, dtsdz2, &
4503 & hcpct, ssoil, zbot
4504
4505 integer :: k
4506
4507!
4508!===> ... begin here
4509!
4510! --- ... set a nominal universal value of the sea-ice specific heat capacity,
4511! hcpct = 1880.0*917.0 = 1.72396e+6 (source: fei chen, 1995)
4512! set bottom of sea-ice pack temperature: tbot = 271.16
4513! set a nominal universal value of glacial-ice specific heat capacity,
4514! hcpct = 2100.0*900.0 = 1.89000e+6 (source: bob grumbine, 2005)
4515! tbot passed in as argument, value from global data set
4516
4517 if (ice == 1) then
4518! --- ... sea-ice
4519 hcpct = 1.72396e+6
4520 tbot = 271.16
4521 else
4522! --- ... glacial-ice
4523 hcpct = 1.89000e+6
4524 endif
4525
4526! --- ... the input argument df1 is a universally constant value of sea-ice
4527! and glacial-ice thermal diffusivity, set in sflx as df1 = 2.2.
4528
4529! --- ... set ice pack depth. use tbot as ice pack lower boundary temperature
4530! (that of unfrozen sea water at bottom of sea ice pack). assume ice
4531! pack is of n=nsoil layers spanning a uniform constant ice pack
4532! thickness as defined by zsoil(nsoil) in routine sflx.
4533! if glacial-ice, set zbot = -25 meters
4534
4535 if (ice == 1) then
4536! --- ... sea-ice
4537 zbot = zsoil(nsoil)
4538 else
4539! --- ... glacial-ice
4540 zbot = -25.0
4541 endif
4542
4543! --- ... calc the matrix coefficients ai, bi, and ci for the top layer
4544
4545 ddz = 1.0 / (-0.5*zsoil(2))
4546 ai(1) = 0.0
4547 ci(1) = (df1*ddz) / (zsoil(1)*hcpct)
4548 bi(1) = -ci(1) + df1 / (0.5*zsoil(1)*zsoil(1)*hcpct*zz1)
4549
4550! --- ... calc the vertical soil temp gradient btwn the top and 2nd soil
4551! layers. recalc/adjust the soil heat flux. use the gradient and
4552! flux to calc rhsts for the top soil layer.
4553
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)
4557
4558! --- ... initialize ddz2
4559
4560 ddz2 = 0.0
4561
4562! --- ... loop thru the remaining soil layers, repeating the above process
4563
4564 do k = 2, nsoil
4565
4566 if (k /= nsoil) then
4567
4568! --- ... calc the vertical soil temp gradient thru this layer.
4569
4570 denom = 0.5 * (zsoil(k-1) - zsoil(k+1))
4571 dtsdz2 = (stc(k) - stc(k+1)) / denom
4572
4573! --- ... calc the matrix coef, ci, after calc'ng its partial product.
4574
4575 ddz2 = 2.0 / (zsoil(k-1) - zsoil(k+1))
4576 ci(k) = -df1*ddz2 / ((zsoil(k-1) - zsoil(k))*hcpct)
4577
4578 else
4579
4580! --- ... calc the vertical soil temp gradient thru the lowest layer.
4581
4582 dtsdz2 = (stc(k) - tbot) &
4583 & / (0.5*(zsoil(k-1) + zsoil(k)) - zbot)
4584
4585! --- ... set matrix coef, ci to zero.
4586
4587 ci(k) = 0.0
4588
4589 endif ! end if_k_block
4590
4591! --- ... calc rhsts for this layer after calc'ng a partial product.
4592
4593 denom = (zsoil(k) - zsoil(k-1)) * hcpct
4594 rhsts(k) = (df1*dtsdz2 - df1*dtsdz) / denom
4595
4596! --- ... calc matrix coefs, ai, and bi for this layer.
4597
4598 ai(k) = - df1*ddz / ((zsoil(k-1) - zsoil(k)) * hcpct)
4599 bi(k) = -(ai(k) + ci(k))
4600
4601! --- ... reset values of dtsdz and ddz for loop to next soil lyr.
4602
4603 dtsdz = dtsdz2
4604 ddz = ddz2
4605
4606 enddo ! end do_k_loop
4607!
4608!...................................
4609 end subroutine hrtice
4610!-----------------------------------
4611
4612
4613!-----------------------------------
4616 subroutine hstep &
4617! --- inputs:
4618 & ( nsoil, stcin, dt, &
4619! --- input/outputs:
4620 & rhsts, ai, bi, ci, &
4621! --- outputs:
4622 & stcout &
4623 & )
4624
4625! ===================================================================== !
4626! description: !
4627! !
4628! subroutine hstep calculates/updates the soil temperature field. !
4629! !
4630! subprogram called: rosr12 !
4631! !
4632! !
4633! ==================== defination of variables ==================== !
4634! !
4635! inputs: size !
4636! nsoil - integer, number of soil layers 1 !
4637! stcin - real, soil temperature nsoil !
4638! dt - real, time step 1 !
4639! !
4640! input/outputs: !
4641! rhsts - real, time tendency of soil thermal diffusion nsoil !
4642! ai - real, matrix coefficients nsold !
4643! bi - real, matrix coefficients nsold !
4644! ci - real, matrix coefficients nsold !
4645! !
4646! outputs: !
4647! stcout - real, updated soil temperature nsoil !
4648! !
4649! ==================== end of description ===================== !
4650!
4651! --- inputs:
4652 integer, intent(in) :: nsoil
4653
4654 real (kind=kind_phys), intent(in) :: stcin(nsoil), dt
4655
4656! --- input/outputs:
4657 real (kind=kind_phys), intent(inout) :: rhsts(nsoil), &
4658 & ai(nsold), bi(nsold), ci(nsold)
4659
4660! --- outputs:
4661 real (kind=kind_phys), intent(out) :: stcout(nsoil)
4662
4663! --- locals:
4664 integer :: k
4665
4666 real (kind=kind_phys) :: ciin(nsold), rhstsin(nsoil)
4667
4668!
4669!===> ... begin here
4670!
4671! --- ... create finite difference values for use in rosr12 routine
4672
4673 do k = 1, nsoil
4674 rhsts(k) = rhsts(k) * dt
4675 ai(k) = ai(k) * dt
4676 bi(k) = 1.0 + bi(k)*dt
4677 ci(k) = ci(k) * dt
4678 enddo
4679
4680! --- ... copy values for input variables before call to rosr12
4681
4682 do k = 1, nsoil
4683 rhstsin(k) = rhsts(k)
4684 enddo
4685
4686 do k = 1, nsold
4687 ciin(k) = ci(k)
4688 enddo
4689
4690! --- ... solve the tri-diagonal matrix equation
4691
4692 call rosr12 &
4693! --- inputs:
4694 & ( nsoil, ai, bi, rhstsin, &
4695! --- input/outputs:
4696 & ciin, &
4697! --- outputs:
4698 & ci, rhsts &
4699 & )
4700
4701! --- ... calc/update the soil temps using matrix solution
4702
4703 do k = 1, nsoil
4704 stcout(k) = stcin(k) + ci(k)
4705 enddo
4706!
4707!...................................
4708 end subroutine hstep
4709!-----------------------------------
4710
4711
4712!-----------------------------------
4715 subroutine rosr12 &
4716! --- inputs:
4717 & ( nsoil, a, b, d, &
4718! --- input/outputs:
4719 & c, &
4720! --- outputs:
4721 & p, delta &
4722 & )
4723
4724! ===================================================================== !
4725! description: !
4726! !
4727! subroutine rosr12 inverts (solve) the tri-diagonal matrix problem !
4728! shown below: !
4729! !
4730! ### ### ### ### ### ###!
4731! #b(1), c(1), 0 , 0 , 0 , . . . , 0 # # # # #!
4732! #a(2), b(2), c(2), 0 , 0 , . . . , 0 # # # # #!
4733! # 0 , a(3), b(3), c(3), 0 , . . . , 0 # # # # d(3) #!
4734! # 0 , 0 , a(4), b(4), c(4), . . . , 0 # # p(4) # # d(4) #!
4735! # 0 , 0 , 0 , a(5), b(5), . . . , 0 # # p(5) # # d(5) #!
4736! # . . # # . # = # . #!
4737! # . . # # . # # . #!
4738! # . . # # . # # . #!
4739! # 0 , . . . , 0 , a(m-2), b(m-2), c(m-2), 0 # #p(m-2)# #d(m-2)#!
4740! # 0 , . . . , 0 , 0 , a(m-1), b(m-1), c(m-1)# #p(m-1)# #d(m-1)#!
4741! # 0 , . . . , 0 , 0 , 0 , a(m) , b(m) # # p(m) # # d(m) #!
4742! ### ### ### ### ### ###!
4743! !
4744! subprogram called: none !
4745! !
4746! !
4747! ==================== defination of variables ==================== !
4748! !
4749! inputs: size !
4750! nsoil - integer, number of soil layers 1 !
4751! a - real, matrix coefficients nsoil !
4752! b - real, matrix coefficients nsoil !
4753! d - real, soil water time tendency nsoil !
4754! !
4755! input/outputs: !
4756! c - real, matrix coefficients nsoil !
4757! !
4758! outputs: !
4759! p - real, nsoil !
4760! delta - real, nsoil !
4761! !
4762! ==================== end of description ===================== !
4763!
4764! --- inputs:
4765 integer, intent(in) :: nsoil
4766
4767 real (kind=kind_phys), dimension(nsoil), intent(in) :: a, b, d
4768
4769! --- input/outputs:
4770 real (kind=kind_phys), dimension(nsoil), intent(inout) :: c
4771
4772! --- outputs:
4773 real (kind=kind_phys), dimension(nsoil), intent(out) :: p, delta
4774
4775! --- locals:
4776 integer :: k, kk
4777
4778!
4779!===> ... begin here
4780!
4781! --- ... initialize eqn coef c for the lowest soil layer
4782
4783 c(nsoil) = 0.0
4784
4785! --- ... solve the coefs for the 1st soil layer
4786
4787 p(1) = -c(1) / b(1)
4788 delta(1) = d(1) / b(1)
4789
4790! --- ... solve the coefs for soil layers 2 thru nsoil
4791
4792 do k = 2, nsoil
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)) )
4796 enddo
4797
4798! --- ... set p to delta for lowest soil layer
4799
4800 p(nsoil) = delta(nsoil)
4801
4802! --- ... adjust p for soil layers 2 thru nsoil
4803
4804 do k = 2, nsoil
4805 kk = nsoil - k + 1
4806 p(kk) = p(kk)*p(kk+1) + delta(kk)
4807 enddo
4808!
4809!...................................
4810 end subroutine rosr12
4811!-----------------------------------
4812
4813
4814!-----------------------------------
4817 subroutine snksrc &
4818! --- inputs:
4819 & ( nsoil, k, tavg, smc, smcmax, psisat, bexp, dt, &
4820 & qtot, zsoil, &
4821! --- input/outputs:
4822 & sh2o, &
4823! --- outputs:
4824 & tsrc &
4825 & )
4826
4827! ===================================================================== !
4828! description: !
4829! !
4830! subroutine snksrc calculates sink/source term of the termal !
4831! diffusion equation. !
4832! !
4833! subprograms called: frh2o !
4834! !
4835! !
4836! ==================== defination of variables ==================== !
4837! !
4838! inputs: size !
4839! nsoil - integer, number of soil layers 1 !
4840! k - integer, index of soil layers 1 !
4841! tavg - real, soil layer average temperature 1 !
4842! smc - real, total soil moisture 1 !
4843! smcmax - real, porosity 1 !
4844! psisat - real, saturated soil potential 1 !
4845! bexp - real, soil type "b" parameter 1 !
4846! dt - real, time step 1 !
4847! qtot - real, tot vertical diff of heat flux 1 !
4848! zsoil - real, soil layer depth below ground (negative) nsoil !
4849! !
4850! input/outputs: !
4851! sh2o - real, available liqued water 1 !
4852! !
4853! outputs: !
4854! tsrc - real, heat source/sink 1 !
4855! !
4856! ==================== end of description ===================== !
4857!
4858! --- parameter constants:
4859 real (kind=kind_phys), parameter :: dh2o = 1.0000e3
4860
4861! --- inputs:
4862 integer, intent(in) :: nsoil, k
4863
4864 real (kind=kind_phys), intent(in) :: tavg, smc, smcmax, psisat, &
4865 & bexp, dt, qtot, zsoil(nsoil)
4866
4867! --- input/outputs:
4868 real (kind=kind_phys), intent(inout) :: sh2o
4869
4870! --- outputs:
4871 real (kind=kind_phys), intent(out) :: tsrc
4872
4873! --- locals:
4874 real (kind=kind_phys) :: dz, free, xh2o
4875
4876! --- external functions:
4877! real (kind=kind_phys) :: frh2o
4878!
4879!===> ... begin here
4880!
4881 if (k == 1) then
4882 dz = -zsoil(1)
4883 else
4884 dz = zsoil(k-1) - zsoil(k)
4885 endif
4886
4887! --- ... via function frh2o, compute potential or 'equilibrium' unfrozen
4888! supercooled free water for given soil type and soil layer temperature.
4889! function frh20 invokes eqn (17) from v. koren et al (1999, jgr, vol.
4890! 104, pg 19573). (aside: latter eqn in journal in centigrade units.
4891! routine frh2o use form of eqn in kelvin units.)
4892
4893! free = frh2o( tavg,smc,sh2o,smcmax,bexp,psisat )
4894
4895 call frh2o &
4896! --- inputs:
4897 & ( tavg, smc, sh2o, smcmax, bexp, psisat, &
4898! --- outputs:
4899 & free &
4900 & )
4901
4902
4903! --- ... in next block of code, invoke eqn 18 of v. koren et al (1999, jgr,
4904! vol. 104, pg 19573.) that is, first estimate the new amountof liquid
4905! water, 'xh2o', implied by the sum of (1) the liquid water at the begin
4906! of current time step, and (2) the freeze of thaw change in liquid
4907! water implied by the heat flux 'qtot' passed in from routine hrt.
4908! second, determine if xh2o needs to be bounded by 'free' (equil amt) or
4909! if 'free' needs to be bounded by xh2o.
4910
4911 xh2o = sh2o + qtot*dt / (dh2o*lsubf*dz)
4912
4913! --- ... first, if freezing and remaining liquid less than lower bound, then
4914! reduce extent of freezing, thereby letting some or all of heat flux
4915! qtot cool the soil temp later in routine hrt.
4916
4917 if ( xh2o < sh2o .and. xh2o < free) then
4918 if ( free > sh2o ) then
4919 xh2o = sh2o
4920 else
4921 xh2o = free
4922 endif
4923 endif
4924
4925! --- ... second, if thawing and the increase in liquid water greater than
4926! upper bound, then reduce extent of thaw, thereby letting some or
4927! all of heat flux qtot warm the soil temp later in routine hrt.
4928
4929 if ( xh2o > sh2o .and. xh2o > free ) then
4930 if ( free < sh2o ) then
4931 xh2o = sh2o
4932 else
4933 xh2o = free
4934 endif
4935 endif
4936
4937 xh2o = max( min( xh2o, smc ), 0.0 )
4938
4939! --- ... calculate phase-change heat source/sink term for use in routine hrt
4940! and update liquid water to reflcet final freeze/thaw increment.
4941
4942 tsrc = -dh2o * lsubf * dz * (xh2o - sh2o) / dt
4943 sh2o = xh2o
4944!
4945!...................................
4946 end subroutine snksrc
4947!-----------------------------------
4948
4949
4950!-----------------------------------
4956 subroutine srt &
4957! --- inputs:
4958 & ( nsoil, edir, et, sh2o, sh2oa, pcpdrp, zsoil, dwsat, &
4959 & dksat, smcmax, bexp, dt, smcwlt, slope, kdt, frzx, sice, &
4960! --- outputs:
4961 & rhstt, runoff1, runoff2, ai, bi, ci &
4962 & )
4963
4964! ===================================================================== !
4965! description: !
4966! subroutine srt calculates the right hand side of the time tendency !
4967! term of the soil water diffusion equation. also to compute !
4968! ( prepare ) the matrix coefficients for the tri-diagonal matrix !
4969! of the implicit time scheme. !
4970! !
4971! subprogram called: wdfcnd !
4972! !
4973! !
4974! ==================== defination of variables ==================== !
4975! !
4976! inputs: size !
4977! nsoil - integer, number of soil layers 1 !
4978! edir - real, direct soil evaporation 1 !
4979! et - real, plant transpiration nsoil !
4980! sh2o - real, unfrozen soil moisture nsoil !
4981! sh2oa - real, nsoil !
4982! pcpdrp - real, combined prcp and drip 1 !
4983! zsoil - real, soil layer depth below ground nsoil !
4984! dwsat - real, saturated soil diffusivity 1 !
4985! dksat - real, saturated soil hydraulic conductivity 1 !
4986! smcmax - real, porosity 1 !
4987! bexp - real, soil type "b" parameter 1 !
4988! dt - real, time step 1 !
4989! smcwlt - real, wilting point 1 !
4990! slope - real, linear reservoir coefficient 1 !
4991! kdt - real, 1 !
4992! frzx - real, frozen ground parameter 1 !
4993! sice - real, ice content at each soil layer nsoil !
4994! !
4995! outputs: !
4996! rhstt - real, soil water time tendency nsoil !
4997! runoff1 - real, surface runoff not infiltrating sfc 1 !
4998! runoff2 - real, sub surface runoff (baseflow) 1 !
4999! ai - real, matrix coefficients nsold !
5000! bi - real, matrix coefficients nsold !
5001! ci - real, matrix coefficients nsold !
5002! !
5003! ==================== end of description ===================== !
5004!
5005! --- inputs:
5006 integer, intent(in) :: nsoil
5007
5008 real (kind=kind_phys), dimension(nsoil), intent(in) :: et, &
5009 & sh2o, sh2oa, zsoil, sice
5010
5011 real (kind=kind_phys), intent(in) :: edir, pcpdrp, dwsat, dksat, &
5012 & smcmax, smcwlt, bexp, dt, slope, kdt, frzx
5013
5014! --- outputs:
5015 real (kind=kind_phys), intent(out) :: runoff1, runoff2, &
5016 & rhstt(nsoil), ai(nsold), bi(nsold), ci(nsold)
5017
5018
5019! --- locals:
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)
5024
5025 integer :: cvfrz, ialp1, iohinf, j, jj, k, ks
5026!
5027!===> ... begin here
5028!
5029! --- ... frozen ground version:
5030! reference frozen ground parameter, cvfrz, is a shape parameter
5031! of areal distribution function of soil ice content which equals
5032! 1/cv. cv is a coefficient of spatial variation of soil ice content.
5033! based on field data cv depends on areal mean of frozen depth, and
5034! it close to constant = 0.6 if areal mean frozen depth is above 20 cm.
5035! that is why parameter cvfrz = 3 (int{1/0.6*0.6}). current logic
5036! doesn't allow cvfrz be bigger than 3
5037
5038 parameter(cvfrz = 3)
5039
5040c ----------------------------------------------------------------------
5041! --- ... determine rainfall infiltration rate and runoff. include
5042! the infiltration formule from schaake and koren model.
5043! modified by q duan
5044
5045 iohinf = 1
5046
5047! --- ... let sicemax be the greatest, if any, frozen water content within
5048! soil layers.
5049
5050 sicemax = 0.0
5051 do ks = 1, nsoil
5052 if (sice(ks) > sicemax) sicemax = sice(ks)
5053 enddo
5054
5055! --- ... determine rainfall infiltration rate and runoff
5056
5057 pddum = pcpdrp
5058 runoff1 = 0.0
5059
5060 if (pcpdrp /= 0.0) then
5061
5062! --- ... modified by q. duan, 5/16/94
5063
5064 dt1 = dt/86400.
5065 smcav = smcmax - smcwlt
5066 dmax(1) = -zsoil(1) * smcav
5067
5068! --- ... frozen ground version:
5069
5070 dice = -zsoil(1) * sice(1)
5071
5072 dmax(1) = dmax(1)*(1.0 - (sh2oa(1)+sice(1)-smcwlt)/smcav)
5073 dd = dmax(1)
5074
5075 do ks = 2, nsoil
5076
5077! --- ... frozen ground version:
5078
5079 dice = dice + ( zsoil(ks-1) - zsoil(ks) ) * sice(ks)
5080
5081 dmax(ks) = (zsoil(ks-1)-zsoil(ks))*smcav
5082 dmax(ks) = dmax(ks)*(1.0 - (sh2oa(ks)+sice(ks)-smcwlt)/smcav)
5083 dd = dd + dmax(ks)
5084 enddo
5085
5086! --- ... val = (1.-exp(-kdt*sqrt(dt1)))
5087! in below, remove the sqrt in above
5088
5089 val = 1.0 - exp(-kdt*dt1)
5090 ddt = dd * val
5091
5092 px = pcpdrp * dt
5093 if (px < 0.0) px = 0.0
5094
5095 infmax = (px*(ddt/(px+ddt)))/dt
5096
5097! --- ... frozen ground version:
5098! reduction of infiltration based on frozen ground parameters
5099
5100 fcr = 1.
5101
5102 if (dice > 1.e-2) then
5103 acrt = cvfrz * frzx / dice
5104 sum = 1.
5105
5106 ialp1 = cvfrz - 1
5107 do j = 1, ialp1
5108 k = 1
5109
5110 do jj = j+1,ialp1
5111 k = k * jj
5112 enddo
5113
5114 sum = sum + (acrt**( cvfrz-j)) / float(k)
5115 enddo
5116
5117 fcr = 1.0 - exp(-acrt) * sum
5118 endif
5119
5120 infmax = infmax * fcr
5121
5122! --- ... correction of infiltration limitation:
5123! if infmax .le. hydrolic conductivity assign infmax the value
5124! of hydrolic conductivity
5125
5126! mxsmc = max ( sh2oa(1), sh2oa(2) )
5127 mxsmc = sh2oa(1)
5128
5129 call wdfcnd &
5130! --- inputs:
5131 & ( mxsmc, smcmax, bexp, dksat, dwsat, sicemax, &
5132! --- outputs:
5133 & wdf, wcnd &
5134 & )
5135
5136 infmax = max( infmax, wcnd )
5137 infmax = min( infmax, px )
5138
5139 if (pcpdrp > infmax) then
5140 runoff1 = pcpdrp - infmax
5141 pddum = infmax
5142 endif
5143
5144 endif ! end if_pcpdrp_block
5145
5146! --- ... to avoid spurious drainage behavior, 'upstream differencing'
5147! in line below replaced with new approach in 2nd line:
5148! 'mxsmc = max(sh2oa(1), sh2oa(2))'
5149
5150 mxsmc = sh2oa(1)
5151
5152 call wdfcnd &
5153! --- inputs:
5154 & ( mxsmc, smcmax, bexp, dksat, dwsat, sicemax, &
5155! --- outputs:
5156 & wdf, wcnd &
5157 & )
5158
5159! --- ... calc the matrix coefficients ai, bi, and ci for the top layer
5160
5161 ddz = 1.0 / ( -.5*zsoil(2) )
5162 ai(1) = 0.0
5163 bi(1) = wdf * ddz / ( -zsoil(1) )
5164 ci(1) = -bi(1)
5165
5166! --- ... calc rhstt for the top layer after calc'ng the vertical soil
5167! moisture gradient btwn the top and next to top layers.
5168
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)
5172
5173! --- ... initialize ddz2
5174
5175 ddz2 = 0.0
5176
5177! --- ... loop thru the remaining soil layers, repeating the abv process
5178
5179 do k = 2, nsoil
5180 denom2 = (zsoil(k-1) - zsoil(k))
5181
5182 if (k /= nsoil) then
5183 slopx = 1.0
5184
5185! --- ... again, to avoid spurious drainage behavior, 'upstream differencing'
5186! in line below replaced with new approach in 2nd line:
5187! 'mxsmc2 = max (sh2oa(k), sh2oa(k+1))'
5188
5189 mxsmc2 = sh2oa(k)
5190
5191 call wdfcnd &
5192! --- inputs:
5193 & ( mxsmc2, smcmax, bexp, dksat, dwsat, sicemax, &
5194! --- outputs:
5195 & wdf2, wcnd2 &
5196 & )
5197
5198! --- ... calc some partial products for later use in calc'ng rhstt
5199
5200 denom = (zsoil(k-1) - zsoil(k+1))
5201 dsmdz2 = (sh2o(k) - sh2o(k+1)) / (denom * 0.5)
5202
5203! --- ... calc the matrix coef, ci, after calc'ng its partial product
5204
5205 ddz2 = 2.0 / denom
5206 ci(k) = -wdf2 * ddz2 / denom2
5207
5208 else ! if_k_block
5209
5210! --- ... slope of bottom layer is introduced
5211
5212 slopx = slope
5213
5214! --- ... retrieve the soil water diffusivity and hydraulic conductivity
5215! for this layer
5216
5217 call wdfcnd &
5218! --- inputs:
5219 & ( sh2oa(nsoil), smcmax, bexp, dksat, dwsat, sicemax, &
5220! --- outputs:
5221 & wdf2, wcnd2 &
5222 & )
5223
5224! --- ... calc a partial product for later use in calc'ng rhstt
5225 dsmdz2 = 0.0
5226
5227! --- ... set matrix coef ci to zero
5228
5229 ci(k) = 0.0
5230
5231 endif ! end if_k_block
5232
5233! --- ... calc rhstt for this layer after calc'ng its numerator
5234
5235 numer = wdf2*dsmdz2 + slopx*wcnd2 - wdf*dsmdz - wcnd + et(k)
5236 rhstt(k) = numer / (-denom2)
5237
5238! --- ... calc matrix coefs, ai, and bi for this layer
5239
5240 ai(k) = -wdf * ddz / denom2
5241 bi(k) = -( ai(k) + ci(k) )
5242
5243! --- ... reset values of wdf, wcnd, dsmdz, and ddz for loop to next lyr
5244! runoff2: sub-surface or baseflow runoff
5245
5246 if (k == nsoil) then
5247 runoff2 = slopx * wcnd2
5248 endif
5249
5250 if (k /= nsoil) then
5251 wdf = wdf2
5252 wcnd = wcnd2
5253 dsmdz= dsmdz2
5254 ddz = ddz2
5255 endif
5256 enddo ! end do_k_loop
5257!
5258!...................................
5259 end subroutine srt
5260!-----------------------------------
5261
5262
5263!-----------------------------------
5267 subroutine sstep &
5268! --- inputs:
5269 & ( nsoil, sh2oin, rhsct, dt, smcmax, cmcmax, zsoil, sice, &
5270! --- input/outputs:
5271 & cmc, rhstt, ai, bi, ci, &
5272! --- outputs:
5273 & sh2oout, runoff3, smc &
5274 & )
5275
5276! ===================================================================== !
5277! description: !
5278! subroutine sstep calculates/updates soil moisture content values !
5279! and canopy moisture content values. !
5280! !
5281! subprogram called: rosr12 !
5282! !
5283! !
5284! ==================== defination of variables ==================== !
5285! !
5286! inputs: size !
5287! nsoil - integer, number of soil layers 1 !
5288! sh2oin - real, unfrozen soil moisture nsoil !
5289! rhsct - real, 1 !
5290! dt - real, time step 1 !
5291! smcmax - real, porosity 1 !
5292! cmcmax - real, maximum canopy water parameters 1 !
5293! zsoil - real, soil layer depth below ground nsoil !
5294! sice - real, ice content at each soil layer nsoil !
5295! !
5296! input/outputs: !
5297! cmc - real, canopy moisture content 1 !
5298! rhstt - real, soil water time tendency nsoil !
5299! ai - real, matrix coefficients nsold !
5300! bi - real, matrix coefficients nsold !
5301! ci - real, matrix coefficients nsold !
5302! !
5303! outputs: !
5304! sh2oout - real, updated soil moisture content nsoil !
5305! runoff3 - real, excess of porosity 1 !
5306! smc - real, total soil moisture nsoil !
5307! !
5308! ==================== end of description ===================== !
5309!
5310! --- input:
5311 integer, intent(in) :: nsoil
5312
5313 real (kind=kind_phys), dimension(nsoil), intent(in) :: sh2oin, &
5314 & zsoil, sice
5315
5316 real (kind=kind_phys), intent(in) :: rhsct, dt, smcmax, cmcmax
5317
5318! --- inout/outputs:
5319 real (kind=kind_phys), intent(inout) :: cmc, rhstt(nsoil), &
5320 & ai(nsold), bi(nsold), ci(nsold)
5321
5322! --- outputs:
5323 real (kind=kind_phys), intent(out) :: sh2oout(nsoil), runoff3, &
5324 & smc(nsoil)
5325
5326! --- locals:
5327 real (kind=kind_phys) :: ciin(nsold), rhsttin(nsoil), ddz, stot, &
5328 & wplus
5329
5330 integer :: i, k, kk11
5331!
5332!===> ... begin here
5333!
5334! --- ... create 'amount' values of variables to be input to the
5335! tri-diagonal matrix routine.
5336
5337 do k = 1, nsoil
5338 rhstt(k) = rhstt(k) * dt
5339 ai(k) = ai(k) * dt
5340 bi(k) = 1. + bi(k) * dt
5341 ci(k) = ci(k) * dt
5342 enddo
5343
5344! --- ... copy values for input variables before call to rosr12
5345
5346 do k = 1, nsoil
5347 rhsttin(k) = rhstt(k)
5348 enddo
5349
5350 do k = 1, nsold
5351 ciin(k) = ci(k)
5352 enddo
5353
5354! --- ... call rosr12 to solve the tri-diagonal matrix
5355
5356 call rosr12 &
5357! --- inputs:
5358 & ( nsoil, ai, bi, rhsttin, &
5359! --- input/outputs:
5360 & ciin, &
5361! --- outputs:
5362 & ci, rhstt &
5363 & )
5364
5365! --- ... sum the previous smc value and the matrix solution to get
5366! a new value. min allowable value of smc will be 0.02.
5367! runoff3: runoff within soil layers
5368
5369 wplus = 0.0
5370 runoff3 = 0.0
5371 ddz = -zsoil(1)
5372
5373 do k = 1, nsoil
5374 if (k /= 1) ddz = zsoil(k - 1) - zsoil(k)
5375
5376 sh2oout(k) = sh2oin(k) + ci(k) + wplus/ddz
5377
5378 stot = sh2oout(k) + sice(k)
5379 if (stot > smcmax) then
5380 if (k == 1) then
5381 ddz = -zsoil(1)
5382 else
5383 kk11 = k - 1
5384 ddz = -zsoil(k) + zsoil(kk11)
5385 endif
5386
5387 wplus = (stot - smcmax) * ddz
5388 else
5389 wplus = 0.0
5390 endif
5391
5392 smc(k) = max( min( stot, smcmax ), 0.02 )
5393 sh2oout(k) = max( smc(k)-sice(k), 0.0 )
5394 enddo
5395
5396 runoff3 = wplus
5397
5398! --- ... update canopy water content/interception (cmc). convert rhsct to
5399! an 'amount' value and add to previous cmc value to get new cmc.
5400
5401 cmc = cmc + dt*rhsct
5402 if (cmc < 1.e-20) cmc = 0.0
5403 cmc = min( cmc, cmcmax )
5404!
5405!...................................
5406 end subroutine sstep
5407!-----------------------------------
5408
5409
5410!-----------------------------------
5414 subroutine tbnd &
5415! --- inputs:
5416 & ( tu, tb, zsoil, zbot, k, nsoil, &
5417! --- outputs:
5418 & tbnd1 &
5419 & )
5420
5421! ===================================================================== !
5422! description: !
5423! !
5424! subroutine tbnd calculates temperature on the boundary of the !
5425! layer by interpolation of the middle layer temperatures !
5426! !
5427! subprogram called: none !
5428! !
5429! ==================== defination of variables ==================== !
5430! !
5431! inputs: size !
5432! tu - real, soil temperature 1 !
5433! tb - real, bottom soil temp 1 !
5434! zsoil - real, soil layer depth nsoil !
5435! zbot - real, specify depth of lower bd soil 1 !
5436! k - integer, soil layer index 1 !
5437! nsoil - integer, number of soil layers 1 !
5438! !
5439! outputs: !
5440! tbnd1 - real, temperature at bottom interface of the lyr 1 !
5441! !
5442! ==================== end of description ===================== !
5443!
5444! --- input:
5445 integer, intent(in) :: k, nsoil
5446
5447 real (kind=kind_phys), intent(in) :: tu, tb, zbot, zsoil(nsoil)
5448
5449! --- output:
5450 real (kind=kind_phys), intent(out) :: tbnd1
5451
5452! --- locals:
5453 real (kind=kind_phys) :: zb, zup
5454
5455! --- ... use surface temperature on the top of the first layer
5456
5457 if (k == 1) then
5458 zup = 0.0
5459 else
5460 zup = zsoil(k-1)
5461 endif
5462
5463! --- ... use depth of the constant bottom temperature when interpolate
5464! temperature into the last layer boundary
5465
5466 if (k == nsoil) then
5467 zb = 2.0*zbot - zsoil(k)
5468 else
5469 zb = zsoil(k+1)
5470 endif
5471
5472! --- ... linear interpolation between the average layer temperatures
5473
5474 tbnd1 = tu + (tb-tu)*(zup-zsoil(k))/(zup-zb)
5475!
5476!...................................
5477 end subroutine tbnd
5478!-----------------------------------
5479
5480
5481!-----------------------------------
5488 subroutine tmpavg &
5489! --- inputs:
5490 & ( tup, tm, tdn, zsoil, nsoil, k, &
5491! --- outputs:
5492 & tavg &
5493 & )
5494
5495! ===================================================================== !
5496! description: !
5497! subroutine tmpavg calculates soil layer average temperature (tavg) !
5498! in freezing/thawing layer using up, down, and middle layer !
5499! temperatures (tup, tdn, tm), where tup is at top boundary of !
5500! layer, tdn is at bottom boundary of layer. tm is layer prognostic !
5501! state temperature. !
5502! !
5503! !
5504! subprogram called: none !
5505! !
5506!
5507! ==================== defination of variables ==================== !
5508! !
5509! inputs: size !
5510! tup - real, temperature ar top boundary of layer 1 !
5511! tm - real, layer prognostic state temperature 1 !
5512! tdn - real, temperature ar bottom boundary of layer 1 !
5513! zsoil - real, soil layer depth nsoil !
5514! nsoil - integer, number of soil layers 1 !
5515! k - integer, layer index 1 !
5516! outputs: !
5517! tavg - real, soil layer average temperature 1 !
5518! !
5519! ==================== end of description ===================== !
5520!
5521! --- input:
5522 integer, intent(in) :: nsoil, k
5523
5524 real (kind=kind_phys), intent(in) :: tup, tm, tdn, zsoil(nsoil)
5525
5526! --- output:
5527 real (kind=kind_phys), intent(out) :: tavg
5528
5529! --- locals:
5530 real (kind=kind_phys) :: dz, dzh, x0, xdn, xup
5531!
5532!===> ... begin here
5533!
5534 if (k == 1) then
5535 dz = -zsoil(1)
5536 else
5537 dz = zsoil(k-1) - zsoil(k)
5538 endif
5539
5540 dzh = dz * 0.5
5541
5542 if (tup < tfreez) then
5543
5544 if (tm < tfreez) then
5545 if (tdn < tfreez) then ! tup, tm, tdn < t0
5546 tavg = (tup + 2.0*tm + tdn) / 4.0
5547 else ! tup & tm < t0, tdn >= t0
5548 x0 = (tfreez - tm) * dzh / (tdn - tm)
5549 tavg = 0.5*(tup*dzh + tm*(dzh+x0)+tfreez*(2.*dzh-x0)) / dz
5550 endif
5551 else
5552 if (tdn < tfreez) then ! tup < t0, tm >= t0, tdn < t0
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
5556 else ! tup < t0, tm >= t0, tdn >= t0
5557 xup = (tfreez-tup) * dzh / (tm-tup)
5558 tavg = 0.5*(tup*xup + tfreez*(2.*dz-xup)) / dz
5559 endif
5560 endif
5561
5562 else ! if_tup_block
5563
5564 if (tm < tfreez) then
5565 if (tdn < tfreez) then ! tup >= t0, tm < t0, tdn < t0
5566 xup = dzh - (tfreez-tup) * dzh / (tm-tup)
5567 tavg = 0.5*(tfreez*(dz-xup) + tm*(dzh+xup)+tdn*dzh) / dz
5568 else ! tup >= t0, tm < t0, tdn >= t0
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
5572 endif
5573 else
5574 if (tdn < tfreez) then ! tup >= t0, tm >= t0, tdn < t0
5575 xdn = dzh - (tfreez-tm) * dzh / (tdn-tm)
5576 tavg = (tfreez*(dz-xdn) + 0.5*(tfreez+tdn)*xdn) / dz
5577 else ! tup >= t0, tm >= t0, tdn >= t0
5578 tavg = (tup + 2.0*tm + tdn) / 4.0
5579 endif
5580 endif
5581
5582 endif ! end if_tup_block
5583!
5584!...................................
5585 end subroutine tmpavg
5586!-----------------------------------
5587
5588
5589!-----------------------------------
5592 subroutine transp &
5593! --- inputs:
5594 & ( nsoil, nroot, etp1, smc, smcwlt, smcref, &
5595 & cmc, cmcmax, zsoil, shdfac, pc, cfactr, rtdis, &
5596! --- outputs:
5597 & et1 &
5598 & )
5599
5600! ===================================================================== !
5601! description: !
5602! subroutine transp calculates transpiration for the veg class. !
5603! !
5604! subprogram called: none !
5605! !
5606! !
5607! ==================== defination of variables ==================== !
5608! !
5609! inputs: size !
5610! nsoil - integer, number of soil layers 1 !
5611! nroot - integer, number of root layers 1 !
5612! etp1 - real, potential evaporation 1 !
5613! smc - real, unfrozen soil moisture nsoil !
5614! smcwlt - real, wilting point 1 !
5615! smcref - real, soil mois threshold 1 !
5616! cmc - real, canopy moisture content 1 !
5617! cmcmax - real, maximum canopy water parameters 1 !
5618! zsoil - real, soil layer depth below ground nsoil !
5619! shdfac - real, aeral coverage of green vegetation 1 !
5620! pc - real, plant coeff 1 !
5621! cfactr - real, canopy water parameters 1 !
5622! rtdis - real, root distribution nsoil !
5623! !
5624! outputs: !
5625! et1 - real, plant transpiration nsoil !
5626! !
5627! ==================== end of description ===================== !
5628!
5629! --- input:
5630 integer, intent(in) :: nsoil, nroot
5631
5632 real (kind=kind_phys), intent(in) :: etp1, smcwlt, smcref, &
5633 & cmc, cmcmax, shdfac, pc, cfactr
5634
5635 real (kind=kind_phys), dimension(nsoil), intent(in) :: smc, &
5636 & zsoil, rtdis
5637
5638! --- output:
5639 real (kind=kind_phys), dimension(nsoil), intent(out) :: et1
5640
5641! --- locals:
5642 real (kind=kind_phys) :: denom, etp1a, rtx, sgx, gx(7)
5643
5644 integer :: i, k
5645!
5646!===> ... begin here
5647!
5648! --- ... initialize plant transp to zero for all soil layers.
5649
5650 do k = 1, nsoil
5651 et1(k) = 0.0
5652 enddo
5653
5654! --- ... calculate an 'adjusted' potential transpiration
5655! if statement below to avoid tangent linear problems near zero
5656! note: gx and other terms below redistribute transpiration by layer,
5657! et(k), as a function of soil moisture availability, while preserving
5658! total etp1a.
5659
5660 if (cmc /= 0.0) then
5661 etp1a = shdfac * pc * etp1 * (1.0 - (cmc /cmcmax) ** cfactr)
5662 else
5663 etp1a = shdfac * pc * etp1
5664 endif
5665
5666 sgx = 0.0
5667 do i = 1, nroot
5668 gx(i) = ( smc(i) - smcwlt ) / ( smcref - smcwlt )
5669 gx(i) = max( min( gx(i), 1.0 ), 0.0 )
5670 sgx = sgx + gx(i)
5671 enddo
5672 sgx = sgx / nroot
5673
5674 denom = 0.0
5675 do i = 1, nroot
5676 rtx = rtdis(i) + gx(i) - sgx
5677 gx(i) = gx(i) * max( rtx, 0.0 )
5678 denom = denom + gx(i)
5679 enddo
5680 if (denom <= 0.0) denom = 1.0
5681
5682 do i = 1, nroot
5683 et1(i) = etp1a * gx(i) / denom
5684 enddo
5685
5686! --- ... above code assumes a vertically uniform root distribution
5687! code below tests a variable root distribution
5688
5689! et(1) = ( zsoil(1) / zsoil(nroot) ) * gx * etp1a
5690! et(1) = ( zsoil(1) / zsoil(nroot) ) * etp1a
5691
5692! --- ... using root distribution as weighting factor
5693
5694! et(1) = rtdis(1) * etp1a
5695! et(1) = etp1a * part(1)
5696
5697! --- ... loop down thru the soil layers repeating the operation above,
5698! but using the thickness of the soil layer (rather than the
5699! absolute depth of each layer) in the final calculation.
5700
5701! do k = 2, nroot
5702! gx = ( smc(k) - smcwlt ) / ( smcref - smcwlt )
5703! gx = max ( min ( gx, 1.0 ), 0.0 )
5704! --- ... test canopy resistance
5705! gx = 1.0
5706! et(k) = ((zsoil(k)-zsoil(k-1))/zsoil(nroot))*gx*etp1a
5707! et(k) = ((zsoil(k)-zsoil(k-1))/zsoil(nroot))*etp1a
5708
5709! --- ... using root distribution as weighting factor
5710
5711! et(k) = rtdis(k) * etp1a
5712! et(k) = etp1a*part(k)
5713! enddo
5714
5715!
5716!...................................
5717 end subroutine transp
5718!-----------------------------------
5719
5720
5721!-----------------------------------
5725 subroutine wdfcnd &
5726! --- inputs:
5727 & ( smc, smcmax, bexp, dksat, dwsat, sicemax, &
5728! --- outputs:
5729 & wdf, wcnd &
5730 & )
5731
5732! ===================================================================== !
5733! description: !
5734! subroutine wdfcnd calculates soil water diffusivity and soil !
5735! hydraulic conductivity. !
5736! !
5737! subprogram called: none !
5738! !
5739! !
5740! ==================== defination of variables ==================== !
5741! !
5742! inputs: size !
5743! smc - real, layer total soil moisture 1 !
5744! smcmax - real, porosity 1 !
5745! bexp - real, soil type "b" parameter 1 !
5746! dksat - real, saturated soil hydraulic conductivity 1 !
5747! dwsat - real, saturated soil diffusivity 1 !
5748! sicemax - real, max frozen water content in soil layer 1 !
5749! !
5750! outputs: !
5751! wdf - real, soil water diffusivity 1 !
5752! wcnd - real, soil hydraulic conductivity 1 !
5753! !
5754! ==================== end of description ===================== !
5755!
5756! --- input:
5757 real (kind=kind_phys), intent(in) :: smc, smcmax, bexp, dksat, &
5758 & dwsat, sicemax
5759
5760! --- output:
5761 real (kind=kind_phys), intent(out) :: wdf, wcnd
5762
5763! --- locals:
5764 real (kind=kind_phys) :: expon, factr1, factr2, vkwgt
5765!
5766!===> ... begin here
5767!
5768! --- ... calc the ratio of the actual to the max psbl soil h2o content
5769
5770 factr1 = min(1.0, max(0.0, 0.2/smcmax))
5771 factr2 = min(1.0, max(0.0, smc/smcmax))
5772
5773! --- ... prep an expntl coef and calc the soil water diffusivity
5774
5775 expon = bexp + 2.0
5776 wdf = dwsat * factr2 ** expon
5777
5778! --- ... frozen soil hydraulic diffusivity. very sensitive to the vertical
5779! gradient of unfrozen water. the latter gradient can become very
5780! extreme in freezing/thawing situations, and given the relatively
5781! few and thick soil layers, this gradient sufferes serious
5782! trunction errors yielding erroneously high vertical transports of
5783! unfrozen water in both directions from huge hydraulic diffusivity.
5784! therefore, we found we had to arbitrarily constrain wdf
5785!
5786! version d_10cm: ....... factr1 = 0.2/smcmax
5787! weighted approach....... pablo grunmann, 28_sep_1999.
5788
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
5792 endif
5793
5794! --- ... reset the expntl coef and calc the hydraulic conductivity
5795
5796 expon = (2.0 * bexp) + 3.0
5797 wcnd = dksat * factr2 ** expon
5798!
5799!...................................
5800 end subroutine wdfcnd
5801!-----------------------------------
5802
5803! =========================== !
5804! end contain programs !
5805! =========================== !
5806
5807!...................................
5808 end subroutine gfssflx
5809!-----------------------------------
5810 end module sflx
subroutine csnow
This subroutine calculates snow termal conductivity.
Definition sflx.f:1229
subroutine alcalc
This subroutine calculates albedo including snow effect (0 -> 1).
Definition sflx.f:989
subroutine snksrc(nsoil, k, tavg, smc, smcmax, psisat, bexp, dt, qtot, zsoil, sh2o, tsrc)
This subroutine calculates sink/source term of the termal diffusion equation.
Definition sflx.f:4826
subroutine redprm(errmsg, errflg)
This subroutine internally sets default values or optionally read-in via namelist i/o,...
Definition sflx.f:1683
subroutine sstep(nsoil, sh2oin, rhsct, dt, smcmax, cmcmax, zsoil, sice, cmc, rhstt, ai, bi, ci, sh2oout, runoff3, smc)
This subroutine calculates/updates soil moisture content values and canopy moisture content values.
Definition sflx.f:5275
subroutine penman
This subroutine calculates potential evaporation for the current point. various partial sums/products...
Definition sflx.f:1572
subroutine hrtice(nsoil, stc, zsoil, yy, zz1, df1, ice, tbot, rhsts, ai, bi, ci)
This subroutine calculates the right hand side of the time tendency term of the soil thermal diffusio...
Definition sflx.f:4452
subroutine gfssflx(nsoil, couple, icein, ffrozp, dt, zlvl, sldpth, swdn, swnet, lwdn, sfcems, sfcprs, sfctmp, sfcspd, prcp, q2, q2sat, dqsdt2, th2, ivegsrc, vegtyp, soiltyp, slopetyp, shdmin, alb, snoalb, rhonewsn, exticeden, bexpp, xlaip, lheatstrg, tbot, cmc, t1, stc, smc, sh2o, sneqv, ch, cm, z0, nroot, shdfac, snowh, albedo, eta, sheat, ec, edir, et, ett, esnow, drip, dew, beta, etp, ssoil, flx1, flx2, flx3, runoff1, runoff2, runoff3, snomlt, sncovr, rc, pc, rsmin, xlai, rcs, rct, rcq, rcsoil, soilw, soilm, smcwlt, smcdry, smcref, smcmax, errmsg, errflg)
This is the entity of GFS Noah LSM model of physics subroutines. It is a soil/veg/snowpack land-surfa...
Definition sflx.f:131
subroutine rosr12(nsoil, a, b, d, c, p, delta)
This subroutine inverts (solve) the tri-diagonal matrix problem.
Definition sflx.f:4723
subroutine evapo(nsoil, nroot, cmc, cmcmax, etp1, dt, zsoil, sh2o, smcmax, smcwlt, smcref, smcdry, pc, shdfac, cfactr, rtdis, fxexp, eta1, edir1, ec1, et1, ett1)
This subroutine calculates soil moisture flux. The soil moisture content (smc - a per unit volume mea...
Definition sflx.f:3153
subroutine transp(nsoil, nroot, etp1, smc, smcwlt, smcref, cmc, cmcmax, zsoil, shdfac, pc, cfactr, rtdis, et1)
This subroutine calculates transpiration for the veg class.
Definition sflx.f:5599
subroutine frh2o(tkelv, smc, sh2o, smcmax, bexp, psis, liqwat)
This subroutine calculates amount of supercooled liquid soil water content if temperature is below 27...
Definition sflx.f:3924
subroutine tdfcnd(smc, qz, smcmax, sh2o, df)
This subroutine calculates thermal diffusivity and conductivity of the soil for a given point and tim...
Definition sflx.f:3005
subroutine tbnd(tu, tb, zsoil, zbot, k, nsoil, tbnd1)
This subroutine calculates temperature on the boundary of the layer by interpolation of the middle la...
Definition sflx.f:5420
subroutine nopac
This subroutine calculates soil moisture and heat flux values and update soil moisture content and so...
Definition sflx.f:1293
subroutine snowz0
This subroutine calculates total roughness length over snow.
Definition sflx.f:2948
subroutine shflx(nsoil, smc, smcmax, dt, yy, zz1, zsoil, zbot, psisat, bexp, df1, ice, quartz, csoil, vegtyp, shdfac, lheatstrg, stc, t1, tbot, sh2o, ssoil)
This subroutine updates the temperature state of the soil column based on the thermal diffusion equat...
Definition sflx.f:3303
subroutine canres
This subroutine calculates canopy resistance which depends on incoming solar radiation,...
Definition sflx.f:1075
subroutine snowpack(esd, dtsec, tsnow, tsoil, snowh, sndens)
This subroutine calculates compaction of a snowpack under conditions of increasing snow density,...
Definition sflx.f:3683
subroutine snow_new
This subroutine calculates snow depth and densitity to account for the new snowfall....
Definition sflx.f:2871
subroutine hrt(nsoil, stc, smc, smcmax, zsoil, yy, zz1, tbot, zbot, psisat, dt, bexp, df1, quartz, csoil, vegtyp, shdfac, lheatstrg, sh2o, rhsts, ai, bi, ci)
This subroutine calculates the right hand side of the time tendency term of the soil thermal diffusio...
Definition sflx.f:4082
subroutine devap(etp1, smc, shdfac, smcmax, smcdry, fxexp, edir1)
This subrtouine calculates direct soil evaporation.
Definition sflx.f:3845
subroutine wdfcnd(smc, smcmax, bexp, dksat, dwsat, sicemax, wdf, wcnd)
This subroutine calculates soil water diffusivity and soil hydraulic conductivity.
Definition sflx.f:5731
subroutine hstep(nsoil, stcin, dt, rhsts, ai, bi, ci, stcout)
This subroutine calculates/updates the soil temperature field.
Definition sflx.f:4624
subroutine snopac
This subroutine calculates soil moisture and heat flux values and update soil moisture content and so...
Definition sflx.f:2344
subroutine tmpavg(tup, tm, tdn, zsoil, nsoil, k, tavg)
This subroutine calculates soil layer average temperature (tavg) in freezing/thawing layer using up,...
Definition sflx.f:5494
subroutine srt(nsoil, edir, et, sh2o, sh2oa, pcpdrp, zsoil, dwsat, dksat, smcmax, bexp, dt, smcwlt, slope, kdt, frzx, sice, rhstt, runoff1, runoff2, ai, bi, ci)
This subroutine calculates the right hand side of the time tendency term of the soil water diffusion ...
Definition sflx.f:4963
subroutine smflx(nsoil, dt, kdt, smcmax, smcwlt, cmcmax, prcp1, zsoil, slope, frzx, bexp, dksat, dwsat, shdfac, edir1, ec1, et1, cmc, sh2o, smc, runoff1, runoff2, runoff3, drip)
This subroutine calculates soil moisture flux. The soil moisture content (smc - a per unit vulume mea...
Definition sflx.f:3476
subroutine snfrac
This subroutine calculates snow fraction (0->1).
Definition sflx.f:2272
subroutine sfcdif
This subroutine calculates surface layer exchange coefficients via iterative process(see Chen et al....
Definition sflx.f:1986
subroutine albedo(parameters, vegtyp, ist, ice, nsoil, dt, cosz, fage, elai, esai, tg, tv, snowh, fsno, fwet, smc, sneqvo, sneqv, qsnow, fveg, iloc, jloc, albold, tauss, albgrd, albgri, albd, albi, fabd, fabi, ftdd, ftid, ftii, fsun, frevi, frevd, fregd, fregi, bgap, wgap, albsnd, albsni)
surface albedos. also fluxes (per unit incoming direct and diffuse radiation) reflected,...
subroutine error(parameters, swdown,fsa,fsr,fira,fsh,fcev, fgev,fctr,ssoil,beg_wb,canliq,canice, sneqv,wa,smc,dzsnso,prcp,ecan, etran,edir,runsrf,runsub,dt,nsoil, nsnow,ist,errwat, iloc,jloc,fveg, sav,sag,fsrv,fsrg,zwt,pah, ifdef ccpp
check surface energy balance and water balance.
This module contains namelist options for Noah LSM.
This module contains the entity of GFS Noah LSM Model(Version 2.7).
Definition sflx.f:5