28 ( im, hvap, cp, hfus, jcal, eps, epsm1, rvrdm1, rd, rhw0, &
29 pi, tgice, sbc, ps, u1, v1, usfco, vsfco, icplocn2atm, t1, &
30 q1, tref, cm, ch, lseaspray, fm, fm10, &
31 prsl1, prslki, prsik1, prslk1, wet, use_lake_model, xlon, &
33 sfcemis, dlwflx, sfcnsw, rain, timestep, kdt, solhr,xcosz, &
34 wind, flag_iter, flag_guess, nstf_name1, nstf_name4, &
35 nstf_name5, lprnt, ipr, thsfc_loc, &
36 tskin, tsurf, xt, xs, xu, xv, xz, zm, xtts, xzts, dt_cool, &
37 z_c, c_0, c_d, w_0, w_d, d_conv, ifd, qrain, &
38 qsurf, gflux, cmm, chh, evap, hflx, ep, errmsg, errflg &
172 integer,
intent(in) :: im, kdt, ipr, nstf_name1, nstf_name4, nstf_name5
173 integer,
intent(in) :: icplocn2atm
175 real (kind=kind_phys),
intent(in) :: hvap, cp, hfus, jcal, eps, &
176 epsm1, rvrdm1, rd, rhw0, sbc, pi, tgice
177 real (kind=kind_phys),
dimension(:),
intent(in) :: ps, u1, v1, &
178 usfco, vsfco, t1, q1, cm, ch, fm, fm10, &
179 prsl1, prslki, prsik1, prslk1, xlon, xcosz, &
180 sinlat, stress, sfcemis, dlwflx, sfcnsw, rain, wind
181 real (kind=kind_phys),
dimension(:),
intent(in),
optional :: &
183 real (kind=kind_phys),
intent(in) :: timestep
184 real (kind=kind_phys),
intent(in) :: solhr
187 logical,
intent(in) :: lseaspray
189 logical,
dimension(:),
intent(in) :: flag_iter, flag_guess, wet
190 integer,
dimension(:),
intent(in) :: use_lake_model
191 logical,
intent(in) :: lprnt
192 logical,
intent(in) :: thsfc_loc
196 real (kind=kind_phys),
dimension(:),
intent(inout) :: tskin, &
198 real (kind=kind_phys),
dimension(:),
intent(inout),
optional :: &
199 xt, xs, xu, xv, xz, zm, xtts, xzts, dt_cool, &
200 z_c, c_0, c_d, w_0, w_d, d_conv, ifd, qrain
203 real (kind=kind_phys),
dimension(:),
intent(inout) :: qsurf, gflux, cmm, chh, evap, hflx, ep
205 character(len=*),
intent(out) :: errmsg
206 integer,
intent(out) :: errflg
213 real (kind=kind_phys),
dimension(im) :: q0, qss, rch, rho_a, theta1, tv1, wndmag
215 real(kind=kind_phys) :: elocp,tem,cpinv,hvapi
220 real (kind=kind_phys),
dimension(im) :: xt_old, xs_old, xu_old, xv_old, xz_old, &
221 zm_old,xtts_old, xzts_old, ifd_old, tref_old, tskin_old, dt_cool_old,z_c_old
223 real(kind=kind_phys) :: ulwflx(im), nswsfc(im)
227 real(kind=kind_phys) :: alpha,beta,rho_w,f_nsol,sss,sep, cosa,sina,taux,tauy, &
228 grav,dz,t0,ttop0,ttop
230 real(kind=kind_phys) :: le,fc,dwat,dtmp,wetc,alfac,ustar_a,rich
231 real(kind=kind_phys) :: rnl_ts,hs_ts,hl_ts,rf_ts,q_ts
232 real(kind=kind_phys) :: fw,q_warm
233 real(kind=kind_phys) :: t12,alon,tsea,sstc,dta,dtz
234 real(kind=kind_phys) :: zsea1,zsea2,soltim
239 real (kind=kind_phys) :: f10m, u10m, v10m, ws10, ru10, qss1, &
240 bb1, hflxs, evaps, ptem
245 real (kind=kind_phys),
parameter :: alps=0.75,bets=0.75,gams=0.15, &
246 ws10cr=30., conlf=7.2e-9, consf=6.4e-8
247 real (kind=kind_phys) :: windrel
254 if (nstf_name1 == 0)
return
267 flag(i) = wet(i) .and. flag_iter(i) .and. use_lake_model(i)/=1
268 do_nst = do_nst .or. flag(i)
270 if (.not. do_nst)
return
276 if(wet(i) .and. flag_guess(i) .and. use_lake_model(i)/=1)
then
283 xtts_old(i) = xtts(i)
284 xzts_old(i) = xzts(i)
286 tskin_old(i) = tskin(i)
287 dt_cool_old(i) = dt_cool(i)
301 nswsfc(i) = sfcnsw(i)
302 wndmag(i) = sqrt(u1(i)*u1(i) + v1(i)*v1(i))
304 q0(i) = max(q1(i), 1.0e-8_kp)
307 theta1(i) = t1(i) * prslki(i)
309 theta1(i) = t1(i) / prslk1(i)
312 tv1(i) = t1(i) * (one + rvrdm1*q0(i))
313 rho_a(i) = prsl1(i) / (rd*tv1(i))
314 qss(i) = fpvs(tsurf(i))
315 qss(i) = eps*qss(i) / (ps(i) + epsm1*qss(i))
324 if (icplocn2atm ==0)
then
325 rch(i) = rho_a(i) * cp * ch(i) * wind(i)
326 cmm(i) = cm(i) * wind(i)
327 chh(i) = rho_a(i) * ch(i) * wind(i)
328 else if (icplocn2atm ==1)
then
329 windrel= sqrt( (u1(i)-usfco(i))**2 + (v1(i)-vsfco(i))**2 )
330 rch(i) = rho_a(i) * cp * ch(i) * windrel
331 cmm(i) = cm(i) * windrel
332 chh(i) = rho_a(i) * ch(i) * windrel
337 evap(i) = elocp * rch(i) * (qss(i) - q0(i))
341 hflx(i) = rch(i) * (tsurf(i) - theta1(i))
343 hflx(i) = rch(i) * (tsurf(i)/prsik1(i) - theta1(i))
354 zsea1 = 0.001_kp*real(nstf_name4)
355 zsea2 = 0.001_kp*real(nstf_name5)
364 ulwflx(i) = sfcemis(i) * sbc * t12 * t12
365 alon = xlon(i)*rad2deg
366 grav =
grv(sinlat(i))
367 soltim = mod(alon/15.0_kp + solhr, 24.0_kp)*3600.0_kp
369 call rhocoef(tsea,sss,rho_w,alpha,beta)
373 le = (2.501_kp-0.00237_kp*tsea)*1.0e6_kp
374 dwat = 2.11e-5_kp*(t1(i)/t0k)**1.94_kp
375 dtmp = (one+3.309e-3_kp*(t1(i)-t0k)-1.44e-6_kp*(t1(i)-t0k) &
376 * (t1(i)-t0k))*0.02411_kp/(rho_a(i)*cp)
377 wetc = 622.0_kp*le*qss(i)/(rd*t1(i)*t1(i))
378 alfac = one / (one + (wetc*le*dwat)/(cp*dtmp))
379 tem = (1.0e3_kp * rain(i) / rho_w) * alfac * cp_w
380 qrain(i) = tem * (tsea-t1(i)+1.0e3_kp*(qss(i)-q0(i))*le/cp)
384 f_nsol = hflx(i) + evap(i) + ulwflx(i) - dlwflx(i) + omg_sh*qrain(i)
390 sep = sss*(evap(i)/le-rain(i))/rho_w
391 ustar_a = sqrt(stress(i)/rho_a(i))
395 rnl_ts = 4.0_kp*sfcemis(i)*sbc*tsea*tsea*tsea
397 hl_ts = rch(i)*elocp*eps*hvap*qss(i)/(rd*t12)
398 rf_ts = tem * (one+rch(i)*hl_ts)
399 q_ts = rnl_ts + hs_ts + hl_ts + omg_sh*rf_ts
405 call cool_skin(ustar_a,f_nsol,nswsfc(i),evap(i),sss,alpha,beta, &
406 rho_w,rho_a(i),tsea,q_ts,hl_ts,grav,le, &
407 dt_cool(i),z_c(i),c_0(i),c_d(i))
409 tem = one / wndmag(i)
412 taux = max(stress(i),tau_min)*cosa
413 tauy = max(stress(i),tau_min)*sina
414 fc = const_rot*sinlat(i)
418 if ( (soltim > solar_time_6am .and. ifd(i) == zero) )
then
427 if ( f_nsol > zero .and. xt(i) > zero )
then
428 call convdepth(kdt,timestep,nswsfc(i),f_nsol,sss,sep,rho_w, &
429 alpha,beta,xt(i),xs(i),xz(i),d_conv(i))
451 call dtm_1p(kdt,timestep,rich,taux,tauy,nswsfc(i), &
452 f_nsol,sss,sep,q_ts,hl_ts,rho_w,alpha,beta,alon, &
453 sinlat(i),soltim,grav,le,d_conv(i), &
454 xt(i),xs(i),xu(i),xv(i),xz(i),xzts(i),xtts(i))
459 if ( xt(i) > zero )
then
463 if ( xz(i) >= z_w_max )
then
466 call dtl_reset(xt(i),xs(i),xu(i),xv(i),xz(i),xtts(i), xzts(i))
473 if ( d_conv(i) > zero )
then
478 call dtm_1p_fca(d_conv(i),xt(i),xtts(i),xz(i),xzts(i))
479 if ( xz(i) >= z_w_max )
then
480 call dtl_reset (xt(i),xs(i),xu(i),xv(i),xz(i),xzts(i),xtts(i))
487 dz = min(xz(i),max(d_conv(i),delz))
493 q_warm = fw*nswsfc(i)-f_nsol
497 if ( q_warm > zero )
then
498 call cal_ttop(kdt,timestep,q_warm,rho_w,dz, xt(i),xz(i),ttop0)
505 ttop = ((xt(i)+xt(i))/xz(i))*(one-dz/((xz(i)+xz(i))))
512 if ( ttop > ttop0 )
then
513 call dtm_1p_tla(dz,ttop0,xt(i),xtts(i),xz(i),xzts(i))
517 if ( xz(i) >= z_w_max )
then
518 call dtl_reset (xt(i),xs(i),xu(i),xv(i),xz(i),xzts(i),xtts(i))
527 t0 = (xt(i)+xt(i))/xz(i)
528 if ( t0 > tw_max )
then
530 if ( xz(i) >= z_w_max )
then
531 call dtl_reset (xt(i),xs(i),xu(i),xv(i),xz(i),xzts(i),xtts(i))
539 sstc = tref(i) + (xt(i)+xt(i))/xz(i) - dt_cool(i)
541 if ( sstc > sst_max )
then
543 call dtm_1p_mta(dta,xt(i),xtts(i),xz(i),xzts(i))
546 if ( xz(i) >= z_w_max )
then
547 call dtl_reset (xt(i),xs(i),xu(i),xv(i),xz(i),xzts(i),xtts(i))
553 if ( abs(soltim) < 2.0_kp*timestep )
then
554 call dtl_reset (xt(i),xs(i),xu(i),xv(i),xz(i),xzts(i),xtts(i))
563 call get_dtzm_point(xt(i),xz(i),dt_cool(i),z_c(i), zsea1,zsea2,dtz)
564 tsurf(i) = max(tgice, tref(i) + dtz )
570 if ( xt(i) > zero )
then
571 call cal_w(kdt,xz(i),xt(i),xzts(i),xtts(i),w_0(i),w_d(i))
593 if (wet(i) .and. use_lake_model(i)/=1)
then
594 if (flag_guess(i))
then
601 xtts(i) = xtts_old(i)
602 xzts(i) = xzts_old(i)
604 tskin(i) = tskin_old(i)
605 dt_cool(i) = dt_cool_old(i)
612 if ( nstf_name1 > 1 )
then
621 if ( nstf_name1 > 1 )
then
626 qss(i) = fpvs( tskin(i) )
627 qss(i) = eps*qss(i) / (ps(i) + epsm1*qss(i))
629 evap(i) = elocp*rch(i) * (qss(i) - q0(i))
632 hflx(i) = rch(i) * (tskin(i) - theta1(i))
634 hflx(i) = rch(i) * (tskin(i)/prsik1(i) - theta1(i))
644 if(lseaspray .and. flag(i))
then
645 f10m = fm10(i) / fm(i)
648 ws10 = sqrt(u10m*u10m + v10m*v10m)
650 ws10 = min(ws10,ws10cr)
651 tem = .015 * ws10 * ws10
652 ru10 = 1. - .087 * log(10./tem)
654 qss1 = eps * qss1 / (prsl1(i) + epsm1 * qss1)
655 tem = rd * cp * t1(i) * t1(i)
656 tem = 1. + eps * hvap * hvap * qss1 / tem
658 evaps = conlf * (ws10**5.4) * ru10 * bb1
659 evaps = evaps * rho_a(i) * hvap * (qss1 - q0(i))
660 evap(i) = evap(i) + alps * evaps
661 hflxs = consf * (ws10**3.4) * ru10
662 hflxs = hflxs * rho_a(i) * cp * (tskin(i) - t1(i))
664 hflx(i) = hflx(i) + bets * hflxs - ptem * evaps
671 hflx(i) = hflx(i) * tem * cpinv
672 evap(i) = evap(i) * tem * hvapi
subroutine sfc_nst_run(im, hvap, cp, hfus, jcal, eps, epsm1, rvrdm1, rd, rhw0, pi, tgice, sbc, ps, u1, v1, usfco, vsfco, icplocn2atm, t1, q1, tref, cm, ch, lseaspray, fm, fm10, prsl1, prslki, prsik1, prslk1, wet, use_lake_model, xlon, sinlat, stress, sfcemis, dlwflx, sfcnsw, rain, timestep, kdt, solhr, xcosz, wind, flag_iter, flag_guess, nstf_name1, nstf_name4, nstf_name5, lprnt, ipr, thsfc_loc, tskin, tsurf, xt, xs, xu, xv, xz, zm, xtts, xzts, dt_cool, z_c, c_0, c_d, w_0, w_d, d_conv, ifd, qrain, qsurf, gflux, cmm, chh, evap, hflx, ep, errmsg, errflg)