14 & lsm,lsm_ruc,grav,cp,eps,epsm1,con_rocp, &
17 & usfco,vsfco,icplocn2atm, &
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 integer,
intent(in) :: icplocn2atm
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)
92 if (icplocn2atm ==0)
then
93 u10m(i) = f10m(i) * u1(i)
94 v10m(i) = f10m(i) * v1(i)
95 else if (icplocn2atm ==1)
then
96 u10m(i) = usfco(i)+f10m(i) * (u1(i)-usfco(i))
97 v10m(i) = vsfco(i)+f10m(i) * (v1(i)-vsfco(i))
99 have_2m = use_lake_model(i)>0 .and. use_lake2m .and. &
100 & iopt_lake==iopt_lake_clm
114 t2m(i)=tskin(i)*wrk + t1(i)*prslki(i)*fhi - (grav+grav)/cp
116 t2m(i) = tskin(i)*wrk + t1(i)*fhi - (grav+grav)/cp
118 if(evap(i) >= 0.)
then
119 q2m(i) = qsurf(i)*wrk + max(qmin,q1(i))*fhi
122 qss = eps * qss/(ps(i) + epsm1 * qss)
123 q2m(i) = qss*wrk + max(qmin,q1(i))*fhi
127 qss = eps * qss / (ps(i) + epsm1 * qss)
128 q2m(i) = min(q2m(i),qss)
131 thcon = (1.e5_kind_phys/ps(i))**con_rocp
134 qss = eps * qss / (ps(i) + epsm1 * qss)
137 qv1 = q1c / (one - q1c)
138 qsfcmr = qsurf(i)/(one - qsurf(i))
139 chs = cdq(i) * wind(i)
141 chs2 = ust(i)*con_karman/fh2(i)
143 qsfcprox = max(qmin,qv1 + evap(i)/cqs)
145 ruc_have_2m:
if(.not.have_2m)
then
148 th2m = tskin(i)*thcon -
shflx(i)/chs2
150 x2m = max(qmin,qsfcprox - evap(i)/cqs2)
151 q2m(i) = x2m/(one + x2m)
153 t2m(i) = tskin(i)*wrk + t1(i)*fhi - (grav+grav)/cp
154 q2m(i) = qsurf(i)*wrk + max(qmin,q1c)*fhi
159 dt = t1(i) - tskin(i)
163 ff = min(max(one-dt/10._kind_phys,0.01_kind_phys), one)
165 fac = log((2._kind_phys +.05_kind_phys)/(0.05_kind_phys + &
166 & ff))/log((dz1 + .05_kind_phys)/(0.05_kind_phys + ff))
167 t2_alt = tskin(i) + fac * dt
174 ff = min(max(one-dq/0.003_kind_phys,0.01_kind_phys), one)
176 fac = log((2._kind_phys +.05_kind_phys)/(0.05_kind_phys + &
177 & ff))/log((dz1 + .05_kind_phys)/(0.05_kind_phys + ff))
178 q2_alt = qsfcmr + fac * dq
179 q2_alt = q2_alt/(one + q2_alt)
191 x2m = max(min(tskin(i),t1(i)) , t2m(i))
192 t2m(i) = min(max(tskin(i),t1(i)) , x2m)
194 x2m = max(min(qsurf(i),q1c) , q2m(i))
195 q2m(i) = min(max(qsurf(i),q1c) , x2m)
199 qss = eps * qss/(ps(i) + epsm1 * qss)
200 q2m(i) = min(q2m(i),qss)
208 q2m(i) = min(q2m(i),1.05_kind_dbl_prec*q1c)
214 qv = max(qmin,(q2m(i)/(1.-q2m(i))))
215 tem = max(ps(i) * qv/( eps - epsm1 *qv), qmin)
216 dpt2m(i) = 243.5_kind_dbl_prec/( ( 17.67_kind_dbl_prec / &
217 & log(tem/611.2_kind_dbl_prec) ) - one) + con_t0c
218 dpt2m(i) = min(dpt2m(i),t2m(i))
221 if (debug_print)
then
223 if (abs(xlat_d(i)-testptlat).lt.0.2 .and. &
224 & abs(xlon_d(i)-testptlon).lt.0.2)
then
225 print 100,
'(ruc_lsm_diag) i=',i, &
226 &
' lat,lon=',xlat_d(i),xlon_d(i),
'zf ',zf(i), &
227 &
'tskin ',tskin(i),
't2m ',t2m(i),
't1',t1(i),
'shflx',
shflx(i),&
228 &
'qsurf ',qsurf(i),
'qsfcprox ',qsfcprox,
'q2m ',q2m(i), &
229 &
'q1 ',q1(i),
'evap ',evap(i),
'dpt2m ',dpt2m(i), &
230 &
'chs2 ',chs2,
'cqs2 ',cqs2,
'cqs ',cqs,
'cdq',cdq(i)
233 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, icplocn2atm, 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)