CCPP SciDoc v7.0.0  v7.0.0
Common Community Physics Package Developed at DTC
 
Loading...
Searching...
No Matches
cires_orowam2017.f
1
3
6 contains
7
10
12 subroutine oro_wam_2017(im, levs,npt,ipt, kref,kdt,me,master,
13 & dtp,dxres, taub, u1, v1, t1, xn, yn, bn2, rho, prsi, prsL,
14 & del, sigma, hprime, gamma, theta,
15 & sinlat, xlatd, taup, taud, pkdis)
16!
17 USE machine , ONLY : kind_phys
18 use ugwp_common_v0 , only : grav, omega2
19!
20 implicit none
21
22 integer :: im, levs
23 integer :: npt
24 integer :: kdt, me, master
25 integer :: kref(im), ipt(im)
26 real(kind=kind_phys), intent(in) :: dtp, dxres
27 real(kind=kind_phys), intent(in) :: taub(im)
28
29 real(kind=kind_phys), intent(in) :: sinlat(im), xlatd(im)
30 real(kind=kind_phys), intent(in), dimension(im) :: sigma,
31 & hprime, gamma, theta
32
33 real(kind=kind_phys), intent(in), dimension(im) :: xn, yn
34
35 real(kind=kind_phys), intent(in), dimension(im, levs) ::
36 & u1, v1, t1, bn2, rho, prsl, del
37
38 real(kind=kind_phys), intent(in), dimension(im, levs+1) :: prsi
39!
40! out : taup, taud, pkdis
41!
42 real(kind=kind_phys), intent(inout), dimension(im, levs+1) :: taup
43 real(kind=kind_phys), intent(inout), dimension(im, levs) :: taud
44 real(kind=kind_phys), intent(inout), dimension(im, levs) :: pkdis
45 real(kind=kind_phys) :: belps, aelps, nhills, selps
46!
47! multiwave oro-spectra
48! locals
49!
50 integer :: i, j, k, isp, iw
51
52 integer, parameter :: nworo = 30
53 real(kind=kind_phys), parameter :: fc_flag = 0.0
54 real(kind=kind_phys), parameter :: mkzmin = 6.28e-3/50.0
55 real(kind=kind_phys), parameter :: mkz2min = mkzmin* mkzmin
56 real(kind=kind_phys), parameter :: kedmin = 1.e-3
57 real(kind=kind_phys), parameter :: kedmax = 350.,axmax=250.e-5
58 real(kind=kind_phys), parameter :: rtau = 0.01 ! nonlin-OGW scale 1/10sec
59 real(kind=kind_phys), parameter :: linsat2 =0.5
60 real(kind=kind_phys), parameter :: kxmin = 6.28e-3/100.
61 real(kind=kind_phys), parameter :: kxmax = 6.28e-3/5.0
62 real(kind=kind_phys), parameter :: dkx = (kxmax -kxmin)/(nworo-1)
63 real(kind=kind_phys), parameter :: kx_slope= -5./3.
64 real(kind=kind_phys), parameter :: hps =7000., rhp2 = .5/hps
65 real(kind=kind_phys), parameter :: cxmin=0.5, cxmin2=cxmin*cxmin
66
67 real :: akx(nworo), cxoro(nworo), akx2(nworo)
68 real :: aspkx(nworo), c2f2(nworo) , cdf2(nworo)
69 real :: tau_sp(nworo,levs+1), wkdis(nworo, levs+1)
70 real :: tau_kx(nworo),taub_kx(nworo)
71 real, dimension(nworo, levs+1) :: wrms, akzw
72
73 real :: tauz(levs+1), rms_wind(levs+1)
74 real :: wave_act(nworo,levs+1)
75
76 real :: kxw, kzw, kzw2, kzw3, kzi, dzmet, rhoint
77 real :: rayf, kturb
78 real :: uz, bv, bv2,kxsp, fcor2, cf2
79
80 real :: fdis
81 real :: wfdm, wfdt, wfim, wfit
82 real :: betadis, betam, betat, kds, cx, rhofac
83 real :: etwk, etws, tauk, cx2sat
84 real :: cdf1, tau_norm
85!
86! mean flow
87!
88 real, dimension(levs+1) :: uzi,rhoi,ktur, kalp, dzi
89
90 integer :: nw, nzi, ksrc
91 taud(:, :) = 0.0 ; pkdis(:,:) = 0.0 ; taup(:,:) = 0.0
92 tau_sp(:,:) = 0.0 ; wrms(:,:) = 0.0
93 nw = nworo
94 nzi = levs+1
95
96 do iw = 1, nw
97! !kxw = 0.25/(dxres)*iw
98 kxw = kxmin+(iw-1)*dkx
99 akx(iw) = kxw
100 akx2(iw) = kxw*kxw
101 aspkx(iw) = kxw ** (kx_slope)
102 tau_kx(iw) = aspkx(iw)*dkx
103 enddo
104
105 tau_norm = sum(tau_kx)
106 tau_kx(:) = tau_kx(:)/tau_norm
107
108 if (kdt == 1) then
109771 format( 'vay-oro19 ', 3(2x,f8.3))
110 write(6,771)
111 & maxval(tau_kx)*maxval(taub)*1.e3,
112 & minval(tau_kx), maxval(tau_kx)
113 endif
114!
115! main loop over oro-points
116!
117 do i =1, npt
118 j = ipt(i)
119
120!
121! estimate "nhills" => stochastic choices for OGWs
122!
123 if (taub(i) > 0.) then
124!
125! max_kxridge =min( .5*sigma(j)/hprime(j), kmax)
126! ridge-dependent dkx = (max_kxridge -kxmin)/(nw-1)
127! option to make grid-box variable kx-spectra kxw = kxmin+(iw-1)*dkx
128!
129 wave_act(1:nw, 1:levs+1) = 1.0
130 ksrc = kref(i)
131 tauz(1:ksrc) = taub(i)
132 taub_kx(1:nw) = tau_kx(1:nw) * taub(i)
133 wkdis(:,:) = kedmin
134
135 call oro_meanflow_v0(levs, nzi, u1(j,:), v1(j,:), t1(j,:),
136 & prsi(j,:), prsl(j,:), del(j,:), rho(i,:),
137 & bn2(i,:), uzi, rhoi,ktur, kalp,dzi,
138 & xn(i), yn(i))
139
140 fcor2 = (omega2*sinlat(j))*(omega2*sinlat(j))*fc_flag
141
142 k = ksrc
143
144 bv2 = bn2(i,k)
145 uz = uzi(k) !u1(j,ksrc)*xn(i)+v1(j,ksrc)*yn(i)!
146 kturb = ktur(k)
147 rayf = kalp(k)
148 rhoint = rhoi(k)
149 dzmet = dzi(k)
150 kzw = max(sqrt(bv2)/max(cxmin, uz), mkzmin)
151!
152! specify oro-kx spectra and related variables k=ksrc
153!
154 do iw = 1, nw
155 kxw = akx(iw)
156 cxoro(iw) = 0.0 - uz
157 c2f2(iw) = fcor2/akx2(iw)
158 wrms(iw,k)= taub_kx(iw)/rhoint*kzw/kxw
159 tau_sp(iw, k) = taub_kx(iw)
160!
161!
162 if (cxoro(iw) > cxmin) then
163 wave_act(iw,k:levs+1) = 0. ! crit-level
164 else
165 cdf2(iw) = cxoro(iw)*cxoro(iw) -c2f2(iw)
166 if ( cdf2(iw) < cxmin2) then
167 wave_act(iw,k:levs+1) = 0. ! coriolis cut-off
168 else
169 kzw2 = max(bv2/cdf2(iw) - akx2(iw), mkz2min)
170 kzw = sqrt(kzw2)
171 akzw(iw,k)= kzw
172 wrms(iw,k)= taub_kx(iw)/rhoint * kzw/kxw
173 endif
174 endif
175 enddo ! nw-spectral loop
176!
177! defined abobe, k = ksrc: akx(nworo), cxoro(nworo), tau_sp(ksrc, nworo)
178! propagate upward multiwave-spectra are filtered by dissipation & instability
179!
180! tau_sp(:,ksrc+1:levs+1) = tau_sp(:, ksrc)
181 do k= ksrc+1, levs
182 uz = uzi(k)
183 bv2 =bn2(i,k)
184 bv = sqrt(bv2)
185 rayf = kalp(k)
186 rhoint= rhoi(k)
187 dzmet = dzi(k)
188 rhofac = rhoi(k-1)/rhoi(k)
189
190 do iw = 1, nworo
191!
192 if (wave_act(iw, k-1) <= 0.0) cycle
193 cxoro(iw)= 0.0 - uz
194 if ( cxoro(iw) > cxmin) then
195 wave_act(iw,k:levs+1) = 0.0 ! crit-level
196 else
197 cdf2(iw) = cxoro(iw)*cxoro(iw) -c2f2(iw)
198 if ( cdf2(iw) < cxmin2) wave_act(iw,k:levs+1) = 0.0
199 endif
200 if ( wave_act(iw,k) <= 0.0) cycle
201!
202! upward propagation
203!
204 kzw2 = bv2/cdf2(iw) - akx2(iw)
205
206 if (kzw2 < mkz2min) then
207 wave_act(iw,k:levs+1) = 0.0
208 else
209!
210! upward propagation w/o reflection
211!
212 kxw = akx(iw)
213 kzw = sqrt(kzw2)
214 akzw(iw,k) = kzw
215 kzw3 = kzw2*kzw
216
217 cx = cxoro(iw)
218 betadis = cdf2(iw) / (cx*cx+c2f2(iw))
219 betam = 1.0 / (1.0+betadis)
220 betat = 1.0 - betam
221 kds = wkdis(iw,k-1)
222
223 etws = wrms(iw,k-1)*rhofac * kzw/akzw(iw,k-1)
224
225 kturb = ktur(k)+pkdis(j,k-1)
226 wfim = kturb*kzw2 +rayf
227 wfit = wfim ! do updates with Pr-numbers Kv/Kt
228 cdf1 = sqrt(cdf2(iw))
229 wfdm = wfim/(kxw*cdf1)*betam
230 wfdt = wfit/(kxw*cdf1)*betat
231 kzi = 2.*kzw*(wfdm+wfdt)*dzmet
232 fdis = exp(-kzi)
233
234 etwk = etws*fdis
235 cx2sat = linsat2*cdf2(iw)
236
237 if (etwk > cx2sat) then
238 kds = kxw*cdf1*rhp2/kzw3
239 etwk = cx2sat
240 wfim = kds*kzw2
241 wfdm = wfim/(kxw*cdf1)
242 kzi = 2.*kzw*(wfdm + wfdm)*dzmet
243 etwk = cx2sat*exp(-kzi)
244 endif
245! if( lat(j) eq 40.5 ) then stop
246 wkdis(iw,k) = kds
247 wrms(iw,k) = etwk
248 tauk = etwk*kxw/kzw
249 tau_sp(iw,k) = tauk *rhoint
250 if ( tau_sp(iw,k) > tau_sp(iw,k-1))
251 & tau_sp(iw,k) = tau_sp(iw,k-1)
252
253 ENDIF ! upward
254 ENDDO ! spectral
255
256!......... do spectral sum of rms, wkdis, tau
257
258 tauz(k) = sum( tau_sp(:,k)*wave_act(:,k) )
259 rms_wind(k) = sum( wrms(:,k)*wave_act(:,k) )
260
261 pkdis(j,k) = sum(wkdis(:,k)*wave_act(:,k))+rms_wind(k)*rtau
262
263 if (pkdis(j,k) > kedmax) pkdis(j,k) = kedmax
264
265 ENDDO ! k=ksrc+1, levs
266
267 k = ksrc
268 tauz(k) = sum(tau_sp(:,k)*wave_act(:,k))
269 tauz(k) = tauz(k+1) ! zero momentum dep-n at k=ksrc
270
271 pkdis(j,k) = sum(wkdis(:,k)*wave_act(:,k))
272 rms_wind(k) = sum(wrms(:,k)*wave_act(:,k))
273 tauz(levs+1) = tauz(levs)
274 taup(i, 1:levs+1) = tauz(1:levs+1)
275 do k=ksrc, levs
276 taud(i,k) = ( tauz(k+1) - tauz(k))*grav/del(j,k)
277! if (taud(i,k) .gt. 0)taud(i,k)=taud(i,k)*.01
278! if (abs(taud(i,k)).ge.axmax)taud(i,k)=sign(taud(i,k),axmax)
279 enddo
280 endif ! taub > 0
281 enddo ! oro-points (i, j, ipt)
282!23456
283 end subroutine oro_wam_2017
284
286 subroutine oro_meanflow_v0(nz, nzi, u1, v1, t1, pint, pmid,
287 & delp, rho, bn2, uzi, rhoi, ktur, kalp, dzi, xn, yn)
288
289 use ugwp_common_v0 , only : grav, rgrav, rdi, velmin, dw2min
290 implicit none
291
292 integer :: nz, nzi
293 real, dimension(nz ) :: u1, v1, t1, delp, rho, pmid
294 real, dimension(nz ) :: bn2 ! define at the interfaces
295 real, dimension(nz+1) :: pint
296 real :: xn, yn
297! output
298
299 real, dimension(nz+1) :: dzi, uzi, rhoi, ktur, kalp
300
301! locals
302 integer :: i, j, k
303 real :: ui, vi, ti, uz, vz, shr2, rdz, kamp
304 real :: zgrow, zmet, rdpm, ritur, kmol, w1
305! paremeters
306 real, parameter :: hps = 7000., rpspa = 1.e-5
307 real, parameter :: rhps=1.0/hps
308 real, parameter :: h4= 0.25/hps
309 real, parameter :: rimin = 1.0/8.0, kedmin = 0.01
310 real, parameter :: lturb = 30. , uturb = 150.0
311 real, parameter :: lsc2 = lturb*lturb,usc2 = uturb*uturb
312 kalp(1:nzi) = 2.e-7 ! radiative damping
313
314 do k=2, nz
315 rdpm = grav/(pmid(k-1)-pmid(k))
316 ui = .5*(u1(k-1)+u1(k))
317 vi = .5*(v1(k-1)+v1(k))
318 uzi(k) = ui*xn + vi*yn
319 ti = .5*(t1(k-1)+t1(k))
320 rhoi(k) = rdi*pint(k)/ti
321 rdz = rdpm *rhoi(k)
322 dzi(k) = 1./rdz
323 uz = u1(k)-u1(k-1)
324 vz = v1(k)-v1(k-1)
325 shr2 = rdz*rdz*(max(uz*uz+vz*vz, dw2min))
326 zmet = -hps*alog(pint(k)*rpspa)
327 zgrow = exp(zmet*h4)
328 kmol = 2.e-5*exp(zmet*rhps)+kedmin
329 ritur = max(bn2(k)/shr2, rimin)
330 kamp = sqrt(shr2)*lsc2 *zgrow
331 w1 = 1./(1. + 5*ritur)
332 ktur(k) = kamp * w1 * w1 +kmol
333 enddo
334
335 k = 1
336 uzi(k) = uzi(k+1)
337 ktur(k) = ktur(k+1)
338 rhoi(k) = rdi*pint(k)/t1(k+1)
339 dzi(k) = rgrav*delp(k)/rhoi(k)
340
341 k = nzi
342 uzi(k) = uzi(k-1)
343 ktur(k) = ktur(k-1)
344 rhoi(k) = rhoi(k-1)*.5
345 dzi(k) = dzi(k-1)
346
347 end subroutine oro_meanflow_v0
348
350 subroutine ugwpv0_tofd1d(levs, sigflt, elvmax, zsurf,
351 & zpbl, u, v, zmid, utofd, vtofd, epstofd, krf_tofd)
352 use machine , only : kind_phys
353 use ugwp_common_v0 , only : rcpd2
354 use ugwpv0_oro_init, only : n_tofd, const_tofd, ze_tofd
355 use ugwpv0_oro_init, only : a12_tofd, ztop_tofd
356!
357 implicit none
358 integer :: levs
359 real(kind_phys), dimension(levs) :: u, v, zmid
360 real(kind_phys) :: sigflt, elvmax, zpbl, zsurf
361 real(kind_phys), dimension(levs) :: utofd, vtofd
362 real(kind_phys), dimension(levs) :: epstofd, krf_tofd
363!
364! locals
365!
366 integer :: i, k
367 real(kind_phys) :: sghmax = 5.
368 real(kind_phys) :: sgh2, ekin, zdec, rzdec, umag, zmet
369 real(kind_phys) :: zarg, ztexp, krf
370!
371 utofd =0.0 ; vtofd = 0.0
372 epstofd =0.0 ; krf_tofd =0.0
373!
374 zdec = max(n_tofd*sigflt, zpbl) ! ntimes*sgh_turb or Zpbl
375 zdec = min(ze_tofd, zdec) ! cannot exceed 18 km
376 rzdec = 1.0/zdec
377 sgh2 = max(sigflt*sigflt, sghmax*sghmax) ! 25 meters dz-of the first layer
378
379 do k=1, levs
380 zmet = zmid(k)-zsurf
381 if (zmet > ztop_tofd) cycle
382 ekin = u(k)*u(k) + v(k)*v(k)
383 umag = sqrt(ekin)
384 zarg = zmet*rzdec
385 ztexp = exp(-zarg*sqrt(zarg))
386 krf = const_tofd* a12_tofd *sgh2* zmet ** (-1.2) *ztexp
387
388 utofd(k) = -krf*u(k)
389 vtofd(k) = -krf*v(k)
390 epstofd(k) = rcpd2*krf*ekin ! more accurate heat/mom form using "implicit tend-solver"
391 ! to update momentum and temp-re; epstofd(k) can be skipped
392 krf_tofd(k) = krf
393 enddo
394!
395 end subroutine ugwpv0_tofd1d
396 end module cires_orowam2017
This module includes the OROGW solver of WAM2017.
This module contains UGWP v0 initialization schemes.
This module contains orographic wave source schemes for UGWP v0.