CCPP SciDoc v7.0.0  v7.0.0
Common Community Physics Package Developed at DTC
Loading...
Searching...
No Matches
gwdps.f
1!> \file gwdps.f
2!! This file is the parameterization of orographic gravity wave
3!! drag and mountain blocking.
4
5!> This module contains the CCPP-compliant orographic gravity wave dray scheme.
6!> This version of gwdps is called from the unified_ugwp CCPP scheme
7 module gwdps
8
9 contains
10
11!> \defgroup gfs_gwdps GFS gwdps Module
12!! This subroutine includes orographic gravity wave drag and mountain
13!! blocking.
14!!
15!> The time tendencies of zonal and meridional wind are altered to
16!! include the effect of mountain induced gravity wave drag from
17!! subgrid scale orography including convective breaking, shear
18!! breaking and the presence of critical levels.
19!!
20!! \section arg_table_gwdps_run Argument Table
21!! \htmlinclude gwdps_run.html
22!!
23!> \section gen_gwdps GFS Orographic GWD Scheme General Algorithm
24!! -# Calculate subgrid mountain blocking
25!! -# Calculate orographic wave drag
26!!
27!! The NWP model gravity wave drag (GWD) scheme in the GFS has two
28!! main components: how the surface stress is computed, and then how
29!! that stress is distributed over a vertical column where it may
30!! interact with the models momentum. Each of these depends on the
31!! large scale environmental atmospheric state and assumptions about
32!! the sub-grid scale processes. In Alpert GWD (1987) based on linear,
33!! two-dimensional non-rotating, stably stratified flow over a mountain ridge,
34!! sub-grid scale gravity wave motions are assumed which propagate away
35!! from the mountain. Described in Alpert (1987), the flux measured over
36!! a "low level" vertically averaged layer, in the atmosphere defines a base
37!! level flux. "Low level" was taken to be the first 1/3 of the troposphere
38!! in the 1987 implementation. This choice was meant to encompass a thick
39!! low layer for vertical averages of the environmental (large scale) flow
40!! quantities. The vertical momentum flux or gravity wave stress in a
41!! grid box due to a single mountain is given as in Pierrehumbert(1986)
42!! \cite pierrehumbert_1986 :
43!! \f[
44!! \tau = \frac {\rho \: U^{3}\: G(F_{r})} {\Delta X \; N }
45!! \f]
46!! where \f$ \Delta X \f$ is a grid increment, N is the Brunt Viasala frequency
47!! \f[
48!! N(\sigma) = \frac{-g \: \sigma \:
49!! \frac{\partial\Theta}{\partial\sigma}}{\Theta \:R \:T}
50!! \f]
51!! The environmental variables are calculated from a mass weighted vertical
52!! average over a base layer. \f$G(F_{r})\f$ is a monotonically increasing
53!! function of Froude number :
54!! \f[
55!! F_{r} = \frac{N h^{'}}{U}
56!! \f]
57!! where \f$U\f$ is the wind speed calculated as a mass weighted vertical average in
58!! the base layer, and \f$h^{'}\f$, is the vertical displacement caused by the orography
59!! variance. An effective mountain length for the gravity wave processes:
60!! \f[
61!! l^{*} = \frac{\Delta X}{m}
62!! \f]
63!! where \f$m\f$ is the number of mountains in a grid box, can then
64!! be defined to obtain the form of the base level stress
65!! \f[
66!! \tau = \frac {\rho \: U^{3} \: G(F_{r})} {N \;l^{*}}
67!! \f]
68!! giving the stress induced from the surface in a model grid box.
69!! Pierrehumbert(1986) \cite pierrehumbert_1986 gives the form
70!! for the function \f$G(F_{r})\f$ as
71!! \f[
72!! G(F_{r}) = \bar{G}\frac{F^{2}_{r}}{F^{2}_{r}\: + \:a^{2}}
73!! \f]
74!! Where \f$ \bar{G} \f$ is an order unity non-dimensional saturation
75!! flux set to 1 and \f$a\f$ is a function of the mountain aspect ratio also
76!!set to 1 in the 1987 implementation of the GFS GWD. Typical values of
77!! U=10m/s, N=0.01 1/s, l*=100km, and a=1, gives a flux of 1 Pascal and
78!! if this flux is made to go to zero linearly with height then the
79!! decelerations would be about 10/m/s/day which is consistent with
80!! observations in PH.
81!!
82!! In Kim, Moorthi, Alpert's (1998, 2001) GWD currently in GFS operations,
83!! the GWD scheme has the same physical basis as in Alpert (1987) with the addition
84!! of enhancement factors for the amplitude, G, and mountain shape details
85!! in G(Fr) to account for effects from the mountain blocking. A factor,
86!! E m', is an enhancement factor on the stress in the Alpert '87 scheme.
87!! The E ranges from no enhancement to an upper limit of 3, E=E(OA)[1-3],
88!! and is a function of OA, the Orographic Asymmetry defined in Kim and Arakawa (1995)
89!! \cite kim_and_arakawa_1995 as
90!! Orographic Asymmetry (OA):
91!! \f[
92!! OA=\frac{ \bar{x} \; - \;
93!! \sum\limits_{j=1}^{N_{b}} x_{j} \; n_{j} }{\sigma_{x}}
94!! \f]
95!! where \f$N_{b}\f$ is the total number of bottom blocks in the mountain barrier,
96!! \f$ \sigma_{x} \f$ is the standard deviation of the horizontal distance defined by
97!!\f[
98!! \sigma_{x} = \sqrt{ \frac{\sum\limits_{j=1}^{N_{b}}
99!! \; (x_{j} \; - \; \bar{x} )^2}{N_{x}} }
100!!\f]
101!! where \f$N_{x}\f$ is the number of grid intervals for the large scale domain being
102!! considered. So the term, E(OA)m'/ \f$ \Delta X \f$ in Kim's scheme represents
103!! a multiplier on G shown in Alpert's eq (1), where m' is the number of mountains
104!! in a sub-grid scale box. Kim increased the complexity of m' making it a
105!! function of the fractional area of the sub-grid mountain and the asymmetry
106!! and convexity statistics which are found from running a gravity wave
107!! model for a large number of cases:
108!! \f[
109!! m^{'} = C_{m} \Delta X \left[ \frac{1 \; + \;
110!! \sum\limits_{x} L_{h} }{\Delta X} \right]^{OA+1}
111!! \f]
112!! Where, according to Kim, \f$ \sum \frac{L_{h}}{\Delta X} \f$ is
113!! the fractional area covered by the subgrid-scale orography higher than
114!! a critical height \f$ h_{c} = Fr_{c} U_{0}/N_{0} \f$ , over the
115!! "low level" vertically averaged layer, for a grid box with the interval
116!! \f$ \Delta X \f$. Each \f$ L_{n}\f$ is the width of a segment of
117!! orography intersection at the critical height:
118!! \f[
119!! Fr_{0} = \frac{N_{0} \; h^{'}}{U_{0}}
120!! \f]
121!! \f[
122!! G^{'}(OC,Fr_{0}) = \frac{Fr_{0}^{2}}{Fr_{0}^{2} \; + \; a^{2}}
123!! \f]
124!! \f[
125!! a^{2} = \frac{C_{G}}{OC}
126!! \f]
127!! \f[
128!! E(OA, Fr_{0}) = (OA \; + \; 2)^{\delta}
129!! \f]
130!! and
131!! \f[
132!! \delta \; = \; \frac{C_{E} \; Fr_{0}}{Fr_{c}}
133!! \f]
134!! where \f$ Fr_{c} \f$ is as in Alpert.
135!!
136!! This represents a closed scheme, somewhat empirical adjustments
137!! to the original scheme to calculate the surface stress.
138!!
139!! Momentum is deposited by the sub-grid scale gravity waves break due
140!! to the presence of convective mixing assumed to occur when the
141!! minimum Richardson number:
142!!
143!! Orographic Convexity (OC) =
144!! \f[
145!! OC=\frac{ \sum\limits_{j=1}^{N_{x}}
146!! \; (h_{j} \; - \; \bar{h})^4 }{N_{x} \;\sigma_{h}^4}
147!! \f]
148!! and where
149!! \f[
150!! \sigma_{h} = \sqrt{ \frac{\sum\limits_{j=1}^{N_{x}}
151!! \; (h_{j} \; - \; \bar{h} )^2}{N_{x}} }
152!! \f]
153!! This represents a closed scheme, somewhat empirical adjustments
154!! to the original scheme to calculate the surface stress.
155!!
156!! Momentum is deposited by the sub-grid scale gravity waves break due
157!! to the presence of convective mixing assumed to occur when
158!! the minimum Richardson number:
159!! \f[
160!! Ri_{m} = \frac{Ri(1 \; - \; Fr)}{(1 \; + \; \sqrt{Ri}Fr)^2}
161!! \f]
162!! Is less than 1/4 Or if critical layers are encountered in a layer
163!! the the momentum flux will vanish. The critical layer is defined
164!! when the base layer wind becomes perpendicular to the environmental
165!! wind. Otherwise, wave breaking occurs at a level where the amplification
166!! of the wave causes the local Froude number or similarly a truncated
167!! (first term of the) Scorer parameter, to be reduced below a critical
168!! value by the saturation hypothesis (Lindzen). This is done through
169!! eq 1 which can be written as
170!! \f[
171!! \tau = \rho U N k h^{'2}
172!! \f]
173!! For small Froude number this is discretized in the vertical so at each
174!! level the stress is reduced by ratio of the Froude or truncated Scorer
175!! parameter, \f$ \frac{U^{2}}{N^{2}} = \frac{N \tau_{l-1}}{\rho U^{3} k} \f$ ,
176!! where the stress is from the layer below beginning with that found near
177!! the surface. The respective change in momentum is applied in
178!! that layer building up from below.
179!!
180!! An amplitude factor is part of the calibration of this scheme which is
181!! a function of the model resolution and the vertical diffusion. This
182!! is because the vertical diffusion and the GWD account encompass
183!! similar physical processes. Thus, one needs to run the model over
184!! and over for various amplitude factors for GWD and vertical diffusion.
185!!
186!! In addition, there is also mountain blocking from lift and frictional
187!! forces. Improved integration between how the GWD is calculated and
188!! the mountain blocking of wind flow around sub-grid scale orography
189!! is underway at NCEP. The GFS already has convectively forced GWD
190!! an independent process.
191!!
192!> \section det_gwdps GFS Orographic GWD Scheme Detailed Algorithm
193!> @{
194 subroutine gwdps_run( &
195 & IM,KM,A,B,C,U1,V1,T1,Q1,KPBL, &
196 & PRSI,DEL,PRSL,PRSLK,PHII, PHIL,DELTIM,KDT, &
197 & HPRIME,OC,OA4,CLX4,THETA,SIGMA,GAMMA,ELVMAX, &
198 & DUSFC,DVSFC,dtaux2d_ms,dtauy2d_ms,dtaux2d_bl, &
199 & dtauy2d_bl,dusfc_ms,dvsfc_ms,dusfc_bl,dvsfc_bl, &
200 & G, CP, RD, RV, IMX, &
201 & nmtvr, cdmbgwd, me, lprnt, ipr, rdxzb, ldiag_ugwp, &
202 & errmsg, errflg)
203
204!
205! ********************************************************************
206! -----> I M P L E M E N T A T I O N V E R S I O N <----------
207!
208! --- Not in this code -- History of GWDP at NCEP----
209! ---------------- -----------------------
210! VERSION 3 MODIFIED FOR GRAVITY WAVES, LOCATION: .FR30(V3GWD) *J*
211!--- 3.1 INCLUDES VARIABLE SATURATION FLUX PROFILE CF ISIGST
212!--- 3.G INCLUDES PS COMBINED W/ PH (GLAS AND GFDL)
213!----- ALSO INCLUDED IS RI SMOOTH OVER A THICK LOWER LAYER
214!----- ALSO INCLUDED IS DECREASE IN DE-ACC AT TOP BY 1/2
215!----- THE NMC GWD INCORPORATING BOTH GLAS(P&S) AND GFDL(MIGWD)
216!----- MOUNTAIN INDUCED GRAVITY WAVE DRAG
217!----- CODE FROM .FR30(V3MONNX) FOR MONIN3
218!----- THIS VERSION (06 MAR 1987)
219!----- THIS VERSION (26 APR 1987) 3.G
220!----- THIS VERSION (01 MAY 1987) 3.9
221!----- CHANGE TO FORTRAN 77 (FEB 1989) --- HANN-MING HENRY JUANG
222!----- 20070601 ELVMAX bug fix (*j*)
223!
224! VERSION 4
225! ----- This code -----
226!
227!----- MODIFIED TO IMPLEMENT THE ENHANCED LOW TROPOSPHERIC GRAVITY
228!----- WAVE DRAG DEVELOPED BY KIM AND ARAKAWA(JAS, 1995).
229! Orographic Std Dev (hprime), Convexity (OC), Asymmetry (OA4)
230! and Lx (CLX4) are input topographic statistics needed.
231!
232!----- PROGRAMMED AND DEBUGGED BY HONG, ALPERT AND KIM --- JAN 1996.
233!----- debugged again - moorthi and iredell --- may 1998.
234!-----
235! Further Cleanup, optimization and modification
236! - S. Moorthi May 98, March 99.
237!----- modified for usgs orography data (ncep office note 424)
238! and with several bugs fixed - moorthi and hong --- july 1999.
239!
240!----- Modified & implemented into NRL NOGAPS
241! - Young-Joon Kim, July 2000
242!-----
243! VERSION lm MB (6): oz fix 8/2003
244! ----- This code -----
245!
246!------ Changed to include the Lott and Miller Mtn Blocking
247! with some modifications by (*j*) 4/02
248! From a Principal Coordinate calculation using the
249! Hi Res 8 minute orography, the Angle of the
250! mtn with that to the East (x) axis is THETA, the slope
251! parameter SIGMA. The anisotropy is in GAMMA - all are input
252! topographic statistics needed. These are calculated off-line
253! as a function of model resolution in the fortran code ml01rg2.f,
254! with script mlb2.sh. (*j*)
255!----- gwdps_mb.f version (following lmi) elvmax < hncrit (*j*)
256! MB3a expt to enhance elvmax mtn hgt see sigfac & hncrit
257! gwdps_GWDFIX_v6.f FIXGWD GF6.0 20070608 sigfac=4.
258!-----
259!----------------------------------------------------------------------C
260! USE
261! ROUTINE IS CALLED FROM GBPHYS (AFTER CALL TO MONNIN)
262!
263! PURPOSE
264! USING THE GWD PARAMETERIZATIONS OF PS-GLAS AND PH-
265! GFDL TECHNIQUE. THE TIME TENDENCIES OF U V
266! ARE ALTERED TO INCLUDE THE EFFECT OF MOUNTAIN INDUCED
267! GRAVITY WAVE DRAG FROM SUB-GRID SCALE OROGRAPHY INCLUDING
268! CONVECTIVE BREAKING, SHEAR BREAKING AND THE PRESENCE OF
269! CRITICAL LEVELS
270!
271! INPUT
272! A(IM,KM) NON-LIN TENDENCY FOR V WIND COMPONENT
273! B(IM,KM) NON-LIN TENDENCY FOR U WIND COMPONENT
274! C(IM,KM) NON-LIN TENDENCY FOR TEMPERATURE
275! U1(IM,KM) ZONAL WIND M/SEC AT T0-DT
276! V1(IM,KM) MERIDIONAL WIND M/SEC AT T0-DT
277! T1(IM,KM) TEMPERATURE DEG K AT T0-DT
278! Q1(IM,KM) SPECIFIC HUMIDITY AT T0-DT
279!
280! DELTIM TIME STEP SECS
281! SI(N) P/PSFC AT BASE OF LAYER N
282! SL(N) P/PSFC AT MIDDLE OF LAYER N
283! DEL(N) POSITIVE INCREMENT OF P/PSFC ACROSS LAYER N
284! KPBL(IM) is the index of the top layer of the PBL
285! ipr & lprnt for diagnostics
286!
287! OUTPUT
288! A, B AS AUGMENTED BY TENDENCY DUE TO GWDPS
289! OTHER INPUT VARIABLES UNMODIFIED.
290! revision log:
291! May 2013 J. Wang change cleff back to opn setting
292! Jan 2014 J. Wang merge Henry and Fangin's dissipation heat in gfs to nems
293!
294!
295! ********************************************************************
296 USE machine , ONLY : kind_phys
297 implicit none
298!
299 ! Interface variables
300 integer, intent(in) :: im, km, imx, kdt, ipr, me
301 integer, intent(in) :: KPBL(:) ! Index for the PBL top layer!
302 real(kind=kind_phys), intent(in) :: &
303 & deltim, g, cp, rd, rv, cdmbgwd(:)
304 real(kind=kind_phys), intent(inout) :: &
305 & a(:,:), b(:,:), c(:,:)
306 real(kind=kind_phys), intent(in) :: &
307 & u1(:,:), v1(:,:), t1(:,:), &
308 & q1(:,:), prsi(:,:), del(:,:), &
309 & prsl(:,:), prslk(:,:), phil(:,:), &
310 & phii(:,:)
311 real(kind=kind_phys), intent(in) :: &
312 & oc(:), oa4(:,:), clx4(:,:), hprime(:)
313 real(kind=kind_phys), intent(inout) :: elvmax(:)
314 real(kind=kind_phys), intent(in) :: &
315 & theta(:), sigma(:), gamma(:)
316 real(kind=kind_phys), intent(inout) :: dusfc(:), dvsfc(:), &
317 & rdxzb(:)
318 real(kind=kind_phys), intent(inout), optional :: dtaux2d_ms(:,:), &
319 & dtauy2d_ms(:,:), dtaux2d_bl(:,:), &
320 & dtauy2d_bl(:,:)
321 real(kind=kind_phys), intent(inout), optional :: dusfc_ms(:), &
322 & dvsfc_ms(:), dusfc_bl(:), dvsfc_bl(:)
323 integer, intent(in) :: nmtvr
324 logical, intent(in) :: lprnt
325 logical, intent(in) :: ldiag_ugwp
326 character(len=*), intent(out) :: errmsg
327 integer, intent(out) :: errflg
328!
329 ! Local variables
330! for lm mtn blocking
331 real(kind=kind_phys) wk(im)
332 real(kind=kind_phys) bnv2lm(im,km),pe(im),ek(im),zbk(im),up(im)
333 real(kind=kind_phys) db(im,km),ang(im,km),uds(im,km)
334 real(kind=kind_phys) zlen, rtrm, phiang, cdmb, dbim, zr, cdmbo4
335 real(kind=kind_phys) eng0, eng1
336!
337! Some constants
338!
339 real(kind=kind_phys) pi, dw2min, rimin, ric, bnv2min, efmin
340 &, efmax,hpmax,hpmin, rad_to_deg, deg_to_rad
341 parameter(pi=3.1415926535897931)
342 parameter(rad_to_deg=180.0/pi, deg_to_rad=pi/180.0)
343 parameter(dw2min=1., rimin=-100., ric=0.25, bnv2min=1.0e-5)
344! PARAMETER (EFMIN=0.0, EFMAX=10.0, hpmax=200.0)
345 parameter(efmin=0.0, efmax=10.0, hpmax=2400.0, hpmin=1.0)
346!
347 real(kind=kind_phys) frc, ce, ceofrc, frmax, cg, gmax
348 &, veleps, factop, rlolev, rdi
349! &, CRITAC, VELEPS, FACTOP, RLOLEV, RDI
350 parameter(frc=1.0, ce=0.8, ceofrc=ce/frc, frmax=100., cg=0.5)
351 parameter(gmax=1.0, veleps=1.0, factop=0.5)
352! parameter (GMAX=1.0, CRITAC=5.0E-4, VELEPS=1.0, FACTOP=0.5)
353 parameter(rlolev=50000.0)
354! parameter (RLOLEV=500.0)
355! parameter (RLOLEV=0.5)
356!
357 real(kind=kind_phys) dpmin,hminmt,hncrit,minwnd,sigfac
358! --- for lm mtn blocking
359! parameter (cdmb = 1.0) !< non-dim sub grid mtn drag Amp (*j*)
360 parameter(hncrit=8000.) !< Max value in meters for ELVMAX (*j*)
361! hncrit set to 8000m and sigfac added to enhance elvmax mtn hgt
362 parameter(sigfac=4.0) !< MB3a expt test for ELVMAX factor (*j*)
363 parameter(hminmt=50.) !< min mtn height (*j*)
364 parameter(minwnd=0.1) !< min wind component (*j*)
365
366! parameter (dpmin=00.0) !< Minimum thickness of the reference layer
367!! parameter (dpmin=05.0) !< Minimum thickness of the reference layer
368! parameter (dpmin=20.0) !< Minimum thickness of the reference layer
369 !< in centibars
370 parameter(dpmin=5000.0) !< Minimum thickness of the reference layer
371 !< in Pa
372!
373 real(kind=kind_phys) fdir
374 integer mdir
375 parameter(mdir=8, fdir=mdir/(pi+pi))
376 integer nwdir(mdir)
377 data nwdir/6,7,5,8,2,3,1,4/
378 save nwdir
379!
380 LOGICAL ICRILV(IM)
381!
382!---- MOUNTAIN INDUCED GRAVITY WAVE DRAG
383!
384 real(kind=kind_phys) taub(im), xn(im), yn(im), ubar(im) &
385 &, vbar(im), ulow(im), oa(im), clx(im) &
386 &, roll(im), uloi(im) &
387 &, dtfac(im), xlinv(im), delks(im)
388! &, DTFAC(IM), XLINV(IM), DELKS(IM), DELKS1(IM)
389!
390 real(kind=kind_phys) bnv2(im,km), taup(im,km+1), ri_n(im,km) &
391 &, taud(im,km), ro(im,km), vtk(im,km) &
392 &, vtj(im,km), scor(im), velco(im,km-1) &
393 &, bnv2bar(im), cdsigohp(im)
394!
395! real(kind=kind_phys) VELKO(KM-1)
396 integer kref(IM), kint(im), iwk(im), ipt(im)
397! for lm mtn blocking
398 integer iwklm(im)
399! integer kreflm(IM), iwklm(im)
400 integer idxzb(im), ktrial, klevm1
401!
402 real(kind=kind_phys) gor, gocp, fv, gr2, bnv, fr &
403 &, brvf, cleff, tem, tem1, tem2, temc, temv&
404 &, wdir, ti, rdz, dw2, shr2, bvf2 &
405 &, rdelks, efact, coefm, gfobnv, onebg &
406 &, scork, rscor, hd, fro, rim, sira &
407 &, dtaux, dtauy, pkp1log, pklog &
408 &, cosang, sinang, cos2a, sin2a, oneocpdt
409!
410 integer kmm1, kmm2, lcap, lcapp1, kbps, kbpsp1,kbpsm1 &
411 &, kmps, idir, nwd, i, j, k, klcap, kp1, kmpbl, npt, npr, kmll
412! &, kmll,kmds,ihit,jhit
413!
414 ! Initialize CCPP error handling variables
415 errmsg = ''
416 errflg = 0
417!
418! parameter (cdmb = 1.0) ! non-dim sub grid mtn drag Amp (*j*)
419! non-dim sub grid mtn drag Amp (*j*)
420! cdmb = 1.0/float(IMX/192)
421! cdmb = 192.0/float(IMX)
422 cdmb = 4.0 * 192.0/float(imx)
423 if (cdmbgwd(1) >= 0.0) cdmb = cdmb * cdmbgwd(1)
424 cdmbo4 = 0.25 * cdmb
425!
426 npr = 0
427!
428 DO k = 1, km
429 DO i = 1, im
430 db(i,k) = 0.
431 ang(i,k) = 0.
432 uds(i,k) = 0.
433 ENDDO
434 ENDDO
435!
436 rdi = 1.0 / rd
437 onebg = 1.0 / g
438 gor = g/rd
439 gr2 = g*gor
440 gocp = g/cp
441 fv = rv/rd - 1
442 oneocpdt = 1.0 / (cp*deltim)
443!
444! NCNT = 0
445 kmm1 = km - 1
446 kmm2 = km - 2
447 lcap = km
448 lcapp1 = lcap + 1
449!
450 rdxzb(:) = 0
451!
452 IF ( nmtvr == 14) then
453! ---- for lm and gwd calculation points
454 ipt = 0
455 npt = 0
456 DO i = 1,im
457 IF (elvmax(i) > hminmt .and. hprime(i) > hpmin) then
458 npt = npt + 1
459 ipt(npt) = i
460! if (lprnt .and. ipr == i) npr = npt
461 ENDIF
462 ENDDO
463 IF (npt == 0) RETURN ! No gwd/mb calculation done!
464!
465! if (lprnt) print *,' npt=',npt,' npr=',npr,' ipr=',ipr,' im=',im
466! &,' ipt(npt)=',ipt(npt)
467!
468! --- iwklm is the level above the height of the of the mountain.
469! --- idxzb is the level of the dividing streamline.
470! INITIALIZE DIVIDING STREAMLINE (DS) CONTROL VECTOR
471!
472 do i=1,npt
473 iwklm(i) = 2
474 idxzb(i) = 0
475! kreflm(i) = 0
476 enddo
477! if (lprnt)
478! & print *,' in gwdps_lm.f npt,IM,IY,km,me=',npt,IM,IY,km,me
479!
480!
481!> --- Subgrid Mountain Blocking Section
482!
483!..............................
484!..............................
485!
486! (*j*) 11/03: test upper limit on KMLL=km - 1
487! then do not need hncrit -- test with large hncrit first.
488! KMLL = km / 2 ! maximum mtnlm height : # of vertical levels / 2
489
490 kmll = kmm1
491
492! --- No mtn should be as high as KMLL (so we do not have to start at
493! --- the top of the model but could do calc for all levels).
494!
495 DO i = 1, npt
496 j = ipt(i)
497 elvmax(j) = min(elvmax(j) + sigfac * hprime(j), hncrit)
498 cdsigohp(i) = cdmbo4 * sigma(j) / hprime(j)
499 ENDDO
500!
501 DO k = 1,kmll
502 DO i = 1, npt
503 j = ipt(i)
504! --- interpolate to max mtn height for index, iwklm(I) wk[gz]
505! --- ELVMAX is limited to hncrit because to hi res topo30 orog.
506 pkp1log = phil(j,k+1) * onebg
507 pklog = phil(j,k) * onebg
508!!!------- ELVMAX(J) = min (ELVMAX(J) + sigfac * hprime(j), hncrit)
509
510 if (elvmax(j) <= pkp1log .and. elvmax(j) >= pklog) THEN
511
512! print *,' in gwdps_lm.f 1 =',k,ELVMAX(j),pklog,pkp1log,me
513! --- wk for diags but can be saved and reused.
514 wk(i) = g * elvmax(j) / (phil(j,k+1) - phil(j,k))
515 iwklm(i) = max(iwklm(i), k+1)
516! print *,' in gwdps_lm.f 2 npt=',npt,i,j,wk(i),iwklm(i),me
517 endif
518!
519! --- find at prsl levels large scale environment variables
520! --- these cover all possible mtn max heights
521 vtj(i,k) = t1(j,k) * (1.0+fv*q1(j,k))
522 vtk(i,k) = vtj(i,k) / prslk(j,k)
523 ro(i,k) = rdi * prsl(j,k) / vtj(i,k) ! DENSITY Kg/M**3
524 ENDDO
525 ENDDO
526!
527! testing for highest model level of mountain top
528!
529! ihit = 2
530! jhit = 0
531! do i = 1, npt
532! j=ipt(i)
533! if ( iwklm(i) .gt. ihit ) then
534! ihit = iwklm(i)
535! jhit = j
536! endif
537! enddo
538! print *, ' mb: kdt,max(iwklm),jhit,phil,me=',
539! & kdt,ihit,jhit,phil(jhit,ihit),me
540
541 klevm1 = kmll - 1
542 DO k = 1, klevm1
543 kp1 = k + 1
544 DO i = 1, npt
545 j = ipt(i)
546 rdz = g / (phil(j,kp1) - phil(j,k))
547! --- Brunt-Vaisala Frequency
548!> - Compute Brunt-Vaisala Frequency \f$N\f$.
549 bnv2lm(i,k) = (g+g) * rdz * (vtk(i,kp1) - vtk(i,k))
550 & / (vtk(i,kp1) + vtk(i,k))
551 bnv2lm(i,k) = max( bnv2lm(i,k), bnv2min )
552 ENDDO
553 ENDDO
554! print *,' in gwdps_lm.f 3 npt=',npt,j,RDZ,me
555!
556 DO i = 1, npt
557 j = ipt(i)
558 delks(i) = 1.0 / (prsi(j,1) - prsi(j,iwklm(i)))
559! DELKS1(I) = 1.0 / (PRSI(J,1) - PRSL(J,iwklm(i)))
560 ubar(i) = 0.0
561 vbar(i) = 0.0
562 roll(i) = 0.0
563 pe(i) = 0.0
564 ek(i) = 0.0
565 bnv2bar(i) = (prsi(j,1)-prsl(j,1)) * delks(i) * bnv2lm(i,1)
566 ENDDO
567
568! --- find the dividing stream line height
569! --- starting from the level above the max mtn downward
570! --- iwklm(i) is the k-index of mtn elvmax elevation
571!> - Find the dividing streamline height starting from the level above
572!! the maximum mountain height and processing downward.
573! DO Ktrial = KMLL, 1, -1
574! DO I = 1, npt
575! IF ( Ktrial < iwklm(I) .and. kreflm(I) == 0 ) then
576! kreflm(I) = Ktrial
577! ENDIF
578! ENDDO
579! ENDDO
580! print *,' in gwdps_lm.f 4 npt=',npt,kreflm(npt),me
581!
582! --- in the layer kreflm(I) to 1 find PE (which needs N, ELVMAX)
583! --- make averages, guess dividing stream (DS) line layer.
584! --- This is not used in the first cut except for testing and
585! --- is the vert ave of quantities from the surface to mtn top.
586!
587 DO i = 1, npt
588 DO k = 1, iwklm(i)-1
589 j = ipt(i)
590 rdelks = del(j,k) * delks(i)
591 ubar(i) = ubar(i) + rdelks * u1(j,k) ! trial Mean U below
592 vbar(i) = vbar(i) + rdelks * v1(j,k) ! trial Mean V below
593 roll(i) = roll(i) + rdelks * ro(i,k) ! trial Mean RO below
594 if (k < iwklm(i)-1) then
595 rdelks = (prsl(j,k)-prsl(j,k+1)) * delks(i)
596 else
597 rdelks = (prsl(j,k)-prsi(j,k+1)) * delks(i)
598 endif
599 bnv2bar(i) = bnv2bar(i) + bnv2lm(i,k) * rdelks
600! --- these vert ave are for diags, testing and GWD to follow (*j*).
601 ENDDO
602 ENDDO
603! print *,' in gwdps_lm.f 5 =',i,kreflm(npt),BNV2bar(npt),me
604!
605! --- integrate to get PE in the trial layer.
606! --- Need the first layer where PE>EK - as soon as
607! --- IDXZB is not 0 we have a hit and Zb is found.
608!
609 DO i = 1, npt
610 j = ipt(i)
611 DO k = iwklm(i), 1, -1
612 phiang = atan2(v1(j,k),u1(j,k))*rad_to_deg
613 ang(i,k) = ( theta(j) - phiang )
614 if ( ang(i,k) > 90. ) ang(i,k) = ang(i,k) - 180.
615 if ( ang(i,k) < -90. ) ang(i,k) = ang(i,k) + 180.
616 ang(i,k) = ang(i,k) * deg_to_rad
617!
618!> - Compute wind speed UDS
619!!\f[
620!! UDS=\max(\sqrt{U1^2+V1^2},minwnd)
621!!\f]
622!! where \f$ minwnd=0.1 \f$, \f$U1\f$ and \f$V1\f$ are zonal and
623!! meridional wind components of model layer wind.
624
625 uds(i,k) =
626 & max(sqrt(u1(j,k)*u1(j,k) + v1(j,k)*v1(j,k)), minwnd)
627! --- Test to see if we found Zb previously
628 IF (idxzb(i) == 0 ) then
629 pe(i) = pe(i) + bnv2lm(i,k) * (g*elvmax(j) - phil(j,k))
630 & * (phii(j,k+1) - phii(j,k))
631 & * (onebg*onebg)
632! --- KE
633! --- Wind projected on the line perpendicular to mtn range, U(Zb(K)).
634! --- kenetic energy is at the layer Zb
635! --- THETA ranges from -+90deg |_ to the mtn "largest topo variations"
636 up(i) = uds(i,k) * cos(ang(i,k))
637 ek(i) = 0.5 * up(i) * up(i)
638
639! --- Dividing Stream lime is found when PE =exceeds EK.
640 IF (pe(i) >= ek(i)) THEN
641 idxzb(i) = k
642 rdxzb(j) = real(k,kind=kind_phys)
643 ENDIF
644! --- Then mtn blocked flow is between Zb=k(IDXZB(I)) and surface
645!
646!> - The dividing streamline height (idxzb), of a subgrid scale
647!! obstable, is found by comparing the potential (PE) and kinetic
648!! energies (EK) of the upstream large scale wind and subgrid scale air
649!! parcel movements. the dividing streamline is found when
650!! \f$PE\geq EK\f$. Mountain-blocked flow is defined to exist between
651!! the surface and the dividing streamline height (\f$h_d\f$), which
652!! can be found by solving an integral equation for \f$h_d\f$:
653!!\f[
654!! \frac{U^{2}(h_{d})}{2}=\int_{h_{d}}^{H} N^{2}(z)(H-z)dz
655!!\f]
656!! where \f$H\f$ is the maximum subgrid scale elevation within the grid
657!! box of actual orography, \f$h\f$, obtained from the GTOPO30 dataset
658!! from the U.S. Geological Survey.
659 ENDIF
660 ENDDO
661 ENDDO
662!
663! print *,' in gwdps_lm.f 6 =',phiang,THETA(ipt(npt)),me
664! print *,' in gwdps_lm.f 7 =',IDXZB(npt),PE(npt)
665!
666! if (lprnt .and. npr .gt. 0) then
667! print *,' BNV2bar,BNV2lm=',bnv2bar(npr),BNV2lm(npr,1:klevm1)
668! print *,' npr,IDXZB,UDS=',npr,IDXZB(npr),UDS(npr,:)
669! print *,' PE,UP,EK=',PE(npr),UP(npr),EK(npr)
670! endif
671!
672 DO i = 1, npt
673 j = ipt(i)
674! --- Calc if N constant in layers (Zb guess) - a diagnostic only.
675 zbk(i) = elvmax(j)
676 & - sqrt(ubar(i)*ubar(i) + vbar(i)*vbar(i))/bnv2bar(i)
677 ENDDO
678!
679! if (lprnt .and. npr .gt. 0) then
680! print *,' iwklm,ZBK=',iwklm(npr),ZBK(npr),IDXZB(npr)
681! print *,' Zb=',PHIL(ipr),IDXZB(npr))/G
682! print *,' in gwdps_lm.f 8 npt =',npt,ZBK(npt),UP(npt),me
683! endif
684!
685! --- The drag for mtn blocked flow
686!
687 DO i = 1, npt
688 j = ipt(i)
689 zlen = 0.
690! print *,' in gwdps_lm.f 9 =',i,j,IDXZB(i),me
691 IF (idxzb(i) > 0) then
692 DO k = idxzb(i), 1, -1
693 IF (phil(j,idxzb(i)) > phil(j,k)) then
694
695!> - Calculate \f$ZLEN\f$, which sums up a number of contributions of
696!! elliptic obstables.
697!!\f[
698!! ZLEN=\sqrt{[\frac{h_{d}-z}{z+h'}]}
699!!\f]
700!! where \f$z\f$ is the height, \f$h'\f$ is the orographic standard
701!! deviation (HPRIME).
702 zlen = sqrt( (phil(j,idxzb(i)) - phil(j,k))
703 & / (phil(j,k ) + g*hprime(j)) )
704! --- lm eq 14:
705!> - Calculate the drag coefficient to vary with the aspect ratio of
706!! the obstable as seen by the incident flow (see eq.14 in Lott and
707!! Miller (1997) \cite lott_and_miller_1997)
708!!\f[
709!! R=\frac{\cos^{2}\psi+\gamma\sin^{2}\psi}{\gamma\cos^{2}\psi+\sin^{2}\psi}
710!!\f]
711!! where \f$\psi\f$, which is derived from THETA, is the angle between
712!! the incident flow direction and the normal ridge direcion.
713!! \f$\gamma\f$ is the orographic anisotropy (GAMMA).
714
715 cosang = cos(ang(i,k))
716 sinang = sin(ang(i,k))
717 cos2a = cosang * cosang
718 sin2a = sinang * sinang
719 tem = cos2a + gamma(j)*sin2a
720 ! Here Rtrm is 1.0/R
721 ! --------------------
722 if (abs(tem) > 1.e-06) then
723 rtrm = (gamma(j)*cos2a + sin2a) / tem
724 elseif (tem > 0.0) then
725 rtrm = (gamma(j)*cos2a + sin2a) * 1.0e6
726 else
727 rtrm = - (gamma(j)*cos2a + sin2a) * 1.0e6
728 endif
729 zr = max( 2.0 - rtrm, 0. )
730
731! --- (negitive of DB -- see sign at tendency)
732!> - In each model layer below the dividing streamlines, a drag from
733!! the blocked flow is exerted by the obstacle on the large scale flow.
734!! The drag per unit area and per unit height is written (eq.15 in
735!! Lott and Miller (1997) \cite lott_and_miller_1997):
736!!\f[
737!! D_{b}(z)=-C_{d}\max(2-\frac{1}{R},0)\rho\frac{\sigma}{2h'}ZLEN\max(\cos\psi,\gamma\sin\psi)\frac{UDS}{2}
738!!\f]
739!! where \f$C_{d}\f$ is a specified constant, \f$\sigma\f$ is the
740!! orographic slope.
741
742 db(i,k) = cdsigohp(i) * zr * ro(i,k) * zlen
743 & * max(cosang, gamma(j)*sinang) * uds(i,k)
744!
745! if(lprnt .and. i .eq. npr) then
746! print *,' in gwdps_lmi.f 10 npt=',npt,i,j,idxzb(i)
747! &, DBTMP,R' ang=',ang(i,k),' gamma=',gamma(j),' K=',K
748! print *,' in gwdps_lmi.f 11 K=',k,ZLEN,cos(ANG(I,K))
749! print *,' in gwdps_lmi.f 12 DB=',DB(i,k),sin(ANG(I,K))
750! endif
751 endif
752 ENDDO
753! if(lprnt) print *,' @K=1,ZLEN,DBTMP=',K,ZLEN,DBTMP
754 endif
755 ENDDO
756!
757!.............................
758!.............................
759! end mtn blocking section
760!
761 ELSEIF ( nmtvr /= 14) then
762! ---- for mb not present and gwd (nmtvr .ne .14)
763 ipt = 0
764 npt = 0
765 DO i = 1,im
766 IF ( hprime(i) > hpmin ) then
767 npt = npt + 1
768 ipt(npt) = i
769 if (ipr == i) npr = npt
770 ENDIF
771 ENDDO
772 IF (npt == 0) RETURN ! No gwd/mb calculation done!
773!
774! if (lprnt) print *,' NPR=',npr,' npt=',npt,' IPR=',IPR
775! &,' ipt(npt)=',ipt(npt)
776!
777 do i=1,npt
778 idxzb(i) = 0
779 enddo
780 ENDIF
781!
782!.............................
783!.............................
784!
785!>-# Orographic Gravity Wave Drag Section
786 kmpbl = km / 2 ! maximum pbl height : # of vertical levels / 2
787!
788! Scale cleff between IM=384*2 and 192*2 for T126/T170 and T62
789!
790 if (imx > 0) then
791! cleff = 1.0E-5 * SQRT(FLOAT(IMX)/384.0) ! this is inverse of CLEFF!
792! cleff = 1.0E-5 * SQRT(FLOAT(IMX)/192.0) ! this is inverse of CLEFF!
793! cleff = 0.5E-5 * SQRT(FLOAT(IMX)/192.0) ! this is inverse of CLEFF!
794! cleff = 1.0E-5 * SQRT(FLOAT(IMX)/192)/float(IMX/192)
795! cleff = 1.0E-5 / SQRT(FLOAT(IMX)/192.0) ! this is inverse of CLEFF!
796 cleff = 0.5e-5 / sqrt(float(imx)/192.0) ! this is inverse of CLEFF!
797! hmhj for ndsl
798! jw cleff = 0.1E-5 / SQRT(FLOAT(IMX)/192.0) ! this is inverse of CLEFF!
799! cleff = 2.0E-5 * SQRT(FLOAT(IMX)/192.0) ! this is inverse of CLEFF!
800! cleff = 2.5E-5 * SQRT(FLOAT(IMX)/192.0) ! this is inverse of CLEFF!
801 endif
802 if (cdmbgwd(2) >= 0.0) cleff = cleff * cdmbgwd(2)
803!
804 DO k = 1,km
805 DO i =1,npt
806 j = ipt(i)
807 vtj(i,k) = t1(j,k) * (1.0+fv*q1(j,k))
808 vtk(i,k) = vtj(i,k) / prslk(j,k)
809 ro(i,k) = rdi * prsl(j,k) / vtj(i,k) ! DENSITY TONS/M**3
810 taup(i,k) = 0.0
811 ENDDO
812 ENDDO
813 DO k = 1,kmm1
814 kp1 = k + 1
815 DO i =1,npt
816 j = ipt(i)
817 ti = 2.0 / (t1(j,k)+t1(j,kp1))
818 tem = ti / (prsl(j,k)-prsl(j,kp1))
819 rdz = g / (phil(j,kp1) - phil(j,k))
820 tem1 = u1(j,k) - u1(j,kp1)
821 tem2 = v1(j,k) - v1(j,kp1)
822 dw2 = tem1*tem1 + tem2*tem2
823 shr2 = max(dw2,dw2min) * rdz * rdz
824 bvf2 = g*(gocp+rdz*(vtj(i,kp1)-vtj(i,k))) * ti
825 ri_n(i,k) = max(bvf2/shr2,rimin) ! Richardson number
826! Brunt-Vaisala Frequency
827! TEM = GR2 * (PRSL(J,K)+PRSL(J,K+1)) * TEM
828! BNV2(I,K) = TEM * (VTK(I,K+1)-VTK(I,K))/(VTK(I,K+1)+VTK(I,K))
829 bnv2(i,k) = (g+g) * rdz * (vtk(i,kp1)-vtk(i,k))
830 & / (vtk(i,kp1)+vtk(i,k))
831 bnv2(i,k) = max( bnv2(i,k), bnv2min )
832 ENDDO
833 ENDDO
834! print *,' in gwdps_lm.f GWD:14 =',npt,kmm1,bnv2(npt,kmm1)
835!
836! Apply 3 point smoothing on BNV2
837!
838! do k=1,km
839! do i=1,im
840! vtk(i,k) = bnv2(i,k)
841! enddo
842! enddo
843! do k=2,kmm1
844! do i=1,im
845! bnv2(i,k) = 0.25*(vtk(i,k-1)+vtk(i,k+1)) + 0.5*vtk(i,k)
846! enddo
847! enddo
848!
849! Finding the first interface index above 50 hPa level
850!
851 do i=1,npt
852 iwk(i) = 2
853 enddo
854 DO k=3,kmpbl
855 DO i=1,npt
856 j = ipt(i)
857 tem = (prsi(j,1) - prsi(j,k))
858 if (tem < dpmin) iwk(i) = k
859 enddo
860 enddo
861!
862!> - Calculate the reference level index: kref=max(2,KPBL+1). where
863!! KPBL is the index for the PBL top layer.
864 kbps = 1
865 kmps = km
866 DO i=1,npt
867 j = ipt(i)
868 kref(i) = max(iwk(i), kpbl(j)+1 ) ! reference level
869 delks(i) = 1.0 / (prsi(j,1) - prsi(j,kref(i)))
870! DELKS1(I) = 1.0 / (PRSI(J,1) - PRSL(J,kref(I)))
871 ubar(i) = 0.0
872 vbar(i) = 0.0
873 roll(i) = 0.0
874 kbps = max(kbps, kref(i))
875 kmps = min(kmps, kref(i))
876!
877 bnv2bar(i) = (prsi(j,1)-prsl(j,1)) * delks(i) * bnv2(i,1)
878 ENDDO
879! print *,' in gwdps_lm.f GWD:15 =',KBPS,KMPS
880 kbpsp1 = kbps + 1
881 kbpsm1 = kbps - 1
882 DO k = 1,kbps
883 DO i = 1,npt
884 IF (k < kref(i)) THEN
885 j = ipt(i)
886 rdelks = del(j,k) * delks(i)
887 ubar(i) = ubar(i) + rdelks * u1(j,k) ! Mean U below kref
888 vbar(i) = vbar(i) + rdelks * v1(j,k) ! Mean V below kref
889!
890 roll(i) = roll(i) + rdelks * ro(i,k) ! Mean RO below kref
891 if (k < kref(i)-1) then
892 rdelks = (prsl(j,k)-prsl(j,k+1)) * delks(i)
893 else
894 rdelks = (prsl(j,k)-prsi(j,k+1)) * delks(i)
895 endif
896 bnv2bar(i) = bnv2bar(i) + bnv2(i,k) * rdelks
897 ENDIF
898 ENDDO
899 ENDDO
900! print *,' in gwdps_lm.f GWD:15B =',bnv2bar(npt)
901!
902! FIGURE OUT LOW-LEVEL HORIZONTAL WIND DIRECTION AND FIND 'OA'
903!
904! NWD 1 2 3 4 5 6 7 8
905! WD W S SW NW E N NE SE
906!
907!> - Calculate low-level horizontal wind direction, the derived
908!! orographic asymmetry parameter (OA), and the derived Lx (CLX).
909 DO i = 1,npt
910 j = ipt(i)
911 wdir = atan2(ubar(i),vbar(i)) + pi
912 idir = mod(nint(fdir*wdir),mdir) + 1
913 nwd = nwdir(idir)
914 oa(i) = (1-2*int( (nwd-1)/4 )) * oa4(j,mod(nwd-1,4)+1)
915 clx(i) = clx4(j,mod(nwd-1,4)+1)
916 ENDDO
917!
918!-----XN,YN "LOW-LEVEL" WIND PROJECTIONS IN ZONAL
919! & MERIDIONAL DIRECTIONS
920!-----ULOW "LOW-LEVEL" WIND MAGNITUDE - (= U)
921!-----BNV2 BNV2 = N**2
922!-----TAUB BASE MOMENTUM FLUX
923!-----= -(RO * U**3/(N*XL)*GF(FR) FOR N**2 > 0
924!-----= 0. FOR N**2 < 0
925!-----FR FROUDE = N*HPRIME / U
926!-----G GMAX*FR**2/(FR**2+CG/OC)
927!
928!-----INITIALIZE SOME ARRAYS
929!
930 DO i = 1,npt
931 xn(i) = 0.0
932 yn(i) = 0.0
933 taub(i) = 0.0
934 ulow(i) = 0.0
935 dtfac(i) = 1.0
936 icrilv(i) = .false. ! INITIALIZE CRITICAL LEVEL CONTROL VECTOR
937
938!
939!----COMPUTE THE "LOW LEVEL" WIND MAGNITUDE (M/S)
940!
941 ulow(i) = max(sqrt(ubar(i)*ubar(i) + vbar(i)*vbar(i)), 1.0)
942 uloi(i) = 1.0 / ulow(i)
943 ENDDO
944!
945 DO k = 1,kmm1
946 kp1 = k + 1
947 DO i = 1,npt
948 j = ipt(i)
949 velco(i,k) = 0.5 * ((u1(j,k)+u1(j,kp1))*ubar(i)
950 & + (v1(j,k)+v1(j,kp1))*vbar(i))
951 velco(i,k) = velco(i,k) * uloi(i)
952! IF ((VELCO(I,K).LT.VELEPS) .AND. (VELCO(I,K).GT.0.)) THEN
953! VELCO(I,K) = VELEPS
954! ENDIF
955 ENDDO
956 ENDDO
957!
958!
959! find the interface level of the projected wind where
960! low levels & upper levels meet above pbl
961!
962! do i=1,npt
963! kint(i) = km
964! enddo
965! do k = 1,kmm1
966! do i = 1,npt
967! IF (K .GT. kref(I)) THEN
968! if(velco(i,k) .lt. veleps .and. kint(i) .eq. km) then
969! kint(i) = k+1
970! endif
971! endif
972! enddo
973! enddo
974! WARNING KINT = KREF !!!!!!!!!
975 do i=1,npt
976 kint(i) = kref(i)
977 enddo
978!
979! if(lprnt) print *,' ubar=',ubar
980! &,' vbar=',vbar,' ulow=',ulow,' veleps=',veleps
981!
982 DO i = 1,npt
983 j = ipt(i)
984 bnv = sqrt( bnv2bar(i) )
985 fr = bnv * uloi(i) * min(hprime(j),hpmax)
986 fr = min(fr, frmax)
987 xn(i) = ubar(i) * uloi(i)
988 yn(i) = vbar(i) * uloi(i)
989!
990! Compute the base level stress and store it in TAUB
991! CALCULATE ENHANCEMENT FACTOR, NUMBER OF MOUNTAINS & ASPECT
992! RATIO CONST. USE SIMPLIFIED RELATIONSHIP BETWEEN STANDARD
993! DEVIATION & CRITICAL HGT
994!
995!> - Calculate enhancement factor (E),number of mountans (m') and
996!! aspect ratio constant.
997!!\n As in eq.(4.9),(4.10),(4.11) in Kim and Arakawa (1995)
998!! \cite kim_and_arakawa_1995, we define m' and E in such a way that they
999!! depend on the geometry and location of the subgrid-scale orography
1000!! through OA and the nonlinearity of flow above the orography through
1001!! Fr. OC, which is the orographic convexity, and statistically
1002!! determine how protruded (sharp) the subgrid-scale orography is, is
1003!! included in the saturation flux G' in such a way that G' is
1004!! proportional to OC. The forms of E,m' and G' are:
1005!!\f[
1006!! E(OA,F_{r_{0}})=(OA+2)^{\delta}
1007!!\f]
1008!!\f[
1009!! \delta=C_{E}F_{r_{0}}/F_{r_{c}}
1010!!\f]
1011!!\f[
1012!! m'(OA,CLX)=C_{m}\triangle x(1+CLX)^{OA+1}
1013!!\f]
1014!!\f[
1015!! G'(OC,F_{r_{0}})=\frac{F_{r_{0}}^2}{F_{r_{0}}^2+a^{2}}
1016!!\f]
1017!!\f[
1018!! a^{2}=C_{G}OC^{-1}
1019!!\f]
1020!! where \f$F_{r_{c}}(=1)\f$ is the critical Froude number,
1021!! \f$F_{r_{0}}\f$ is the Froude number. \f$C_{E}\f$,\f$C_{m}\f$,
1022!! \f$C_{G}\f$ are constants.
1023
1024!> - Calculate the reference-level drag \f$\tau_{0}\f$ (eq.(4.8) in
1025!! Kim and Arakawa (1995) \cite kim_and_arakawa_1995):
1026!!\f[
1027!! \tau_0=E\frac{m'}{\triangle x}\frac{\rho_{0}U_0^3}{N_{0}}G'
1028!!\f]
1029!! where \f$E\f$,\f$m'\f$, and \f$G'\f$ are the enhancement factor,
1030!! "the number of mountains", and the flux function defined above,
1031!! respectively.
1032
1033 efact = (oa(i) + 2.) ** (ceofrc*fr)
1034 efact = min( max(efact,efmin), efmax )
1035!
1036 coefm = (1. + clx(i)) ** (oa(i)+1.)
1037!
1038 xlinv(i) = coefm * cleff
1039!
1040 tem = fr * fr * oc(j)
1041 gfobnv = gmax * tem / ((tem + cg)*bnv) ! G/N0
1042!
1043 taub(i) = xlinv(i) * roll(i) * ulow(i) * ulow(i)
1044 & * ulow(i) * gfobnv * efact ! BASE FLUX Tau0
1045!
1046! tem = min(HPRIME(I),hpmax)
1047! TAUB(I) = XLINV(I) * ROLL(I) * ULOW(I) * BNV * tem * tem
1048!
1049 k = max(1, kref(i)-1)
1050 tem = max(velco(i,k)*velco(i,k), 0.1)
1051 scor(i) = bnv2(i,k) / tem ! Scorer parameter below ref level
1052 ENDDO
1053! if(lprnt) print *,' taub=',taub
1054!
1055!----SET UP BOTTOM VALUES OF STRESS
1056!
1057 DO k = 1, kbps
1058 DO i = 1,npt
1059 IF (k <= kref(i)) taup(i,k) = taub(i)
1060 ENDDO
1061 ENDDO
1062!
1063! Now compute vertical structure of the stress.
1064!
1065 DO k = kmps, kmm1 ! Vertical Level K Loop!
1066 kp1 = k + 1
1067 DO i = 1, npt
1068!
1069!-----UNSTABLE LAYER IF RI < RIC
1070!-----UNSTABLE LAYER IF UPPER AIR VEL COMP ALONG SURF VEL <=0 (CRIT LAY)
1071!---- AT (U-C)=0. CRIT LAYER EXISTS AND BIT VECTOR SHOULD BE SET (.LE.)
1072!
1073 IF (k >= kref(i)) THEN
1074 icrilv(i) = icrilv(i) .OR. ( ri_n(i,k) < ric)
1075 & .OR. (velco(i,k) <= 0.0)
1076 ENDIF
1077 ENDDO
1078!
1079!> - Compute the drag above the reference level (\f$k\geq kref\f$):
1080!! - Calculate the ratio of the Scorer parameter (\f$R_{scor}\f$).
1081!! \n From a series of experiments, Kim and Arakawa (1995)
1082!! \cite kim_and_arakawa_1995 found that the magnitude of drag divergence
1083!! tends to be underestimated by the revised scheme in low-level
1084!! downstream regions with wave breaking. Therefore, at low levels when
1085!! OA > 0 (i.e., in the "downstream" region) the saturation hypothesis
1086!! is replaced by the following formula based on the ratio of the
1087!! the Scorer parameter:
1088!!\f[
1089!! R_{scor}=\min \left[\frac{\tau_i}{\tau_{i+1}},1\right]
1090!!\f]
1091 DO i = 1,npt
1092 IF (k >= kref(i)) THEN
1093 IF (.NOT.icrilv(i) .AND. taup(i,k) > 0.0 ) THEN
1094 temv = 1.0 / max(velco(i,k), 0.01)
1095! IF (OA(I) .GT. 0. .AND. PRSI(ipt(i),KP1).GT.RLOLEV) THEN
1096 IF (oa(i) > 0. .AND. kp1 < kint(i)) THEN
1097 scork = bnv2(i,k) * temv * temv
1098 rscor = min(1.0, scork / scor(i))
1099 scor(i) = scork
1100 ELSE
1101 rscor = 1.
1102 ENDIF
1103!
1104!> - The drag above the reference level is expressed as:
1105!!\f[
1106!! \tau=\frac{m'}{\triangle x}\rho NUh_d^2
1107!!\f]
1108!! where \f$h_{d}\f$ is the displacement wave amplitude. In the absence
1109!! of wave breaking, the displacement amplitude for the \f$i^{th}\f$
1110!! layer can be expressed using the drag for the layer immediately
1111!! below. Thus, assuming \f$\tau_i=\tau_{i+1}\f$, we can get:
1112!!\f[
1113!! h_{d_i}^2=\frac{\triangle x}{m'}\frac{\tau_{i+1}}{\rho_{i}N_{i}U_{i}}
1114!!\f]
1115
1116 brvf = sqrt(bnv2(i,k)) ! Brunt-Vaisala Frequency
1117! TEM1 = XLINV(I)*(RO(I,KP1)+RO(I,K))*BRVF*VELCO(I,K)*0.5
1118 tem1 = xlinv(i)*(ro(i,kp1)+ro(i,k))*brvf*0.5
1119 & * max(velco(i,k),0.01)
1120 hd = sqrt(taup(i,k) / tem1)
1121 fro = brvf * hd * temv
1122!
1123! RIM is the MINIMUM-RICHARDSON NUMBER BY SHUTTS (1985)
1124!
1125!> - The minimum Richardson number (\f$Ri_{m}\f$) or local
1126!! wave-modified Richardson number, which determines the onset of wave
1127!! breaking, is expressed in terms of \f$R_{i}\f$ and
1128!! \f$F_{r_{d}}=Nh_{d}/U\f$:
1129!!\f[
1130!! Ri_{m}=\frac{Ri(1-Fr_{d})}{(1+\sqrt{Ri}\cdot Fr_{d})^{2}}
1131!!\f]
1132!! see eq.(4.6) in Kim and Arakawa (1995) \cite kim_and_arakawa_1995.
1133
1134 tem2 = sqrt(ri_n(i,k))
1135 tem = 1. + tem2 * fro
1136 rim = ri_n(i,k) * (1.-fro) / (tem * tem)
1137!
1138! CHECK STABILITY TO EMPLOY THE 'SATURATION HYPOTHESIS'
1139! OF LINDZEN (1981) EXCEPT AT TROPOSPHERIC DOWNSTREAM REGIONS
1140!
1141!> - Check stability to employ the 'saturation hypothesis' of Lindzen
1142!! (1981) \cite lindzen_1981 except at tropospheric downstream regions.
1143!! \n Wave breaking occurs when \f$Ri_{m}<Ri_{c}=0.25\f$. Then
1144!! Lindzen's wave saturation hypothesis resets the displacement
1145!! amplitude \f$h_{d}\f$ to that corresponding to \f$Ri_{m}=0.25\f$,
1146!! we obtain the critical \f$h_{d}\f$(or \f$h_{c}\f$) expressed in
1147!! terms of the mean values of \f$U\f$, \f$N\f$, and \f$Ri\f$ (
1148!! eq.(4.7) in Kim and Arakawa (1995) \cite kim_and_arakawa_1995):
1149!!\f[
1150!! h_{c}=\frac{U}{N}\left\{2(2+\frac{1}{\sqrt{Ri}})^{1/2}-(2+\frac{1}{\sqrt{Ri}})\right\}
1151!!\f]
1152!! if \f$Ri_{m}\leq Ri_{c}\f$, obtain \f$\tau\f$ from the drag above
1153!! the reference level by using \f$h_{c}\f$ computed above; otherwise
1154!! \f$\tau\f$ is unchanged (note: scaled by the ratio of the Scorer
1155!! paramter).
1156! ----------------------
1157 IF (rim <= ric .AND.
1158! & (OA(I) .LE. 0. .OR. PRSI(ipt(I),KP1).LE.RLOLEV )) THEN
1159 & (oa(i) <= 0. .OR. kp1 >= kint(i) )) THEN
1160 temc = 2.0 + 1.0 / tem2
1161 hd = velco(i,k) * (2.*sqrt(temc)-temc) / brvf
1162 taup(i,kp1) = tem1 * hd * hd
1163 ELSE
1164 taup(i,kp1) = taup(i,k) * rscor
1165 ENDIF
1166 taup(i,kp1) = min(taup(i,kp1), taup(i,k))
1167 ENDIF
1168 ENDIF
1169 ENDDO
1170 ENDDO
1171!
1172! DO I=1,IM
1173! taup(i,km+1) = taup(i,km)
1174! ENDDO
1175!
1176 IF(lcap <= km) THEN
1177 DO klcap = lcapp1, km+1
1178 DO i = 1,npt
1179 sira = prsi(ipt(i),klcap) / prsi(ipt(i),lcap)
1180 taup(i,klcap) = sira * taup(i,lcap)
1181 ENDDO
1182 ENDDO
1183 ENDIF
1184!
1185! Calculate - (g/p*)*d(tau)/d(sigma) and Decel terms DTAUX, DTAUY
1186!
1187 DO k = 1,km
1188 DO i = 1,npt
1189 taud(i,k) = g * (taup(i,k+1) - taup(i,k)) / del(ipt(i),k)
1190 ENDDO
1191 ENDDO
1192!
1193!------LIMIT DE-ACCELERATION (MOMENTUM DEPOSITION ) AT TOP TO 1/2 VALUE
1194!------THE IDEA IS SOME STUFF MUST GO OUT THE 'TOP'
1195!
1196 DO klcap = lcap, km
1197 DO i = 1,npt
1198 taud(i,klcap) = taud(i,klcap) * factop
1199 ENDDO
1200 ENDDO
1201!
1202!------IF THE GRAVITY WAVE DRAG WOULD FORCE A CRITICAL LINE IN THE
1203!------LAYERS BELOW SIGMA=RLOLEV DURING THE NEXT DELTIM TIMESTEP,
1204!------THEN ONLY APPLY DRAG UNTIL THAT CRITICAL LINE IS REACHED.
1205!
1206 DO k = 1,kmm1
1207 DO i = 1,npt
1208 IF (k > kref(i) .and. prsi(ipt(i),k) >= rlolev) THEN
1209 IF(taud(i,k) /= 0.) THEN
1210 tem = deltim * taud(i,k)
1211 dtfac(i) = min(dtfac(i),abs(velco(i,k)/tem))
1212 ENDIF
1213 ENDIF
1214 ENDDO
1215 ENDDO
1216!
1217! if(lprnt .and. npr > 0) then
1218! print *,' before A=',A(npr,:)
1219! print *,' before B=',B(npr,:)
1220! endif
1221
1222!> - Calculate outputs: A, B, DUSFC, DVSFC (see parameter description).
1223!! - Below the dividing streamline height (k < idxzb), mountain
1224!! blocking(\f$D_{b}\f$) is applied.
1225!! - Otherwise (k>= idxzb), orographic GWD (\f$\tau\f$) is applied.
1226
1227 DO k = 1,km
1228 DO i = 1,npt
1229 j = ipt(i)
1230 taud(i,k) = taud(i,k) * dtfac(i)
1231 dtaux = taud(i,k) * xn(i)
1232 dtauy = taud(i,k) * yn(i)
1233 eng0 = 0.5*(u1(j,k)*u1(j,k)+v1(j,k)*v1(j,k))
1234
1235 if (k < idxzb(i)) then ! --- lm mb (*j*) changes overwrite GWD
1236 ! ---------------------------------------
1237 dbim = db(i,k) / (1.+db(i,k)*deltim)
1238 a(j,k) = - dbim * v1(j,k) + a(j,k)
1239 b(j,k) = - dbim * u1(j,k) + b(j,k)
1240 eng1 = eng0*(1.0-dbim*deltim)*(1.0-dbim*deltim)
1241
1242! if ( ABS(DBIM * U1(J,K)) > .01 )
1243! & print *,' in gwdps_lmi.f KDT=',KDT,I,K,DB(I,K),
1244! & dbim,idxzb(I),U1(J,K),V1(J,K),me
1245
1246 tem1 = dbim * del(j,k)
1247 dusfc(j) = dusfc(j) + onebg * tem1 * u1(j,k)
1248 dvsfc(j) = dvsfc(j) + onebg * tem1 * v1(j,k)
1249 ! Output blocking tendencies if ldiag_ugwp=.true.
1250 if (ldiag_ugwp) then
1251 dtaux2d_bl(j,k) = - dbim * u1(j,k)
1252 dtauy2d_bl(j,k) = - dbim * v1(j,k)
1253 dusfc_bl(j) = dusfc_bl(j) + dtaux2d_bl(j,k) * del(j,k)
1254 dvsfc_bl(j) = dvsfc_bl(j) + dtauy2d_bl(j,k) * del(j,k)
1255 end if
1256 else ! orographic GWD applied
1257 ! ----------------------
1258 a(j,k) = dtauy + a(j,k)
1259 b(j,k) = dtaux + b(j,k)
1260 tem1 = u1(j,k) + dtaux*deltim
1261 tem2 = v1(j,k) + dtauy*deltim
1262 eng1 = 0.5 * (tem1*tem1+tem2*tem2)
1263 dusfc(j) = dusfc(j) - onebg * dtaux * del(j,k)
1264 dvsfc(j) = dvsfc(j) - onebg * dtauy * del(j,k)
1265 ! Output mesoscale GWD tendencies if ldiag_ugwp=.ture.
1266 if (ldiag_ugwp) then
1267 dtaux2d_ms(j,k) = dtaux
1268 dtauy2d_ms(j,k) = dtauy
1269 dusfc_ms(j) = dusfc_ms(j) + dtaux * del(j,k)
1270 dvsfc_ms(j) = dvsfc_ms(j) + dtauy * del(j,k)
1271 end if
1272 endif
1273 c(j,k) = c(j,k) + max(eng0-eng1,0.) * oneocpdt
1274 ENDDO
1275 ENDDO
1276
1277! if (lprnt) then
1278! print *,' in gwdps_lm.f after A=',A(ipr,:)
1279! print *,' in gwdps_lm.f after B=',B(ipr,:)
1280! print *,' DB=',DB(ipr,:)
1281! endif
1282
1283 if (ldiag_ugwp) then
1284 ! Finalize dusfc and dvsfc diagnostics
1285 DO i = 1,npt
1286 j = ipt(i)
1287 dusfc_ms(j) = - onebg * dusfc_ms(j)
1288 dvsfc_ms(j) = - onebg * dvsfc_ms(j)
1289 dusfc_bl(j) = - onebg * dusfc_bl(j)
1290 dvsfc_bl(j) = - onebg * dvsfc_bl(j)
1291 ENDDO
1292 end if
1293!
1294! MONITOR FOR EXCESSIVE GRAVITY WAVE DRAG TENDENCIES IF NCNT>0
1295!
1296! IF(NCNT.GT.0) THEN
1297! IF(LAT.GE.38.AND.LAT.LE.42) THEN
1298!CMIC$ GUARD 37
1299! DO 92 I = 1,IM
1300! IF(IKOUNT.GT.NCNT) GO TO 92
1301! IF(I.LT.319.OR.I.GT.320) GO TO 92
1302! DO 91 K = 1,KM
1303! IF(ABS(TAUD(I,K)) .GT. CRITAC) THEN
1304! IF(I.LE.IM) THEN
1305! IKOUNT = IKOUNT+1
1306! PRINT 123,I,LAT,KDT
1307! PRINT 124,TAUB(I),BNV(I),ULOW(I),
1308! 1 GF(I),FR(I),ROLL(I),HPRIME(I),XN(I),YN(I)
1309! PRINT 124,(TAUD(I,KK),KK = 1,KM)
1310! PRINT 124,(TAUP(I,KK),KK = 1,KM+1)
1311! PRINT 124,(ri_n(I,KK),KK = 1,KM)
1312! DO 93 KK = 1,KMM1
1313! VELKO(KK) =
1314! 1 0.5*((U1(I,KK)+U1(I,KK+1))*UBAR(I)+
1315! 2 (V1(I,KK)+V1(I,KK+1))*VBAR(I))*ULOI(I)
1316!93 CONTINUE
1317! PRINT 124,(VELKO(KK),KK = 1,KMM1)
1318! PRINT 124,(A (I,KK),KK = 1,KM)
1319! PRINT 124,(DTAUY(I,KK),KK = 1,KM)
1320! PRINT 124,(B (I,KK),KK = 1,KM)
1321! PRINT 124,(DTAUX(I,KK),KK = 1,KM)
1322! GO TO 92
1323! ENDIF
1324! ENDIF
1325!91 CONTINUE
1326!92 CONTINUE
1327!CMIC$ END GUARD 37
1328!123 FORMAT(' *** MIGWD PRINT *** I=',I3,' LAT=',I3,' KDT=',I3)
1329!124 FORMAT(2X, 10E13.6)
1330! ENDIF
1331! ENDIF
1332!
1333! print *,' in gwdps_lm.f 18 =',A(ipt(1),idxzb(1))
1334! &, B(ipt(1),idxzb(1)),me
1335 RETURN
1336 end subroutine gwdps_run
1337!> @}
1338 end module gwdps
subroutine gwdps_run(im, km, a, b, c, u1, v1, t1, q1, kpbl, prsi, del, prsl, prslk, phii, phil, deltim, kdt, hprime, oc, oa4, clx4, theta, sigma, gamma, elvmax, dusfc, dvsfc, dtaux2d_ms, dtauy2d_ms, dtaux2d_bl, dtauy2d_bl, dusfc_ms, dvsfc_ms, dusfc_bl, dvsfc_bl, g, cp, rd, rv, imx, nmtvr, cdmbgwd, me, lprnt, ipr, rdxzb, ldiag_ugwp, errmsg, errflg)
Definition gwdps.f:203
This module contains the CCPP-compliant orographic gravity wave dray scheme. This version of gwdps is...
Definition gwdps.f:7