UPP  001
 All Data Structures Files Functions Pages
OTLIFT.f
Go to the documentation of this file.
1 
25  SUBROUTINE otlift(SLINDX)
26 
27 !
28  use vrbls3d, only: pmid, t, q
29  use vrbls2d, only: t500
30  use masks, only: lmh
31  use lookup_mod, only: thl, rdth, jtb, qs0, sqs, rdq,itb, ptbl, pl, &
32  rdp, the0, sthe, rdthe, ttbl
33  use ctlblk_mod, only: jsta, jend, im, spval
34  use params_mod, only: d00,h10e5, capa, elocp, eps, oneps
35  use upp_physics, only: fpvsnew
36 !
37 
38 !
39  implicit none
40 !
41 ! SET LOCAL PARAMETERS.
42  real,PARAMETER :: d8202=.820231e0 , h5e4=5.e4 , p500=50000.
43 
44 !
45 ! DECLARE VARIABLES.
46  real,intent(out) :: slindx(im,jsta:jend)
47  REAL :: tvp, esatp, qsatp
48  REAL :: tth, tp, apesp, partmp, thesp, tpsp
49  REAL :: bqs00, sqs00, bqs10, sqs10, bq, sq, tq
50  REAL :: p00, p10, p01, p11, t00, t10, t01, t11
51  REAL :: bthe00, sthe00, bthe10, sthe10, bth, sth
52  REAL :: tqq, qq, qbt, tthbt, tbt, apebt, ppq, pp
53 !
54  INTEGER :: i, j, lbtm, ittbk, iq, it, iptbk, ith, ip, iqtb
55  INTEGER :: ittb, iptb, ithtb
56 !
57 !***********************************************************************
58 ! START OTLIFT HERE
59 !
60 ! INTIALIZE LIFTED INDEX ARRAY TO ZERO.
61 !$omp parallel do private(i,j)
62  DO j=jsta,jend
63  DO i=1,im
64  slindx(i,j) = d00
65  ENDDO
66  ENDDO
67 !--------------FIND EXNER AT LOWEST LEVEL-------------------------------
68  DO j=jsta,jend
69  DO i=1,im
70  lbtm=nint(lmh(i,j))
71  IF(t(i,j,lbtm)<spval .AND. q(i,j,lbtm)<spval) THEN
72  tbt = t(i,j,lbtm)
73  qbt = q(i,j,lbtm)
74  apebt = (h10e5/pmid(i,j,lbtm))**capa
75 !--------------SCALING POTENTIAL TEMPERATURE & TABLE INDEX--------------
76  tthbt = tbt*apebt
77  tth = (tthbt-thl)*rdth
78  tqq = tth-aint(tth)
79  ittb = int(tth)+1
80 !--------------KEEPING INDICES WITHIN THE TABLE-------------------------
81  IF(ittb < 1)THEN
82  ittb = 1
83  tqq = d00
84  ENDIF
85  IF(ittb >= jtb)THEN
86  ittb = jtb-1
87  tqq = d00
88  ENDIF
89 !--------------BASE AND SCALING FACTOR FOR SPEC. HUMIDITY---------------
90  ittbk = ittb
91  bqs00=qs0(ittbk)
92  sqs00=sqs(ittbk)
93  bqs10=qs0(ittbk+1)
94  sqs10=sqs(ittbk+1)
95 !--------------SCALING SPEC. HUMIDITY & TABLE INDEX---------------------
96  bq=(bqs10-bqs00)*tqq+bqs00
97  sq=(sqs10-sqs00)*tqq+sqs00
98  tq=(qbt-bq)/sq*rdq
99  ppq = tq-aint(tq)
100  iqtb = int(tq)+1
101 !--------------KEEPING INDICES WITHIN THE TABLE-------------------------
102  IF(iqtb < 1)THEN
103  iqtb = 1
104  ppq = d00
105  ENDIF
106  IF(iqtb >= itb)THEN
107  iqtb = itb-1
108  ppq = d00
109  ENDIF
110 !--------------SATURATION PRESSURE AT FOUR SURROUNDING TABLE PTS.-------
111  iq=iqtb
112  it = ittb
113  p00=ptbl(iq,it)
114  p10=ptbl(iq+1,it)
115  p01=ptbl(iq,it+1)
116  p11=ptbl(iq+1,it+1)
117 !--------------SATURATION POINT VARIABLES AT THE BOTTOM-----------------
118  tpsp = p00+(p10-p00)*ppq+(p01-p00)*tqq &
119  +(p00-p10-p01+p11)*ppq*tqq
120  IF(tpsp <= d00) tpsp = h10e5
121  apesp = (h10e5/tpsp)**capa
122  thesp = tthbt*exp(elocp*qbt*apesp/tthbt)
123 !--------------SCALING PRESSURE & TT TABLE INDEX------------------------
124  tp=(h5e4-pl)*rdp
125  qq = tp-aint(tp)
126  iptb = int(tp)+1
127 !--------------KEEPING INDICES WITHIN THE TABLE-------------------------
128  IF(iptb < 1)THEN
129  iptb = 1
130  qq = d00
131  ENDIF
132  IF(iptb >= itb)THEN
133  iptb = itb-1
134  qq = d00
135  ENDIF
136 !--------------BASE AND SCALING FACTOR FOR THE--------------------------
137  iptbk=iptb
138  bthe00=the0(iptbk)
139  sthe00=sthe(iptbk)
140  bthe10=the0(iptbk+1)
141  sthe10=sthe(iptbk+1)
142 !--------------SCALING THE & TT TABLE INDEX-----------------------------
143  bth=(bthe10-bthe00)*qq+bthe00
144  sth=(sthe10-sthe00)*qq+sthe00
145  tth=(thesp-bth)/sth*rdthe
146  pp = tth-aint(tth)
147  ithtb = int(tth)+1
148 !--------------KEEPING INDICES WITHIN THE TABLE-------------------------
149  IF(ithtb < 1)THEN
150  ithtb = 1
151  pp = d00
152  ENDIF
153  IF(ithtb >= jtb)THEN
154  ithtb = jtb-1
155  pp = d00
156  ENDIF
157 !--------------TEMPERATURE AT FOUR SURROUNDING TT TABLE PTS.------------
158  ith=ithtb
159  ip=iptb
160  t00=ttbl(ith,ip)
161  t10=ttbl(ith+1,ip)
162  t01=ttbl(ith,ip+1)
163  t11=ttbl(ith+1,ip+1)
164 !--------------PARCEL TEMPERATURE AT 500MB----------------------------
165  IF(tpsp >= h5e4)THEN
166  partmp=(t00+(t10-t00)*pp+(t01-t00)*qq &
167  +(t00-t10-t01+t11)*pp*qq)
168  ELSE
169  partmp=tbt*apebt*d8202
170  ENDIF
171 !--------------LIFTED INDEX---------------------------------------------
172 !
173 ! GSM THE PARCEL TEMPERATURE AT 500 MB HAS BEEN COMPUTED, AND WE
174 ! FIND THE MIXING RATIO AT THAT LEVEL WHICH WILL BE THE SATURATION
175 ! VALUE SINCE WE'RE FOLLOWING A MOIST ADIABAT. NOTE THAT THE
176 ! AMBIENT 500 MB SHOULD PROBABLY BE VIRTUALIZED, BUT THE IMPACT
177 ! OF MOISTURE AT THAT LEVEL IS QUITE SMALL
178 
179  esatp=fpvsnew(partmp)
180  qsatp=eps*esatp/(p500-esatp*oneps)
181  tvp=partmp*(1+0.608*qsatp)
182  slindx(i,j)=t500(i,j)-tvp
183  ENDIF !end T(I,J,LBTM)<SPVAL
184  ENDDO
185  ENDDO
186 ! write(*,*) ' in otlift t500 partmp ',t500(1,1),partmp(1,1)
187 ! write(*,*) ' in otlift tbt ',tbt(1,1)
188 !
189  RETURN
190  END
Definition: MASKS_mod.f:1
elemental real function, public fpvsnew(t)
Definition: UPP_PHYSICS.f:341
calcape() computes CAPE/CINS and other storm related variables.
Definition: UPP_PHYSICS.f:27