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
141 real(kind=kind_phys),
parameter :: one = 1.0_kind_phys
142 real(kind=kind_phys),
parameter :: himax = 8.0_kind_phys
143 real(kind=kind_phys),
parameter :: himin = 0.1_kind_phys
144 real(kind=kind_phys),
parameter :: hsmax = 2.0_kind_phys
145 real(kind=kind_phys),
parameter :: timin = 173.0_kind_phys
146 real(kind=kind_phys),
parameter :: albfw = 0.06_kind_phys
147 real(kind=kind_phys),
parameter :: dsi = one/0.33_kind_phys
148 real(kind=kind_phys),
parameter :: qmin = 1.0e-8_kind_phys
151 integer,
intent(in) :: im, kice, ipr
152 logical,
intent(in) :: lprnt
153 logical,
intent(in) :: thsfc_loc
155 real (kind=kind_phys),
intent(in) :: sbc, hvap, tgice, cp, eps, &
156 & epsm1, grav, rvrdm1, t0c, rd
158 real (kind=kind_phys),
dimension(:),
intent(in) :: ps, &
159 & t1, q1, sfcemis, dlwflx, sfcnsw, sfcdsw, srflag, cm, ch, &
160 & prsl1, prslki, prsik1, prslk1, wind
162 integer,
dimension(:),
intent(in) :: islmsk
163 real (kind=kind_phys),
intent(in) :: delt
165 logical,
dimension(im),
intent(in) :: flag_iter
166 integer,
dimension(im),
intent(in) :: use_lake_model
169 real (kind=kind_phys),
dimension(:),
intent(inout) :: hice, &
170 & fice, tice, weasd, tsfc_wat, tprcp, ep
172 real (kind=kind_phys),
dimension(:,:),
intent(inout) :: tiice
175 real (kind=kind_phys),
dimension(:),
intent(inout) :: snwdph, &
176 & snowmt, gflux, cmm, chh, evapi, evapw, hflxi, hflxw, &
179 character(len=*),
intent(out) :: errmsg
180 integer,
intent(out) :: errflg
183 real (kind=kind_phys),
dimension(im) :: ffw, &
186 & focn, snof, rch, rho, &
189 real (kind=kind_phys) :: t12, t14, tem, stsice(im,kice)
190 &, q0, qs1, qssi, qssw
191 real (kind=kind_phys) :: cpinv, hvapi, elocp, snetw
213 flag(i) = islmsk(i) == 2 .and. flag_iter(i) &
214 & .and. use_lake_model(i) /=1
215 do_sice = do_sice .or. flag(i)
221 if (.not. do_sice)
return
225 if (srflag(i) > zero)
then
226 ep(i) = ep(i)*(one-srflag(i))
227 weasd(i) = weasd(i) + 1000.0_kind_phys*tprcp(i)*srflag(i)
228 tprcp(i) = tprcp(i)*(one-srflag(i))
237 stsice(i,k) = tiice(i,k)
254 q0 = max(q1(i), qmin)
257 theta1(i) = t1(i) * prslki(i)
259 theta1(i) = t1(i) / prslk1(i)
262 rho(i) = prsl1(i) / (rd*t1(i)*(one+rvrdm1*q0))
264 qs1 = max(eps*qs1 / (prsl1(i) + epsm1*qs1), qmin)
274 ffw(i) = one - fice(i)
277 qssi = eps*qssi / (ps(i) + epsm1*qssi)
279 qssw = eps*qssw / (ps(i) + epsm1*qssw)
283 snowd(i) = weasd(i) * 0.001_kind_phys
293 cmm(i) = cm(i) * wind(i)
294 chh(i) = rho(i) * ch(i) * wind(i)
299 evapi(i) = elocp * rch(i) * (qssi - q0)
300 evapw(i) = elocp * rch(i) * (qssw - q0)
302 snetw = sfcdsw(i) * (one - albfw)
303 snetw = min(3.0_kind_phys*sfcnsw(i) &
304 & / (one+2.0_kind_phys*ffw(i)), snetw)
306 sneti(i) = (sfcnsw(i) - ffw(i)*snetw) / fice(i)
308 t12 = tice(i) * tice(i)
314 hfi(i) = -dlwflx(i) + sfcemis(i)*sbc*t14 + evapi(i) &
315 & + rch(i)*(tice(i) - theta1(i))
317 hfi(i) = -dlwflx(i) + sfcemis(i)*sbc*t14 + evapi(i) &
318 & + rch(i)*(tice(i)/prsik1(i) - theta1(i))
322 hfd(i) = 4.0_kind_phys*sfcemis(i)*sbc*tice(i)*t12 &
323 & + (one + elocp*eps*hvap*qs1/(rd*t12)) * rch(i)
335 focn(i) = 2.0_kind_phys
339 hice(i) = max( min( hice(i), himax ), himin )
340 snowd(i) = min( snowd(i), hsmax )
342 if (snowd(i) > (2.0_kind_phys*hice(i)))
then
344 snowd(i) = hice(i) + hice(i)
353 & ( im, kice, fice, flag, hfi, hfd, sneti, focn, delt,
356 & snowd, hice, stsice, tice, snof, snowmt, gflux )
360 if (tice(i) < timin)
then
361 print *,
'warning: snow/ice temperature is too low:',tice(i)
363 print *,
'fix snow/ice temperature: reset it to:',tice(i)
366 if (stsice(i,1) < timin)
then
367 print *,
'warning: layer 1 ice temp is too low:',stsice(i,1)
369 print *,
'fix layer 1 ice temp: reset it to:',stsice(i,1)
372 if (stsice(i,2) < timin)
then
373 print *,
'warning: layer 2 ice temp is too low:',stsice(i,2)
375 print *,
'fix layer 2 ice temp: reset it to:',stsice(i,2)
384 tiice(i,k) = min(stsice(i,k), t0c)
394 hflxi(i) = rch(i) * (tice(i) - theta1(i))
395 hflxw(i) = rch(i) * (tgice - theta1(i))
397 tem = one / prsik1(i)
398 hflxi(i) = rch(i) * (tice(i)*tem - theta1(i))
399 hflxw(i) = rch(i) * (tgice*tem - theta1(i))
409 qss_i(i) = q1(i) + evapi(i) / (elocp*rch(i))
410 qss_w(i) = q1(i) + evapw(i) / (elocp*rch(i))
416 weasd(i) = snowd(i) * 1000.0_kind_phys
417 snwdph(i) = weasd(i) * dsi
420 hflxi(i) = hflxi(i) * tem * cpinv
421 hflxw(i) = hflxw(i) * tem * cpinv
422 evapi(i) = evapi(i) * tem * hvapi
423 evapw(i) = evapw(i) * tem * hvapi
463 & ( im, kmi, fice, flag, hfi, hfd, sneti, focn, delt, &
466 & snowd, hice, stsice, tice, snof, &
524 real (kind=kind_phys),
parameter :: ds = 330.0_kind_phys
525 real (kind=kind_phys),
parameter :: dw =1000.0_kind_phys
526 real (kind=kind_phys),
parameter :: dsdw = ds/dw
527 real (kind=kind_phys),
parameter :: dwds = dw/ds
528 real (kind=kind_phys),
parameter :: ks = 0.31_kind_phys
529 real (kind=kind_phys),
parameter :: i0 = 0.3_kind_phys
530 real (kind=kind_phys),
parameter :: ki = 2.03_kind_phys
531 real (kind=kind_phys),
parameter :: di = 917.0_kind_phys
532 real (kind=kind_phys),
parameter :: didw = di/dw
533 real (kind=kind_phys),
parameter :: dsdi = ds/di
534 real (kind=kind_phys),
parameter :: ci = 2054.0_kind_phys
535 real (kind=kind_phys),
parameter :: li = 3.34e5_kind_phys
536 real (kind=kind_phys),
parameter :: si = 1.0_kind_phys
537 real (kind=kind_phys),
parameter :: mu = 0.054_kind_phys
538 real (kind=kind_phys),
parameter :: tfi = -mu*si
539 real (kind=kind_phys),
parameter :: tfw = -1.8_kind_phys
540 real (kind=kind_phys),
parameter :: tfi0 = tfi-0.0001_kind_phys
541 real (kind=kind_phys),
parameter :: dici = di*ci
542 real (kind=kind_phys),
parameter :: dili = di*li
543 real (kind=kind_phys),
parameter :: dsli = ds*li
544 real (kind=kind_phys),
parameter :: ki4 = ki*4.0_kind_phys
545 real (kind=kind_phys),
parameter :: zero = 0.0_kind_phys
546 real (kind=kind_phys),
parameter :: one = 1.0_kind_phys
548 integer,
intent(in) :: im, kmi, ipr
551 real (kind=kind_phys),
dimension(im),
intent(in) :: fice, hfi, &
554 real (kind=kind_phys),
intent(in) :: delt
556 logical,
dimension(im),
intent(in) :: flag
559 real (kind=kind_phys),
dimension(im),
intent(inout) :: snowd, &
562 real (kind=kind_phys),
dimension(im,kmi),
intent(inout) :: stsice
565 real (kind=kind_phys),
dimension(im),
intent(out) :: snowmt, &
570 real (kind=kind_phys) :: dt2, dt4, dt6, h1, h2, dh, wrk, wrk1, &
571 & dt2i, hdi, hsni, ai, bi, a1, b1, a10, b10&
572 &, c1, ip, k12, k32, tsf, f1, tmelt, bmelt
585 snowd(i) = snowd(i) * dwds
586 hdi = (dsdw*snowd(i) + didw*hice(i))
588 if (hice(i) < hdi)
then
589 snowd(i) = snowd(i) + hice(i) - hdi
590 hsni = (hdi - hice(i)) * dsdi
591 hice(i) = hice(i) + hsni
594 snof(i) = snof(i) * dwds
595 tice(i) = tice(i) - t0c
596 stsice(i,1) = min(stsice(i,1)-t0c, tfi0)
597 stsice(i,2) = min(stsice(i,2)-t0c, tfi0)
600 if (snowd(i) > zero)
then
607 tice(i) = min(tice(i), tsf)
612 ai = hfi(i) - sneti(i) + ip - tice(i)*bi
616 k12 = ki4*ks / (ks*hice(i) + ki4*snowd(i))
620 k32 = (ki+ki) / hice(i)
622 wrk = one / (dt6*k32 + dici*hice(i))
623 a10 = dici*hice(i)*dt2i + k32*(dt4*k32 + dici*hice(i))*wrk
624 b10 = -di*hice(i) * (ci*stsice(i,1) + li*tfi/stsice(i,1)) &
626 & - k32*(dt4*k32*tfw + dici*hice(i)*stsice(i,2)) * wrk
628 wrk1 = k12 / (k12 + bi)
631 c1 = dili * tfi * dt2i * hice(i)
635 stsice(i,1) = -(sqrt(b1*b1-4.0_kind_phys*a1*c1) + b1)/(a1+a1)
636 tice(i) = (k12*stsice(i,1) - ai) / (k12 + bi)
645 if (tice(i) > tsf)
then
648 stsice(i,1) = -(sqrt(b1*b1-4.0_kind_phys*a1*c1) + b1) &
651 tmelt = (k12*(stsice(i,1)-tsf) - (ai+bi*tsf)) * delt
654 snowd(i) = snowd(i) + snof(i)*delt
658 stsice(i,2) = (dt2*k32*(stsice(i,1) + tfw + tfw) &
659 & + dici*hice(i)*stsice(i,2)) * wrk
665 bmelt = (focn(i) + ki4*(stsice(i,2) - tfw)/hice(i)) * delt
669 h1 = 0.5_kind_phys * hice(i)
670 h2 = 0.5_kind_phys * hice(i)
674 if (tmelt <= snowd(i)*dsli)
then
675 snowmt(i) = tmelt / dsli
676 snowd(i) = snowd(i) - snowmt(i)
679 h1 = max(zero, h1 - (tmelt - snowd(i)*dsli) &
680 & / (di * (ci - li/stsice(i,1)) * (tfi - stsice(i,1))))
688 if (bmelt < zero)
then
689 dh = -bmelt / (dili + dici*(tfi - tfw))
690 stsice(i,2) = (h2*stsice(i,2) + dh*tfw) / (h2 + dh)
693 h2 = h2 - bmelt / (dili + dici*(tfi - stsice(i,2)))
702 if (hice(i) > zero)
then
703 if (h1 > 0.5_kind_phys*hice(i))
then
704 f1 = one - (h2+h2) / hice(i)
705 stsice(i,2) = f1 * (stsice(i,1) + li*tfi/(ci*stsice(i,1)))&
706 & + (one - f1)*stsice(i,2)
708 if (stsice(i,2) > tfi)
then
709 hice(i) = hice(i) - h2*ci*(stsice(i,2) - tfi)/ (li*delt)
713 f1 = (h1+h1) / hice(i)
714 stsice(i,1) = f1 * (stsice(i,1) + li*tfi/(ci*stsice(i,1)))&
715 & + (one - f1)*stsice(i,2)
716 stsice(i,1) = (stsice(i,1) - sqrt(stsice(i,1)*stsice(i,1) &
717 & - 4.0_kind_phys*tfi*li/ci)) * 0.5_kind_phys
720 k12 = ki4*ks / (ks*hice(i) + ki4*snowd(i))
721 gflux(i) = k12 * (stsice(i,1) - tice(i))
723 snowd(i) = snowd(i) + (h1*(ci*(stsice(i,1) - tfi) &
724 & - li*(one - tfi/stsice(i,1))) &
725 & + h2*(ci*(stsice(i,2) - tfi) - li)) / li
727 hice(i) = max(zero, snowd(i)*dsdi)
734 gflux(i) = fice(i) * gflux(i)
735 snowmt(i) = snowmt(i) * dsdw
736 snowd(i) = snowd(i) * dsdw
737 tice(i) = tice(i) + t0c
738 stsice(i,1) = stsice(i,1) + t0c
739 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