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)
17 USE machine ,
ONLY : kind_phys
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)
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
33 real(kind=kind_phys),
intent(in),
dimension(im) :: xn, yn
35 real(kind=kind_phys),
intent(in),
dimension(im, levs) ::
36 & u1, v1, t1, bn2, rho, prsl, del
38 real(kind=kind_phys),
intent(in),
dimension(im, levs+1) :: prsi
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
50 integer :: i, j, k, isp, iw
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
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
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
73 real :: tauz(levs+1), rms_wind(levs+1)
74 real :: wave_act(nworo,levs+1)
76 real :: kxw, kzw, kzw2, kzw3, kzi, dzmet, rhoint
78 real :: uz, bv, bv2,kxsp, fcor2, cf2
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
88 real,
dimension(levs+1) :: uzi,rhoi,ktur, kalp, dzi
90 integer :: nw, nzi, ksrc
91 taud(:, :) = 0.0 ; pkdis(:,:) = 0.0 ; taup(:,:) = 0.0
92 tau_sp(:,:) = 0.0 ; wrms(:,:) = 0.0
98 kxw = kxmin+(iw-1)*dkx
101 aspkx(iw) = kxw ** (kx_slope)
102 tau_kx(iw) = aspkx(iw)*dkx
105 tau_norm = sum(tau_kx)
106 tau_kx(:) = tau_kx(:)/tau_norm
109771
format(
'vay-oro19 ', 3(2x,f8.3))
111 & maxval(tau_kx)*maxval(taub)*1.e3,
112 & minval(tau_kx), maxval(tau_kx)
123 if (taub(i) > 0.)
then
129 wave_act(1:nw, 1:levs+1) = 1.0
131 tauz(1:ksrc) = taub(i)
132 taub_kx(1:nw) = tau_kx(1:nw) * taub(i)
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,
140 fcor2 = (omega2*sinlat(j))*(omega2*sinlat(j))*fc_flag
150 kzw = max(sqrt(bv2)/max(cxmin, uz), mkzmin)
157 c2f2(iw) = fcor2/akx2(iw)
158 wrms(iw,k)= taub_kx(iw)/rhoint*kzw/kxw
159 tau_sp(iw, k) = taub_kx(iw)
162 if (cxoro(iw) > cxmin)
then
163 wave_act(iw,k:levs+1) = 0.
165 cdf2(iw) = cxoro(iw)*cxoro(iw) -c2f2(iw)
166 if ( cdf2(iw) < cxmin2)
then
167 wave_act(iw,k:levs+1) = 0.
169 kzw2 = max(bv2/cdf2(iw) - akx2(iw), mkz2min)
172 wrms(iw,k)= taub_kx(iw)/rhoint * kzw/kxw
188 rhofac = rhoi(k-1)/rhoi(k)
192 if (wave_act(iw, k-1) <= 0.0) cycle
194 if ( cxoro(iw) > cxmin)
then
195 wave_act(iw,k:levs+1) = 0.0
197 cdf2(iw) = cxoro(iw)*cxoro(iw) -c2f2(iw)
198 if ( cdf2(iw) < cxmin2) wave_act(iw,k:levs+1) = 0.0
200 if ( wave_act(iw,k) <= 0.0) cycle
204 kzw2 = bv2/cdf2(iw) - akx2(iw)
206 if (kzw2 < mkz2min)
then
207 wave_act(iw,k:levs+1) = 0.0
218 betadis = cdf2(iw) / (cx*cx+c2f2(iw))
219 betam = 1.0 / (1.0+betadis)
223 etws = wrms(iw,k-1)*rhofac * kzw/akzw(iw,k-1)
225 kturb = ktur(k)+pkdis(j,k-1)
226 wfim = kturb*kzw2 +rayf
228 cdf1 = sqrt(cdf2(iw))
229 wfdm = wfim/(kxw*cdf1)*betam
230 wfdt = wfit/(kxw*cdf1)*betat
231 kzi = 2.*kzw*(wfdm+wfdt)*dzmet
235 cx2sat = linsat2*cdf2(iw)
237 if (etwk > cx2sat)
then
238 kds = kxw*cdf1*rhp2/kzw3
241 wfdm = wfim/(kxw*cdf1)
242 kzi = 2.*kzw*(wfdm + wfdm)*dzmet
243 etwk = cx2sat*exp(-kzi)
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)
258 tauz(k) = sum( tau_sp(:,k)*wave_act(:,k) )
259 rms_wind(k) = sum( wrms(:,k)*wave_act(:,k) )
261 pkdis(j,k) = sum(wkdis(:,k)*wave_act(:,k))+rms_wind(k)*rtau
263 if (pkdis(j,k) > kedmax) pkdis(j,k) = kedmax
268 tauz(k) = sum(tau_sp(:,k)*wave_act(:,k))
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)
276 taud(i,k) = ( tauz(k+1) - tauz(k))*grav/del(j,k)
286 subroutine oro_meanflow_v0(nz, nzi, u1, v1, t1, pint, pmid,
287 & delp, rho, bn2, uzi, rhoi, ktur, kalp, dzi, xn, yn)
293 real,
dimension(nz ) :: u1, v1, t1, delp, rho, pmid
294 real,
dimension(nz ) :: bn2
295 real,
dimension(nz+1) :: pint
299 real,
dimension(nz+1) :: dzi, uzi, rhoi, ktur, kalp
303 real :: ui, vi, ti, uz, vz, shr2, rdz, kamp
304 real :: zgrow, zmet, rdpm, ritur, kmol, w1
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
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
325 shr2 = rdz*rdz*(max(uz*uz+vz*vz, dw2min))
326 zmet = -hps*alog(pint(k)*rpspa)
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
338 rhoi(k) = rdi*pint(k)/t1(k+1)
339 dzi(k) = rgrav*delp(k)/rhoi(k)
344 rhoi(k) = rhoi(k-1)*.5
350 subroutine ugwpv0_tofd1d(levs, sigflt, elvmax, zsurf,
351 & zpbl, u, v, zmid, utofd, vtofd, epstofd, krf_tofd)
352 use machine ,
only : kind_phys
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
367 real(kind_phys) :: sghmax = 5.
368 real(kind_phys) :: sgh2, ekin, zdec, rzdec, umag, zmet
369 real(kind_phys) :: zarg, ztexp, krf
371 utofd =0.0 ; vtofd = 0.0
372 epstofd =0.0 ; krf_tofd =0.0
374 zdec = max(n_tofd*sigflt, zpbl)
375 zdec = min(ze_tofd, zdec)
377 sgh2 = max(sigflt*sigflt, sghmax*sghmax)
381 if (zmet > ztop_tofd) cycle
382 ekin = u(k)*u(k) + v(k)*v(k)
385 ztexp = exp(-zarg*sqrt(zarg))
386 krf = const_tofd* a12_tofd *sgh2* zmet ** (-1.2) *ztexp
390 epstofd(k) = rcpd2*krf*ekin