1 !----------------------------------------------------------------------
3 MODULE MODULE_SF_MYJSFC
5 !----------------------------------------------------------------------
7 USE MODULE_MODEL_CONSTANTS
9 USE MODULE_DM, ONLY : WRF_DM_MAXVAL
12 !----------------------------------------------------------------------
14 ! REFERENCES: Janjic (2002), NCEP Office Note 437
17 ! MYJSFC GENERATES THE SURFACE EXCHANGE COEFFICIENTS FOR VERTICAL
18 ! TURBULENT EXCHANGE BASED UPON MONIN_OBUKHOV THEORY WITH
19 ! VARIOUS REFINEMENTS.
21 !----------------------------------------------------------------------
23 INTEGER :: ITRMX=5 ! Iteration count for sfc layer computations
25 REAL,PARAMETER :: VKARMAN=0.4
26 REAL,PARAMETER :: CAPA=R_D/CP,ELOCP=2.72E6/CP,RCAP=1./CAPA
27 REAL,PARAMETER :: GOCP02=G/CP*2.,GOCP10=G/CP*10.
28 ! REAL,PARAMETER :: EPSU2=1.E-4,EPSUST=0.07,EPSZT=1.E-5
29 ! ECMWF sets lower limit on ln(Z0h)=-20 --> EPSZT=2.e-9
30 REAL,PARAMETER :: EPSU2=1.E-6,EPSUST=1.e-9,EPSZT=1.E-28
31 REAL,PARAMETER :: A2S=17.2693882,A3S=273.16,A4S=35.86
32 REAL,PARAMETER :: SEAFC=0.98,PQ0SEA=PQ0*SEAFC
33 REAL,PARAMETER :: BETA=1./273.,EXCML=0.0001,EXCMS=0.0001 &
34 & ,GLKBR=10.,GLKBS=30.,PI=3.1415926 &
35 & ,QVISC=2.1E-5,RIC=0.505,SMALL=0.35 &
36 & ,SQPR=0.84,SQSC=0.84,SQVISC=258.2,TVISC=2.1E-5 &
37 & ,USTC=0.7,USTR=0.225,VISC=1.5E-5,FH=1.01 &
38 & ,WWST=1.2,ZTFC=1.,TOPOFAC=9.0e-6
40 REAL,PARAMETER :: BTG=BETA*G,CZIV=SMALL*GLKBS &
42 & ,RTVISC=1./TVISC,RVISC=1./VISC &
44 & ,FZQ1=RTVISC*QVISC*ZQRZT &
45 & ,FZQ2=RTVISC*QVISC*ZQRZT &
46 & ,FZT1=RVISC *TVISC*SQPR &
47 & ,FZT2=CZIV*GRRS*TVISC*SQPR &
54 !----------------------------------------------------------------------
55 INTEGER, PARAMETER :: KZTM=10001,KZTM2=KZTM-2
57 REAL :: DZETA1,DZETA2,FH01,FH02,ZTMAX1,ZTMAX2,ZTMIN1,ZTMIN2
59 REAL,DIMENSION(KZTM) :: PSIH1,PSIH2,PSIM1,PSIM2
61 !----------------------------------------------------------------------
65 !----------------------------------------------------------------------
66 SUBROUTINE MYJSFC(ITIMESTEP,HT,DZ &
67 & ,PMID,PINT,TH,T,QV,QC,U,V,Q2 &
68 & ,TSK,QSFC,THZ0,QZ0,UZ0,VZ0 &
69 & ,LOWLYR,XLAND,IVGTYP,ISURBAN,IZ0TLND &
70 & ,USTAR,ZNT,Z0BASE,PBLH,MAVAIL,RMOL &
73 & ,CHS,CHS2,CQS2,HFX,QFX,FLX_LH,FLHC,FLQC &
75 & ,U10,V10,T02,TH02,TSHLTR,TH10,Q02,QSHLTR,Q10,PSHLTR &
76 & ,P1000mb,U10E,V10E &
77 & ,IDS,IDE,JDS,JDE,KDS,KDE &
78 & ,IMS,IME,JMS,JME,KMS,KME &
79 & ,ITS,ITE,JTS,JTE,KTS,KTE)
80 !----------------------------------------------------------------------
84 !----------------------------------------------------------------------
85 INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE &
86 & ,IMS,IME,JMS,JME,KMS,KME &
87 & ,ITS,ITE,JTS,JTE,KTS,KTE
89 INTEGER,INTENT(IN) :: ITIMESTEP
91 INTEGER,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: LOWLYR
93 REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: HT,MAVAIL,TSK &
96 REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(IN) :: DZ &
101 INTEGER,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: IVGTYP
102 INTEGER, INTENT(IN) :: ISURBAN
103 INTEGER, INTENT(IN) :: IZ0TLND
105 REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(OUT) :: FLX_LH,HFX,PSHLTR &
108 & ,U10,V10,TH02,Q02 &
111 REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(INOUT) :: AKHS,AKMS &
113 REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(OUT) :: RIB
115 REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(INOUT) :: QZ0,RMOL,THZ0 &
119 REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(OUT) :: CHS,CHS2,CQS2 &
120 & ,CPM,CT,FLHC,FLQC &
123 REAL,INTENT(IN) :: P1000mb
124 !----------------------------------------------------------------------
128 INTEGER :: I,J,K,KFLIP,LMH,LPBL,NTSD
130 REAL :: A,APESFC,B,BTGX,CWMLOW &
131 & ,DQDT,DTDIF,DTDT,DUDT,DVDT &
133 & ,P02P,P10P,PLOW,PSFC,PTOP,QLOW,QS02,QS10 &
134 & ,RAPA,RAPA02,RAPA10,RATIOMX,RDZ,SEAMASK,SM &
135 & ,T02P,T10P,TEM,TH02P,TH10P,THLOW,THELOW,THM &
136 & ,TLOW,TZ0,ULOW,VLOW,ZSL
138 REAL,DIMENSION(KTS:KTE) :: CWMK,PK,Q2K,QK,THEK,THK,TK,UK,VK
140 REAL,DIMENSION(KTS:KTE-1) :: EL,ELM
142 REAL,DIMENSION(KTS:KTE+1) :: ZHK
144 REAL,DIMENSION(ITS:ITE,JTS:JTE) :: THSK
146 REAL,DIMENSION(ITS:ITE,KTS:KTE+1,JTS:JTE) :: ZINT
148 !----------------------------------------------------------------------
149 !**********************************************************************
150 !----------------------------------------------------------------------
152 !*** MAKE PREPARATIONS
154 !----------------------------------------------------------------------
165 ZINT(I,KTE+1,J)=HT(I,J) ! Z at bottom of lowest sigma layer
169 !!!!!! UNCOMMENT THESE LINES IF USING ETA COORDINATES
171 !!!!!! ZINT(I,KTE+1,J)=1.E-4 ! Z of bottom of lowest eta layer
172 !!!!!! ZHK(KTE+1)=1.E-4 ! Z of bottom of lowest eta layer
181 ZINT(I,K,J)=ZINT(I,K+1,J)+DZ(I,KFLIP,J)
188 #if ( NMM_CORE == 1 )
199 !!! Z0(I,J)=SM*Z0SEA+(1.-SM)*(Z0(I,J)*Z0MAX+FIS*FCM+Z0LAND)
200 !!! ZNT(I,J)=SM*Z0SEA+(1.-SM)*(ZNT(I,J)*Z0MAX+FIS*FCM+Z0LAND)
213 !----------------------------------------------------------------------
214 setup_integration: DO J=JTS,JTE
215 !----------------------------------------------------------------------
219 !*** LOWEST LAYER ABOVE GROUND MUST BE FLIPPED
221 LMH=KTE-LOWLYR(I,J)+1
223 PTOP=PINT(I,KTE+1,J) ! KTE+1=KME
224 PSFC=PINT(I,LOWLYR(I,J),J)
225 ! Define THSK here (for first timestep mostly)
226 ! THSK(I,J)=TSK(I,J)/(PSFC*1.E-5)**CAPA
227 THSK(I,J)=TSK(I,J)/(PSFC/P1000mb)**CAPA
229 !*** CONVERT LAND MASK (1 FOR SEA; 0 FOR LAND)
231 SEAMASK=XLAND(I,J)-1.
233 !*** FILL 1-D VERTICAL ARRAYS
234 !*** AND FLIP DIRECTION SINCE MYJ SCHEME
235 !*** COUNTS DOWNWARD FROM THE DOMAIN'S TOP
241 RATIOMX=QV(I,KFLIP,J)
242 QK(K)=RATIOMX/(1.+RATIOMX)
243 PK(K)=PMID(I,KFLIP,J)
244 CWMK(K)=QC(I,KFLIP,J)
245 THEK(K)=(CWMK(K)*(-ELOCP/TK(K))+1.)*THK(K)
246 Q2K(K)=2.*Q2(I,KFLIP,J)
248 !*** COMPUTE THE HEIGHTS OF THE LAYER INTERFACES
253 ZHK(KTE+1)=HT(I,J) ! Z at bottom of lowest sigma layer
261 !*** FIND THE HEIGHT OF THE PBL
265 IF(Q2K(K)<=EPSQ2*FH) THEN
273 !-----------------------------------------------------------------------
274 !--------------THE HEIGHT OF THE PBL------------------------------------
275 !-----------------------------------------------------------------------
277 110 PBLH(I,J)=ZHK(LPBL)-ZHK(LMH+1)
279 !----------------------------------------------------------------------
281 !*** FIND THE SURFACE EXCHANGE COEFFICIENTS
283 !----------------------------------------------------------------------
292 ZSL=(ZHK(LMH)-ZHK(LMH+1))*0.5
293 ! APESFC=(PSFC*1.E-5)**CAPA
294 APESFC=(PSFC/P1000mb)**CAPA
295 !tgs - in ARW THZ0 is not initialized when MYJSFC is called first time
296 #if ( NMM_CORE == 1 )
301 ! if(itimestep.le.1) then
307 CALL SFCDIF(NTSD,SEAMASK,THSK(I,J),QSFC(I,J),PSFC &
308 & ,UZ0(I,J),VZ0(I,J),TZ0,TSK(I,J),THZ0(I,J),QZ0(I,J) &
309 & ,USTAR(I,J),ZNT(I,J),Z0BASE(I,J),CT(I,J),RMOL(I,J) &
310 & ,AKMS(I,J),AKHS(I,J),RIB(I,J),PBLH(I,J),MAVAIL(I,J) &
311 & ,IVGTYP(I,J),ISURBAN,IZ0TLND &
312 & ,CHS(I,J),CHS2(I,J),CQS2(I,J) &
313 & ,HFX(I,J),QFX(I,J),FLX_LH(I,J) &
314 & ,FLHC(I,J),FLQC(I,J),QGH(I,J),CPM(I,J) &
315 & ,ULOW,VLOW,TLOW,THLOW,THELOW,QLOW,CWMLOW &
317 & ,U10(I,J),V10(I,J),TSHLTR(I,J),TH10(I,J) &
318 & ,QSHLTR(I,J),Q10(I,J),PSHLTR(I,J) &
319 & ,U10E(I,J),V10E(I,J) &
320 & ,IDS,IDE,JDS,JDE,KDS,KDE &
321 & ,IMS,IME,JMS,JME,KMS,KME &
322 & ,ITS,ITE,JTS,JTE,KTS,KTE,i,j,ZHK(LMH+1))
324 !*** REMOVE SUPERATURATION AT 2M AND 10M
329 TH02(I,J)=TSHLTR(I,J)
331 RAPA02=RAPA-GOCP02/TH02P
332 RAPA10=RAPA-GOCP10/TH10P
336 ! 1 may 06 tgs T02(I,J) = T02P
337 T02(I,J) = TH02(I,J)*APESFC
339 ! P02P=(RAPA02**RCAP)*1.E5
340 ! P10P=(RAPA10**RCAP)*1.E5
341 P02P=(RAPA02**RCAP)*P1000mb
342 P10P=(RAPA10**RCAP)*P1000mb
344 QS02=PQ0/P02P*EXP(A2*(T02P-A3)/(T02P-A4))
345 QS10=PQ0/P10P*EXP(A2*(T10P-A3)/(T10P-A4))
347 IF(QSHLTR(I,J)>QS02)QSHLTR(I,J)=QS02
348 IF(Q10 (I,J)>QS10)Q10 (I,J)=QS10
349 Q02(I,J)=QSHLTR(I,J)/(1.-QSHLTR(I,J))
350 !----------------------------------------------------------------------
354 !----------------------------------------------------------------------
355 ENDDO setup_integration
356 !----------------------------------------------------------------------
358 END SUBROUTINE MYJSFC
359 !XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
360 !----------------------------------------------------------------------
361 SUBROUTINE SFCDIF(NTSD,SEAMASK,THS,QS,PSFC &
362 & ,UZ0,VZ0,TZ0,TSK,THZ0,QZ0 &
363 & ,USTAR,Z0,Z0BASE,CT,RLMO,AKMS,AKHS,RIB,PBLH,WETM &
364 & ,VEGTYP,ISURBAN,IZ0TLND &
365 & ,CHS,CHS2,CQS2,HFX,QFX,FLX_LH,FLHC,FLQC,QGH,CPM &
366 & ,ULOW,VLOW,TLOW,THLOW,THELOW,QLOW,CWMLOW &
368 & ,U10,V10,TH02,TH10,Q02,Q10,PSHLTR &
370 & ,IDS,IDE,JDS,JDE,KDS,KDE &
371 & ,IMS,IME,JMS,JME,KMS,KME &
372 & ,ITS,ITE,JTS,JTE,KTS,KTE,i,j,ZSFC)
373 ! ****************************************************************
377 ! ****************************************************************
378 !----------------------------------------------------------------------
382 !----------------------------------------------------------------------
383 INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE &
384 & ,IMS,IME,JMS,JME,KMS,KME &
385 & ,ITS,ITE,JTS,JTE,KTS,KTE,i,j
387 INTEGER,INTENT(IN) :: NTSD
389 REAL,INTENT(IN) :: CWMLOW,PBLH,PLOW,QLOW,PSFC,SEAMASK,ZSFC &
390 & ,THELOW,THLOW,THS,TSK,TLOW,TZ0,ULOW,VLOW,WETM,ZSL &
392 INTEGER, INTENT(IN) :: VEGTYP, ISURBAN, IZ0TLND
394 REAL,INTENT(OUT) :: CHS,CHS2,CPM,CQS2,CT,FLHC,FLQC,FLX_LH,HFX &
395 & ,PSHLTR,Q02,Q10,QFX,QGH,RIB,RLMO &
396 & ,TH02,TH10,U10,V10,U10E,V10E
398 REAL,INTENT(INOUT) :: AKHS,AKMS,QZ0,THZ0,USTAR,UZ0,VZ0,Z0,QS
399 !----------------------------------------------------------------------
405 REAL :: A,B,BTGH,BTGX,CXCHL,CXCHS,CZETMAX,DTHV,DU2,ELFC,FCT &
406 & ,HLFLX,HSFLX,HV,PSH02,PSH10,PSHZ,PSHZL,PSM10,PSMZ,PSMZL &
407 & ,RDZ,RDZT,RLMA,RLMN,RLMP &
408 & ,RLOGT,RLOGU,RWGH,RZ,RZST,RZSU,SIMH,SIMM,TEM,THM &
409 & ,UMFLX,USTARK,VMFLX,WGHT,WGHTT,WGHTQ,WSTAR2 &
410 & ,X,XLT,XLT4,XLU,XLU4,XT,XT4,XU,XU4,ZETALT,ZETALU &
411 & ,ZETAT,ZETAU,ZQ,ZSLT,ZSLU,ZT,ZU,TOPOTERM,ZZIL
416 REAL :: AKHS02,AKHS10,AKMS02,AKMS10,EKMS10,QSAT10,QSAT2 &
417 & ,RLNT02,RLNT10,RLNU10,SIMH02,SIMH10,SIMM10,T02,T10 &
418 & ,TERM1,RLOW,WSTAR,XLT02,XLT024,XLT10 &
419 & ,XLT104,XLU10,XLU104,XU10,XU104,ZT02,ZT10,ZTAT02,ZTAT10 &
420 & ,ZTAU,ZTAU10,ZU10,ZUUZ
421 !----------------------------------------------------------------------
422 !**********************************************************************
423 !----------------------------------------------------------------------
437 !----------------------------------------------------------------------
441 !----------------------------------------------------------------------
445 !----------------------------------------------------------------------
447 !----------------------------------------------------------------------
448 Z0=MAX(USTFC*USTAR*USTAR,1.59E-5)
450 !*** VISCOUS SUBLAYER, JANJIC MWR 1994
452 !----------------------------------------------------------------------
454 !----------------------------------------------------------------------
458 #if ( NMM_CORE == 1 )
469 ZU=FZU1*SQRT(SQRT(Z0*USTAR*RVISC))/USTAR
472 UZ0=(ULOW*RWGH+UZ0)*0.5
473 VZ0=(VLOW*RWGH+VZ0)*0.5
480 #if ( NMM_CORE == 1 )
486 THZ0=((WGHTT*THLOW+THS)/(WGHTT+1.)+THZ0)*0.5
487 QZ0=((WGHTQ*QLOW+QS)/(WGHTQ+1.)+QZ0)*0.5
489 THZ0=(WGHTT*THLOW+THS)/(WGHTT+1.)
490 QZ0=(WGHTQ*QLOW+QS)/(WGHTQ+1.)
495 IF(USTAR>=USTR.AND.USTAR<USTC)THEN
500 ZT=FZT2*SQRT(SQRT(Z0*USTAR*RVISC))/USTAR
505 #if ( NMM_CORE == 1 )
512 THZ0=((WGHTT*THLOW+THS)/(WGHTT+1.)+THZ0)*0.5
513 QZ0=((WGHTQ*QLOW+QS)/(WGHTQ+1.)+QZ0)*0.5
515 THZ0=(WGHTT*THLOW+THS)/(WGHTT+1.)
516 QZ0=(WGHTQ*QLOW+QS)/(WGHTQ+1.)
520 !----------------------------------------------------------------------
522 !----------------------------------------------------------------------
532 !----------------------------------------------------------------------
534 !----------------------------------------------------------------------
536 THM=(THELOW+THZ0)*0.5
539 B=(ELOCP/TEM-1.-P608)*THM
541 DTHV=((THELOW-THZ0)*((QLOW+QZ0+CWMLOW)*(0.5*P608)+1.) &
542 & +(QLOW-QZ0+CWMLOW)*A+CWMLOW*B)
544 DU2=MAX((ULOW-UZ0)**2+(VLOW-VZ0)**2,EPSU2)
545 RIB=BTGX*DTHV*ZSL/DU2
546 !----------------------------------------------------------------------
548 !----------------------------------------------------------------------
549 ! AKMS=MAX( VISC*RDZ,CXCHS)
550 ! AKHS=MAX(TVISC*RDZ,CXCHS)
551 !----------------------------------------------------------------------
552 ! ELSE ! turbulent branch
553 !----------------------------------------------------------------------
563 !----------------------------------------------------------------------
564 !*** 1./MONIN-OBUKHOV LENGTH
565 !----------------------------------------------------------------------
567 RLMO=ELFC*AKHS*DTHV/USTAR**3
574 ZETALU=MIN(MAX(ZETALU,ZTMIN1),ZTMAX1)
575 ZETALT=MIN(MAX(ZETALT,ZTMIN1),ZTMAX1)
576 ZETAU=MIN(MAX(ZETAU,ZTMIN1/RZSU),ZTMAX1/RZSU)
577 ZETAT=MIN(MAX(ZETAT,ZTMIN1/RZST),ZTMAX1/RZST)
579 !----------------------------------------------------------------------
581 !----------------------------------------------------------------------
583 RZ=(ZETAU-ZTMIN1)/DZETA1
588 PSMZ=(PSIM1(K+2)-PSIM1(K+1))*RDZT+PSIM1(K+1)
590 RZ=(ZETALU-ZTMIN1)/DZETA1
595 PSMZL=(PSIM1(K+2)-PSIM1(K+1))*RDZT+PSIM1(K+1)
597 SIMM=PSMZL-PSMZ+RLOGU
599 RZ=(ZETAT-ZTMIN1)/DZETA1
604 PSHZ=(PSIH1(K+2)-PSIH1(K+1))*RDZT+PSIH1(K+1)
606 RZ=(ZETALT-ZTMIN1)/DZETA1
611 PSHZL=(PSIH1(K+2)-PSIH1(K+1))*RDZT+PSIH1(K+1)
613 SIMH=(PSHZL-PSHZ+RLOGT)*FH01
615 !----------------------------------------------------------------------
617 !!!!!!!!!!!!!!!!!!!!!
618 AKMS=MAX(USTARK/SIMM,CXCHS)
619 AKHS=MAX(USTARK/SIMH,CXCHS)
621 !----------------------------------------------------------------------
622 !*** BELJAARS CORRECTION FOR USTAR
623 !----------------------------------------------------------------------
626 WSTAR2=WWST2*ABS(BTGH*AKHS*DTHV)**(2./3.) !zj
630 USTAR=MAX(SQRT(AKMS*SQRT(DU2+WSTAR2)),EPSUST)
632 !----------------------------------------------------------------------
633 ! ENDIF ! End of turbulent branch
634 !----------------------------------------------------------------------
636 ENDDO ! End of the iteration loop over sea points
638 !----------------------------------------------------------------------
642 !----------------------------------------------------------------------
646 !----------------------------------------------------------------------
660 !----------------------------------------------------------------------
662 THM=(THELOW+THZ0)*0.5
665 B=(ELOCP/TEM-1.-P608)*THM
667 DTHV=((THELOW-THZ0)*((QLOW+QZ0+CWMLOW)*(0.5*P608)+1.) &
668 & +(QLOW-QZ0+CWMLOW)*A+CWMLOW*B)
670 DU2=MAX((ULOW-UZ0)**2+(VLOW-VZ0)**2,EPSU2)
671 RIB=BTGX*DTHV*ZSL/DU2
672 !----------------------------------------------------------------------
674 ! AKMS=MAX( VISC*RDZ,CXCHL)
675 ! AKHS=MAX(TVISC*RDZ,CXCHL)
676 !----------------------------------------------------------------------
677 ! ELSE ! Turbulent branch
678 !----------------------------------------------------------------------
685 ZSLT=ZSL+ZU ! u,v and t are at the same level
687 !-- BSF on 10/19/2011: Added new IF-ELSE block but commented out until
688 ! final matter is resolved.
689 !BSF IF ( (IZ0TLND==0) .or. (VEGTYP == ISURBAN) ) THEN
690 !BSF ! Just use the original CZIL value.
693 !BSF ! Modify CZIL according to Chen & Zhang, 2009
694 !BSF ! CZIL = 10 ** -0.40 H, ( where H = 10*Zo )
695 !BSF CZIL = 10.0 ** ( -0.40 * ( Z0 / 0.07 ) )
698 ZILFC=-CZIL*VKARMAN*SQVISC
700 !----------------------------------------------------------------------
702 !mp Topo modification of ZILFC term
704 ! TOPOTERM=TOPOFAC*ZSFC**2.
705 ! TOPOTERM=MAX(TOPOTERM,3.0)
707 ! RIB modification to ZILFC term
713 ! ZZIL=ZILFC*TOPOTERM
715 ZZIL=ZILFC*(1.0+(RIB/RIC)*(RIB/RIC)*CZETMAX)
717 ZZIL=ZILFC*(1.0+CZETMAX)
724 !----------------------------------------------------------------------
726 land_point_iteration: DO ITR=1,ITRMX
728 !----------------------------------------------------------------------
729 !*** ZILITINKEVITCH FIX FOR ZT
730 !----------------------------------------------------------------------
732 ! oldform ZT=MAX(EXP(ZZIL*SQRT(USTAR*ZU))*ZU,EPSZT)
733 ZT=MAX(EXP(ZZIL*SQRT(USTAR*Z0BASE))*Z0BASE,EPSZT)
738 !----------------------------------------------------------------------
739 !*** 1./MONIN-OBUKHOV LENGTH-SCALE
740 !----------------------------------------------------------------------
742 RLMO=ELFC*AKHS*DTHV/USTAR**3
748 ZETALU=MIN(MAX(ZETALU,ZTMIN2),ZTMAX2)
749 ZETALT=MIN(MAX(ZETALT,ZTMIN2),ZTMAX2)
750 ZETAU=MIN(MAX(ZETAU,ZTMIN2/RZSU),ZTMAX2/RZSU)
751 ZETAT=MIN(MAX(ZETAT,ZTMIN2/RZST),ZTMAX2/RZST)
753 !----------------------------------------------------------------------
755 !----------------------------------------------------------------------
757 RZ=(ZETAU-ZTMIN2)/DZETA2
762 PSMZ=(PSIM2(K+2)-PSIM2(K+1))*RDZT+PSIM2(K+1)
764 RZ=(ZETALU-ZTMIN2)/DZETA2
769 PSMZL=(PSIM2(K+2)-PSIM2(K+1))*RDZT+PSIM2(K+1)
771 SIMM=PSMZL-PSMZ+RLOGU
773 RZ=(ZETAT-ZTMIN2)/DZETA2
778 PSHZ=(PSIH2(K+2)-PSIH2(K+1))*RDZT+PSIH2(K+1)
780 RZ=(ZETALT-ZTMIN2)/DZETA2
785 PSHZL=(PSIH2(K+2)-PSIH2(K+1))*RDZT+PSIH2(K+1)
787 SIMH=(PSHZL-PSHZ+RLOGT)*FH02
788 !----------------------------------------------------------------------
790 AKMS=MAX(USTARK/SIMM,CXCHL)
791 AKHS=MAX(USTARK/SIMH,CXCHL)
793 !----------------------------------------------------------------------
794 !*** BELJAARS CORRECTION FOR USTAR
795 !----------------------------------------------------------------------
798 WSTAR2=WWST2*ABS(BTGH*AKHS*DTHV)**(2./3.) !zj
803 USTAR=MAX(SQRT(AKMS*SQRT(DU2+WSTAR2)),EPSUST)
805 !----------------------------------------------------------------------
806 ENDDO land_point_iteration
807 !----------------------------------------------------------------------
809 ! ENDIF ! End of turbulant branch over land
811 !----------------------------------------------------------------------
813 ENDIF ! End of land/sea branch
815 !----------------------------------------------------------------------
816 !*** COUNTERGRADIENT FIX
817 !----------------------------------------------------------------------
821 ! FCT=-10.*(BTGX)**(-1./3.)
822 ! CT=FCT*(HV/(PBLH*PBLH))**(2./3.)
827 !----------------------------------------------------------------------
828 !----------------------------------------------------------------------
829 !*** THE FOLLOWING DIAGNOSTIC BLOCK PRODUCES 2-m and 10-m VALUES
830 !*** FOR TEMPERATURE, MOISTURE, AND WINDS. IT IS DONE HERE SINCE
831 !*** THE VARIOUS QUANTITIES NEEDED FOR THE COMPUTATION ARE LOST
832 !*** UPON EXIT FROM THE ROTUINE.
833 !----------------------------------------------------------------------
834 !----------------------------------------------------------------------
836 WSTAR=SQRT(WSTAR2)/WWST
838 UMFLX=AKMS*(ULOW -UZ0 )
839 VMFLX=AKMS*(VLOW -VZ0 )
840 HSFLX=AKHS*(THLOW-THZ0)
841 HLFLX=AKHS*(QLOW -QZ0 )
842 !----------------------------------------------------------------------
844 !----------------------------------------------------------------------
845 ! IF(SEAMASK>0.5)THEN
846 ! AKMS10=MAX( VISC/10.,CXCHS)
847 ! AKHS02=MAX(TVISC/02.,CXCHS)
848 ! AKHS10=MAX(TVISC/10.,CXCHS)
850 ! AKMS10=MAX( VISC/10.,CXCHL)
851 ! AKHS02=MAX(TVISC/02.,CXCHL)
852 ! AKHS10=MAX(TVISC/10.,CXCHL)
854 !----------------------------------------------------------------------
856 !----------------------------------------------------------------------
869 !----------------------------------------------------------------------
871 !----------------------------------------------------------------------
875 !----------------------------------------------------------------------
876 ZTAU10=MIN(MAX(ZTAU10,ZTMIN1),ZTMAX1)
877 ZTAT02=MIN(MAX(ZTAT02,ZTMIN1),ZTMAX1)
878 ZTAT10=MIN(MAX(ZTAT10,ZTMIN1),ZTMAX1)
879 !----------------------------------------------------------------------
880 RZ=(ZTAU10-ZTMIN1)/DZETA1
885 PSM10=(PSIM1(K+2)-PSIM1(K+1))*RDZT+PSIM1(K+1)
887 SIMM10=PSM10-PSMZ+RLNU10
889 RZ=(ZTAT02-ZTMIN1)/DZETA1
894 PSH02=(PSIH1(K+2)-PSIH1(K+1))*RDZT+PSIH1(K+1)
896 SIMH02=(PSH02-PSHZ+RLNT02)*FH01
898 RZ=(ZTAT10-ZTMIN1)/DZETA1
903 PSH10=(PSIH1(K+2)-PSIH1(K+1))*RDZT+PSIH1(K+1)
905 SIMH10=(PSH10-PSHZ+RLNT10)*FH01
907 AKMS10=MAX(USTARK/SIMM10,CXCHS)
908 AKHS02=MAX(USTARK/SIMH02,CXCHS)
909 AKHS10=MAX(USTARK/SIMH10,CXCHS)
911 !----------------------------------------------------------------------
913 !----------------------------------------------------------------------
917 !----------------------------------------------------------------------
918 ZTAU10=MIN(MAX(ZTAU10,ZTMIN2),ZTMAX2)
919 ZTAT02=MIN(MAX(ZTAT02,ZTMIN2),ZTMAX2)
920 ZTAT10=MIN(MAX(ZTAT10,ZTMIN2),ZTMAX2)
921 !----------------------------------------------------------------------
922 RZ=(ZTAU10-ZTMIN2)/DZETA2
927 PSM10=(PSIM2(K+2)-PSIM2(K+1))*RDZT+PSIM2(K+1)
929 SIMM10=PSM10-PSMZ+RLNU10
931 RZ=(ZTAT02-ZTMIN2)/DZETA2
936 PSH02=(PSIH2(K+2)-PSIH2(K+1))*RDZT+PSIH2(K+1)
938 SIMH02=(PSH02-PSHZ+RLNT02)*FH02
940 RZ=(ZTAT10-ZTMIN2)/DZETA2
945 PSH10=(PSIH2(K+2)-PSIH2(K+1))*RDZT+PSIH2(K+1)
947 SIMH10=(PSH10-PSHZ+RLNT10)*FH02
949 AKMS10=MAX(USTARK/SIMM10,CXCHL)
950 AKHS02=MAX(USTARK/SIMH02,CXCHL)
951 AKHS10=MAX(USTARK/SIMH10,CXCHL)
952 !----------------------------------------------------------------------
954 !----------------------------------------------------------------------
956 !----------------------------------------------------------------------
957 U10 =UMFLX/AKMS10+UZ0
958 V10 =VMFLX/AKMS10+VZ0
959 TH02=HSFLX/AKHS02+THZ0
961 !*** BE CERTAIN THAT THE 2-M THETA AND 10-M THETA ARE BRACKETED BY
962 !*** THE VALUES OF THZ0 AND THLOW.
964 IF(THLOW>THZ0.AND.(TH02<THZ0.OR.TH02>THLOW).OR. &
965 THLOW<THZ0.AND.(TH02>THZ0.OR.TH02<THLOW))THEN
966 TH02=THZ0+2.*RDZ*(THLOW-THZ0)
969 TH10=HSFLX/AKHS10+THZ0
971 IF(THLOW>THZ0.AND.(TH10<THZ0.OR.TH10>THLOW).OR. &
972 THLOW<THZ0.AND.(TH10>THZ0.OR.TH10<THLOW))THEN
973 TH10=THZ0+10.*RDZ*(THLOW-THZ0)
976 Q02 =HLFLX/AKHS02+QZ0
977 Q10 =HLFLX/AKHS10+QZ0
979 PSHLTR=PSFC*EXP(TERM1)
981 !----------------------------------------------------------------------
982 !*** COMPUTE "EQUIVALENT" Z0 TO APPROXIMATE LOCAL SHELTER READINGS.
983 !----------------------------------------------------------------------
990 !1st ZUUZ=MIN(0.5*ZU,0.1)
991 !1st ZU=MAX(0.1*ZU,ZUUZ)
992 !tst ZUUZ=amin1(ZU*0.50,0.3)
993 !tst ZU=amax1(ZU*0.3,ZUUZ)
995 ZUUZ=AMIN1(ZU*0.50,0.18)
996 ZU=AMAX1(ZU*0.35,ZUUZ)
1005 ZTAU10=MIN(MAX(ZTAU10,ZTMIN2),ZTMAX2)
1006 ZETAU=MIN(MAX(ZETAU,ZTMIN2/RZSU),ZTMAX2/RZSU)
1008 RZ=(ZTAU10-ZTMIN2)/DZETA2
1013 PSM10=(PSIM2(K+2)-PSIM2(K+1))*RDZT+PSIM2(K+1)
1014 SIMM10=PSM10-PSMZ+RLNU10
1015 EKMS10=MAX(USTARK/SIMM10,CXCHL)
1017 U10E=UMFLX/EKMS10+UZ0
1018 V10E=VMFLX/EKMS10+VZ0
1025 !----------------------------------------------------------------------
1026 !*** SET OTHER WRF DRIVER ARRAYS
1027 !----------------------------------------------------------------------
1029 RLOW=PLOW/(R_D*TLOW)
1034 QFX=-RLOW*HLFLX*WETM
1038 !!! QGH=PQ0/PSHLTR*EXP(A2S*(TSK-A3S)/(TSK-A4S))
1039 QGH=((1.-SEAMASK)*PQ0+SEAMASK*PQ0SEA) &
1040 & /PLOW*EXP(A2S*(TLOW-A3S)/(TLOW-A4S))
1041 QGH=QGH/(1.-QGH) !Convert to mixing ratio
1042 CPM=CP*(1.+0.8*QLOW)
1044 !*** DO NOT COMPUTE QS OVER LAND POINTS HERE SINCE IT IS
1045 !*** A PROGNOSTIC VARIABLE THERE. IT IS OKAY TO USE IT
1046 !*** AS A DIAGNOSTIC OVER WATER SINCE IT WILL CAUSE NO
1047 !*** INTERFERENCE BEFORE BEING RECOMPUTED IN MYJPBL.
1051 & *EXP(A2S*(TSK-A3S)/(TSK-A4S))
1054 !----------------------------------------------------------------------
1056 END SUBROUTINE SFCDIF
1058 !----------------------------------------------------------------------
1059 SUBROUTINE MYJSFCINIT(LOWLYR,USTAR,Z0 &
1060 & ,SEAMASK,XICE,IVGTYP,RESTART &
1061 & ,ALLOWED_TO_READ &
1062 & ,IDS,IDE,JDS,JDE,KDS,KDE &
1063 & ,IMS,IME,JMS,JME,KMS,KME &
1064 & ,ITS,ITE,JTS,JTE,KTS,KTE)
1065 !----------------------------------------------------------------------
1067 !----------------------------------------------------------------------
1068 LOGICAL,INTENT(IN) :: RESTART,ALLOWED_TO_READ
1070 INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE &
1071 & ,IMS,IME,JMS,JME,KMS,KME &
1072 & ,ITS,ITE,JTS,JTE,KTS,KTE
1074 INTEGER,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: IVGTYP
1076 INTEGER,DIMENSION(IMS:IME,JMS:JME),INTENT(INOUT) :: LOWLYR
1078 REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: SEAMASK,XICE
1080 REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(INOUT) :: USTAR,Z0
1082 REAL,DIMENSION(0:30) :: VZ0TBL
1083 REAL,DIMENSION(0:30) :: VZ0TBL_24
1085 INTEGER :: I,IDUM,IRECV,J,JDUM,K,ITF,JTF,KTF,MAXGBL_IVGTYP &
1086 &, MAXLOC_IVGTYP,MPI_COMM_COMP
1088 ! INTEGER :: MPI_INTEGER,MPI_MAX
1090 REAL :: SM,X,ZETA1,ZETA2,ZRNG1,ZRNG2
1092 REAL :: PIHF=3.1415926/2.,EPS=1.E-6
1093 !----------------------------------------------------------------------
1096 & 2.653,0.826,0.563,1.089,0.854,0.856,0.035,0.238,0.065,0.076 &
1097 & ,0.011,0.035,0.011,0.000,0.000,0.000,0.000,0.000,0.000,0.000 &
1098 & ,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000/)
1101 & 1.00, 0.07, 0.07, 0.07, 0.07, 0.15, &
1102 & 0.08, 0.03, 0.05, 0.86, 0.80, 0.85, &
1103 & 2.65, 1.09, 0.80, 0.001, 0.04, 0.05, &
1104 & 0.01, 0.04, 0.06, 0.05, 0.03, 0.001, &
1105 & 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 /)
1107 !----------------------------------------------------------------------
1114 !*** FOR NOW, ASSUME SIGMA MODE FOR LOWEST MODEL LAYER
1122 !----------------------------------------------------------------------
1125 IF(.NOT.RESTART)THEN
1126 ! CALL WRF_GET_DM_COMMUNICATOR(MPI_COMM_COMP)
1127 ! MAXLOC_IVGTYP=MAXVAL(IVGTYP)
1128 ! CALL MPI_ALLREDUCE(MAXLOC_IVGTYP,MAXGBL_IVGTYP,1,MPI_INTEGER &
1129 ! &, MPI_MAX,MPI_COMM_COMP,IRECV)
1130 MAXGBL_IVGTYP=MAXVAL(IVGTYP)
1132 CALL WRF_DM_MAXVAL(MAXGBL_IVGTYP,IDUM,JDUM)
1135 IF (MAXGBL_IVGTYP<13) THEN
1139 IF(SM+XICE(I,J)<0.5)THEN
1140 Z0(I,J)=VZ0TBL(IVGTYP(I,J))
1150 IF(SM+XICE(I,J)<0.5)THEN
1151 Z0(I,J)=VZ0TBL_24(IVGTYP(I,J))
1156 ENDIF ! Vegtype check
1158 ENDIF ! Restart check
1161 !----------------------------------------------------------------------
1162 IF(.NOT.RESTART)THEN
1169 !----------------------------------------------------------------------
1171 !*** COMPUTE SURFACE LAYER INTEGRAL FUNCTIONS
1173 !----------------------------------------------------------------------
1189 DZETA1=ZRNG1/(KZTM-1)
1190 DZETA2=ZRNG2/(KZTM-1)
1192 !----------------------------------------------------------------------
1193 !*** FUNCTION DEFINITION LOOP
1194 !----------------------------------------------------------------------
1201 !----------------------------------------------------------------------
1203 !----------------------------------------------------------------------
1207 !----------------------------------------------------------------------
1208 !*** PAULSON 1970 FUNCTIONS
1209 !----------------------------------------------------------------------
1210 X=SQRT(SQRT(1.-16.*ZETA1))
1212 PSIM1(K)=-2.*LOG((X+1.)/2.)-LOG((X*X+1.)/2.)+2.*ATAN(X)-PIHF
1213 PSIH1(K)=-2.*LOG((X*X+1.)/2.)
1215 !----------------------------------------------------------------------
1217 !----------------------------------------------------------------------
1221 !----------------------------------------------------------------------
1222 !*** PAULSON 1970 FUNCTIONS
1223 !----------------------------------------------------------------------
1227 !----------------------------------------------------------------------
1228 !*** HOLTSLAG AND DE BRUIN 1988
1229 !----------------------------------------------------------------------
1231 PSIM1(K)=0.7*ZETA1+0.75*ZETA1*(6.-0.35*ZETA1)*EXP(-0.35*ZETA1)
1232 PSIH1(K)=0.7*ZETA1+0.75*ZETA1*(6.-0.35*ZETA1)*EXP(-0.35*ZETA1)
1233 !----------------------------------------------------------------------
1237 !----------------------------------------------------------------------
1239 !----------------------------------------------------------------------
1243 !----------------------------------------------------------------------
1244 !*** PAULSON 1970 FUNCTIONS
1245 !----------------------------------------------------------------------
1247 X=SQRT(SQRT(1.-16.*ZETA2))
1249 PSIM2(K)=-2.*LOG((X+1.)/2.)-LOG((X*X+1.)/2.)+2.*ATAN(X)-PIHF
1250 PSIH2(K)=-2.*LOG((X*X+1.)/2.)
1251 !----------------------------------------------------------------------
1253 !----------------------------------------------------------------------
1257 !----------------------------------------------------------------------
1258 !*** PAULSON 1970 FUNCTIONS
1259 !----------------------------------------------------------------------
1264 !----------------------------------------------------------------------
1265 !*** HOLTSLAG AND DE BRUIN 1988
1266 !----------------------------------------------------------------------
1268 PSIM2(K)=0.7*ZETA2+0.75*ZETA2*(6.-0.35*ZETA2)*EXP(-0.35*ZETA2)
1269 PSIH2(K)=0.7*ZETA2+0.75*ZETA2*(6.-0.35*ZETA2)*EXP(-0.35*ZETA2)
1270 !----------------------------------------------------------------------
1274 !----------------------------------------------------------------------
1282 !----------------------------------------------------------------------
1284 !----------------------------------------------------------------------
1287 !----------------------------------------------------------------------
1289 END SUBROUTINE MYJSFCINIT
1291 !----------------------------------------------------------------------
1293 END MODULE MODULE_SF_MYJSFC
1295 !----------------------------------------------------------------------