UPP (develop)
Loading...
Searching...
No Matches
CALPBLREGIME.f
Go to the documentation of this file.
1
28!-----------------------------------------------------------------------
32!-----------------------------------------------------------------------
33 SUBROUTINE calpblregime(PBLREGIME)
34
35!
36 use vrbls3d, only: uh, vh, pmid, t, q, pint, zmid, zint
37 use vrbls2d, only: ths, qs, smstav, twbs, qwbs, pblh
38 use masks, only: dx
39 use params_mod, only: p1000, capa, d608, h1, g, rd, cp
40 use ctlblk_mod, only: jsta, jend, spval, lm, jsta_m, jend_m, im, &
41 jsta_2l, jend_2u, ista, iend, ista_m, iend_m,ista_2l,iend_2u
42 use gridspec_mod, only: gridtype
43!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
44 implicit none
45!
46! INCLUDE,DERIVE,SET PARAMETERS.
47!
48 REAL , PARAMETER :: VCONVC=1.
49!
50! DECLARE VARIABLES.
51!
52 REAL,dimension(ista_2l:iend_2u,jsta_2l:jend_2u),intent(inout) :: PBLREGIME
53!
54 integer I,J,IE,IW,ii,jj
55 real APE,THV,THVX,GOVRTH,UMASS,VMASS,WSPD,TSKV,DTHV,RHOX,fluxc,tsfc, &
56 vconv,vsgd,br,thx
57
58!
59!
60!*************************************************************************
61!
62! INITIALIZE ARRAYS.
63!
64!$omp parallel do private(i,j)
65 DO j=jsta,jend
66 DO i=ista,iend
67 pblregime(i,j) = spval
68 ENDDO
69 ENDDO
70!
71! COMPUTE BULK RICHARDSON NUMBER AS CODED IN WRF module_sf_sfclay
72!
73!!$omp parallel do
74!!$omp& private(uhkl,ulkl,vhkl,vlkl,rib,ubot,utop,vbot,vtop,
75!!$omp& betta,ricr,ustarr,wmin,tvhtop,ztop,
76!!$omp& wndsl,wndslp,betta,ricr,ustarr,wmin
77!!$omp& ,IFRSTLEV
78!!$omp& ,ICALPBL
79!!$omp& ,LVLP
80!!$omp& ,RIF
81!!$omp& ,RIBP
82!!$omp& ,UBOT1
83!!$omp& ,VBOT1
84!!$omp& ,ZBOT1
85!!$omp& ,THVBOT1)
86!
87 IF(gridtype /= 'A')THEN
88 call exch(uh(1,jsta_2l,lm))
89 call exch(vh(1,jsta_2l,lm))
90 END IF
91
92 DO j=jsta_m,jend_m
93 DO i=ista_m,iend_m
94!
95 IF(pmid(i,j,lm)<spval .AND. qs(i,j)<spval .AND. &
96 smstav(i,j)<spval) THEN
97 ape = (p1000/pmid(i,j,lm))**capa
98 thx = t(i,j,lm)*ape
99 thvx = (q(i,j,lm)*d608+h1)*thx
100 govrth = g/thx
101 IF(gridtype == 'E')THEN
102 ie=i+mod(j+1,2)
103 iw=i+mod(j+1,2)-1
104 umass = (uh(i,j-1,lm)+uh(iw,j,lm)+uh(ie,j,lm) &
105 + uh(i,j+1,lm))/4.0
106 vmass = (vh(i,j-1,lm)+vh(iw,j,lm)+vh(ie,j,lm) &
107 + vh(i,j+1,lm))/4.0
108 wspd= sqrt(umass*umass+vmass*vmass)
109 ELSE IF(gridtype == 'B')THEN
110 ie = i
111 iw = i-1
112 umass = (uh(iw,j-1,lm)+uh(iw,j,lm)+uh(ie,j-1,lm) &
113 + uh(i,j,lm))/4.0
114 vmass = (vh(iw,j-1,lm)+vh(iw,j,lm)+vh(ie,j-1,lm) &
115 + vh(i,j,lm))/4.0
116 wspd= sqrt(umass*umass+vmass*vmass)
117 ELSE
118 wspd = sqrt(uh(i,j,lm)*uh(i,j,lm)+vh(i,j,lm)*vh(i,j,lm))
119 END IF
120
121 tskv = ths(i,j)*(1.+d608*qs(i,j)*smstav(i,j))
122 dthv = (thvx-tskv)
123! Convective velocity scale Vc and subgrid-scale velocity Vsg
124! following Beljaars (1995, QJRMS) and Mahrt and Sun (1995, MWR)
125! ... HONG Aug. 2001
126!
127 rhox = pint(i,j,lm+1)/rd/(t(i,j,lm)*(q(i,j,lm)*d608+h1)) !density
128 fluxc = max(-twbs(i,j)/rhox/cp - d608*tskv*qwbs(i,j)/rhox,0.)
129 tsfc = ths(i,j)*(pint(i,j,lm+1)/p1000)**capa
130 vconv = vconvc*(g/tsfc*pblh(i,j)*fluxc)**.33
131! VCONV comes from Beljaars only
132 vsgd = 0.32 * (max(dx(i,j)/5000.-1.,0.))**.33
133 wspd = sqrt(wspd*wspd+vconv*vconv+vsgd*vsgd)
134 wspd = max(wspd,0.1)
135 br = govrth*(zmid(i,j,lm)-zint(i,j,lm+1))*dthv/(wspd*wspd)
136
137 IF(br < 0.0) THEN
138 pblregime(i,j) = 4.0
139 ELSE IF(br == 0.0) THEN
140 pblregime(i,j) = 3.0
141 ELSE IF(br < 0.2) THEN
142 pblregime(i,j) = 2.0
143 ELSE
144 pblregime(i,j) = 1.0
145 END IF
146
147! ii=im/2
148! jj=(jsta+jend)/2
149! if(i==ii.and.j==jj)print*,'Debug: CALPBLREGIME ',i,j,br, &
150! PBLREGIME(I,J)
151 END IF !end IF PMID
152
153 ENDDO
154 ENDDO
155!
156! END OF ROUTINE.
157!
158 RETURN
159 END
160
subroutine calpblregime(pblregime)
Subroutine that determines the PBL regime.
subroutine exch(a)
exch() Subroutine that exchanges one halo row.
Definition EXCH.f:27