UPP (develop)
Loading...
Searching...
No Matches
CLMAX.f
1 SUBROUTINE clmax(EL0,SQZ,SQ,RQ2L,RQ2H)
2!
3! CALCULATES THE FREE-ATMOSPHERE ASYMPTOTE OF THE TURBULENCE LENGTH
4! SCALE (L-INF IN THE BLACKADAR's FORMULA) FROM THE DISTRIBUTION
5! OF THE TURBULENT ENERGY (see MY82)
6!
7! EXTRACTED FROM EXISTING CODE BY L. LOBOCKI, JULY 28, 1992
8! 01-10-22 H CHUANG - MODIFIED TO PROCESS HYBRID MODEL OUTPUT
9! 02-06-19 MIKE BALDWIN - WRF VERSION
10! 21-07-26 W Meng - Restrict computation from undefined grids
11! 21-10-26 J MENG - 2D DECOMPOSITION
12!
13! INPUT:
14! ------
15!
16! PINT (IM,jsta_2l:jend_2u,LP1) - PRESSURE ON INTERFACES
17! HTM (IM,jsta_2l:jend_2u,LM) - HEIGHT TOPOGRAPHY MASK ARRAY
18! Q2 (IM,jsta_2l:jend_2u,LM) - TWICE THE TURBULENT ENERGY FIELD
19! ZINT (IM,jsta_2l:jend_2u,LP1) - ETA INTERFACES HEIGHT FIELD
20! SM (IM,jsta_2l:jend_2u) - SEA MASK
21! HGT (IM,jsta_2l:jend_2u) - SURFACE ELEVATION ARRAY
22! LMH (IM,jsta_2l:jend_2u) - TOPOGRAPHY INDEXES ARRAY
23!
24! OUTPUT:
25! -------
26!
27! EL0 (IM,JM) - ARRAY OF RESULTING ASYMPTOTIC MIXING LENGTHS
28!
29!
30! SCRATCH AREAS:
31! --------------
32!
33! SQZ(IM,JM),SQ(IM,JM),RQ2L(IM,JM),RQ2H(IM,JM)
34!
35!
36! RELEVANT CONSTANTS:
37! -------------------
38!
39! PROPORTIONALITY CONSTANT BETWEEN ASYMPTOTIC MIXING LENGTH AND THE
40! S.D. OF Q DISTRIBUTION, FOR LAND AND SEA AREAS, CORRESPONDINGLY:
41
42 use vrbls3d, only: zint, q2, pint
43! use vrbls2d, only:
44 use masks, only: lmh, sm
45 use params_mod, only: epsq2
46 use ctlblk_mod, only: jsta, jend, lm, im, spval, ista, iend
47!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
48 implicit none
49!
50 real,PARAMETER :: ALPHAL=0.2, alphas=0.2
51!
52! ASYMPTOTIC MIXING LENGTH LIMITATIONS:
53 real,PARAMETER :: EL0M=300.0, elmin=11.0
54!
55! MINIMAL VALUE OF TURBULENT ENERGY:
56! real,PARAMETER :: EPSQ2=0.2
57!
58! ------------------------------------------------------------------
59!
60 real,dimension(ista:iend,jsta:jend),intent(inout) :: SQZ,SQ,RQ2L,RQ2H,EL0
61 real,dimension(ista:iend,jsta:jend) :: HGT
62!jw
63 integer I,J,L
64 real dp, RQ2m
65! ------------------------------------------------------------------
66!
67!
68!$omp parallel do
69 DO j=jsta,jend
70 DO i=ista,iend
71 sqz(i,j) = 0.0
72 sq(i,j) = 0.0
73 rq2h(i,j) = 0.0
74 hgt(i,j) = zint(i,j,nint(lmh(i,j)))
75 ENDDO
76 ENDDO
77!
78 DO l=1,lm
79 DO j=jsta,jend
80 DO i=ista,iend
81 IF(q2(i,j,l) <= epsq2) THEN
82 rq2l(i,j) = 0.0
83 ELSE
84 rq2l(i,j) = sqrt(q2(i,j,l))
85 ENDIF
86!
87! -----------------------------------------------------------------
88! THIS PART OF THE CODE IS LEFT FOR TESTING OTHER PARAMETERIZATION
89! SCHEMES
90!
91! IF (L>=LMH(I,J)) GOTO 215
92! RQ2L(I,J)=SQRT(Q2(I,J,L))
93! IF(Q2(I,J,L)<0.0)THEN
94! write(3,*)'NEGATIVE Q2 AT (I,J,L)=(',I,',',J,',',L,'): ',
95! Q2(I,J,L)
96! STOP
97! ENDIF
98! -----------------------------------------------------------------
99!
100 dp = pint(i,j,l+1) - pint(i,j,l)
101!***
102!*** SUM OF Q2 AT BOTH LOWER & UPPER SURFACES:
103!***
104 rq2m = rq2h(i,j) + rq2l(i,j)
105!***
106!*** INTEGRAL OF Q*Z OVER DP
107!***
108 sqz(i,j) = ((zint(i,j,l)+zint(i,j,l+1))*0.5-hgt(i,j))*rq2m*dp &
109 & + sqz(i,j)
110!***
111!*** INTEGRAL OF Q OVER DP:
112!***
113 sq(i,j) = rq2m*dp + sq(i,j)
114 rq2h(i,j) = rq2l(i,j)
115 ENDDO
116 ENDDO
117!215 CONTINUE
118 ENDDO
119!***
120!*** CLIPPING & APPLYING DIFFERENT VALUES OF THE PROPORTIONALITY
121!*** CONSTANT ALPHA FOR THE LAND AND SEA AREA:
122!***
123!$omp parallel do
124 DO j=jsta,jend
125 DO i=ista,iend
126 IF(hgt(i,j)<spval)THEN
127 el0(i,j)= max(min( &
128 & ((sm(i,j)*alphas+(1.0-sm(i,j))*alphal)*sqz(i,j) &
129 & /(sq(i,j)+epsq2)),el0m),elmin)
130 ELSE
131 el0(i,j)= spval
132 ENDIF
133 ENDDO
134 ENDDO
135!
136 RETURN
137 END
138