38 & ( im, kice, sbc, hvap, tgice, cp, eps, epsm1, rvrdm1, grav, &
39 & t0c, rd, ps, t1, q1, delt, &
40 & sfcemis, dlwflx, sfcnsw, sfcdsw, srflag, &
41 & cm, ch, prsl1, prslki, prsik1, prslk1, wind, &
42 & flag_iter, use_lake_model, lprnt, ipr, thsfc_loc, &
43 & hice, fice, tice, weasd, tsfc_wat, tprcp, tiice, ep, &
44 & snwdph, qss_i, qss_w, snowmt, gflux, cmm, chh, &
45 & evapi, evapw, hflxi, hflxw, islmsk, &
133 use machine,
only : kind_phys
134 use funcphys,
only : fpvs
139 integer,
parameter :: kmi = 2
140 real(kind=kind_phys),
parameter :: zero = 0.0_kind_phys, one = 1.0_kind_phys
141 real(kind=kind_phys),
parameter :: himax = 8.0_kind_phys
142 real(kind=kind_phys),
parameter :: himin = 0.1_kind_phys
143 real(kind=kind_phys),
parameter :: hsmax = 2.0_kind_phys
144 real(kind=kind_phys),
parameter :: timin = 173.0_kind_phys
145 real(kind=kind_phys),
parameter :: albfw = 0.06_kind_phys
146 real(kind=kind_phys),
parameter :: dsi = one/0.33_kind_phys
147 real(kind=kind_phys),
parameter :: qmin = 1.0e-8_kind_phys
150 integer,
intent(in) :: im, kice, ipr
151 logical,
intent(in) :: lprnt
152 logical,
intent(in) :: thsfc_loc
154 real (kind=kind_phys),
intent(in) :: sbc, hvap, tgice, cp, eps, &
155 & epsm1, grav, rvrdm1, t0c, rd
157 real (kind=kind_phys),
dimension(:),
intent(in) :: ps, &
158 & t1, q1, sfcemis, dlwflx, sfcnsw, sfcdsw, srflag, cm, ch, &
159 & prsl1, prslki, prsik1, prslk1, wind
161 integer,
dimension(:),
intent(in) :: islmsk
162 real (kind=kind_phys),
intent(in) :: delt
164 logical,
dimension(im),
intent(in) :: flag_iter
165 integer,
dimension(im),
intent(in) :: use_lake_model
168 real (kind=kind_phys),
dimension(:),
intent(inout) :: hice, &
169 & fice, tice, weasd, tsfc_wat, tprcp, ep
171 real (kind=kind_phys),
dimension(:,:),
intent(inout) :: tiice
174 real (kind=kind_phys),
dimension(:),
intent(inout) :: snwdph, &
175 & snowmt, gflux, cmm, chh, evapi, evapw, hflxi, hflxw, &
178 character(len=*),
intent(out) :: errmsg
179 integer,
intent(out) :: errflg
182 real (kind=kind_phys),
dimension(im) :: ffw, &
185 & focn, snof, rch, rho, &
188 real (kind=kind_phys) :: t12, t14, tem, stsice(im,kice)
189 &, q0, qs1, qssi, qssw
190 real (kind=kind_phys) :: cpinv, hvapi, elocp, snetw
212 flag(i) = islmsk(i) == 2 .and. flag_iter(i) &
213 & .and. use_lake_model(i) /=1
214 do_sice = do_sice .or. flag(i)
220 if (.not. do_sice)
return
224 if (srflag(i) > zero)
then
225 ep(i) = ep(i)*(one-srflag(i))
226 weasd(i) = weasd(i) + 1000.0_kind_phys*tprcp(i)*srflag(i)
227 tprcp(i) = tprcp(i)*(one-srflag(i))
236 stsice(i,k) = tiice(i,k)
253 q0 = max(q1(i), qmin)
256 theta1(i) = t1(i) * prslki(i)
258 theta1(i) = t1(i) / prslk1(i)
261 rho(i) = prsl1(i) / (rd*t1(i)*(one+rvrdm1*q0))
263 qs1 = max(eps*qs1 / (prsl1(i) + epsm1*qs1), qmin)
273 ffw(i) = one - fice(i)
276 qssi = eps*qssi / (ps(i) + epsm1*qssi)
278 qssw = eps*qssw / (ps(i) + epsm1*qssw)
282 snowd(i) = weasd(i) * 0.001_kind_phys
292 cmm(i) = cm(i) * wind(i)
293 chh(i) = rho(i) * ch(i) * wind(i)
298 evapi(i) = elocp * rch(i) * (qssi - q0)
299 evapw(i) = elocp * rch(i) * (qssw - q0)
301 snetw = sfcdsw(i) * (one - albfw)
302 snetw = min(3.0_kind_phys*sfcnsw(i) &
303 & / (one+2.0_kind_phys*ffw(i)), snetw)
305 sneti(i) = (sfcnsw(i) - ffw(i)*snetw) / fice(i)
307 t12 = tice(i) * tice(i)
313 hfi(i) = -dlwflx(i) + sfcemis(i)*sbc*t14 + evapi(i) &
314 & + rch(i)*(tice(i) - theta1(i))
316 hfi(i) = -dlwflx(i) + sfcemis(i)*sbc*t14 + evapi(i) &
317 & + rch(i)*(tice(i)/prsik1(i) - theta1(i))
321 hfd(i) = 4.0_kind_phys*sfcemis(i)*sbc*tice(i)*t12 &
322 & + (one + elocp*eps*hvap*qs1/(rd*t12)) * rch(i)
334 focn(i) = 2.0_kind_phys
338 hice(i) = max( min( hice(i), himax ), himin )
339 snowd(i) = min( snowd(i), hsmax )
341 if (snowd(i) > (2.0_kind_phys*hice(i)))
then
343 snowd(i) = hice(i) + hice(i)
352 & ( im, kice, fice, flag, hfi, hfd, sneti, focn, delt,
355 & snowd, hice, stsice, tice, snof, snowmt, gflux )
359 if (tice(i) < timin)
then
360 print *,
'warning: snow/ice temperature is too low:',tice(i)
362 print *,
'fix snow/ice temperature: reset it to:',tice(i)
365 if (stsice(i,1) < timin)
then
366 print *,
'warning: layer 1 ice temp is too low:',stsice(i,1)
368 print *,
'fix layer 1 ice temp: reset it to:',stsice(i,1)
371 if (stsice(i,2) < timin)
then
372 print *,
'warning: layer 2 ice temp is too low:',stsice(i,2)
374 print *,
'fix layer 2 ice temp: reset it to:',stsice(i,2)
383 tiice(i,k) = min(stsice(i,k), t0c)
393 hflxi(i) = rch(i) * (tice(i) - theta1(i))
394 hflxw(i) = rch(i) * (tgice - theta1(i))
396 tem = one / prsik1(i)
397 hflxi(i) = rch(i) * (tice(i)*tem - theta1(i))
398 hflxw(i) = rch(i) * (tgice*tem - theta1(i))
408 qss_i(i) = q1(i) + evapi(i) / (elocp*rch(i))
409 qss_w(i) = q1(i) + evapw(i) / (elocp*rch(i))
415 weasd(i) = snowd(i) * 1000.0_kind_phys
416 snwdph(i) = weasd(i) * dsi
419 hflxi(i) = hflxi(i) * tem * cpinv
420 hflxw(i) = hflxw(i) * tem * cpinv
421 evapi(i) = evapi(i) * tem * hvapi
422 evapw(i) = evapw(i) * tem * hvapi
462 & ( im, kmi, fice, flag, hfi, hfd, sneti, focn, delt, &
465 & snowd, hice, stsice, tice, snof, &
523 real (kind=kind_phys),
parameter :: ds = 330.0_kind_phys
524 real (kind=kind_phys),
parameter :: dw =1000.0_kind_phys
525 real (kind=kind_phys),
parameter :: dsdw = ds/dw
526 real (kind=kind_phys),
parameter :: dwds = dw/ds
527 real (kind=kind_phys),
parameter :: ks = 0.31_kind_phys
528 real (kind=kind_phys),
parameter :: i0 = 0.3_kind_phys
529 real (kind=kind_phys),
parameter :: ki = 2.03_kind_phys
530 real (kind=kind_phys),
parameter :: di = 917.0_kind_phys
531 real (kind=kind_phys),
parameter :: didw = di/dw
532 real (kind=kind_phys),
parameter :: dsdi = ds/di
533 real (kind=kind_phys),
parameter :: ci = 2054.0_kind_phys
534 real (kind=kind_phys),
parameter :: li = 3.34e5_kind_phys
535 real (kind=kind_phys),
parameter :: si = 1.0_kind_phys
536 real (kind=kind_phys),
parameter :: mu = 0.054_kind_phys
537 real (kind=kind_phys),
parameter :: tfi = -mu*si
538 real (kind=kind_phys),
parameter :: tfw = -1.8_kind_phys
539 real (kind=kind_phys),
parameter :: tfi0 = tfi-0.0001_kind_phys
540 real (kind=kind_phys),
parameter :: dici = di*ci
541 real (kind=kind_phys),
parameter :: dili = di*li
542 real (kind=kind_phys),
parameter :: dsli = ds*li
543 real (kind=kind_phys),
parameter :: ki4 = ki*4.0_kind_phys
544 real (kind=kind_phys),
parameter :: zero = 0.0_kind_phys, one = 1.0_kind_phys
547 integer,
intent(in) :: im, kmi, ipr
550 real (kind=kind_phys),
dimension(im),
intent(in) :: fice, hfi, &
553 real (kind=kind_phys),
intent(in) :: delt
555 logical,
dimension(im),
intent(in) :: flag
558 real (kind=kind_phys),
dimension(im),
intent(inout) :: snowd, &
561 real (kind=kind_phys),
dimension(im,kmi),
intent(inout) :: stsice
564 real (kind=kind_phys),
dimension(im),
intent(out) :: snowmt, &
569 real (kind=kind_phys) :: dt2, dt4, dt6, h1, h2, dh, wrk, wrk1, &
570 & dt2i, hdi, hsni, ai, bi, a1, b1, a10, b10&
571 &, c1, ip, k12, k32, tsf, f1, tmelt, bmelt
584 snowd(i) = snowd(i) * dwds
585 hdi = (dsdw*snowd(i) + didw*hice(i))
587 if (hice(i) < hdi)
then
588 snowd(i) = snowd(i) + hice(i) - hdi
589 hsni = (hdi - hice(i)) * dsdi
590 hice(i) = hice(i) + hsni
593 snof(i) = snof(i) * dwds
594 tice(i) = tice(i) - t0c
595 stsice(i,1) = min(stsice(i,1)-t0c, tfi0)
596 stsice(i,2) = min(stsice(i,2)-t0c, tfi0)
599 if (snowd(i) > zero)
then
606 tice(i) = min(tice(i), tsf)
611 ai = hfi(i) - sneti(i) + ip - tice(i)*bi
615 k12 = ki4*ks / (ks*hice(i) + ki4*snowd(i))
619 k32 = (ki+ki) / hice(i)
621 wrk = one / (dt6*k32 + dici*hice(i))
622 a10 = dici*hice(i)*dt2i + k32*(dt4*k32 + dici*hice(i))*wrk
623 b10 = -di*hice(i) * (ci*stsice(i,1) + li*tfi/stsice(i,1)) &
625 & - k32*(dt4*k32*tfw + dici*hice(i)*stsice(i,2)) * wrk
627 wrk1 = k12 / (k12 + bi)
630 c1 = dili * tfi * dt2i * hice(i)
634 stsice(i,1) = -(sqrt(b1*b1-4.0_kind_phys*a1*c1) + b1)/(a1+a1)
635 tice(i) = (k12*stsice(i,1) - ai) / (k12 + bi)
644 if (tice(i) > tsf)
then
647 stsice(i,1) = -(sqrt(b1*b1-4.0_kind_phys*a1*c1) + b1) &
650 tmelt = (k12*(stsice(i,1)-tsf) - (ai+bi*tsf)) * delt
653 snowd(i) = snowd(i) + snof(i)*delt
657 stsice(i,2) = (dt2*k32*(stsice(i,1) + tfw + tfw) &
658 & + dici*hice(i)*stsice(i,2)) * wrk
664 bmelt = (focn(i) + ki4*(stsice(i,2) - tfw)/hice(i)) * delt
668 h1 = 0.5_kind_phys * hice(i)
669 h2 = 0.5_kind_phys * hice(i)
673 if (tmelt <= snowd(i)*dsli)
then
674 snowmt(i) = tmelt / dsli
675 snowd(i) = snowd(i) - snowmt(i)
678 h1 = max(zero, h1 - (tmelt - snowd(i)*dsli) &
679 & / (di * (ci - li/stsice(i,1)) * (tfi - stsice(i,1))))
687 if (bmelt < zero)
then
688 dh = -bmelt / (dili + dici*(tfi - tfw))
689 stsice(i,2) = (h2*stsice(i,2) + dh*tfw) / (h2 + dh)
692 h2 = h2 - bmelt / (dili + dici*(tfi - stsice(i,2)))
701 if (hice(i) > zero)
then
702 if (h1 > 0.5_kind_phys*hice(i))
then
703 f1 = one - (h2+h2) / hice(i)
704 stsice(i,2) = f1 * (stsice(i,1) + li*tfi/(ci*stsice(i,1)))&
705 & + (one - f1)*stsice(i,2)
707 if (stsice(i,2) > tfi)
then
708 hice(i) = hice(i) - h2*ci*(stsice(i,2) - tfi)/ (li*delt)
712 f1 = (h1+h1) / hice(i)
713 stsice(i,1) = f1 * (stsice(i,1) + li*tfi/(ci*stsice(i,1)))&
714 & + (one - f1)*stsice(i,2)
715 stsice(i,1) = (stsice(i,1) - sqrt(stsice(i,1)*stsice(i,1) &
716 & - 4.0_kind_phys*tfi*li/ci)) * 0.5_kind_phys
719 k12 = ki4*ks / (ks*hice(i) + ki4*snowd(i))
720 gflux(i) = k12 * (stsice(i,1) - tice(i))
722 snowd(i) = snowd(i) + (h1*(ci*(stsice(i,1) - tfi) &
723 & - li*(one - tfi/stsice(i,1))) &
724 & + h2*(ci*(stsice(i,2) - tfi) - li)) / li
726 hice(i) = max(zero, snowd(i)*dsdi)
733 gflux(i) = fice(i) * gflux(i)
734 snowmt(i) = snowmt(i) * dsdw
735 snowd(i) = snowd(i) * dsdw
736 tice(i) = tice(i) + t0c
737 stsice(i,1) = stsice(i,1) + t0c
738 stsice(i,2) = stsice(i,2) + t0c
subroutine sfc_sice_run(im, kice, sbc, hvap, tgice, cp, eps, epsm1, rvrdm1, grav, t0c, rd, ps, t1, q1, delt, sfcemis, dlwflx, sfcnsw, sfcdsw, srflag, cm, ch, prsl1, prslki, prsik1, prslk1, wind, flag_iter, use_lake_model, lprnt, ipr, thsfc_loc, hice, fice, tice, weasd, tsfc_wat, tprcp, tiice, ep, snwdph, qss_i, qss_w, snowmt, gflux, cmm, chh, evapi, evapw, hflxi, hflxw, islmsk, errmsg, errflg