14 & lsm,lsm_ruc,grav,cp,eps,epsm1,con_rocp, &
17 & usfco,vsfco,use_oceanuv, &
18 & zf,ps,u1,v1,t1,q1,prslki,evap,fm,fh,fm10,fh2, &
19 & ust,tskin,qsurf,thsfc_loc,diag_flux,diag_log, &
20 & use_lake_model,iopt_lake,iopt_lake_clm, &
21 & lake_t2m,lake_q2m,use_lake2m, &
22 & f10m,u10m,v10m,t2m,q2m,dpt2m,errmsg,errflg &
25 use machine ,
only : kind_phys, kind_dbl_prec
26 use funcphys,
only : fpvs
27 use physcons,
only : con_t0c
30 integer,
intent(in) :: im, lsm, lsm_ruc, iopt_lake, iopt_lake_clm
31 logical,
intent(in) :: use_lake2m
32 logical,
intent(in) :: use_oceanuv
33 logical,
intent(in) :: thsfc_loc
34 logical,
intent(in) :: diag_flux
35 logical,
intent(in) :: diag_log
36 real(kind=kind_phys),
intent(in) :: grav,cp,eps,epsm1,con_rocp
37 real(kind=kind_phys),
intent(in) :: con_karman
38 real(kind=kind_phys),
dimension(:),
intent( in) :: &
39 & zf, ps, u1, v1, t1, q1, ust, tskin, &
41 & qsurf, prslki, evap, fm, fh, fm10, fh2, &
42 &
shflx, cdq, wind, xlat_d, xlon_d
43 real(kind=kind_phys),
dimension(:),
intent(out) :: &
44 & f10m, u10m, v10m, t2m, q2m, dpt2m
45 real(kind=kind_phys),
dimension(:),
intent(in),
optional :: &
47 integer,
dimension(:),
intent(in) :: use_lake_model
48 character(len=*),
intent(out) :: errmsg
49 integer,
intent(out) :: errflg
53 real (kind_phys),
parameter :: zero = 0._kind_dbl_prec
54 real (kind_phys),
parameter :: one = 1._kind_dbl_prec
55 real (kind_phys),
parameter :: qmin=1.0e-8
58 logical :: debug_print
59 real(kind=kind_phys) :: q1c, qv, tem, qv1, th2m, x2m, rho
60 real(kind=kind_phys) :: dt, dq, qsfcmr, qsfcprox, ff, fac, dz1
61 real(kind=kind_phys) :: t2_alt, q2_alt
62 real(kind=kind_phys) :: thcon, cqs, chs, chs2, cqs2
63 real(kind=kind_phys) :: testptlat, testptlon
66 real(kind=kind_phys) :: fhi, qss, wrk
76 testptlat = 35.3_kind_phys
77 testptlon = 273.0_kind_phys
91 f10m(i) = fm10(i) / fm(i)
93 u10m(i) = usfco(i)+f10m(i) * (u1(i)-usfco(i))
94 v10m(i) = vsfco(i)+f10m(i) * (v1(i)-vsfco(i))
96 u10m(i) = f10m(i) * u1(i)
97 v10m(i) = f10m(i) * v1(i)
100 have_2m = use_lake_model(i)>0 .and. use_lake2m .and. &
101 & iopt_lake==iopt_lake_clm
115 t2m(i)=tskin(i)*wrk + t1(i)*prslki(i)*fhi - (grav+grav)/cp
117 t2m(i) = tskin(i)*wrk + t1(i)*fhi - (grav+grav)/cp
119 if(evap(i) >= 0.)
then
120 q2m(i) = qsurf(i)*wrk + max(qmin,q1(i))*fhi
123 qss = eps * qss/(ps(i) + epsm1 * qss)
124 q2m(i) = qss*wrk + max(qmin,q1(i))*fhi
128 qss = eps * qss / (ps(i) + epsm1 * qss)
129 q2m(i) = min(q2m(i),qss)
132 thcon = (1.e5_kind_phys/ps(i))**con_rocp
135 qss = eps * qss / (ps(i) + epsm1 * qss)
138 qv1 = q1c / (one - q1c)
139 qsfcmr = qsurf(i)/(one - qsurf(i))
140 chs = cdq(i) * wind(i)
142 chs2 = ust(i)*con_karman/fh2(i)
144 qsfcprox = max(qmin,qv1 + evap(i)/cqs)
146 ruc_have_2m:
if(.not.have_2m)
then
149 th2m = tskin(i)*thcon -
shflx(i)/chs2
151 x2m = max(qmin,qsfcprox - evap(i)/cqs2)
152 q2m(i) = x2m/(one + x2m)
154 t2m(i) = tskin(i)*wrk + t1(i)*fhi - (grav+grav)/cp
155 q2m(i) = qsurf(i)*wrk + max(qmin,q1c)*fhi
160 dt = t1(i) - tskin(i)
164 ff = min(max(one-dt/10._kind_phys,0.01_kind_phys), one)
166 fac = log((2._kind_phys +.05_kind_phys)/(0.05_kind_phys + &
167 & ff))/log((dz1 + .05_kind_phys)/(0.05_kind_phys + ff))
168 t2_alt = tskin(i) + fac * dt
175 ff = min(max(one-dq/0.003_kind_phys,0.01_kind_phys), one)
177 fac = log((2._kind_phys +.05_kind_phys)/(0.05_kind_phys + &
178 & ff))/log((dz1 + .05_kind_phys)/(0.05_kind_phys + ff))
179 q2_alt = qsfcmr + fac * dq
180 q2_alt = q2_alt/(one + q2_alt)
192 x2m = max(min(tskin(i),t1(i)) , t2m(i))
193 t2m(i) = min(max(tskin(i),t1(i)) , x2m)
195 x2m = max(min(qsurf(i),q1c) , q2m(i))
196 q2m(i) = min(max(qsurf(i),q1c) , x2m)
200 qss = eps * qss/(ps(i) + epsm1 * qss)
201 q2m(i) = min(q2m(i),qss)
209 q2m(i) = min(q2m(i),1.05_kind_dbl_prec*q1c)
215 qv = max(qmin,(q2m(i)/(1.-q2m(i))))
216 tem = max(ps(i) * qv/( eps - epsm1 *qv), qmin)
217 dpt2m(i) = 243.5_kind_dbl_prec/( ( 17.67_kind_dbl_prec / &
218 & log(tem/611.2_kind_dbl_prec) ) - one) + con_t0c
219 dpt2m(i) = min(dpt2m(i),t2m(i))
222 if (debug_print)
then
224 if (abs(xlat_d(i)-testptlat).lt.0.2 .and. &
225 & abs(xlon_d(i)-testptlon).lt.0.2)
then
226 print 100,
'(ruc_lsm_diag) i=',i, &
227 &
' lat,lon=',xlat_d(i),xlon_d(i),
'zf ',zf(i), &
228 &
'tskin ',tskin(i),
't2m ',t2m(i),
't1',t1(i),
'shflx',
shflx(i),&
229 &
'qsurf ',qsurf(i),
'qsfcprox ',qsfcprox,
'q2m ',q2m(i), &
230 &
'q1 ',q1(i),
'evap ',evap(i),
'dpt2m ',dpt2m(i), &
231 &
'chs2 ',chs2,
'cqs2 ',cqs2,
'cqs ',cqs,
'cdq',cdq(i)
234 100
format (
";;; ",a,i4,a,2f14.7/(4(a10,
'='es11.4)))
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...
subroutine sfc_diag_run(im, xlat_d, xlon_d, lsm, lsm_ruc, grav, cp, eps, epsm1, con_rocp, con_karman, shflx, cdq, wind, usfco, vsfco, use_oceanuv, zf, ps, u1, v1, t1, q1, prslki, evap, fm, fh, fm10, fh2, ust, tskin, qsurf, thsfc_loc, diag_flux, diag_log, use_lake_model, iopt_lake, iopt_lake_clm, lake_t2m, lake_q2m, use_lake2m, f10m, u10m, v10m, t2m, q2m, dpt2m, errmsg, errflg)