[524] | 1 | ! |
---|
| 2 | ! $Header$ |
---|
| 3 | ! |
---|
[5246] | 4 | SUBROUTINE advz(limit,dtz,w,sm,s0,sx,sy,sz) |
---|
[5271] | 5 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
---|
[5285] | 6 | USE paramet_mod_h |
---|
[5271] | 7 | IMPLICIT NONE |
---|
[524] | 8 | |
---|
[5246] | 9 | !CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
| 10 | ! C |
---|
| 11 | ! first-order moments (FOM) advection of tracer in Z direction C |
---|
| 12 | ! C |
---|
| 13 | ! Source : Pascal Simon (Meteo,CNRM) C |
---|
| 14 | ! Adaptation : A.Armengaud (LGGE) juin 94 C |
---|
| 15 | ! C |
---|
| 16 | ! C |
---|
| 17 | ! sont des arguments d'entree pour le s-pg... C |
---|
| 18 | ! C |
---|
| 19 | ! dq est l'argument de sortie pour le s-pg C |
---|
| 20 | ! C |
---|
| 21 | !CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
| 22 | ! |
---|
| 23 | ! parametres principaux du modele |
---|
| 24 | ! |
---|
[5271] | 25 | |
---|
[524] | 26 | |
---|
[5272] | 27 | |
---|
[5246] | 28 | ! INCLUDE "traceur.h" |
---|
[524] | 29 | |
---|
[5246] | 30 | ! Arguments : |
---|
| 31 | ! ----------- |
---|
| 32 | ! dtz : frequence fictive d'appel du transport |
---|
| 33 | ! w : flux de masse en z en Pa.m2.s-1 |
---|
[524] | 34 | |
---|
[5246] | 35 | INTEGER :: ntra |
---|
| 36 | PARAMETER (ntra = 1) |
---|
[524] | 37 | |
---|
[5246] | 38 | REAL :: dtz |
---|
| 39 | REAL :: w ( iip1,jjp1,llm ) |
---|
[524] | 40 | |
---|
[5246] | 41 | ! moments: SM total mass in each grid box |
---|
| 42 | ! S0 mass of tracer in each grid box |
---|
| 43 | ! Si 1rst order moment in i direction |
---|
| 44 | ! |
---|
| 45 | REAL :: SM(iip1,jjp1,llm) & |
---|
| 46 | ,S0(iip1,jjp1,llm,ntra) |
---|
| 47 | REAL :: sx(iip1,jjp1,llm,ntra) & |
---|
| 48 | ,sy(iip1,jjp1,llm,ntra) & |
---|
| 49 | ,sz(iip1,jjp1,llm,ntra) |
---|
[524] | 50 | |
---|
| 51 | |
---|
[5246] | 52 | ! Local : |
---|
| 53 | ! ------- |
---|
[524] | 54 | |
---|
[5246] | 55 | ! mass fluxes across the boundaries (UGRI,VGRI,WGRI) |
---|
| 56 | ! mass fluxes in kg |
---|
| 57 | ! declaration : |
---|
[524] | 58 | |
---|
[5246] | 59 | REAL :: WGRI(iip1,jjp1,0:llm) |
---|
[524] | 60 | |
---|
[5246] | 61 | ! |
---|
| 62 | ! the moments F are used as temporary storage for |
---|
| 63 | ! portions of grid boxes in transit at the current latitude |
---|
| 64 | ! |
---|
| 65 | REAL :: FM(iim,llm) |
---|
| 66 | REAL :: F0(iim,llm,ntra),FX(iim,llm,ntra) |
---|
| 67 | REAL :: FY(iim,llm,ntra),FZ(iim,llm,ntra) |
---|
| 68 | ! |
---|
| 69 | ! work arrays |
---|
| 70 | ! |
---|
| 71 | REAL :: ALF(iim),ALF1(iim),ALFQ(iim),ALF1Q(iim) |
---|
| 72 | REAL :: TEMPTM ! Just temporal variable |
---|
| 73 | REAL :: sqi,sqf |
---|
| 74 | ! |
---|
| 75 | LOGICAL :: LIMIT |
---|
| 76 | INTEGER :: lon,lat,niv |
---|
| 77 | INTEGER :: i,j,jv,k,l,lp |
---|
[524] | 78 | |
---|
[5246] | 79 | lon = iim |
---|
| 80 | lat = jjp1 |
---|
| 81 | niv = llm |
---|
[524] | 82 | |
---|
[5246] | 83 | ! *** Test de passage d'arguments ****** |
---|
[524] | 84 | |
---|
[5246] | 85 | ! DO 399 l = 1, llm |
---|
| 86 | ! DO 399 j = 1, jjp1 |
---|
| 87 | ! DO 399 i = 1, iip1 |
---|
| 88 | ! IF (S0(i,j,l,ntra) .lt. 0. ) THEN |
---|
| 89 | ! PRINT*,'S0(',i,j,l,')=',S0(i,j,l,ntra) |
---|
| 90 | ! print*, 'sx(',i,j,l,')=',sx(i,j,l,ntra) |
---|
| 91 | ! print*, 'sy(',i,j,l,')=',sy(i,j,l,ntra) |
---|
| 92 | ! print*, 'sz(',i,j,l,')=',sz(i,j,l,ntra) |
---|
| 93 | ! PRINT*, 'AIE !! debut ADVZ - pbl arg. passage dans ADVZ' |
---|
| 94 | ! STOP |
---|
| 95 | ! ENDIF |
---|
| 96 | 399 CONTINUE |
---|
[524] | 97 | |
---|
[5246] | 98 | !----------------------------------------------------------------- |
---|
| 99 | ! *** Test : diag de la qqtite totale de traceur |
---|
| 100 | ! dans l'atmosphere avant l'advection en z |
---|
| 101 | sqi = 0. |
---|
| 102 | sqf = 0. |
---|
[524] | 103 | |
---|
[5246] | 104 | DO l = 1,llm |
---|
| 105 | DO j = 1,jjp1 |
---|
| 106 | DO i = 1,iim |
---|
| 107 | !IM 240305 sqi = sqi + S0(i,j,l,9) |
---|
| 108 | sqi = sqi + S0(i,j,l,ntra) |
---|
| 109 | ENDDO |
---|
| 110 | ENDDO |
---|
| 111 | ENDDO |
---|
| 112 | PRINT*,'-------- DIAG DANS ADVZ - ENTREE ---------' |
---|
| 113 | PRINT*,'sqi=',sqi |
---|
[524] | 114 | |
---|
[5246] | 115 | !----------------------------------------------------------------- |
---|
| 116 | ! Interface : adaptation nouveau modele |
---|
| 117 | ! ------------------------------------- |
---|
| 118 | ! |
---|
| 119 | ! Conversion du flux de masse en kg.s-1 |
---|
[524] | 120 | |
---|
[5246] | 121 | DO l = 1,llm |
---|
| 122 | DO j = 1,jjp1 |
---|
| 123 | DO i = 1,iip1 |
---|
| 124 | ! wgri (i,j,llm+1-l) = w (i,j,l) / g |
---|
| 125 | wgri (i,j,llm+1-l) = w (i,j,l) |
---|
| 126 | ! wgri (i,j,0) = 0. ! a detruire ult. |
---|
| 127 | ! wgri (i,j,l) = 0.1 ! w (i,j,l) |
---|
| 128 | ! wgri (i,j,llm) = 0. ! a detruire ult. |
---|
| 129 | END DO |
---|
| 130 | END DO |
---|
| 131 | END DO |
---|
| 132 | DO j = 1,jjp1 |
---|
| 133 | DO i = 1,iip1 |
---|
| 134 | wgri(i,j,0)=0. |
---|
| 135 | enddo |
---|
| 136 | enddo |
---|
[524] | 137 | |
---|
[5246] | 138 | !----------------------------------------------------------------- |
---|
[524] | 139 | |
---|
[5246] | 140 | ! start here |
---|
| 141 | ! boucle sur les latitudes |
---|
| 142 | ! |
---|
| 143 | DO K=1,LAT |
---|
| 144 | ! |
---|
| 145 | ! place limits on appropriate moments before transport |
---|
| 146 | ! (if flux-limiting is to be applied) |
---|
| 147 | ! |
---|
| 148 | IF(.NOT.LIMIT) GO TO 101 |
---|
| 149 | ! |
---|
| 150 | DO JV=1,NTRA |
---|
| 151 | DO L=1,NIV |
---|
| 152 | DO I=1,LON |
---|
| 153 | sz(I,K,L,JV)=SIGN(AMIN1(AMAX1(S0(I,K,L,JV),0.), & |
---|
| 154 | ABS(sz(I,K,L,JV))),sz(I,K,L,JV)) |
---|
| 155 | END DO |
---|
| 156 | END DO |
---|
| 157 | END DO |
---|
| 158 | ! |
---|
| 159 | 101 CONTINUE |
---|
| 160 | ! |
---|
| 161 | ! boucle sur les niveaux intercouches de 1 a NIV-1 |
---|
| 162 | ! (flux nul au sommet L=0 et a la base L=NIV) |
---|
| 163 | ! |
---|
| 164 | ! calculate flux and moments between adjacent boxes |
---|
| 165 | ! (flux from LP to L if WGRI(L).lt.0, from L to LP if WGRI(L).gt.0) |
---|
| 166 | ! 1- create temporary moments/masses for partial boxes in transit |
---|
| 167 | ! 2- reajusts moments remaining in the box |
---|
| 168 | ! |
---|
| 169 | DO L=1,NIV-1 |
---|
| 170 | LP=L+1 |
---|
| 171 | ! |
---|
| 172 | DO I=1,LON |
---|
| 173 | ! |
---|
| 174 | IF(WGRI(I,K,L).LT.0.) THEN |
---|
| 175 | FM(I,L)=-WGRI(I,K,L)*DTZ |
---|
| 176 | ALF(I)=FM(I,L)/SM(I,K,LP) |
---|
| 177 | SM(I,K,LP)=SM(I,K,LP)-FM(I,L) |
---|
| 178 | ELSE |
---|
| 179 | FM(I,L)=WGRI(I,K,L)*DTZ |
---|
| 180 | ALF(I)=FM(I,L)/SM(I,K,L) |
---|
| 181 | SM(I,K,L)=SM(I,K,L)-FM(I,L) |
---|
| 182 | ENDIF |
---|
| 183 | ! |
---|
| 184 | ALFQ (I)=ALF(I)*ALF(I) |
---|
| 185 | ALF1 (I)=1.-ALF(I) |
---|
| 186 | ALF1Q(I)=ALF1(I)*ALF1(I) |
---|
| 187 | ! |
---|
| 188 | END DO |
---|
| 189 | ! |
---|
| 190 | DO JV=1,NTRA |
---|
| 191 | DO I=1,LON |
---|
| 192 | ! |
---|
| 193 | IF(WGRI(I,K,L).LT.0.) THEN |
---|
| 194 | ! |
---|
| 195 | F0(I,L,JV)=ALF (I)*( S0(I,K,LP,JV)-ALF1(I)*sz(I,K,LP,JV) ) |
---|
| 196 | FZ(I,L,JV)=ALFQ(I)*sz(I,K,LP,JV) |
---|
| 197 | FX(I,L,JV)=ALF (I)*sx(I,K,LP,JV) |
---|
| 198 | FY(I,L,JV)=ALF (I)*sy(I,K,LP,JV) |
---|
| 199 | ! |
---|
| 200 | S0(I,K,LP,JV)=S0(I,K,LP,JV)-F0(I,L,JV) |
---|
| 201 | sz(I,K,LP,JV)=ALF1Q(I)*sz(I,K,LP,JV) |
---|
| 202 | sx(I,K,LP,JV)=sx(I,K,LP,JV)-FX(I,L,JV) |
---|
| 203 | sy(I,K,LP,JV)=sy(I,K,LP,JV)-FY(I,L,JV) |
---|
| 204 | ! |
---|
| 205 | ELSE |
---|
| 206 | ! |
---|
| 207 | F0(I,L,JV)=ALF (I)*(S0(I,K,L,JV)+ALF1(I)*sz(I,K,L,JV) ) |
---|
| 208 | FZ(I,L,JV)=ALFQ(I)*sz(I,K,L,JV) |
---|
| 209 | FX(I,L,JV)=ALF (I)*sx(I,K,L,JV) |
---|
| 210 | FY(I,L,JV)=ALF (I)*sy(I,K,L,JV) |
---|
| 211 | ! |
---|
| 212 | S0(I,K,L,JV)=S0(I,K,L,JV)-F0(I,L,JV) |
---|
| 213 | sz(I,K,L,JV)=ALF1Q(I)*sz(I,K,L,JV) |
---|
| 214 | sx(I,K,L,JV)=sx(I,K,L,JV)-FX(I,L,JV) |
---|
| 215 | sy(I,K,L,JV)=sy(I,K,L,JV)-FY(I,L,JV) |
---|
| 216 | ! |
---|
| 217 | ENDIF |
---|
| 218 | ! |
---|
| 219 | END DO |
---|
| 220 | END DO |
---|
| 221 | ! |
---|
| 222 | END DO |
---|
| 223 | ! |
---|
| 224 | ! puts the temporary moments Fi into appropriate neighboring boxes |
---|
| 225 | ! |
---|
| 226 | DO L=1,NIV-1 |
---|
| 227 | LP=L+1 |
---|
| 228 | ! |
---|
| 229 | DO I=1,LON |
---|
| 230 | ! |
---|
| 231 | IF(WGRI(I,K,L).LT.0.) THEN |
---|
| 232 | SM(I,K,L)=SM(I,K,L)+FM(I,L) |
---|
| 233 | ALF(I)=FM(I,L)/SM(I,K,L) |
---|
| 234 | ELSE |
---|
| 235 | SM(I,K,LP)=SM(I,K,LP)+FM(I,L) |
---|
| 236 | ALF(I)=FM(I,L)/SM(I,K,LP) |
---|
| 237 | ENDIF |
---|
| 238 | ! |
---|
| 239 | ALF1(I)=1.-ALF(I) |
---|
| 240 | ALFQ(I)=ALF(I)*ALF(I) |
---|
| 241 | ALF1Q(I)=ALF1(I)*ALF1(I) |
---|
| 242 | ! |
---|
| 243 | END DO |
---|
| 244 | ! |
---|
| 245 | DO JV=1,NTRA |
---|
| 246 | DO I=1,LON |
---|
| 247 | ! |
---|
| 248 | IF(WGRI(I,K,L).LT.0.) THEN |
---|
| 249 | ! |
---|
| 250 | TEMPTM=-ALF(I)*S0(I,K,L,JV)+ALF1(I)*F0(I,L,JV) |
---|
| 251 | S0(I,K,L,JV)=S0(I,K,L,JV)+F0(I,L,JV) |
---|
| 252 | sz(I,K,L,JV)=ALF(I)*FZ(I,L,JV)+ALF1(I)*sz(I,K,L,JV)+3.*TEMPTM |
---|
| 253 | sx(I,K,L,JV)=sx(I,K,L,JV)+FX(I,L,JV) |
---|
| 254 | sy(I,K,L,JV)=sy(I,K,L,JV)+FY(I,L,JV) |
---|
| 255 | ! |
---|
| 256 | ELSE |
---|
| 257 | ! |
---|
| 258 | TEMPTM=ALF(I)*S0(I,K,LP,JV)-ALF1(I)*F0(I,L,JV) |
---|
| 259 | S0(I,K,LP,JV)=S0(I,K,LP,JV)+F0(I,L,JV) |
---|
| 260 | sz(I,K,LP,JV)=ALF(I)*FZ(I,L,JV)+ALF1(I)*sz(I,K,LP,JV) & |
---|
| 261 | +3.*TEMPTM |
---|
| 262 | sx(I,K,LP,JV)=sx(I,K,LP,JV)+FX(I,L,JV) |
---|
| 263 | sy(I,K,LP,JV)=sy(I,K,LP,JV)+FY(I,L,JV) |
---|
| 264 | ! |
---|
| 265 | ENDIF |
---|
| 266 | ! |
---|
| 267 | END DO |
---|
| 268 | END DO |
---|
| 269 | ! |
---|
| 270 | END DO |
---|
| 271 | ! |
---|
| 272 | ! fin de la boucle principale sur les latitudes |
---|
| 273 | ! |
---|
| 274 | END DO |
---|
| 275 | ! |
---|
| 276 | !------------------------------------------------------------- |
---|
| 277 | ! |
---|
| 278 | ! ----------- AA Test en fin de ADVX ------ Controle des S* |
---|
| 279 | |
---|
| 280 | ! DO 9999 l = 1, llm |
---|
| 281 | ! DO 9999 j = 1, jjp1 |
---|
| 282 | ! DO 9999 i = 1, iip1 |
---|
| 283 | ! IF (S0(i,j,l,ntra).lt.0..and.LIMIT) THEN |
---|
| 284 | ! PRINT*, '-------------------' |
---|
| 285 | ! PRINT*, 'En fin de ADVZ' |
---|
| 286 | ! PRINT*,'S0(',i,j,l,')=',S0(i,j,l,ntra) |
---|
| 287 | ! print*, 'sx(',i,j,l,')=',sx(i,j,l,ntra) |
---|
| 288 | ! print*, 'sy(',i,j,l,')=',sy(i,j,l,ntra) |
---|
| 289 | ! print*, 'sz(',i,j,l,')=',sz(i,j,l,ntra) |
---|
| 290 | ! WRITE (*,*) 'On arrete !! - pbl en fin de ADVZ1' |
---|
| 291 | ! STOP |
---|
| 292 | ! ENDIF |
---|
| 293 | 9999 CONTINUE |
---|
| 294 | |
---|
| 295 | ! *** ------------------- bouclage cyclique en X ------------ |
---|
| 296 | |
---|
| 297 | ! DO l = 1,llm |
---|
| 298 | ! DO j = 1,jjp1 |
---|
| 299 | ! SM(iip1,j,l) = SM(1,j,l) |
---|
| 300 | ! S0(iip1,j,l,ntra) = S0(1,j,l,ntra) |
---|
| 301 | ! sx(iip1,j,l,ntra) = sx(1,j,l,ntra) |
---|
| 302 | ! sy(iip1,j,l,ntra) = sy(1,j,l,ntra) |
---|
| 303 | ! sz(iip1,j,l,ntra) = sz(1,j,l,ntra) |
---|
| 304 | ! ENDDO |
---|
| 305 | ! ENDDO |
---|
| 306 | |
---|
| 307 | !------------------------------------------------------------- |
---|
| 308 | ! *** Test : diag de la qqtite totale de traceur |
---|
| 309 | ! dans l'atmosphere avant l'advection en z |
---|
| 310 | DO l = 1,llm |
---|
| 311 | DO j = 1,jjp1 |
---|
| 312 | DO i = 1,iim |
---|
| 313 | !IM 240305 sqf = sqf + S0(i,j,l,9) |
---|
| 314 | sqf = sqf + S0(i,j,l,ntra) |
---|
| 315 | ENDDO |
---|
| 316 | ENDDO |
---|
| 317 | ENDDO |
---|
| 318 | PRINT*,'-------- DIAG DANS ADVZ - SORTIE ---------' |
---|
| 319 | PRINT*,'sqf=', sqf |
---|
| 320 | |
---|
| 321 | !------------------------------------------------------------- |
---|
| 322 | RETURN |
---|
| 323 | END SUBROUTINE advz |
---|
| 324 | !_______________________________________________________________ |
---|
| 325 | !_______________________________________________________________ |
---|