UPP (develop)
Loading...
Searching...
No Matches
MIXLEN.f
1 SUBROUTINE mixlen(EL0,EL)
2!
3! CALCULATES LAYER-AVERAGED BLACKADAR'S MIXING LENGTH, AND PBL TOP
4! AS CPBLT*(ASYMPTOTIC EL); AND THEN EL, ACCOUNT TAKEN OF STABILITY,
5! PBL TOP AND VERTICAL GRID DISTANCE RESTRICTIONS (SEE BELOW)
6!
7! SET FROM EXISTING CODES BY L. LOBOCKI, JUNE 5, 1992
8! MODIFIED BY FEDOR MESINGER, OCTOBER 13, NOVEMBER 19
9! MODIFIED BY JIM TUCCILLO FOR MPI IMPLEMENTATION
10! 01-10-25 H CHUANG - MODIFIED TO PROCESS HYBRID MODEL OUTPUT
11! 02-06-19 MIKE BALDWIN - WRF VERSION
12! 21-03-11 B Cui - change local arrays to dimension (im,jsta:jend)
13! 21-09-30 J MENG - 2D DECOMPOSITION
14!
15!
16! INPUT:
17! ------
18!
19! ZINT (IM,jsta_2l:jend_2u,LP1) - ETA INTERFACES HEIGHT FIELD
20! T (IM,jsta_2l:jend_2u,LM) - TEMPERATURE
21! PMID (IM,jsta_2l:jend_2u,LM) - PRESSURE IN LAYERS
22! Q2 (IM,jsta_2l:jend_2u,LM) - TURBULENCE KINETIC ENERGY * 2
23! HGT (IM,jsta_2l:jend_2u) - SURFACE ELEVATION ARRAY
24! HTM (IM,jsta_2l:jend_2u,LM) - HEIGHT TOPOGRAPHY MASK ARRAY
25! EL0 (IM,JM) - ARRAY OF ASYMPTOTIC VALUES FOR MIXING LENGTH
26!
27! OUTPUT:
28! -------
29!
30! EL (IM,jsta_2l:jend_2u,LM) - FIELD OF RESULTING MASTER LENGTH SCALES
31!
32!
33! SCRATCH AREAS:
34! --------------
35!
36! VKRMZ(IM,JM)
37!
38! RELEVANT CONSTANTS:
39! -------------------
40!
41! VON KARMAN CONSTANT:
42 use vrbls3d, only: zint, pmid, t, q2
43 use masks, only: lmh, htm
44 use params_mod, only: epsq2, capa
45 use ctlblk_mod, only: jsta, jend, jsta_m, jend_m, im, jm, jsta_2l, jend_2u,&
46 lm, lm1, spval,&
47 ista, iend, ista_m, iend_m, ista_2l, iend_2u
48
49!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
50 implicit none
51!
52 real,PARAMETER :: VKRM=0.4
53! CONSTANTS NEEDED FOR THE EL(BL,ST,ZI) SCHEME:
54 real,PARAMETER :: FRG=4.*9.8,drdrff=0.54,cpblt=10., &
55 csh=0.23*0.5, epsn2=1.e-7
56!
57! ------------------------------------------------------------------
58!
59 real,intent(in) :: el0(ista_2l:iend_2u,jsta_2l:jend_2u)
60 real,intent(out) :: EL(ista_2l:iend_2u,jsta_2l:jend_2u,LM)
61 real HGT(ISTA:IEND,JSTA:JEND),APE(ISTA_M:IEND_M,JSTA_M:JEND_M,2)
62!
63 integer I,J,L
64 real ZL,VKRMZ,ENSQ,Q2KL,ELST,ZIAG,ELVGD
65
66!***********************************************************************
67!
68!$omp parallel do
69 DO l=1,lm
70 DO j=jsta,jend
71 DO i=ista,iend
72 el(i,j,l)=0.
73 ENDDO
74 ENDDO
75 ENDDO
76 DO j=jsta,jend
77 DO i=ista,iend
78 hgt(i,j)=zint(i,j,nint(lmh(i,j))+1)
79 ENDDO
80 ENDDO
81!
82!---THE AVERAGE EL SCHEME---------------------------(FM, AUGUST 19 MEMO)
83! FIRST GET EL IN THE LAYERS
84!
85!$omp parallel do private(i,j,l,vkrmz,zl)
86 DO l=1,lm
87 DO j=jsta,jend
88 DO i=ista,iend
89 IF(hgt(i,j)<spval)THEN
90 zl = 0.5*(zint(i,j,l)+zint(i,j,l+1))
91 vkrmz = (zl-hgt(i,j))*vkrm
92 el(i,j,l) = el0(i,j)*vkrmz/(el0(i,j)+vkrmz)
93 ELSE
94 el(i,j,l) = spval
95 ENDIF
96 ENDDO
97 ENDDO
98 ENDDO
99!***
100!*** GET NOW THE INTERFACE EL BY TWO-POINT AVERAGING OF LAYER VALUES
101!***
102 DO l=1,lm1
103!$omp parallel do private(i,j)
104 DO j=jsta,jend
105 DO i=ista,iend
106 IF(hgt(i,j)<spval)THEN
107 el(i,j,l) = 0.5*(el(i,j,l)+el(i,j,l+1))*htm(i,j,l+1)
108 ELSE
109 el(i,j,l) = spval
110 ENDIF
111 ENDDO
112 ENDDO
113 ENDDO
114!
115!$omp parallel do private(i,j)
116 DO j=jsta,jend
117 DO i=ista,iend
118 IF(hgt(i,j)<spval)THEN
119 el(i,j,lm) = 0.0
120 ELSE
121 el(i,j,lm) = spval
122 ENDIF
123 ENDDO
124 ENDDO
125!---STABILITY, PBL TOP, AND VERTICAL GRID DISTANCE RESTRICTIONS:--------
126! COMPUTE EL STABLE AND
127! * USE THE SMALLER OF EL BLACKADAR, EL STABLE IF WITHIN PBL;
128! * USE THE SMALLEST OF EL STABLE, ELVGD, AND VKRMZ IF ABOVE PBL
129! (ASSUME PBL TOP IS AT CPBLT*EL0(K));
130!$omp parallel do private(i,j)
131 DO j=jsta_m,jend_m
132 DO i=ista_m,iend_m
133 ape(i,j,1) = (1.e5/pmid(i,j,1))**capa
134 ENDDO
135 ENDDO
136!
137 DO l=1,lm1
138!$omp parallel do private(i,j,elst,elvgd,ensq,q2kl,ziag)
139 DO j=jsta_m,jend_m
140 DO i=ista_m,iend_m
141 IF(t(i,j,l)<spval)THEN
142 ape(i,j,2) = (1.e5/pmid(i,j,l+1))**capa
143 ensq = htm(i,j,l+1)* &
144 frg*(t(i,j,l)*ape(i,j,1)-t(i,j,l+1)*ape(i,j,2))/ &
145 ((t(i,j,l)*ape(i,j,1)+t(i,j,l+1)*ape(i,j,2))* &
146 (zint(i,j,l)-zint(i,j,l+2))+epsn2)
147 ensq = amax1(ensq,epsn2)
148 q2kl = amax1(epsq2,q2(i,j,l))
149 elst = drdrff*sqrt(q2kl/ensq)
150!WAS ELST = DRDRFF*SQRT(Q2(I,J,L)/ENSQ)
151 ziag = zint(i,j,l+1)-hgt(i,j)
152!
153 IF(ziag < cpblt*el0(i,j))THEN
154 el(i,j,l) = amin1(el(i,j,l),elst)
155 ELSE
156 elvgd = csh*(zint(i,j,l)-zint(i,j,l+2))
157 el(i,j,l) = amin1(elst,elvgd,vkrm*ziag)
158 ENDIF
159 ape(i,j,1) = ape(i,j,2)
160 ELSE
161 el(i,j,l) = spval
162 ENDIF
163 ENDDO
164 ENDDO
165 ENDDO
166!
167 RETURN
168 END
169