source: trunk/LMDZ.MARS/libf/phymars/gwstress_mod.F @ 2156

Last change on this file since 2156 was 1912, checked in by emillour, 7 years ago

Mars GCM:
Tidying the gravity wave routines by turning them into modules:
orodrag.F -> orodrag_mod.F : note that the declared size of pvar(), which is
used in call to gwstress was wrong.
calldrag_noro.F -> calldrag_noro_mod.F
drag_noro.F -> drag_noro_mod.F
gwstress.F -> gwstress_mod.F
EM

File size: 3.2 KB
RevLine 
[1912]1      MODULE gwstress_mod
2     
3      IMPLICIT NONE
4     
5      CONTAINS
6
[38]7      SUBROUTINE GWSTRESS
8     *         (  klon  , klev
9     *         , KKCRIT, KSECT, KKHLIM, KTEST, KKCRITH, KCRIT, kkenvh
10     *         , kknu
11     *         , PRHO  , PSTAB, PVPH  , PVAR ,PVARor, psig 
12     *         , PTFR  , PTAU 
13     *         ,pgeom1 , pgamma, pd1  , pd2   ,pdmod ,pnu )
14C
15C**** *GWSTRESS*
16C
17C     PURPOSE.
18C     --------
19C
20C**   INTERFACE.
21C     ----------
22C     CALL *GWSTRESS*  FROM *GWDRAG*
23C
24C        EXPLICIT ARGUMENTS :
25C        --------------------
26C     ==== INPUTS ===
27C     ==== OUTPUTS ===
28C
29C        IMPLICIT ARGUMENTS :   NONE
30C        --------------------
31C
32C     METHOD.
33C     -------
34C
35C
36C     EXTERNALS.
37C     ----------
38C
39C
40C     REFERENCE.
41C     ----------
42C
43C        SEE ECMWF RESEARCH DEPARTMENT DOCUMENTATION OF THE "I.F.S."
44C
45C     AUTHOR.
46C     -------
47C
48C     MODIFICATIONS.
49C     --------------
50C     F. LOTT PUT THE NEW GWD ON IFS      22/11/93
51C
52C-----------------------------------------------------------------------
[1047]53      use dimradmars_mod, only: ndlo2
[38]54      implicit none
55      integer klon,klev,kidia,kfdia
56
[1912]57      include "yoegwd.h"
[38]58
59C-----------------------------------------------------------------------
60C
61C*       0.1   ARGUMENTS
62C              ---------
63C
64      INTEGER KKCRIT(NDLO2),KKCRITH(NDLO2),KCRIT(NDLO2),KSECT(NDLO2),
65     *        KKHLIM(NDLO2),KTEST(NDLO2),KKENVH(NDLO2),KKNU(NDLO2)
66C
67      REAL PRHO(NDLO2,klev+1),PSTAB(NDLO2,klev+1),PTAU(NDLO2,klev+1),
68     *     PVPH(NDLO2,klev+1),PVAR(NDLO2,4),PTFR(NDLO2),
69     *     pgeom1(NDLO2,klev),PVARor(NDLO2)
70C
71      real pd1(NDLO2),pd2(NDLO2),pnu(NDLO2),psig(NDLO2),pgamma(NDLO2)
72      real pdmod(NDLO2)
73C
74C-----------------------------------------------------------------------
75C
76C*       0.2   LOCAL ARRAYS
77C              ------------
78      integer jl
79      real zblock,zvar,zeff
80      logical lo
81
82C
83C-----------------------------------------------------------------------
84C
85C*       0.3   FUNCTIONS
86C              ---------
87C     ------------------------------------------------------------------
88C
89C*         1.    INITIALIZATION
90C                --------------
91
92
93      kidia=1
94      kfdia=klon
95
96
97C
98 100  CONTINUE
99C
100C*         3.1     GRAVITY WAVE STRESS.
101C
102  300 CONTINUE
103C
104C
105      DO 301 JL=kidia,kfdia
106      IF(KTEST(JL).EQ.1) THEN
107     
108C  EFFECTIVE MOUNTAIN HEIGHT ABOVE THE BLOCKED FLOW
109 
110c        IF(KKENVH(JL).EQ.KLEV)THEN
111         ZBLOCK=0.0
112c        ELSE
113c         ZBLOCK=(PGEOM1(JL,KKENVH(JL))+PGEOM1(JL,KKENVH(JL)+1))/2./RG         
114c        ENDIF
115     
116        ZVAR=PVAROR(JL)
117        ZEFF=AMAX1(0.,2.*ZVAR-ZBLOCK)
118
119        PTAU(JL,KLEV+1)=PRHO(JL,KLEV+1)*GKDRAG*psig(jl)*ZEFF**2
120     *    /4./ZVAR*PVPH(JL,KLEV+1)*pdmod(jl)*sqrt(pstab(jl,klev+1))
121
122C  TOO SMALL VALUE OF STRESS OR  LOW LEVEL FLOW INCLUDE CRITICAL LEVEL
123C  OR LOW LEVEL FLOW:  GRAVITY WAVE STRESS NUL.
124               
125        LO=(PTAU(JL,KLEV+1).LT.GTSEC).OR.(KCRIT(JL).GE.KKNU(JL))
126     *      .OR.(PVPH(JL,KLEV+1).LT.GVCRIT)
127c       IF(LO) PTAU(JL,KLEV+1)=0.0
128     
129      ELSE
130     
131          PTAU(JL,KLEV+1)=0.0
132         
133      ENDIF
134     
135  301 CONTINUE
136C
[1912]137
138      END SUBROUTINE GWSTRESS
139     
140      END MODULE gwstress_mod
Note: See TracBrowser for help on using the repository browser.