source: LMDZ5/trunk/libf/phylmd/acama_gwd_rando_m.F90 @ 2333

Last change on this file since 2333 was 2333, checked in by lguez, 9 years ago

New parameterization of gravity wave drag due to front/jet systems, by

  1. de la Camara and F. Lott. The new Camara-Lott parameterization

replaces the Hines parameterization so it is activated if not ok_hines
and ok_gwd_rando.

Also changed distribution of phase speeds in FLOTT_GWD_rando, from
uniform to Gaussian. Bug fix in sugwd_strato. Bug fix in the arguments
of the call to add_phys_tend for methane oxydation.

For the new Camara-Lott parameterization, we need to compute relative
vorticity in calfis and pass it as a new argument "rot" to
physiq. Interpolation of relative vorticity to the physics grid is not
optimal for now: it is not weighted by cell areas.

Alvaro de la Camara, Fran\c{}cois Lott

File size: 17.4 KB
Line 
1module ACAMA_GWD_rando_m
2
3  implicit none
4
5contains
6
7  SUBROUTINE ACAMA_GWD_rando(DTIME, pp, plat, tt, uu, vv, rot, &
8       zustr, zvstr, d_u, d_v,east_gwstress,west_gwstress)
9
10    ! Parametrization of the momentum flux deposition due to a discrete
11    ! number of gravity waves.
12    ! Author: F. Lott, A. de la Camara
13    ! July, 24th, 2014
14    ! Gaussian distribution of the source, source is vorticity squared
15    ! Reference: de la Camara and Lott (GRL, 2015, vol 42, 2071-2078 )
16    ! Lott et al (JAS, 2010, vol 67, page 157-170)
17    ! Lott et al (JAS, 2012, vol 69, page 2134-2151)
18
19!  ONLINE:
20    use dimphy, only: klon, klev
21    use assert_m, only: assert
22    include "YOMCST.h"
23    include "clesphys.h"
24!  OFFLINE:
25!   include "dimensions.h"
26!   include "dimphy.h"
27!END DIFFERENCE
28    include "YOEGWD.h"
29
30    ! 0. DECLARATIONS:
31
32    ! 0.1 INPUTS
33    REAL, intent(in)::DTIME ! Time step of the Physics
34    REAL, intent(in):: PP(:, :) ! (KLON, KLEV) Pressure at full levels
35    REAL, intent(in):: ROT(:,:) ! Relative vorticity             
36    REAL, intent(in):: TT(:, :) ! (KLON, KLEV) Temp at full levels
37    REAL, intent(in):: UU(:, :) ! (KLON, KLEV) Zonal wind at full levels
38    REAL, intent(in):: VV(:, :) ! (KLON, KLEV) Merid wind at full levels
39    REAL, intent(in):: PLAT(:) ! (KLON) LATITUDE                   
40
41    ! 0.2 OUTPUTS
42    REAL, intent(out):: zustr(:), zvstr(:) ! (KLON) Surface Stresses
43
44    REAL, intent(inout):: d_u(:, :), d_v(:, :)
45    REAL, intent(inout):: east_gwstress(:, :) !  Profile of eastward stress
46    REAL, intent(inout):: west_gwstress(:, :) !  Profile of westward stress
47    ! (KLON, KLEV) tendencies on winds
48
49    ! O.3 INTERNAL ARRAYS
50    REAL BVLOW(klon)  !  LOW LEVEL BV FREQUENCY
51    REAL ROTBA(KLON),CORIO(KLON)  !  BAROTROPIC REL. VORTICITY AND PLANETARY
52    REAL UZ(KLON, KLEV + 1)
53
54    INTEGER II, JJ, LL
55
56    ! 0.3.0 TIME SCALE OF THE LIFE CYCLE OF THE WAVES PARAMETERIZED
57
58    REAL DELTAT
59
60    ! 0.3.1 GRAVITY-WAVES SPECIFICATIONS
61
62    INTEGER, PARAMETER:: NK = 2, NP = 2, NO = 2, NW = NK * NP * NO
63    INTEGER JK, JP, JO, JW
64    INTEGER, PARAMETER:: NA = 5  !number of realizations to get the phase speed
65    REAL KMIN, KMAX ! Min and Max horizontal wavenumbers
66    REAL CMIN, CMAX ! Min and Max absolute ph. vel.
67    REAL CPHA ! absolute PHASE VELOCITY frequency
68    REAL ZK(NW, KLON) ! Horizontal wavenumber amplitude
69    REAL ZP(NW, KLON) ! Horizontal wavenumber angle
70    REAL ZO(NW, KLON) ! Absolute frequency !
71
72    ! Waves Intr. freq. at the 1/2 lev surrounding the full level
73    REAL ZOM(NW, KLON), ZOP(NW, KLON)
74
75    ! Wave EP-fluxes at the 2 semi levels surrounding the full level
76    REAL WWM(NW, KLON), WWP(NW, KLON)
77
78    REAL RUW0(NW, KLON) ! Fluxes at launching level
79
80    REAL RUWP(NW, KLON), RVWP(NW, KLON)
81    ! Fluxes X and Y for each waves at 1/2 Levels
82
83    INTEGER LAUNCH, LTROP ! Launching altitude and tropo altitude
84
85    REAL XLAUNCH ! Controle the launching altitude
86    REAL XTROP ! SORT of Tropopause altitude
87    REAL RUW(KLON, KLEV + 1) ! Flux x at semi levels
88    REAL RVW(KLON, KLEV + 1) ! Flux y at semi levels
89
90    REAL PRMAX ! Maximum value of PREC, and for which our linear formula
91    ! for GWs parameterisation apply
92
93    ! 0.3.2 PARAMETERS OF WAVES DISSIPATIONS
94
95    REAL RDISS, ZOISEC ! COEFF DE DISSIPATION, SECURITY FOR INTRINSIC FREQ
96    REAL CORSEC ! SECURITY FOR INTRINSIC CORIOLIS
97    REAL RUWFRT,SATFRT
98
99    ! 0.3.3 BACKGROUND FLOW AT 1/2 LEVELS AND VERTICAL COORDINATE
100
101    REAL H0 ! Characteristic Height of the atmosphere
102    REAL DZ ! Characteristic depth of the source!
103    REAL PR, TR ! Reference Pressure and Temperature
104
105    REAL ZH(KLON, KLEV + 1) ! Log-pressure altitude
106
107    REAL UH(KLON, KLEV + 1), VH(KLON, KLEV + 1) ! Winds at 1/2 levels
108    REAL PH(KLON, KLEV + 1) ! Pressure at 1/2 levels
109    REAL PSEC ! Security to avoid division by 0 pressure
110    REAL PHM1(KLON, KLEV + 1) ! 1/Press at 1/2 levels
111    REAL BV(KLON, KLEV + 1) ! Brunt Vaisala freq. (BVF) at 1/2 levels
112    REAL BVSEC ! Security to avoid negative BVF
113
114    !-----------------------------------------------------------------
115
116    ! 1. INITIALISATIONS
117
118    ! 1.1 Basic parameter
119
120    ! Are provided from elsewhere (latent heat of vaporization, dry
121    ! gaz constant for air, gravity constant, heat capacity of dry air
122    ! at constant pressure, earth rotation rate, pi).
123
124    ! 1.2 Tuning parameters of V14
125
126! Values for linear in rot (recommended):
127!   RUWFRT=0.005 ! As RUWMAX but for frontal waves
128!   SATFRT=1.00  ! As SAT    but for frontal waves
129! Values when rot^2 is used                         
130!    RUWFRT=0.02  ! As RUWMAX but for frontal waves
131!    SATFRT=1.00  ! As SAT    but for frontal waves
132!    CMAX = 30.   ! Characteristic phase speed
133! Values when rot^2*EXP(-pi*sqrt(J)) is used                         
134    RUWFRT=2.0   ! As RUWMAX but for frontal waves ~ N0*F0/4*DZ
135    SATFRT=0.60   ! As SAT    but for frontal waves
136    CMAX = 40.    ! Characteristic phase speed
137! Phase speed test
138!   RUWFRT=0.01
139!   CMAX = 50.   ! Characteristic phase speed (TEST)
140! Values when rot^2 and exp(-m^2*dz^2) are used     
141!   RUWFRT=0.03  ! As RUWMAX but for frontal waves
142!   SATFRT=1.00  ! As SAT    but for frontal waves
143! CRUCIAL PARAMETERS FOR THE WIND FILTERING
144    XLAUNCH=0.95 ! Parameter that control launching altitude
145    RDISS = 1    ! Diffusion parameter
146
147    ! maximum of rain for which our theory applies (in kg/m^2/s)
148
149    DZ = 1000. ! Characteristic depth of the source
150    XTROP=0.2 ! Parameter that control tropopause altitude
151    DELTAT=24.*3600. ! Time scale of the waves (first introduced in 9b)
152!   DELTAT=DTIME     ! No AR-1 Accumulation, OR OFFLINE             
153
154    KMIN = 2.E-5
155    ! minimum horizontal wavenumber (inverse of the subgrid scale resolution)
156
157    KMAX = 1.E-3  ! Max horizontal wavenumber
158    CMIN = 1.     ! Min phase velocity
159
160    TR = 240. ! Reference Temperature
161    PR = 101300. ! Reference pressure
162    H0 = RD * TR / RG ! Characteristic vertical scale height
163
164    BVSEC = 5.E-3 ! Security to avoid negative BVF
165    PSEC = 1.E-6 ! Security to avoid division by 0 pressure
166    ZOISEC = 1.E-6 ! Security FOR 0 INTRINSIC FREQ
167    CORSEC = ROMEGA*2.*SIN(2.*RPI/180.)! Security for CORIO
168
169!  ONLINE
170    call assert(klon == (/size(pp, 1), size(tt, 1), size(uu, 1), &
171         size(vv, 1), size(rot,1), size(zustr), size(zvstr), size(d_u, 1), &
172         size(d_v, 1), &
173        size(east_gwstress,1), size(west_gwstress,1) /), &
174        "ACAMA_GWD_RANDO klon")
175    call assert(klev == (/size(pp, 2), size(tt, 2), size(uu, 2), &
176         size(vv, 2), size(d_u, 2), size(d_v, 2), &
177         size(east_gwstress,2), size(west_gwstress,2) /), &
178         "ACAMA_GWD_RANDO klev")
179!  END ONLINE
180
181    IF(DELTAT < DTIME)THEN
182       PRINT *, 'flott_gwd_rando: deltat < dtime!'
183       STOP 1
184    ENDIF
185
186    IF (KLEV < NW) THEN
187       PRINT *, 'flott_gwd_rando: you will have problem with random numbers'
188       STOP 1
189    ENDIF
190
191    ! 2. EVALUATION OF THE BACKGROUND FLOW AT SEMI-LEVELS
192
193    ! Pressure and Inv of pressure
194    DO LL = 2, KLEV
195       PH(:, LL) = EXP((LOG(PP(:, LL)) + LOG(PP(:, LL - 1))) / 2.)
196       PHM1(:, LL) = 1. / PH(:, LL)
197    end DO
198
199    PH(:, KLEV + 1) = 0.
200    PHM1(:, KLEV + 1) = 1. / PSEC
201    PH(:, 1) = 2. * PP(:, 1) - PH(:, 2)
202
203    ! Launching altitude
204
205    LAUNCH=0
206    LTROP =0
207    DO LL = 1, KLEV
208       IF (PH(KLON / 2, LL) / PH(KLON / 2, 1) > XLAUNCH) LAUNCH = LL
209    ENDDO
210    DO LL = 1, KLEV
211       IF (PH(KLON / 2, LL) / PH(KLON / 2, 1) > XTROP) LTROP = LL
212    ENDDO
213
214!   PRINT *,'LAUNCH IN ACAMARA:',LAUNCH
215
216    ! Log pressure vert. coordinate
217    DO LL = 1, KLEV + 1
218       ZH(:, LL) = H0 * LOG(PR / (PH(:, LL) + PSEC))
219    end DO
220
221    ! BV frequency
222    DO LL = 2, KLEV
223       ! BVSEC: BV Frequency (UH USED IS AS A TEMPORARY ARRAY DOWN TO WINDS)
224       UH(:, LL) = 0.5 * (TT(:, LL) + TT(:, LL - 1)) &
225            * RD**2 / RCPD / H0**2 + (TT(:, LL) &
226            - TT(:, LL - 1)) / (ZH(:, LL) - ZH(:, LL - 1)) * RD / H0
227    end DO
228    BVLOW = 0.5 * (TT(:, LTROP )+ TT(:, LAUNCH)) &
229         * RD**2 / RCPD / H0**2 + (TT(:, LTROP ) &
230         - TT(:, LAUNCH))/(ZH(:, LTROP )- ZH(:, LAUNCH)) * RD / H0
231
232    UH(:, 1) = UH(:, 2)
233    UH(:, KLEV + 1) = UH(:, KLEV)
234    BV(:, 1) = UH(:, 2)
235    BV(:, KLEV + 1) = UH(:, KLEV)
236    ! SMOOTHING THE BV HELPS
237    DO LL = 2, KLEV
238       BV(:, LL)=(UH(:, LL+1)+2.*UH(:, LL)+UH(:, LL-1))/4.
239    end DO
240
241    BV=MAX(SQRT(MAX(BV, 0.)), BVSEC)
242    BVLOW=MAX(SQRT(MAX(BVLOW, 0.)), BVSEC)
243
244    ! WINDS
245    DO LL = 2, KLEV
246       UH(:, LL) = 0.5 * (UU(:, LL) + UU(:, LL - 1)) ! Zonal wind
247       VH(:, LL) = 0.5 * (VV(:, LL) + VV(:, LL - 1)) ! Meridional wind
248       UZ(:, LL) = ABS((SQRT(UU(:, LL)**2+VV(:, LL)**2) &
249          - SQRT(UU(:,LL-1)**2+VV(:, LL-1)**2)) &
250          /(ZH(:, LL)-ZH(:, LL-1)) )
251    end DO
252    UH(:, 1) = 0.
253    VH(:, 1) = 0.
254    UH(:, KLEV + 1) = UU(:, KLEV)
255    VH(:, KLEV + 1) = VV(:, KLEV)
256
257    UZ(:, 1) = UZ(:, 2)
258    UZ(:, KLEV + 1) = UZ(:, KLEV)
259    UZ(:, :) = MAX(UZ(:,:), PSEC)
260
261   ! BAROTROPIC VORTICITY AND INTEGRATED CORIOLIS PARAMETER
262   
263    CORIO(:) = MAX(ROMEGA*2.*ABS(SIN(PLAT(:)*RPI/180.)),CORSEC)
264    ROTBA(:)=0.
265    DO LL = 1,KLEV-1
266        !ROTBA(:) = ROTBA(:) + (ROT(:,LL)+ROT(:,LL+1))/2./RG*(PP(:,LL)-PP(:,LL+1))
267        ! Introducing the complete formula (exp of Richardson number):
268        ROTBA(:) = ROTBA(:) + &
269                !((ROT(:,LL)+ROT(:,LL+1))/2.)**2 &
270                (CORIO(:)*TANH(ABS(ROT(:,LL)+ROT(:,LL+1))/2./CORIO(:)))**2 &
271                /RG*(PP(:,LL)-PP(:,LL+1)) &
272                * EXP(-RPI*BV(:,LL+1)/UZ(:,LL+1)) &
273!               * DZ*BV(:,LL+1)/4./ABS(CORIO(:))
274                * DZ*BV(:,LL+1)/4./1.E-4           !  Changes after 1991
275!ARRET
276    ENDDO
277    !   PRINT *,'MAX ROTBA:',MAXVAL(ROTBA)
278    !   ROTBA(:)=(1.*ROTBA(:)  & ! Testing zone
279    !           +0.15*CORIO(:)**2                &
280    !           /(COS(PLAT(:)*RPI/180.)+0.02)  &
281    !           )*DZ*0.01/0.0001/4. ! & ! Testing zone
282    !   MODIF GWD4 AFTER 1985
283    !            *(1.25+SIN(PLAT(:)*RPI/180.))/(1.05+SIN(PLAT(:)*RPI/180.))/1.25
284    !          *1./(COS(PLAT(:)*RPI/180.)+0.02)
285    !    CORIO(:) = MAX(ROMEGA*2.*ABS(SIN(PLAT(:)*RPI/180.)),ZOISEC)/RG*PP(:,1)
286
287    ! 3 WAVES CHARACTERISTICS CHOSEN RANDOMLY AT THE LAUNCH ALTITUDE
288
289    ! The mod functions of weird arguments are used to produce the
290    ! waves characteristics in an almost stochastic way
291
292    JW = 0
293    DO JP = 1, NP
294       DO JK = 1, NK
295          DO JO = 1, NO
296             JW = JW + 1
297             ! Angle
298             DO II = 1, KLON
299                ! Angle (0 or PI so far)
300                ! ZP(JW, II) = (SIGN(1., 0.5 - MOD(TT(II, JW) * 10., 1.)) + 1.) &
301                !      * RPI / 2.
302                ! Angle between 0 and pi
303                  ZP(JW, II) = MOD(TT(II, JW) * 10., 1.) * RPI
304! TEST WITH POSITIVE WAVES ONLY (Part I/II)
305!               ZP(JW, II) = 0.
306                ! Horizontal wavenumber amplitude
307                ZK(JW, II) = KMIN + (KMAX - KMIN) * MOD(TT(II, JW) * 100., 1.)
308                ! Horizontal phase speed
309                CPHA = 0.
310                DO JJ = 1, NA
311                    CPHA = CPHA + &
312         CMAX*2.*(MOD(TT(II, JW+4*(JJ-1)+JJ)**2, 1.)-0.5)*SQRT(3.)/SQRT(NA*1.)
313                END DO
314                IF (CPHA.LT.0.)  THEN
315                   CPHA = -1.*CPHA
316                   ZP(JW,II) = ZP(JW,II) + RPI
317! TEST WITH POSITIVE WAVES ONLY (Part II/II)
318!               ZP(JW, II) = 0.
319                ENDIF
320                CPHA = CPHA + CMIN !we dont allow |c|<1m/s
321                ! Absolute frequency is imposed
322                ZO(JW, II) = CPHA * ZK(JW, II)
323                ! Intrinsic frequency is imposed
324                ZO(JW, II) = ZO(JW, II) &
325                     + ZK(JW, II) * COS(ZP(JW, II)) * UH(II, LAUNCH) &
326                     + ZK(JW, II) * SIN(ZP(JW, II)) * VH(II, LAUNCH)
327                ! Momentum flux at launch lev
328                ! LAUNCHED RANDOM WAVES WITH LOG-NORMAL AMPLITUDE
329                !  RIGHT IN THE SH (GWD4 after 1990)
330                  RUW0(JW, II) = 0.
331                 DO JJ = 1, NA
332                    RUW0(JW, II) = RUW0(JW,II) + &
333         2.*(MOD(TT(II, JW+4*(JJ-1)+JJ)**2, 1.)-0.5)*SQRT(3.)/SQRT(NA*1.)
334                END DO
335                RUW0(JW, II) = RUWFRT &
336                          * EXP(RUW0(JW,II))/1250. &  ! 2 mpa at south pole
337       *((1.05+SIN(PLAT(II)*RPI/180.))/(1.01+SIN(PLAT(II)*RPI/180.))-2.05/2.01)
338                ! RUW0(JW, II) = RUWFRT
339             ENDDO
340          end DO
341       end DO
342    end DO
343
344    ! 4. COMPUTE THE FLUXES
345
346    ! 4.0
347
348    ! 4.1 Vertical velocity at launching altitude to ensure
349    ! the correct value to the imposed fluxes.
350
351    DO JW = 1, NW
352
353       ! Evaluate intrinsic frequency at launching altitude:
354       ZOP(JW, :) = ZO(JW, :) &
355            - ZK(JW, :) * COS(ZP(JW, :)) * UH(:, LAUNCH) &
356            - ZK(JW, :) * SIN(ZP(JW, :)) * VH(:, LAUNCH)
357
358       ! VERSION WITH FRONTAL SOURCES
359
360       ! Momentum flux at launch level imposed by vorticity sources
361
362       ! tanh limitation for values above CORIO (inertial instability).
363       ! WWP(JW, :) = RUW0(JW, :) &
364       WWP(JW, :) = RUWFRT      &
365       !     * (CORIO(:)*TANH(ROTBA(:)/CORIO(:)))**2 &
366       !    * ABS((CORIO(:)*TANH(ROTBA(:)/CORIO(:)))*CORIO(:)) &
367       !  CONSTANT FLUX
368       !    * (CORIO(:)*CORIO(:)) &
369       ! MODERATION BY THE DEPTH OF THE SOURCE (DZ HERE)
370       !      *EXP(-BVLOW(:)**2/MAX(ABS(ZOP(JW, :)),ZOISEC)**2 &
371       !      *ZK(JW, :)**2*DZ**2) &
372       ! COMPLETE FORMULA:
373            !* CORIO(:)**2*TANH(ROTBA(:)/CORIO(:)**2) &
374            * ROTBA(:) &
375       !  RESTORE DIMENSION OF A FLUX
376       !     *RD*TR/PR
377             *1. + RUW0(JW, :)
378
379       ! Factor related to the characteristics of the waves: NONE
380
381       ! Moderation by the depth of the source (dz here): NONE
382
383       ! Put the stress in the right direction:
384
385        RUWP(JW, :) = SIGN(1., ZOP(JW, :))*COS(ZP(JW, :)) * WWP(JW, :)
386        RVWP(JW, :) = SIGN(1., ZOP(JW, :))*SIN(ZP(JW, :)) * WWP(JW, :)
387
388    end DO
389
390    ! 4.2 Uniform values below the launching altitude
391
392    DO LL = 1, LAUNCH
393       RUW(:, LL) = 0
394       RVW(:, LL) = 0
395       DO JW = 1, NW
396          RUW(:, LL) = RUW(:, LL) + RUWP(JW, :)
397          RVW(:, LL) = RVW(:, LL) + RVWP(JW, :)
398       end DO
399    end DO
400
401    ! 4.3 Loop over altitudes, with passage from one level to the next
402    ! done by i) conserving the EP flux, ii) dissipating a little,
403    ! iii) testing critical levels, and vi) testing the breaking.
404
405    DO LL = LAUNCH, KLEV - 1
406       ! Warning: all the physics is here (passage from one level
407       ! to the next)
408       DO JW = 1, NW
409          ZOM(JW, :) = ZOP(JW, :)
410          WWM(JW, :) = WWP(JW, :)
411          ! Intrinsic Frequency
412          ZOP(JW, :) = ZO(JW, :) - ZK(JW, :) * COS(ZP(JW, :)) * UH(:, LL + 1) &
413               - ZK(JW, :) * SIN(ZP(JW, :)) * VH(:, LL + 1)
414
415          ! No breaking (Eq.6)
416          ! Dissipation (Eq. 8)
417          WWP(JW, :) = WWM(JW, :) * EXP(- 2. * RDISS * PR / (PH(:, LL + 1) &
418               + PH(:, LL)) * ((BV(:, LL + 1) + BV(:, LL)) / 2.)**3 &
419               / MAX(ABS(ZOP(JW, :) + ZOM(JW, :)) / 2., ZOISEC)**4 &
420               * ZK(JW, :)**3 * (ZH(:, LL + 1) - ZH(:, LL)))
421
422          ! Critical levels (forced to zero if intrinsic frequency changes sign)
423          ! Saturation (Eq. 12)
424          WWP(JW, :) = min(WWP(JW, :), MAX(0., &
425               SIGN(1., ZOP(JW, :) * ZOM(JW, :))) * ABS(ZOP(JW, :))**3 &
426          !    / BV(:, LL + 1) * EXP(- ZH(:, LL + 1) / H0) * SATFRT**2 * KMIN**2 &
427               / BV(:, LL + 1) * EXP(- ZH(:, LL + 1) / H0) * KMIN**2 &
428!              *(SATFRT*(2.5+1.5*TANH((ZH(:,LL+1)/H0-8.)/2.)))**2 &
429               *SATFRT**2       &
430               / ZK(JW, :)**4)
431       end DO
432
433       ! Evaluate EP-flux from Eq. 7 and give the right orientation to
434       ! the stress
435
436       DO JW = 1, NW
437          RUWP(JW, :) = SIGN(1., ZOP(JW, :))*COS(ZP(JW, :)) * WWP(JW, :)
438          RVWP(JW, :) = SIGN(1., ZOP(JW, :))*SIN(ZP(JW, :)) * WWP(JW, :)
439       end DO
440
441       RUW(:, LL + 1) = 0.
442       RVW(:, LL + 1) = 0.
443
444       DO JW = 1, NW
445          RUW(:, LL + 1) = RUW(:, LL + 1) + RUWP(JW, :)
446          RVW(:, LL + 1) = RVW(:, LL + 1) + RVWP(JW, :)
447          EAST_GWSTRESS(:, LL)=EAST_GWSTRESS(:, LL)+MAX(0.,RUWP(JW,:))/FLOAT(NW)
448          WEST_GWSTRESS(:, LL)=WEST_GWSTRESS(:, LL)+MIN(0.,RUWP(JW,:))/FLOAT(NW)
449       end DO
450    end DO
451
452    ! 5 CALCUL DES TENDANCES:
453
454    ! 5.1 Rectification des flux au sommet et dans les basses couches
455
456    RUW(:, KLEV + 1) = 0.
457    RVW(:, KLEV + 1) = 0.
458    RUW(:, 1) = RUW(:, LAUNCH)
459    RVW(:, 1) = RVW(:, LAUNCH)
460    DO LL = 1, LAUNCH
461       RUW(:, LL) = RUW(:, LAUNCH+1)
462       RVW(:, LL) = RVW(:, LAUNCH+1)
463       EAST_GWSTRESS(:, LL)=EAST_GWSTRESS(:, LAUNCH)
464       WEST_GWSTRESS(:, LL)=WEST_GWSTRESS(:, LAUNCH)
465    end DO
466
467    ! AR-1 RECURSIVE FORMULA (13) IN VERSION 4
468    DO LL = 1, KLEV
469       D_U(:, LL) = (1.-DTIME/DELTAT) * D_U(:, LL) + DTIME/DELTAT/REAL(NW) * &
470            RG * (RUW(:, LL + 1) - RUW(:, LL)) &
471            / (PH(:, LL + 1) - PH(:, LL)) * DTIME
472!  NO AR1 FOR MERIDIONAL TENDENCIES
473!      D_V(:, LL) = (1.-DTIME/DELTAT) * D_V(:, LL) + DTIME/DELTAT/REAL(NW) * &
474       D_V(:, LL) =                                            1./REAL(NW) * &
475            RG * (RVW(:, LL + 1) - RVW(:, LL)) &
476            / (PH(:, LL + 1) - PH(:, LL)) * DTIME
477    ENDDO
478
479    ! Cosmetic: evaluation of the cumulated stress
480    ZUSTR = 0.
481    ZVSTR = 0.
482    DO LL = 1, KLEV
483       ZUSTR = ZUSTR + D_U(:, LL) / RG * (PH(:, LL + 1) - PH(:, LL))/DTIME
484!      ZVSTR = ZVSTR + D_V(:, LL) / RG * (PH(:, LL + 1) - PH(:, LL))/DTIME
485    ENDDO
486! COSMETICS TO VISUALIZE ROTBA
487    ZVSTR = ROTBA
488
489  END SUBROUTINE ACAMA_GWD_RANDO
490
491end module ACAMA_GWD_rando_m
Note: See TracBrowser for help on using the repository browser.