File: C:\NOAA\NEMS_11731\src\atmos\phys\sfc_nst.f
1
2 SUBROUTINE SFC_NST &
3
4
5 ( IM, KM, PS, U1, V1, T1, Q1, tref, cm, ch, &
6 & prsl1, prslki, slimsk, xlon, sinlat, stress, &
7 & sfcemis, dlwflx, sfcnsw, rain, timestep, kdt, &
8 & ddvel, flag_iter, flag_guess, nst_fcst, lprnt, ipr, &
9
10 , tsurf, xt, xs, xu, xv, xz, zm, xtts, xzts, dt_cool, &
11 & z_c, c_0, c_d, w_0, w_d, d_conv, ifd, Qrain, &
12
13 , gflux, CMM, CHH, EVAP, HFLX, EP &
14 & )
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119 USE MACHINE , ONLY : kind_phys
120 USE FUNCPHYS, ONLY : fpvs
121 USE PHYSCONS, HVAP => con_HVAP
122 &, CP => con_CP, HFUS => con_HFUS, JCAL => con_JCAL
123 &, EPS => con_eps, EPSM1 => con_epsm1
124 &, RVRDM1 => con_FVirt, RD => con_RD
125 &, RHW0 => con_rhw0,SBC => con_sbc,pi => con_pi
126 USE date_def, only: idate
127 USE module_nst_parameters, ONLY : t0K,cp_w,omg_m,omg_sh,
128 & sigma_r,gray,solar_time_6am,Ri_c,z_w_max,delz,wd_max,
129 & rad2deg,const_rot,tau_min,tw_max,sst_max
130 USE module_nst_water_prop, ONLY: solar_time_from_julian,
131 & density,rhocoef,compjd,grv
132 &, sw_ps_9b
133 USE nst_module, ONLY : cool_skin,dtm_1p,cal_w,cal_ttop,convdepth,
134 & dtm_1p_fca,dtm_1p_tla,dtm_1p_mwa,dtm_1p_mda,dtm_1p_mta,dtl_reset
135
136 implicit none
137
138
139 real (kind=kind_phys), parameter :: cpinv=1.0/cp, HVAPI=1.0/HVAP
140 real (kind=kind_phys), parameter :: EMISSIV=0.97
141 real (kind=kind_phys), parameter :: f24 = 24.0
142 real (kind=kind_phys), parameter :: f1440 = 1440.0
143
144
145 integer, intent(in) :: im, km, kdt, ipr, nst_fcst
146 real (kind=kind_phys), dimension(im), intent(in) :: ps, u1, v1, &
147 & t1, q1, tref, cm, ch, prsl1, prslki, slimsk, xlon, &
148 & sinlat, stress, sfcemis, dlwflx, sfcnsw, rain, ddvel
149
150 real (kind=kind_phys), intent(in) :: timestep
151
152 logical, intent(in) :: flag_iter(im), flag_guess(im), lprnt
153
154
155
156 real (kind=kind_phys), dimension(im), intent(inout) :: tskin, &
157 & tsurf, xt, xs, xu, xv, xz, zm, xtts, xzts, dt_cool, &
158 & z_c, c_0, c_d, w_0, w_d, d_conv, ifd, qrain
159
160
161 real (kind=kind_phys), dimension(im), intent(out) :: &
162 & qsurf, gflux, cmm, chh, evap, hflx, ep
163
164
165
166
167 integer :: k,i,iter
168
169 real (kind=kind_phys), dimension(im) :: Q0, QSS, RCH,
170 & rho_a, THETA1, TV1, WIND, wndmag
171
172 real(kind=kind_phys) elocp,tem
173
174
175
176 logical flag(im)
177 real (kind=kind_phys), dimension(im) ::
178 & xt_old, xs_old, xu_old, xv_old, xz_old,zm_old,xtts_old,
179 & xzts_old, ifd_old, tref_old, tskin_old, dt_cool_old,z_c_old
180
181 real(kind=kind_phys) ulwflx(im), nswsfc(im)
182
183
184
185 real(kind=kind_phys) alpha,beta,rho_w,F_nsol,sss,sep,soltim,
186 & cosa,sina,taux,tauy,grav,dz,t0,ttop0,ttop
187
188 integer :: iyear,imon,iday,ihr,imin,jd
189 integer :: idat(8),jdat(8)
190
191 real(kind=kind_phys) Le,fc,dwat,dtmp,wetc,alfac,ustar_a,rich
192 real(kind=kind_phys) Rnl_Ts,Hs_Ts,Hl_Ts,RF_Ts,Q_Ts
193 real(kind=kind_phys) jday,jday_old,fw,Q_warm
194 real(kind=kind_phys) t12,alon,alat,es,Qs,tsea,sstc,dta
195 real(kind=kind_phys) fjd1,jd1,jd0
196 real(kind=kind_phys) rinc(5)
197
198
199 integer :: iw3jdn
200
201 cc
202 PARAMETER (elocp=hvap/cp)
203
204 sss = 34.0
205
206 (1) = idate(4)
207 idat(2) = idate(2)
208 idat(3) = idate(3)
209 idat(4) = 0
210 idat(5) = idate(1)
211 idat(6) = 0
212 idat(7) = 0
213 idat(8) = 0
214
215 rinc(1) = 0.
216 rinc(2) = 0.
217 rinc(3) = float(kdt)*timestep/60.0
218 rinc(4) = 0.
219 rinc(5) = 0.
220 call w3movdat(rinc, idat, jdat)
221
222 iyear = jdat(1)
223 imon = jdat(2)
224 iday = jdat(3)
225 ihr = jdat(5)
226 imin = jdat(6)
227
228
229
230 = iw3jdn(1899,12,31)
231 jd1 = iw3jdn(iyear,imon,iday)
232
233
234
235 if (ihr < 12) then
236 jd1 = jd1 - 1
237 fjd1= 0.5 + float(ihr)/f24 + float(imin)/f1440
238 else
239 fjd1= float(ihr - 12)/f24 + float(imin)/f1440
240 endif
241 jday = jd1 - jd0 + fjd1
242
243
244
245 DO I = 1, IM
246 FLAG(I) = SLIMSK(I).EQ. 0. .AND. flag_iter(i)
247 ENDDO
248
249
250
251
252 do i=1, im
253 if((SLIMSK(I).EQ. 0.) .AND. flag_guess(i)) then
254 xt_old(i) = xt(i)
255 xs_old(i) = xs(i)
256 xu_old(i) = xu(i)
257 xv_old(i) = xv(i)
258 xz_old(i) = xz(i)
259 zm_old(i) = zm(i)
260 xtts_old(i) = xtts(i)
261 xzts_old(i) = xzts(i)
262 ifd_old(i) = ifd(i)
263 tskin_old(i) = tskin(i)
264 dt_cool_old(i) = dt_cool(i)
265 z_c_old(i) = z_c(i)
266 endif
267 enddo
268
269
270
271
272
273
274 do i = 1, im
275 if ( flag(i) ) then
276
277 nswsfc(i) = sfcnsw(i)
278 (i) = sqrt(u1(i)*u1(i) + v1(i)*v1(i))
279 wind(i) = wndmag(i) + max( 0.0, min( ddvel(i), 30.0 ) )
280 wind(i) = max( wind(i), 1.0 )
281
282 q0(i) = max(q1(i), 1.0e-8)
283 theta1(i) = t1(i) * prslki(i)
284 tv1(i) = t1(i) * (1.0 + rvrdm1*q0(i))
285 rho_a(i) = prsl1(i) / (rd*tv1(i))
286 qss(i) = fpvs(tsurf(i))
287 (i) = eps*qss(i) / (ps(i) + epsm1*qss(i))
288
289 (i) = 0.0
290 hflx(i) = 0.0
291 gflux(i) = 0.0
292 ep(i) = 0.0
293
294
295
296 (i) = rho_a(i) * cp * ch(i) * wind(i)
297 cmm(i) = cm (i) * wind(i)
298 chh(i) = rho_a(i) * ch(i) * wind(i)
299
300
301
302 (i) = elocp * rch(i) * (qss(i) - q0(i))
303 qsurf(i) = qss(i)
304 hflx(i) = rch(i) * (tsurf(i) - theta1(i))
305
306
307
308
309 endif
310 enddo
311
312
313
314 do i = 1, im
315 if ( flag(i) ) then
316 tsea = tsurf(i)
317 t12 = tsea*tsea
318 ulwflx(i) = sfcemis(i) * sbc * t12 * t12
319 alon = xlon(i)*rad2deg
320 grav = grv(sinlat(i))
321 CALL solar_time_from_julian(jday,alon,soltim)
322 CALL density(tsea,SSS,rho_w)
323 CALL rhocoef(tsea,SSS,rho_w,alpha,beta)
324
325
326
327 = (2.501-.00237*tsea)*1e6
328 dwat = 2.11e-5*(T1(I)/t0K)**1.94
329 = (1.+3.309e-3*(T1(I)-t0K)-1.44e-6*(T1(I)-t0K)*
330 & (T1(I)-t0K))*0.02411/(rho_a(I)*CP)
331 = 622.0*Le*QSS(I)/(rd*t1(i)*t1(i))
332 alfac = 1/(1+(wetc*Le*dwat)/(CP*dtmp))
333 (I) = (1000.*rain(I)/rho_w)*alfac*cp_w*
334 & (tsea-T1(I)+(1000.*QSS(I)-1000.*Q0(I))*Le/CP)
335
336
337
338 = hflx(i) + evap(i) + ulwflx(i) - dlwflx(i)
339 & + omg_sh*Qrain(i)
340
341
342
343
344
345 = sss*(evap(i)/Le-rain(i))/rho_w
346 ustar_a = sqrt(stress(i)/rho_a(i))
347
348
349
350 = 4.0*gray*sigma_r*tsea*tsea*tsea
351 = rch(i)
352 Hl_Ts = rch(i)*elocp*eps*hvap*qss(i)/(rd*t12)
353 RF_Ts = (1000.*rain(i)/rho_w)*alfac*cp_w*(1.0+rch(i)*Hl_Ts)
354 Q_Ts = Rnl_Ts + Hs_Ts + Hl_Ts + omg_sh*RF_Ts
355
356
357
358 call cool_skin(ustar_a,F_nsol,NSWSFC(i),evap(i),sss,alpha,beta
359 &, rho_w,rho_a(i),tsea,Q_Ts,Hl_Ts,grav,Le
360 &, dt_cool(i),z_c(i),c_0(i),c_d(i))
361
362 tem = 1.0 / wndmag(i)
363 cosa = u1(i)*tem
364 sina = v1(i)*tem
365 taux = max(stress(i),tau_min)*cosa
366 tauy = max(stress(i),tau_min)*sina
367 fc = const_rot*sinlat(i)
368
369
370
371 if ( (soltim > solar_time_6am .and. ifd(i) == 0.0) ) then
372 else
373 ifd(i) = 1.0
374
375
376
377
378
379 if ( F_nsol > 0.0 .and. xt(i) > 0.0 ) then
380 call convdepth(kdt,timestep,NSWSFC(i),F_nsol,sss,sep,rho_w
381 &, alpha,beta,xt(i),xs(i),xz(i),d_conv(i))
382 else
383 d_conv(i) = 0.0
384 endif
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400 = Ri_c
401
402 call dtm_1p(kdt,timestep,rich,taux,tauy,NSWSFC(i),
403 & F_nsol,sss,sep,Q_Ts,Hl_Ts,rho_w,alpha,beta,alon,sinlat(i),
404 & soltim,grav,Le,d_conv(i),
405 & xt(i),xs(i),xu(i),xv(i),xz(i),xzts(i),xtts(i))
406
407
408
409
410 if ( xt(i) > 0.0 ) then
411 call dtm_1p_mda(xt(i),xtts(i),xz(i),xzts(i))
412 if ( xz(i) >= z_w_max ) then
413 call dtl_reset(xt(i),xs(i),xu(i),xv(i),xz(i),xtts(i),
414 & xzts(i))
415
416
417
418 endif
419
420
421 if ( d_conv(i) > 0.0 ) then
422 call dtm_1p_fca(d_conv(i),xt(i),xtts(i),xz(i),xzts(i))
423 if ( xz(i) >= z_w_max ) then
424 call dtl_reset
425 & (xt(i),xs(i),xu(i),xv(i),xz(i),xzts(i),xtts(i))
426 endif
427 endif
428
429
430
431
432 = min(xz(i),max(d_conv(i),delz))
433
434 call sw_ps_9b(delz,fw)
435 Q_warm = fw*NSWSFC(i)-F_nsol
436 if ( Q_warm > 0.0 ) then
437 call cal_ttop(kdt,timestep,Q_warm,rho_w,dz,
438 & xt(i),xz(i),ttop0)
439
440
441
442
443
444
445 = ((xt(i)+xt(i))/xz(i))*(1.0-dz/((xz(i)+xz(i))))
446
447
448
449
450
451 if ( ttop > ttop0 ) then
452 call dtm_1p_tla(dz,ttop0,xt(i),xtts(i),xz(i),xzts(i))
453
454
455
456 if ( xz(i) >= z_w_max ) then
457 call dtl_reset
458 & (xt(i),xs(i),xu(i),xv(i),xz(i),xzts(i),xtts(i))
459 endif
460 endif
461 endif
462
463
464
465
466 = (xt(i)+xt(i))/xz(i)
467 if ( t0 > tw_max ) then
468 call dtm_1p_mwa(xt(i),xtts(i),xz(i),xzts(i))
469 if ( xz(i) >= z_w_max ) then
470 call dtl_reset
471 & (xt(i),xs(i),xu(i),xv(i),xz(i),xzts(i),xtts(i))
472 endif
473 endif
474
475
476
477
478 = tref(i) + (xt(i)+xt(i))/xz(i) - dt_cool(i)
479 if ( sstc > sst_max ) then
480 dta = sstc - sst_max
481 call dtm_1p_mta(dta,xt(i),xtts(i),xz(i),xzts(i))
482
483
484 if ( xz(i) >= z_w_max ) then
485 call dtl_reset
486 & (xt(i),xs(i),xu(i),xv(i),xz(i),xzts(i),xtts(i))
487 endif
488 endif
489
490 endif
491
492 endif
493
494
495
496 (i) = max(271.0, tref(i)+(xt(i)+xt(i))/xz(i)-dt_cool(i))
497
498
499
500
501 if ( xt(i) > 0.0 ) then
502 call cal_w(kdt,xz(i),xt(i),xzts(i),xtts(i),w_0(i),w_d(i))
503 else
504 w_0(i) = 0.0
505 w_d(i) = 0.0
506 endif
507
508
509
510
511
512
513
514
515
516 (i) = wind(i)
517
518 ENDIF
519 ENDDO
520
521
522 do i=1, im
523 if((slimsk(I) == 0.) ) then
524 if(flag_guess(i)) then
525 xt(i) = xt_old(i)
526 xs(i) = xs_old(i)
527 xu(i) = xu_old(i)
528 xv(i) = xv_old(i)
529 xz(i) = xz_old(i)
530 zm(i) = zm_old(i)
531 xtts(i) = xtts_old(i)
532 xzts(i) = xzts_old(i)
533 ifd(i) = ifd_old(i)
534 tskin(i) = tskin_old(i)
535 dt_cool(i) = dt_cool_old(i)
536 z_c(i) = z_c_old(i)
537 else
538 if ( nst_fcst > 1 ) then
539 tskin(i) = tsurf(i)
540 endif
541 endif
542 endif
543 enddo
544
545
546
547 if ( nst_fcst > 1 ) then
548
549 do i = 1, im
550 if ( flag(i) ) then
551 qss(i) = fpvs( tskin(i) )
552 qss(i) = eps*qss(i) / (ps(i) + epsm1*qss(i))
553 qsurf(i) = qss(i)
554 evap(i) = elocp*rch(i) * (qss(i) - q0(i))
555 hflx(i) = rch(i) * (tskin(i) - theta1(i))
556 endif
557 enddo
558 endif
559
560
561 do i=1,im
562 if ( flag(i) ) then
563 tem = 1.0 / rho_a(i)
564 hflx(i) = hflx(i) * tem * cpinv
565 evap(i) = evap(i) * tem * hvapi
566 endif
567 enddo
568
569
570
571 return
572 end
573