1 !WRF:MODEL_LAYER:PHYSICS
7 !-------------------------------------------------------------------
8 SUBROUTINE MRF(U3D,V3D,TH3D,T3D,QV3D,QC3D,P3D,PI3D, &
9 RUBLTEN,RVBLTEN,RTHBLTEN, &
14 ZNT,UST,ZOL,HOL,PBL,PSIM,PSIH, &
15 XLAND,HFX,QFX,TSK,GZ1OZ0,WSPD,BR, &
17 SVP1,SVP2,SVP3,SVPT0,EP1,EP2,KARMAN,EOMEG,STBOLT,&
19 ids,ide, jds,jde, kds,kde, &
20 ims,ime, jms,jme, kms,kme, &
21 its,ite, jts,jte, kts,kte, &
25 !-------------------------------------------------------------------
27 !-------------------------------------------------------------------
28 !-- U3D 3D u-velocity interpolated to theta points (m/s)
29 !-- V3D 3D v-velocity interpolated to theta points (m/s)
30 !-- TH3D 3D potential temperature (K)
31 !-- T3D temperature (K)
32 !-- QV3D 3D water vapor mixing ratio (Kg/Kg)
33 !-- QC3D 3D cloud mixing ratio (Kg/Kg)
34 !-- QI3D 3D ice mixing ratio (Kg/Kg)
35 !-- P3D 3D pressure (Pa)
36 !-- PI3D 3D exner function (dimensionless)
37 !-- rr3D 3D dry air density (kg/m^3)
38 !-- RUBLTEN U tendency due to
39 ! PBL parameterization (m/s^2)
40 !-- RVBLTEN V tendency due to
41 ! PBL parameterization (m/s^2)
42 !-- RTHBLTEN Theta tendency due to
43 ! PBL parameterization (K/s)
44 !-- RQVBLTEN Qv tendency due to
45 ! PBL parameterization (kg/kg/s)
46 !-- RQCBLTEN Qc tendency due to
47 ! PBL parameterization (kg/kg/s)
48 !-- RQIBLTEN Qi tendency due to
49 ! PBL parameterization (kg/kg/s)
50 !-- CP heat capacity at constant pressure for dry air (J/kg/K)
51 !-- G acceleration due to gravity (m/s^2)
53 !-- R gas constant for dry air (J/kg/K)
55 !-- dz8w dz between full levels (m)
56 !-- z height above sea level (m)
57 !-- XLV latent heat of vaporization (J/kg)
58 !-- RV gas constant for water vapor (J/kg/K)
59 !-- PSFC pressure at the surface (Pa)
60 !-- ZNT roughness length (m)
61 !-- UST u* in similarity theory (m/s)
62 !-- ZOL z/L height over Monin-Obukhov length
63 !-- HOL PBL height over Monin-Obukhov length
64 !-- PBL PBL height (m)
65 !-- REGIME flag indicating PBL regime (stable, unstable, etc.)
66 !-- PSIM similarity stability function for momentum
67 !-- PSIH similarity stability function for heat
68 !-- XLAND land mask (1 for land, 2 for water)
69 !-- HFX upward heat flux at the surface (W/m^2)
70 !-- QFX upward moisture flux at the surface (kg/m^2/s)
71 !-- TSK surface temperature (K)
72 !-- GZ1OZ0 log(z/z0) where z0 is roughness length
73 !-- WSPD wind speed at lowest model level (m/s)
74 !-- BR bulk Richardson number in surface layer
76 !-- DTMIN time step (minute)
77 !-- rvovrd R_v divided by R_d (dimensionless)
78 !-- SVP1 constant for saturation vapor pressure (kPa)
79 !-- SVP2 constant for saturation vapor pressure (dimensionless)
80 !-- SVP3 constant for saturation vapor pressure (K)
81 !-- SVPT0 constant for saturation vapor pressure (K)
82 !-- EP1 constant for virtual temperature (R_v/R_d - 1) (dimensionless)
83 !-- EP2 constant for specific humidity calculation
84 !-- KARMAN Von Karman constant
85 !-- EOMEG angular velocity of earth's rotation (rad/s)
86 !-- STBOLT Stefan-Boltzmann constant (W/m^2/K^4)
87 !-- ids start index for i in domain
88 !-- ide end index for i in domain
89 !-- jds start index for j in domain
90 !-- jde end index for j in domain
91 !-- kds start index for k in domain
92 !-- kde end index for k in domain
93 !-- ims start index for i in memory
94 !-- ime end index for i in memory
95 !-- jms start index for j in memory
96 !-- jme end index for j in memory
97 !-- kms start index for k in memory
98 !-- kme end index for k in memory
99 !-- its start index for i in tile
100 !-- ite end index for i in tile
101 !-- jts start index for j in tile
102 !-- jte end index for j in tile
103 !-- kts start index for k in tile
104 !-- kte end index for k in tile
105 !-------------------------------------------------------------------
107 INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde, &
108 ims,ime, jms,jme, kms,kme, &
109 its,ite, jts,jte, kts,kte
112 REAL, INTENT(IN ) :: P1000mb
113 REAL, INTENT(IN ) :: DT,DTMIN,CP,G,ROVCP, &
116 REAL, INTENT(IN ) :: SVP1,SVP2,SVP3,SVPT0
117 REAL, INTENT(IN ) :: EP1,EP2,KARMAN,EOMEG,STBOLT
119 REAL, DIMENSION( ims:ime, kms:kme, jms:jme ) , &
120 INTENT(IN ) :: QV3D, &
129 REAL, DIMENSION( ims:ime, kms:kme, jms:jme ) , &
130 INTENT(INOUT) :: RUBLTEN, &
136 REAL, DIMENSION( ims:ime, jms:jme ) , &
137 INTENT(IN ) :: XLAND, &
141 REAL, DIMENSION( ims:ime, jms:jme ) , &
142 INTENT(INOUT) :: HOL, &
147 LOGICAL, INTENT(IN) :: FLAG_QI
149 !m The following 5 variables are changed to memory size from tile size--
151 REAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN ) :: &
155 REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: &
158 REAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN ) :: &
162 REAL, DIMENSION( ims:ime, jms:jme ) , &
165 REAL, DIMENSION( ims:ime, jms:jme ) , &
168 REAL, DIMENSION( ims:ime, jms:jme ) , &
171 INTEGER, DIMENSION( ims:ime, jms:jme ) , &
172 INTENT(OUT ) :: KPBL2D
174 REAL, DIMENSION( ims:ime, kms:kme, jms:jme ) , &
175 INTENT(IN ) :: U3D, &
180 REAL, DIMENSION( ims:ime, jms:jme ) , &
182 INTENT(INOUT) :: REGIME
184 REAL, DIMENSION( ims:ime, kms:kme, jms:jme ) , &
185 INTENT(INOUT) :: RQIBLTEN
187 REAL, DIMENSION( ims:ime, kms:kme, jms:jme ) , &
192 REAL, DIMENSION( its:ite, kts:kte ) :: dz8w2d, &
203 dz8w2d(I,K) = dz8w(i,NK,j)
209 CALL MRF2D(J,U3D(ims,kms,j),V3D(ims,kms,j),T3D(ims,kms,j), &
210 QV3D(ims,kms,j),QC3D(ims,kms,j), &
211 P3D(ims,kms,j),RUBLTEN(ims,kms,j),RVBLTEN(ims,kms,j),&
212 RTHBLTEN(ims,kms,j),RQVBLTEN(ims,kms,j), &
213 RQCBLTEN(ims,kms,j), &
217 PSFC(ims,j),ZNT(ims,j), &
218 UST(ims,j),ZOL(ims,j), &
219 HOL(ims,j),PBL(ims,j),PSIM(ims,j), &
220 PSIH(ims,j),XLAND(ims,j),HFX(ims,j),QFX(ims,j), &
221 TSK(ims,j),GZ1OZ0(ims,j),WSPD(ims,j),BR(ims,j), &
222 DT,DTMIN,KPBL2D(ims,j), &
223 SVP1,SVP2,SVP3,SVPT0,EP1,EP2,KARMAN,EOMEG,STBOLT, &
225 ids,ide, jds,jde, kds,kde, &
226 ims,ime, jms,jme, kms,kme, &
227 its,ite, jts,jte, kts,kte, &
229 QI2DTEN=RQIBLTEN(ims,kms,j), &
230 REGIME=REGIME(ims,j),QI2D=QI3D(ims,kms,j) )
235 RTHBLTEN(I,K,J)=RTHBLTEN(I,K,J)/PI3D(I,K,J)
243 !-------------------------------------------------------------------
244 SUBROUTINE MRF2D(J,U2D,V2D,T2D,QV2D,QC2D, P2D, &
245 U2DTEN,V2DTEN,T2DTEN, &
249 dz8w2d,z2d,XLV,RV,PSFCPA, &
250 ZNT,UST,ZOL,HOL,PBL,PSIM,PSIH, &
251 XLAND,HFX,QFX,TSK,GZ1OZ0,WSPD,BR, &
253 SVP1,SVP2,SVP3,SVPT0,EP1,EP2,KARMAN,EOMEG,STBOLT,&
255 ids,ide, jds,jde, kds,kde, &
256 ims,ime, jms,jme, kms,kme, &
257 its,ite, jts,jte, kts,kte, &
259 regime, qi2d, QI2DTEN )
260 !-------------------------------------------------------------------
262 !-------------------------------------------------------------------
263 ! BASED ON THE "COUNTERGRADIENT" TRANSPORT TERM OF TROEN
264 ! AND MAHRT (1986) FOR THE UNSTABLE PBL.
265 ! THIS ROUTINE USES AN IMPLICIT APPROACH FOR VERTICAL FLUX
266 ! DIVERGENCE AND DOES NOT REQUIRE "MITER" TIMESTEPS.
267 ! IT INCLUDES VERTICAL DIFFUSION IN THE STABLE ATMOSPHERE
268 ! AND MOIST VERTICAL DIFFUSION IN CLOUDS.
269 ! SURFACE FLUXES CALCULATED AS IN HIRPBL.
270 ! 5-LAYER SOIL MODEL OPTION REQUIRED IN SLAB DUE TO LONG TIMESTEP
272 ! CODED BY SONG-YOU HONG (NCEP), IMPLEMENTED BY JIMY DUDHIA (NCAR)
277 ! HONG AND PAN (1996), MON. WEA. REV.
278 ! TROEN AND MAHRT (1986), BOUNDARY LAYER MET.
281 ! INCREASE RLAM FROM 30 TO 150, AND CHANGE FREE ATMOSPHERE
282 ! STABILITY FUNCTION TO INCREASE VERTICAL DIFFUSION
285 ! PUT LOWER LIMIT ON PSI FOR STABLE CONDITIONS. THIS WILL
286 ! PREVENT FLUXES FROM BECOMING TOO SMALL (DUDHIA, OCTOBER 1997)
288 ! CORRECTION TO REGIME CALCULATION. THIS WILL ALLOW POINTS IN
289 ! REGIME 4 MUCH MORE FREQUENTLY GIVING LARGER SURFACE FLUXES
290 ! REGIME 3 NO LONGER USES HOL < 1.5 OR THVX LAPSE-RATE CHECK
291 ! IN MRF SCHEME. THIS WILL MAKE REGIME 3 MUCH LESS FREQUENT.
293 ! ADD SURFACE PRESSURE, PS(I), ARRAY FOR EFFICIENCY
295 ! FIX FOR PROBLEM WITH THIN LAYERS AND HIGH ROUGHNESS
297 ! CHARNOCK CONSTANT NOW COMES FROM NAMELIST (DEFAULT SAME)
299 !-------------------------------------------------------------------
301 REAL RLAM,PRMIN,PRMAX,XKZMIN,XKZMAX,RIMIN,BRCR, &
302 CFAC,PFAC,SFCFRAC,CKZ,ZFMIN,APHI5,APHI16,GAMCRT, &
305 PARAMETER (RLAM=150.,PRMIN=0.5,PRMAX=4.)
306 PARAMETER (XKZMIN=0.01,XKZMAX=1000.,RIMIN=-100.)
307 PARAMETER (BRCR=0.5,CFAC=7.8,PFAC=2.0,SFCFRAC=0.1)
308 PARAMETER (CKZ=0.001,ZFMIN=1.E-8,APHI5=5.,APHI16=16.)
309 PARAMETER (GAMCRT=3.,GAMCRQ=2.E-3)
310 PARAMETER (XKA=2.4E-5)
313 INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde, &
314 ims,ime, jms,jme, kms,kme, &
315 its,ite, jts,jte, kts,kte, &
318 LOGICAL, INTENT(IN) :: FLAG_QI
320 REAL, INTENT(IN ) :: P1000mb
321 REAL, INTENT(IN ) :: DT,DTMIN,CP,G,ROVCP, &
324 REAL, INTENT(IN ) :: SVP1,SVP2,SVP3,SVPT0
325 REAL, INTENT(IN ) :: EP1,EP2,KARMAN,EOMEG,STBOLT
327 REAL, DIMENSION( ims:ime, kms:kme ) , &
328 INTENT(IN ) :: QV2D, &
333 REAL, DIMENSION( ims:ime, kms:kme ) , &
334 INTENT(INOUT) :: U2DTEN, &
340 REAL, DIMENSION( ims:ime ) , &
341 INTENT(INOUT) :: HOL, &
346 REAL, DIMENSION( ims:ime ) , &
347 INTENT(IN ) :: XLAND, &
351 !m The following 5 are changed to memory size---
353 REAL, DIMENSION( ims:ime ), INTENT(IN ) :: PSIM, &
356 REAL, DIMENSION( ims:ime ), INTENT(INOUT) :: WSPD
358 REAL, DIMENSION( ims:ime ), INTENT(IN ) :: GZ1OZ0, &
361 REAL, DIMENSION( ims:ime ) , &
362 INTENT(IN ) :: PSFCPA
364 REAL, DIMENSION( ims:ime ) , &
367 REAL, DIMENSION( ims:ime ) , &
370 INTEGER, DIMENSION( ims:ime ) , &
371 INTENT(OUT ) :: KPBL1D
373 REAL, DIMENSION( ims:ime, kms:kme ) , &
374 INTENT(IN ) :: U2D, &
377 ! MODULE-LOCAL VARIABLES (DEFINED IN SUBROUTINE MRF)
379 REAL, DIMENSION( its:ite, kts:kte ) , &
380 INTENT(IN) :: dz8w2d, &
386 REAL, DIMENSION( ims:ime ) , &
388 INTENT(INOUT) :: REGIME
390 REAL, DIMENSION( ims:ime, kms:kme ) , &
394 REAL, DIMENSION( ims:ime, kms:kme ) , &
396 INTENT(INOUT) :: QI2DTEN
400 REAL, DIMENSION( its:ite, kts:kte+1 ) :: ZQ
402 REAL, DIMENSION( its:ite, kts:kte ) :: &
414 REAL, DIMENSION( its:ite ) :: QIXSV,RHOX, &
421 INTEGER :: ILXM,JLXM,KL, &
424 INTEGER, DIMENSION( its:ite ) :: KPBL,KPBL0
426 REAL, DIMENSION( its:ite, kts:kte ) :: SCR3,SCR4
428 REAL, DIMENSION( its:ite ) :: DUM1, &
431 REAL, DIMENSION( its:ite ) :: ZL1,THERMAL, &
440 REAL, DIMENSION( its:ite, kts:kte ) :: XKZM,XKZH, &
445 REAL, DIMENSION( its:ite, kts:kte ) :: AL
447 LOGICAL, DIMENSION( its:ite ) :: PBLFLG, &
451 REAL, DIMENSION( its:ite ) :: THGB
453 INTEGER :: N,I,K,KK,L,NZOL,IMVDIF
455 INTEGER :: JBGN,JEND,IBGN,IEND,NK
457 REAL :: ZOLN,X,Y,CONT,CONQ,CONW,PL,THCON,TVCON,E1,DTSTEP
458 REAL :: ZL,TSKV,DTHVDZ,DTHVM,VCONV,RZOL
459 REAL :: DTTHX,PSIX,DTG,PSIQ,USTM
460 REAL :: DT4,RDT,SPDK2,FM,FH,HOL1,GAMFAC,VPERT,PRNUM
461 REAL :: ZFAC,XKZO,SS,RI,QMEAN,TMEAN,ALPH,CHI,ZK,RL2,DK,SRI
462 REAL :: BRINT,DTODSD,DSIG,RDZ,DSDZT,DSDZQ,DSDZ2,TTEND,QTEND
463 REAL :: UTEND,VTEND,QCTEND,QITEND,TGC,DTODSU
465 !----------------------------------------------------------------------
478 !-- IMVDIF imvdif=1 for moist adiabat vertical diffusion
484 ! PSFC(I)=PSFCPA(I)/1000.
489 !----CONVERT GROUND TEMPERATURE TO POTENTIAL TEMPERATURE:
494 PS(I)=PSFCPA(I)/1000.
495 ! THGB(I)=TSK(I)*(100./PS(I))**ROVCP
496 THGB(I)=TSK(I)*(P1000mb/PSFCPA(I))**ROVCP
499 !-----DECOUPLE FLUX-FORM VARIABLES TO GIVE U,V,T,THETA,THETA-VIR.,
500 ! T-VIR., QV, AND QC AT CROSS POINTS AND AT KTAU-1.
503 ! THE BOUNDARY WINDS MAY NOT BE ADEQUATELY AFFECTED BY FRICTION,
504 ! SO USE ONLY INTERIOR VALUES OF UX AND VX TO CALCULATE
514 !.....SCR3(I,K) STORE TEMPERATURE,
515 ! SCR4(I,K) STORE VIRTUAL TEMPERATURE.
523 ! THCON=(100./PL)**ROVCP
524 THCON=(P1000mb/(PL*1000.))**ROVCP
525 THX(I,K)=SCR3(I,K)*THCON
537 ! IF(IDRY.EQ.1)GOTO 80
542 TVCON=(1.+EP1*QX(I,K))
543 THVX(I,K)=THX(I,K)*TVCON
544 SCR4(I,K)=SCR3(I,K)*TVCON
548 E1=SVP1*EXP(SVP2*(TGDSA(I)-SVPT0)/(TGDSA(I)-SVP3))
549 QGH(I)=EP2*E1/(PS(I)-E1)
550 CPM(I)=CP*(1.+0.8*QX(I,KL))
553 ! IF(IMOIST.EQ.1)GOTO 80
560 IF (flag_QI .AND. PRESENT( QI2D ) ) THEN
579 !-----COMPUTE THE HEIGHT OF FULL- AND HALF-SIGMA LEVELS ABOVE GROUND
580 ! LEVEL, AND THE LAYER THICKNESSES.
584 RHOX(I)=PS(I)*1000./(R*SCR4(I,KL))
594 ZQ(I,K)=dz8w2d(I,K)+DUM1(I)
599 ZA(I,K)=0.5*(ZQ(I,K)+ZQ(I,K+1))
600 DZQ(I,K)=ZQ(I,K)-ZQ(I,K+1)
605 DZA(I,K)=ZA(I,K)-ZA(I,K+1)
611 GOVRTH(I)=G/THX(I,KL)
614 !-----INITIALIZE VERTICAL TENDENCIES AND
624 ! IF(IDRY.EQ.1)GOTO 250
630 ! IF(IMOIST.EQ.1)GOTO 250
639 !-----CALCULATE BULK RICHARDSON NO. OF SURFACE LAYER, ACCORDING TO
643 ! GZ1OZ0(I)=ALOG(ZA(I,KL)/ZNT(I))
644 ! IF((XLAND(I)-1.5).GE.0)THEN
649 ! WSPD(I)=SQRT(UX(I,KL)*UX(I,KL)+VX(I,KL)*VX(I,KL))
650 ! TSKV=THGB(I)*(1.+EP1*QGH(I)*MAVAIL(I))
651 ! DTHVDZ=(THVX(I,KL)-TSKV)
652 ! IF(-DTHVDZ.GE.0)THEN
657 ! VCONV=VCONVC*SQRT(DTHVM)
658 ! WSPD(I)=SQRT(WSPD(I)*WSPD(I)+VCONV*VCONV)
659 ! WSPD(I)=AMAX1(WSPD(I),1.)
660 ! BR(I)=GOVRTH(I)*ZA(I,KL)*DTHVDZ/(WSPD(I)*WSPD(I))
663 !!-----DIAGNOSE BASIC PARAMETERS FOR THE APPROPRIATED STABILITY CLASS:
665 !! THE STABILITY CLASSES ARE DETERMINED BY BR (BULK RICHARDSON NO.)
666 !! AND HOL (HEIGHT OF PBL/MONIN-OBUKHOV LENGTH).
668 !! CRITERIA FOR THE CLASSES ARE AS FOLLOWS:
671 !! REPRESENTS NIGHTTIME STABLE CONDITIONS (REGIME=1),
673 !! 2. BR .LT. 0.2 .AND. BR .GT. 0.0;
674 !! REPRESENTS DAMPED MECHANICAL TURBULENT CONDITIONS
678 !! REPRESENTS FORCED CONVECTION CONDITIONS (REGIME=3),
681 !! REPRESENTS FREE CONVECTION CONDITIONS (REGIME=4).
687 !!-- REMOVE REGIME 3 DEPENDENCE ON PBL HEIGHT
688 !!-- IF(BR(I).LT.0..AND.HOL(I).GT.1.5)GOTO 310
690 ! IF(BR(I).LT.0.)GOTO 310
692 !!-----CLASS 1; STABLE (NIGHTTIME) CONDITIONS:
694 ! IF(BR(I).LT.0.2)GOTO 270
696 ! PSIM(I)=-10.*GZ1OZ0(I)
697 !! LOWER LIMIT ON PSI IN STABLE CONDITIONS
698 ! PSIM(I)=AMAX1(PSIM(I),-10.)
704 !!-----CLASS 2; DAMPED MECHANICAL TURBULENCE:
706 ! 270 IF(BR(I).EQ.0.0)GOTO 280
708 ! PSIM(I)=-5.0*BR(I)*GZ1OZ0(I)/(1.1-5.0*BR(I))
709 !! LOWER LIMIT ON PSI IN STABLE CONDITIONS
710 ! PSIM(I)=AMAX1(PSIM(I),-10.)
711 !!.....AKB(1976), EQ(16).
717 !!-----CLASS 3; FORCED CONVECTION:
723 !! special use kte instead of kme
725 ! DO 290 KK=kts,kte-1
727 ! IF(THVX(I,K).GT.THVX(I,KL))GOTO 300
730 ! 300 PBL(I)=ZQ(I,K+1)
731 ! IF(UST(I).LT.0.01)THEN
732 ! ZOL(I)=BR(I)*GZ1OZ0(I)
734 ! ZOL(I)=KARMAN*GOVRTH(I)*ZA(I,KL)*MOL(I,J)/(UST(I)*UST(I))
736 ! HOL(I)=-ZOL(I)*PBL(I)/ZA(I,KL)
739 !!-----CLASS 4; FREE CONVECTION:
741 !! 310 IF(THVX(I,KLM).GT.THVX(I,KL))GOTO 280
745 ! IF(UST(I).LT.0.01)THEN
746 ! ZOL(I)=BR(I)*GZ1OZ0(I)
748 ! ZOL(I)=KARMAN*GOVRTH(I)*ZA(I,KL)*MOL(I,J)/(UST(I)*UST(I))
750 ! ZOL(I)=AMIN1(ZOL(I),0.)
751 ! ZOL(I)=AMAX1(ZOL(I),-9.9999)
752 ! NZOL=INT(-ZOL(I)*100.)
753 ! RZOL=-ZOL(I)*100.-NZOL
754 ! PSIM(I)=PSIMTB(NZOL)+RZOL*(PSIMTB(NZOL+1)-PSIMTB(NZOL))
755 ! PSIH(I)=PSIHTB(NZOL)+RZOL*(PSIHTB(NZOL+1)-PSIHTB(NZOL))
756 !!---LIMIT PSIH AND PSIM IN THE CASE OF THIN LAYERS AND HIGH ROUGHNESS
757 !!--- THIS PREVENTS DENOMINATOR IN FLUXES FROM GETTING TOO SMALL
758 ! PSIH(I)=AMIN1(PSIH(I),0.9*GZ1OZ0(I))
759 ! PSIM(I)=AMIN1(PSIM(I),0.9*GZ1OZ0(I))
762 !-----COMPUTE THE FRICTIONAL VELOCITY:
763 ! ZA(1982) EQS(2.60),(2.61).
766 DTG=THX(I,KL)-THGB(I)
767 PSIX=GZ1OZ0(I)-PSIM(I)
768 IF((XLAND(I)-1.5).GE.0)THEN
773 PSIQ=ALOG(KARMAN*UST(I)*ZA(I,KL)/XKA+ZA(I,KL)/ZL)-PSIH(I)
774 UST(I)=KARMAN*WSPD(I)/PSIX
776 USTM=AMAX1(UST(I),0.1)
777 IF((XLAND(I)-1.5).GE.0)THEN
782 ! MOL(I,J)=KARMAN*DTG/(GZ1OZ0(I)-PSIH(I))/PRT
786 WSPD1(I)=SQRT(UX(I,KL)*UX(I,KL)+VX(I,KL)*VX(I,KL))+1.E-9
789 !---- COMPUTE VERTICAL DIFFUSION
791 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
792 ! COMPUTE PRELIMINARY VARIABLES
808 IF(BR(I).GT.0.0)SFCFLG(I)=.FALSE.
810 THERMAL(I)=THVX(I,KL)
813 ! COMPUTE THE FIRST GUESS OF PBL HEIGHT
821 IF(.NOT.STABLE(I))THEN
823 SPDK2=MAX(UX(I,K)**2+VX(I,K)**2,1.)
824 BRUP(I)=(THVX(I,K)-THERMAL(I))*(G*ZA(I,K)/THVX(I,KL))/SPDK2
826 STABLE(I)=BRUP(I).GT.BRCR
833 IF(BRDN(I).GE.BRCR)THEN
835 ELSEIF(BRUP(I).LE.BRCR)THEN
838 BRINT=(BRCR-BRDN(I))/(BRUP(I)-BRDN(I))
840 PBL(I)=ZA(I,K+1)+BRINT*(ZA(I,K)-ZA(I,K+1))
841 IF(PBL(I).LT.ZQ(I,KPBL(I)+1))KPBL(I)=KPBL(I)+1
847 HOL(I)=MAX(BR(I)*FM*FM/FH,RIMIN)
849 HOL(I)=MIN(HOL(I),-ZFMIN)
851 HOL(I)=MAX(HOL(I),ZFMIN)
854 HOL1=HOL(I)*PBL(I)/ZL1(I)*SFCFRAC
855 HOL(I)=-HOL(I)*PBL(I)/ZL1(I)
857 PHIM(I)=(1.-APHI16*HOL1)**(-1./4.)
858 PHIH(I)=(1.-APHI16*HOL1)**(-1./2.)
860 PHIM(I)=(1.+APHI5*HOL1)
863 WSCALE(I)=UST(I)/PHIM(I)
864 WSCALE(I)=MIN(WSCALE(I),UST(I)*APHI16)
865 WSCALE(I)=MAX(WSCALE(I),UST(I)/APHI5)
868 ! COMPUTE THE SURFACE VARIABLES FOR PBL HEIGHT ESTIMATION
869 ! UNDER UNSTABLE CONDITIONS
873 GAMFAC=CFAC/RHOX(I)/WSCALE(I)
874 HGAMT(I)=MIN(GAMFAC*HFX(I)/CPM(I),GAMCRT)
875 HGAMQ(I)=MIN(GAMFAC*QFX(I),GAMCRQ)
876 IF((XLAND(I)-1.5).GE.0)HGAMQ(I)=0.
877 VPERT=HGAMT(I)+EP1*THX(I,KL)*HGAMQ(I)
878 VPERT=MIN(VPERT,GAMCRT)
879 THERMAL(I)=THERMAL(I)+MAX(VPERT,0.)
880 HGAMT(I)=MAX(HGAMT(I),0.0)
881 HGAMQ(I)=MAX(HGAMQ(I),0.0)
894 ! ENHANCE THE PBL HEIGHT BY CONSIDERING THE THERMAL
904 IF(.NOT.STABLE(I).AND.PBLFLG(I))THEN
906 SPDK2=MAX((UX(I,K)**2+VX(I,K)**2),1.)
907 BRUP(I)=(THVX(I,K)-THERMAL(I))*(G*ZA(I,K)/THVX(I,KL))/SPDK2
909 STABLE(I)=BRUP(I).GT.BRCR
917 IF(BRDN(I).GE.BRCR)THEN
919 ELSEIF(BRUP(I).LE.BRCR)THEN
922 BRINT=(BRCR-BRDN(I))/(BRUP(I)-BRDN(I))
924 PBL(I)=ZA(I,K+1)+BRINT*(ZA(I,K)-ZA(I,K+1))
925 IF(PBL(I).LT.ZQ(I,KPBL(I)+1))KPBL(I)=KPBL(I)+1
926 IF(KPBL(I).LE.1)PBLFLG(I)=.FALSE.
930 ! DIAGNOSTIC PBL HEIGHT WITH BRCR EFFECTIVELY ZERO (PBL0)
940 IF(.NOT.STABLE(I).AND.PBLFLG(I))THEN
942 SPDK2=MAX((UX(I,K)**2+VX(I,K)**2),1.)
943 BRUP(I)=(THVX(I,K)-THERMAL(I))*(G*ZA(I,K)/THVX(I,KL))/SPDK2
945 STABLE(I)=BRUP(I).GT.0.0
954 IF(BRDN(I).GE.0.0)THEN
956 ELSEIF(BRUP(I).LE.0.0)THEN
959 BRINT=(0.0-BRDN(I))/(BRUP(I)-BRDN(I))
961 PBL0(I)=ZA(I,K+1)+BRINT*(ZA(I,K)-ZA(I,K+1))
962 IF(PBL0(I).LT.ZQ(I,KPBL0(I)+1))KPBL0(I)=KPBL0(I)+1
963 IF(KPBL0(I).LE.1)PBLFLG(I)=.FALSE.
968 ! COMPUTE DIFFUSION COEFFICIENTS BELOW PBL
973 PRNUM=(PHIH(I)/PHIM(I)+CFAC*KARMAN*SFCFRAC)
974 PRNUM=MIN(PRNUM,PRMAX)
975 PRNUM=MAX(PRNUM,PRMIN)
976 ZFAC=MAX((1.-(ZQ(I,K)-ZL1(I))/(PBL(I)-ZL1(I))),ZFMIN)
978 XKZM(I,K)=XKZO+WSCALE(I)*KARMAN*ZQ(I,K)*ZFAC**PFAC
979 XKZH(I,K)=XKZM(I,K)/PRNUM
980 XKZM(I,K)=MIN(XKZM(I,K),XKZMAX)
981 XKZM(I,K)=MAX(XKZM(I,K),XKZMIN)
982 XKZH(I,K)=MIN(XKZH(I,K),XKZMAX)
983 XKZH(I,K)=MAX(XKZH(I,K),XKZMIN)
988 ! COMPUTE DIFFUSION COEFFICIENTS OVER PBL (FREE ATMOSPHERE)
994 SS=((UX(I,K-1)-UX(I,K))*(UX(I,K-1)-UX(I,K))+(VX(I,K-1)- &
995 VX(I,K))*(VX(I,K-1)-VX(I,K)))/(DZA(I,K-1)*DZA(I,K-1))+ &
997 RI=GOVRTH(I)*(THVX(I,K-1)-THVX(I,K))/(SS*DZA(I,K-1))
999 IF((QCX(I,K)+QIX(I,K)).GT.0.01E-3.AND.(QCX(I,K-1)+ &
1000 QIX(I,K-1)).GT.0.01E-3)THEN
1002 QMEAN=0.5*(QX(I,K)+QX(I,K-1))
1003 TMEAN=0.5*(SCR3(I,K)+SCR3(I,K-1))
1004 ALPH=XLV*QMEAN/R/TMEAN
1005 CHI=XLV*XLV*QMEAN/CP/RV/TMEAN/TMEAN
1006 RI=(1.+ALPH)*(RI-G*G/SS/TMEAN/CP*((CHI-ALPH)/(1.+CHI)))
1010 RL2=(ZK*RLAM/(RLAM+ZK))**2
1015 XKZM(I,K)=XKZO+DK*(1+8.*(-RI)/(1+1.746*SRI))
1016 XKZH(I,K)=XKZO+DK*(1+8.*(-RI)/(1+1.286*SRI))
1019 XKZH(I,K)=XKZO+DK/(1+5.*RI)**2
1021 PRNUM=MIN(PRNUM,PRMAX)
1022 XKZM(I,K)=(XKZH(I,K)-XKZO)*PRNUM+XKZO
1025 XKZM(I,K)=MIN(XKZM(I,K),XKZMAX)
1026 XKZM(I,K)=MAX(XKZM(I,K),XKZMIN)
1027 XKZH(I,K)=MIN(XKZH(I,K),XKZMAX)
1028 XKZH(I,K)=MAX(XKZH(I,K),XKZMIN)
1034 ! COMPUTE TRIDIAGONAL MATRIX ELEMENTS FOR HEAT AND MOISTURE
1048 A1(I,1)=SCR3(I,KL)+HFX(I)/(RHOX(I)*CPM(I))/ZQ(I,KL)*DT4
1049 A2(I,1)=QX(I,KL)+QFX(I)/(RHOX(I))/ZQ(I,KL)*DT4
1055 DTODSD=DT4/dz8w2d(I,K)
1056 DTODSU=DT4/dz8w2d(I,K-1)
1057 DSIG=z2d(I,K)-z2d(I,K-1)
1060 IF(PBLFLG(I).AND.KPBL(I).LT.K)THEN
1061 DSDZT=DSIG*XKZH(I,K)*RDZ*(G/CP-HGAMT(I)/PBL(I))
1062 DSDZQ=DSIG*XKZH(I,K)*RDZ*(-HGAMQ(I)/PBL(I))
1063 A2(I,KK)=A2(I,KK)+DTODSD*DSDZQ
1064 A2(I,KK+1)=QX(I,K-1)-DTODSU*DSDZQ
1066 DSDZT=DSIG*XKZH(I,K)*RDZ*(G/CP)
1067 A2(I,KK+1)=QX(I,K-1)
1069 DSDZ2=DSIG*XKZH(I,K)*RDZ*RDZ
1070 AU(I,KK)=-DTODSD*DSDZ2
1071 AL(I,KK)=-DTODSU*DSDZ2
1072 AD(I,KK)=AD(I,KK)-AU(I,KK)
1073 AD(I,KK+1)=1.-AL(I,KK)
1074 A1(I,KK)=A1(I,KK)+DTODSD*DSDZT
1075 A1(I,KK+1)=SCR3(I,K-1)-DTODSU*DSDZT
1079 ! SOLVE TRIDIAGONAL PROBLEM FOR HEAT AND MOISTURE
1081 CALL TRIDI2(AL,AD,AU,A1,A2,AU,A1,A2, &
1084 ! RECOVER TENDENCIES OF HEAT AND MOISTURE
1089 TTEND=(A1(I,KK)-SCR3(I,K))*RDT
1090 QTEND=(A2(I,KK)-QX(I,K))*RDT
1091 TTNP(I,K)=TTNP(I,K)+TTEND
1092 QTNP(I,K)=QTNP(I,K)+QTEND
1096 ! COMPUTE TRIDIAGONAL MATRIX ELEMENTS FOR MOMENTUM
1110 A1(I,1)=UX(I,KL)-UX(I,KL)/WSPD1(I)*UST(I)*UST(I)/ZQ(I,KL) &
1111 *DT4*(WSPD1(I)/WSPD(I))**2
1112 A2(I,1)=VX(I,KL)-VX(I,KL)/WSPD1(I)*UST(I)*UST(I)/ZQ(I,KL) &
1113 *DT4*(WSPD1(I)/WSPD(I))**2
1119 DTODSD=DT4/dz8w2d(I,K)
1120 DTODSU=DT4/dz8w2d(I,K-1)
1121 DSIG=z2d(I,K)-z2d(I,K-1)
1124 DSDZ2=DSIG*XKZM(I,K)*RDZ*RDZ
1125 AU(I,KK)=-DTODSD*DSDZ2
1126 AL(I,KK)=-DTODSU*DSDZ2
1127 AD(I,KK)=AD(I,KK)-AU(I,KK)
1128 AD(I,KK+1)=1.-AL(I,KK)
1129 A1(I,KK+1)=UX(I,K-1)
1130 A2(I,KK+1)=VX(I,K-1)
1134 ! SOLVE TRIDIAGONAL PROBLEM FOR MOMENTUM
1136 CALL TRIDI2(AL,AD,AU,A1,A2,AU,A1,A2, &
1139 ! RECOVER TENDENCIES OF MOMENTUM
1144 UTEND=(A1(I,KK)-UX(I,K))*RDT
1145 VTEND=(A2(I,KK)-VX(I,K))*RDT
1146 UTNP(I,K)=UTNP(I,K)+UTEND
1147 VTNP(I,K)=VTNP(I,K)+VTEND
1151 ! COMPUTE TRIDIAGONAL MATRIX ELEMENTS FOR CLOUD
1163 ! IF(IMOIST.EQ.1)GOTO 690
1173 DTODSD=DT4/dz8w2d(I,K)
1174 DTODSU=DT4/dz8w2d(I,K-1)
1175 DSIG=z2d(I,K)-z2d(I,K-1)
1178 A1(I,KK+1)=QCX(I,K-1)
1179 A2(I,KK+1)=QIX(I,K-1)
1180 DSDZ2=DSIG*XKZH(I,K)*RDZ*RDZ
1181 AU(I,KK)=-DTODSD*DSDZ2
1182 AL(I,KK)=-DTODSU*DSDZ2
1183 AD(I,KK)=AD(I,KK)-AU(I,KK)
1184 AD(I,KK+1)=1.-AL(I,KK)
1188 ! SOLVE TRIDIAGONAL PROBLEM FOR CLOUD
1190 CALL TRIDI2(AL,AD,AU,A1,A2,AU,A1,A2, &
1196 QCTEND=(A1(I,KK)-QCX(I,K))*RDT
1197 QITEND=(A2(I,KK)-QIX(I,K))*RDT
1198 QCTNP(I,K)=QCTNP(I,K)+QCTEND
1199 QITNP(I,K)=QITNP(I,K)+QITEND
1203 !---- END OF VERTICAL DIFFUSION
1207 !-----CALCULATION OF NEW VALUES DUE TO VERTICAL EXCHANGE PROCESSES IS
1208 ! COMPLETED. THE FINAL STEP IS TO ADD THE TENDENCIES CALCULATED
1209 ! IN HIRPBL TO THOSE OF MM4.
1214 U2DTEN(I,NK)=UTNP(I,K)
1215 V2DTEN(I,NK)=VTNP(I,K)
1218 ! IF(J.EQ.1.AND.IN.GT.1)GOTO 860
1231 ! IF(J.LT.JBGN.OR.J.GT.JEND)GOTO 860
1242 T2DTEN(I,NK)=TTNP(I,K)
1245 ! IF(IDRY.EQ.1)GOTO 860
1249 QV2DTEN(I,NK)=QTNP(I,K)
1252 ! IF(IMOIST.EQ.1)GOTO 860
1256 QC2DTEN(I,NK)=QCTNP(I,K)
1259 IF(flag_QI .AND. PRESENT( QI2DTEN ) ) THEN
1263 QI2DTEN(I,NK)=QITNP(I,K)
1270 !-----APPLY ASSELIN FILTER TO TGD FOR LARGE TIME STEP:
1273 ! TSK(I)=TSK(I)*(PS(I)/100.)**ROVCP
1278 ! KPBL IS NEEDED FOR THE FDDA, AND SINCE THERE IS NO LONGER JUST ONE
1279 ! LARGE "J LOOP" IT MUST BE STORED AS (I,J)...
1281 ! USE NEW DIAGNOSED PBL DEPTH (CALCULATED WITH brcr=0.0)
1282 ! PBL IS USED FOR OUTPUT AND NEXT-TIME-STEP BELJAARS CALC IN SFCLAY
1288 END SUBROUTINE MRF2D
1290 !================================================================
1291 SUBROUTINE TRIDI2(CL,CM,CU,R1,R2,AU,A1,A2, &
1293 !----------------------------------------------------------------
1295 !----------------------------------------------------------------
1297 INTEGER, INTENT(IN ) :: its,ite, kts,kte
1299 REAL, DIMENSION( its:ite, kts+1:kte+1 ) , &
1302 REAL, DIMENSION( its:ite, kts:kte ) , &
1303 INTENT(IN ) :: CM, &
1306 REAL, DIMENSION( its:ite, kts:kte ) , &
1307 INTENT(INOUT) :: AU, &
1315 !----------------------------------------------------------------
1328 FK=1./(CM(I,K)-CL(I,K)*AU(I,K-1))
1330 A1(I,K)=FK*(R1(I,K)-CL(I,K)*A1(I,K-1))
1331 A2(I,K)=FK*(R2(I,K)-CL(I,K)*A2(I,K-1))
1335 FK=1./(CM(I,N)-CL(I,N)*AU(I,N-1))
1336 A1(I,N)=FK*(R1(I,N)-CL(I,N)*A1(I,N-1))
1337 A2(I,N)=FK*(R2(I,N)-CL(I,N)*A2(I,N-1))
1342 A1(I,K)=A1(I,K)-AU(I,K)*A1(I,K+1)
1343 A2(I,K)=A2(I,K)-AU(I,K)*A2(I,K+1)
1347 END SUBROUTINE TRIDI2
1349 !===================================================================
1350 SUBROUTINE mrfinit(RUBLTEN,RVBLTEN,RTHBLTEN,RQVBLTEN, &
1351 RQCBLTEN,RQIBLTEN,P_QI,P_FIRST_SCALAR, &
1352 restart, allowed_to_read , &
1353 ids, ide, jds, jde, kds, kde, &
1354 ims, ime, jms, jme, kms, kme, &
1355 its, ite, jts, jte, kts, kte )
1356 !-------------------------------------------------------------------
1358 !-------------------------------------------------------------------
1359 LOGICAL , INTENT(IN) :: restart , allowed_to_read
1360 INTEGER , INTENT(IN) :: ids, ide, jds, jde, kds, kde, &
1361 ims, ime, jms, jme, kms, kme, &
1362 its, ite, jts, jte, kts, kte
1363 INTEGER , INTENT(IN) :: P_QI,P_FIRST_SCALAR
1365 REAL , DIMENSION( ims:ime , kms:kme , jms:jme ) , INTENT(OUT) :: &
1372 INTEGER :: i, j, k, itf, jtf, ktf
1378 IF(.not.restart)THEN
1392 IF (P_QI .ge. P_FIRST_SCALAR .and. .not.restart) THEN
1402 END SUBROUTINE mrfinit
1404 !-------------------------------------------------------------------
1406 END MODULE module_bl_mrf