UPP  001
 All Data Structures Files Functions Pages
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 !
12 ! INPUT:
13 ! ------
14 !
15 ! PINT (IM,jsta_2l:jend_2u,LP1) - PRESSURE ON INTERFACES
16 ! HTM (IM,jsta_2l:jend_2u,LM) - HEIGHT TOPOGRAPHY MASK ARRAY
17 ! Q2 (IM,jsta_2l:jend_2u,LM) - TWICE THE TURBULENT ENERGY FIELD
18 ! ZINT (IM,jsta_2l:jend_2u,LP1) - ETA INTERFACES HEIGHT FIELD
19 ! SM (IM,jsta_2l:jend_2u) - SEA MASK
20 ! HGT (IM,jsta_2l:jend_2u) - SURFACE ELEVATION ARRAY
21 ! LMH (IM,jsta_2l:jend_2u) - TOPOGRAPHY INDEXES ARRAY
22 !
23 ! OUTPUT:
24 ! -------
25 !
26 ! EL0 (IM,JM) - ARRAY OF RESULTING ASYMPTOTIC MIXING LENGTHS
27 !
28 !
29 ! SCRATCH AREAS:
30 ! --------------
31 !
32 ! SQZ(IM,JM),SQ(IM,JM),RQ2L(IM,JM),RQ2H(IM,JM)
33 !
34 !
35 ! RELEVANT CONSTANTS:
36 ! -------------------
37 !
38 ! PROPORTIONALITY CONSTANT BETWEEN ASYMPTOTIC MIXING LENGTH AND THE
39 ! S.D. OF Q DISTRIBUTION, FOR LAND AND SEA AREAS, CORRESPONDINGLY:
40 
41  use vrbls3d, only: zint, q2, pint
42 ! use vrbls2d, only:
43  use masks, only: lmh, sm
44  use params_mod, only: epsq2
45  use ctlblk_mod, only: jsta, jend, lm, im, spval
46 !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
47  implicit none
48 !
49  real,PARAMETER :: alphal=0.2, alphas=0.2
50 !
51 ! ASYMPTOTIC MIXING LENGTH LIMITATIONS:
52  real,PARAMETER :: el0m=300.0, elmin=11.0
53 !
54 ! MINIMAL VALUE OF TURBULENT ENERGY:
55 ! real,PARAMETER :: EPSQ2=0.2
56 !
57 ! ------------------------------------------------------------------
58 !
59  real,dimension(IM,jsta:jend),intent(inout) :: sqz,sq,rq2l,rq2h,el0
60  real,dimension(IM,jsta:jend) :: hgt
61 !jw
62  integer i,j,l
63  real dp, rq2m
64 ! ------------------------------------------------------------------
65 !
66 !
67 !$omp parallel do
68  DO j=jsta,jend
69  DO i=1,im
70  sqz(i,j) = 0.0
71  sq(i,j) = 0.0
72  rq2h(i,j) = 0.0
73  hgt(i,j) = zint(i,j,nint(lmh(i,j)))
74  ENDDO
75  ENDDO
76 !
77  DO l=1,lm
78  DO j=jsta,jend
79  DO i=1,im
80  IF(q2(i,j,l) <= epsq2) THEN
81  rq2l(i,j) = 0.0
82  ELSE
83  rq2l(i,j) = sqrt(q2(i,j,l))
84  ENDIF
85 !
86 ! -----------------------------------------------------------------
87 ! THIS PART OF THE CODE IS LEFT FOR TESTING OTHER PARAMETERIZATION
88 ! SCHEMES
89 !
90 ! IF (L>=LMH(I,J)) GOTO 215
91 ! RQ2L(I,J)=SQRT(Q2(I,J,L))
92 ! IF(Q2(I,J,L)<0.0)THEN
93 ! write(3,*)'NEGATIVE Q2 AT (I,J,L)=(',I,',',J,',',L,'): ',
94 ! Q2(I,J,L)
95 ! STOP
96 ! ENDIF
97 ! -----------------------------------------------------------------
98 !
99  dp = pint(i,j,l+1) - pint(i,j,l)
100 !***
101 !*** SUM OF Q2 AT BOTH LOWER & UPPER SURFACES:
102 !***
103  rq2m = rq2h(i,j) + rq2l(i,j)
104 !***
105 !*** INTEGRAL OF Q*Z OVER DP
106 !***
107  sqz(i,j) = ((zint(i,j,l)+zint(i,j,l+1))*0.5-hgt(i,j))*rq2m*dp &
108  & + sqz(i,j)
109 !***
110 !*** INTEGRAL OF Q OVER DP:
111 !***
112  sq(i,j) = rq2m*dp + sq(i,j)
113  rq2h(i,j) = rq2l(i,j)
114  ENDDO
115  ENDDO
116 !215 CONTINUE
117  ENDDO
118 !***
119 !*** CLIPPING & APPLYING DIFFERENT VALUES OF THE PROPORTIONALITY
120 !*** CONSTANT ALPHA FOR THE LAND AND SEA AREA:
121 !***
122 !$omp parallel do
123  DO j=jsta,jend
124  DO i=1,im
125  IF(hgt(i,j)<spval)THEN
126  el0(i,j)= max(min( &
127  & ((sm(i,j)*alphas+(1.0-sm(i,j))*alphal)*sqz(i,j) &
128  & /(sq(i,j)+epsq2)),el0m),elmin)
129  ELSE
130  el0(i,j)= spval
131  ENDIF
132  ENDDO
133  ENDDO
134 !
135  RETURN
136  END
137 
Definition: MASKS_mod.f:1