[524] | 1 | ! |
---|
[1279] | 2 | ! $Id: integrd.F 2094 2014-07-16 16:55:47Z dcugnet $ |
---|
[524] | 3 | ! |
---|
| 4 | SUBROUTINE integrd |
---|
| 5 | $ ( nq,vcovm1,ucovm1,tetam1,psm1,massem1, |
---|
[1616] | 6 | $ dv,du,dteta,dq,dp,vcov,ucov,teta,q,ps,masse,phis !,finvmaold |
---|
| 7 | & ) |
---|
[524] | 8 | |
---|
[1454] | 9 | use control_mod, only : planet_type |
---|
[1403] | 10 | |
---|
[524] | 11 | IMPLICIT NONE |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | c======================================================================= |
---|
| 15 | c |
---|
| 16 | c Auteur: P. Le Van |
---|
| 17 | c ------- |
---|
| 18 | c |
---|
| 19 | c objet: |
---|
| 20 | c ------ |
---|
| 21 | c |
---|
| 22 | c Incrementation des tendances dynamiques |
---|
| 23 | c |
---|
| 24 | c======================================================================= |
---|
| 25 | c----------------------------------------------------------------------- |
---|
| 26 | c Declarations: |
---|
| 27 | c ------------- |
---|
| 28 | |
---|
| 29 | #include "dimensions.h" |
---|
| 30 | #include "paramet.h" |
---|
| 31 | #include "comconst.h" |
---|
| 32 | #include "comgeom.h" |
---|
| 33 | #include "comvert.h" |
---|
| 34 | #include "logic.h" |
---|
| 35 | #include "temps.h" |
---|
| 36 | #include "serre.h" |
---|
[1616] | 37 | #include "iniprint.h" |
---|
[524] | 38 | |
---|
| 39 | c Arguments: |
---|
| 40 | c ---------- |
---|
| 41 | |
---|
[1616] | 42 | integer,intent(in) :: nq ! number of tracers to handle in this routine |
---|
| 43 | real,intent(inout) :: vcov(ip1jm,llm) ! covariant meridional wind |
---|
| 44 | real,intent(inout) :: ucov(ip1jmp1,llm) ! covariant zonal wind |
---|
| 45 | real,intent(inout) :: teta(ip1jmp1,llm) ! potential temperature |
---|
| 46 | real,intent(inout) :: q(ip1jmp1,llm,nq) ! advected tracers |
---|
| 47 | real,intent(inout) :: ps(ip1jmp1) ! surface pressure |
---|
| 48 | real,intent(inout) :: masse(ip1jmp1,llm) ! atmospheric mass |
---|
| 49 | real,intent(in) :: phis(ip1jmp1) ! ground geopotential !!! unused |
---|
| 50 | ! values at previous time step |
---|
| 51 | real,intent(inout) :: vcovm1(ip1jm,llm) |
---|
| 52 | real,intent(inout) :: ucovm1(ip1jmp1,llm) |
---|
| 53 | real,intent(inout) :: tetam1(ip1jmp1,llm) |
---|
| 54 | real,intent(inout) :: psm1(ip1jmp1) |
---|
| 55 | real,intent(inout) :: massem1(ip1jmp1,llm) |
---|
| 56 | ! the tendencies to add |
---|
| 57 | real,intent(in) :: dv(ip1jm,llm) |
---|
| 58 | real,intent(in) :: du(ip1jmp1,llm) |
---|
| 59 | real,intent(in) :: dteta(ip1jmp1,llm) |
---|
| 60 | real,intent(in) :: dp(ip1jmp1) |
---|
| 61 | real,intent(in) :: dq(ip1jmp1,llm,nq) !!! unused |
---|
| 62 | ! real,intent(out) :: finvmaold(ip1jmp1,llm) !!! unused |
---|
[524] | 63 | |
---|
| 64 | c Local: |
---|
| 65 | c ------ |
---|
| 66 | |
---|
| 67 | REAL vscr( ip1jm ),uscr( ip1jmp1 ),hscr( ip1jmp1 ),pscr(ip1jmp1) |
---|
[1616] | 68 | REAL massescr( ip1jmp1,llm ) |
---|
| 69 | ! REAL finvmasse(ip1jmp1,llm) |
---|
[524] | 70 | REAL p(ip1jmp1,llmp1) |
---|
| 71 | REAL tpn,tps,tppn(iim),tpps(iim) |
---|
| 72 | REAL qpn,qps,qppn(iim),qpps(iim) |
---|
| 73 | REAL deltap( ip1jmp1,llm ) |
---|
| 74 | |
---|
[1616] | 75 | INTEGER l,ij,iq,i,j |
---|
[524] | 76 | |
---|
| 77 | REAL SSUM |
---|
| 78 | |
---|
| 79 | c----------------------------------------------------------------------- |
---|
| 80 | |
---|
| 81 | DO l = 1,llm |
---|
| 82 | DO ij = 1,iip1 |
---|
| 83 | ucov( ij , l) = 0. |
---|
| 84 | ucov( ij +ip1jm, l) = 0. |
---|
| 85 | uscr( ij ) = 0. |
---|
| 86 | uscr( ij +ip1jm ) = 0. |
---|
| 87 | ENDDO |
---|
| 88 | ENDDO |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | c ............ integration de ps .............. |
---|
| 92 | |
---|
| 93 | CALL SCOPY(ip1jmp1*llm, masse, 1, massescr, 1) |
---|
| 94 | |
---|
[1454] | 95 | DO ij = 1,ip1jmp1 |
---|
[524] | 96 | pscr (ij) = ps(ij) |
---|
| 97 | ps (ij) = psm1(ij) + dt * dp(ij) |
---|
[1454] | 98 | ENDDO |
---|
[524] | 99 | c |
---|
| 100 | DO ij = 1,ip1jmp1 |
---|
| 101 | IF( ps(ij).LT.0. ) THEN |
---|
[1616] | 102 | write(lunout,*) "integrd: negative surface pressure ",ps(ij) |
---|
| 103 | write(lunout,*) " at node ij =", ij |
---|
| 104 | ! since ij=j+(i-1)*jjp1 , we have |
---|
| 105 | j=modulo(ij,jjp1) |
---|
| 106 | i=1+(ij-j)/jjp1 |
---|
| 107 | write(lunout,*) " lon = ",rlonv(i)*180./pi, " deg", |
---|
| 108 | & " lat = ",rlatu(j)*180./pi, " deg" |
---|
[2094] | 109 | call abort_gcm("integrd", "", 1) |
---|
[524] | 110 | ENDIF |
---|
| 111 | ENDDO |
---|
| 112 | c |
---|
| 113 | DO ij = 1, iim |
---|
| 114 | tppn(ij) = aire( ij ) * ps( ij ) |
---|
| 115 | tpps(ij) = aire(ij+ip1jm) * ps(ij+ip1jm) |
---|
| 116 | ENDDO |
---|
| 117 | tpn = SSUM(iim,tppn,1)/apoln |
---|
| 118 | tps = SSUM(iim,tpps,1)/apols |
---|
| 119 | DO ij = 1, iip1 |
---|
| 120 | ps( ij ) = tpn |
---|
| 121 | ps(ij+ip1jm) = tps |
---|
| 122 | ENDDO |
---|
| 123 | c |
---|
| 124 | c ... Calcul de la nouvelle masse d'air au dernier temps integre t+1 ... |
---|
| 125 | c |
---|
| 126 | CALL pression ( ip1jmp1, ap, bp, ps, p ) |
---|
| 127 | CALL massdair ( p , masse ) |
---|
| 128 | |
---|
[1616] | 129 | ! Ehouarn : we don't use/need finvmaold and finvmasse, |
---|
| 130 | ! so might as well not compute them |
---|
| 131 | ! CALL SCOPY( ijp1llm , masse, 1, finvmasse, 1 ) |
---|
| 132 | ! CALL filtreg( finvmasse, jjp1, llm, -2, 2, .TRUE., 1 ) |
---|
[524] | 133 | c |
---|
| 134 | |
---|
| 135 | c ............ integration de ucov, vcov, h .............. |
---|
| 136 | |
---|
[1454] | 137 | DO l = 1,llm |
---|
[524] | 138 | |
---|
[1454] | 139 | DO ij = iip2,ip1jm |
---|
| 140 | uscr( ij ) = ucov( ij,l ) |
---|
| 141 | ucov( ij,l ) = ucovm1( ij,l ) + dt * du( ij,l ) |
---|
| 142 | ENDDO |
---|
[524] | 143 | |
---|
[1454] | 144 | DO ij = 1,ip1jm |
---|
| 145 | vscr( ij ) = vcov( ij,l ) |
---|
| 146 | vcov( ij,l ) = vcovm1( ij,l ) + dt * dv( ij,l ) |
---|
| 147 | ENDDO |
---|
[524] | 148 | |
---|
[1454] | 149 | DO ij = 1,ip1jmp1 |
---|
| 150 | hscr( ij ) = teta(ij,l) |
---|
| 151 | teta ( ij,l ) = tetam1(ij,l) * massem1(ij,l) / masse(ij,l) |
---|
| 152 | & + dt * dteta(ij,l) / masse(ij,l) |
---|
| 153 | ENDDO |
---|
[524] | 154 | |
---|
| 155 | c .... Calcul de la valeur moyenne, unique aux poles pour teta ...... |
---|
| 156 | c |
---|
| 157 | c |
---|
[1454] | 158 | DO ij = 1, iim |
---|
[524] | 159 | tppn(ij) = aire( ij ) * teta( ij ,l) |
---|
| 160 | tpps(ij) = aire(ij+ip1jm) * teta(ij+ip1jm,l) |
---|
[1454] | 161 | ENDDO |
---|
[524] | 162 | tpn = SSUM(iim,tppn,1)/apoln |
---|
| 163 | tps = SSUM(iim,tpps,1)/apols |
---|
| 164 | |
---|
[1454] | 165 | DO ij = 1, iip1 |
---|
[524] | 166 | teta( ij ,l) = tpn |
---|
| 167 | teta(ij+ip1jm,l) = tps |
---|
[1454] | 168 | ENDDO |
---|
[524] | 169 | c |
---|
| 170 | |
---|
[1454] | 171 | IF(leapf) THEN |
---|
[524] | 172 | CALL SCOPY ( ip1jmp1, uscr(1), 1, ucovm1(1, l), 1 ) |
---|
| 173 | CALL SCOPY ( ip1jm, vscr(1), 1, vcovm1(1, l), 1 ) |
---|
| 174 | CALL SCOPY ( ip1jmp1, hscr(1), 1, tetam1(1, l), 1 ) |
---|
[1454] | 175 | END IF |
---|
[524] | 176 | |
---|
[1454] | 177 | ENDDO ! of DO l = 1,llm |
---|
[524] | 178 | |
---|
| 179 | |
---|
| 180 | c |
---|
| 181 | c ....... integration de q ...... |
---|
| 182 | c |
---|
| 183 | c$$$ IF( iadv(1).NE.3.AND.iadv(2).NE.3 ) THEN |
---|
| 184 | c$$$c |
---|
| 185 | c$$$ IF( forward. OR . leapf ) THEN |
---|
| 186 | c$$$ DO iq = 1,2 |
---|
| 187 | c$$$ DO l = 1,llm |
---|
| 188 | c$$$ DO ij = 1,ip1jmp1 |
---|
| 189 | c$$$ q(ij,l,iq) = ( q(ij,l,iq)*finvmaold(ij,l) + dtvr *dq(ij,l,iq) )/ |
---|
| 190 | c$$$ $ finvmasse(ij,l) |
---|
| 191 | c$$$ ENDDO |
---|
| 192 | c$$$ ENDDO |
---|
| 193 | c$$$ ENDDO |
---|
| 194 | c$$$ ELSE |
---|
| 195 | c$$$ DO iq = 1,2 |
---|
| 196 | c$$$ DO l = 1,llm |
---|
| 197 | c$$$ DO ij = 1,ip1jmp1 |
---|
| 198 | c$$$ q( ij,l,iq ) = q( ij,l,iq ) * finvmaold(ij,l) / finvmasse(ij,l) |
---|
| 199 | c$$$ ENDDO |
---|
| 200 | c$$$ ENDDO |
---|
| 201 | c$$$ ENDDO |
---|
| 202 | c$$$ |
---|
| 203 | c$$$ END IF |
---|
| 204 | c$$$c |
---|
| 205 | c$$$ ENDIF |
---|
| 206 | |
---|
[1454] | 207 | if (planet_type.eq."earth") then |
---|
[1279] | 208 | ! Earth-specific treatment of first 2 tracers (water) |
---|
[1454] | 209 | DO l = 1, llm |
---|
| 210 | DO ij = 1, ip1jmp1 |
---|
[1279] | 211 | deltap(ij,l) = p(ij,l) - p(ij,l+1) |
---|
[524] | 212 | ENDDO |
---|
[1454] | 213 | ENDDO |
---|
[524] | 214 | |
---|
[1454] | 215 | CALL qminimum( q, nq, deltap ) |
---|
[1279] | 216 | |
---|
[524] | 217 | c |
---|
| 218 | c ..... Calcul de la valeur moyenne, unique aux poles pour q ..... |
---|
| 219 | c |
---|
| 220 | |
---|
[1454] | 221 | DO iq = 1, nq |
---|
[524] | 222 | DO l = 1, llm |
---|
| 223 | |
---|
| 224 | DO ij = 1, iim |
---|
| 225 | qppn(ij) = aire( ij ) * q( ij ,l,iq) |
---|
| 226 | qpps(ij) = aire(ij+ip1jm) * q(ij+ip1jm,l,iq) |
---|
| 227 | ENDDO |
---|
| 228 | qpn = SSUM(iim,qppn,1)/apoln |
---|
| 229 | qps = SSUM(iim,qpps,1)/apols |
---|
| 230 | |
---|
| 231 | DO ij = 1, iip1 |
---|
| 232 | q( ij ,l,iq) = qpn |
---|
| 233 | q(ij+ip1jm,l,iq) = qps |
---|
| 234 | ENDDO |
---|
| 235 | |
---|
| 236 | ENDDO |
---|
[1454] | 237 | ENDDO |
---|
[524] | 238 | |
---|
[1616] | 239 | ! Ehouarn: forget about finvmaold |
---|
| 240 | ! CALL SCOPY( ijp1llm , finvmasse, 1, finvmaold, 1 ) |
---|
[524] | 241 | |
---|
[1454] | 242 | endif ! of if (planet_type.eq."earth") |
---|
[524] | 243 | c |
---|
| 244 | c |
---|
| 245 | c ..... FIN de l'integration de q ....... |
---|
| 246 | |
---|
| 247 | c ................................................................. |
---|
| 248 | |
---|
| 249 | |
---|
| 250 | IF( leapf ) THEN |
---|
| 251 | CALL SCOPY ( ip1jmp1 , pscr , 1, psm1 , 1 ) |
---|
| 252 | CALL SCOPY ( ip1jmp1*llm, massescr, 1, massem1, 1 ) |
---|
| 253 | END IF |
---|
| 254 | |
---|
| 255 | RETURN |
---|
| 256 | END |
---|