[5099] | 1 | |
---|
[524] | 2 | ! $Header$ |
---|
[5099] | 3 | |
---|
[5105] | 4 | SUBROUTINE advz(limit,dtz,w,sm,s0,sx,sy,sz) |
---|
[5159] | 5 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
---|
| 6 | USE lmdz_paramet |
---|
[5105] | 7 | IMPLICIT NONE |
---|
[524] | 8 | |
---|
[5105] | 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 |
---|
[5159] | 22 | |
---|
[5105] | 23 | ! parametres principaux du modele |
---|
| 24 | ! |
---|
[524] | 25 | |
---|
[5159] | 26 | |
---|
| 27 | |
---|
[5105] | 28 | ! INCLUDE "traceur.h" |
---|
[524] | 29 | |
---|
[5105] | 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 | |
---|
[5105] | 35 | INTEGER :: ntra |
---|
| 36 | PARAMETER (ntra = 1) |
---|
[524] | 37 | |
---|
[5105] | 38 | REAL :: dtz |
---|
| 39 | REAL :: w ( iip1,jjp1,llm ) |
---|
[524] | 40 | |
---|
[5105] | 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 |
---|
[5159] | 44 | |
---|
[5105] | 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 | |
---|
[5105] | 52 | ! Local : |
---|
| 53 | ! ------- |
---|
[524] | 54 | |
---|
[5105] | 55 | ! mass fluxes across the boundaries (UGRI,VGRI,WGRI) |
---|
| 56 | ! mass fluxes in kg |
---|
| 57 | ! declaration : |
---|
[524] | 58 | |
---|
[5105] | 59 | REAL :: WGRI(iip1,jjp1,0:llm) |
---|
[524] | 60 | |
---|
[5159] | 61 | |
---|
[5105] | 62 | ! the moments F are used as temporary storage for |
---|
| 63 | ! portions of grid boxes in transit at the current latitude |
---|
[5159] | 64 | |
---|
[5105] | 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) |
---|
[5159] | 68 | |
---|
[5105] | 69 | ! work arrays |
---|
[5159] | 70 | |
---|
[5105] | 71 | REAL :: ALF(iim),ALF1(iim),ALFQ(iim),ALF1Q(iim) |
---|
| 72 | REAL :: TEMPTM ! Just temporal variable |
---|
| 73 | REAL :: sqi,sqf |
---|
[5159] | 74 | |
---|
[5105] | 75 | LOGICAL :: LIMIT |
---|
| 76 | INTEGER :: lon,lat,niv |
---|
| 77 | INTEGER :: i,j,jv,k,l,lp |
---|
[524] | 78 | |
---|
[5105] | 79 | lon = iim |
---|
| 80 | lat = jjp1 |
---|
| 81 | niv = llm |
---|
[524] | 82 | |
---|
[5105] | 83 | ! *** Test de passage d'arguments ****** |
---|
[524] | 84 | |
---|
[5105] | 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 | |
---|
[5105] | 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 | |
---|
[5105] | 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 | |
---|
[5105] | 115 | !----------------------------------------------------------------- |
---|
| 116 | ! Interface : adaptation nouveau modele |
---|
| 117 | ! ------------------------------------- |
---|
[5159] | 118 | |
---|
[5105] | 119 | ! Conversion du flux de masse en kg.s-1 |
---|
[524] | 120 | |
---|
[5105] | 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 | |
---|
[5105] | 138 | !----------------------------------------------------------------- |
---|
[524] | 139 | |
---|
[5105] | 140 | ! start here |
---|
| 141 | ! boucle sur les latitudes |
---|
[5159] | 142 | |
---|
[5105] | 143 | DO K=1,LAT |
---|
[5159] | 144 | |
---|
[5105] | 145 | ! place limits on appropriate moments before transport |
---|
| 146 | ! (if flux-limiting is to be applied) |
---|
[5159] | 147 | |
---|
[5105] | 148 | IF(.NOT.LIMIT) GO TO 101 |
---|
[5159] | 149 | |
---|
[5105] | 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 |
---|
[5159] | 158 | |
---|
[5105] | 159 | 101 CONTINUE |
---|
[5159] | 160 | |
---|
[5105] | 161 | ! boucle sur les niveaux intercouches de 1 a NIV-1 |
---|
| 162 | ! (flux nul au sommet L=0 et a la base L=NIV) |
---|
[5159] | 163 | |
---|
[5105] | 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 |
---|
[5159] | 168 | |
---|
[5105] | 169 | DO L=1,NIV-1 |
---|
| 170 | LP=L+1 |
---|
[5159] | 171 | |
---|
[5105] | 172 | DO I=1,LON |
---|
[5159] | 173 | |
---|
[5105] | 174 | IF(WGRI(I,K,L)<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 |
---|
[5159] | 183 | |
---|
[5105] | 184 | ALFQ (I)=ALF(I)*ALF(I) |
---|
| 185 | ALF1 (I)=1.-ALF(I) |
---|
| 186 | ALF1Q(I)=ALF1(I)*ALF1(I) |
---|
[5159] | 187 | |
---|
[5105] | 188 | END DO |
---|
[5159] | 189 | |
---|
[5105] | 190 | DO JV=1,NTRA |
---|
| 191 | DO I=1,LON |
---|
[5159] | 192 | |
---|
[5105] | 193 | IF(WGRI(I,K,L)<0.) THEN |
---|
[5159] | 194 | |
---|
[5105] | 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) |
---|
[5159] | 199 | |
---|
[5105] | 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) |
---|
[5159] | 204 | |
---|
[5105] | 205 | ELSE |
---|
[5159] | 206 | |
---|
[5105] | 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) |
---|
[5159] | 211 | |
---|
[5105] | 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) |
---|
[5159] | 216 | |
---|
[5105] | 217 | ENDIF |
---|
[5159] | 218 | |
---|
[5105] | 219 | END DO |
---|
| 220 | END DO |
---|
[5159] | 221 | |
---|
[5105] | 222 | END DO |
---|
[5159] | 223 | |
---|
[5105] | 224 | ! puts the temporary moments Fi into appropriate neighboring boxes |
---|
[5159] | 225 | |
---|
[5105] | 226 | DO L=1,NIV-1 |
---|
| 227 | LP=L+1 |
---|
[5159] | 228 | |
---|
[5105] | 229 | DO I=1,LON |
---|
[5159] | 230 | |
---|
[5105] | 231 | IF(WGRI(I,K,L)<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 |
---|
[5159] | 238 | |
---|
[5105] | 239 | ALF1(I)=1.-ALF(I) |
---|
| 240 | ALFQ(I)=ALF(I)*ALF(I) |
---|
| 241 | ALF1Q(I)=ALF1(I)*ALF1(I) |
---|
[5159] | 242 | |
---|
[5105] | 243 | END DO |
---|
[5159] | 244 | |
---|
[5105] | 245 | DO JV=1,NTRA |
---|
| 246 | DO I=1,LON |
---|
[5159] | 247 | |
---|
[5105] | 248 | IF(WGRI(I,K,L)<0.) THEN |
---|
[5159] | 249 | |
---|
[5105] | 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) |
---|
[5159] | 255 | |
---|
[5105] | 256 | ELSE |
---|
[5159] | 257 | |
---|
[5105] | 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) |
---|
[5159] | 264 | |
---|
[5105] | 265 | ENDIF |
---|
[5159] | 266 | |
---|
[5105] | 267 | END DO |
---|
| 268 | END DO |
---|
[5159] | 269 | |
---|
[5105] | 270 | END DO |
---|
[5159] | 271 | |
---|
[5105] | 272 | ! fin de la boucle principale sur les latitudes |
---|
[5159] | 273 | |
---|
[5105] | 274 | END DO |
---|
[5159] | 275 | |
---|
[5105] | 276 | !------------------------------------------------------------- |
---|
[5159] | 277 | |
---|
[5105] | 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 | !_______________________________________________________________ |
---|