Changeset 5084 for LMDZ6/trunk/libf/dyn3d_common
- Timestamp:
- Jul 19, 2024, 6:40:44 PM (6 months ago)
- Location:
- LMDZ6/trunk/libf/dyn3d_common
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/dyn3d_common/advx.F
r5077 r5084 95 95 96 96 C ------------------------------------- 97 DO j = 1,jjp197 DO 300 j = 1,jjp1 98 98 NUM(j) = 1 99 END DO99 300 CONTINUE 100 100 sqi = 0. 101 101 sqf = 0. … … 121 121 C ugri est en kg/s 122 122 123 DO l = 1,llm124 DO j = 1,jjm+1125 DO i = 1,iip1123 DO 500 l = 1,llm 124 DO 500 j = 1,jjm+1 125 DO 500 i = 1,iip1 126 126 C ugri (i,j,llm+1-l) = pbaru (i,j,l) * ( dsig(l) / g ) 127 127 ugri (i,j,llm+1-l) = pbaru (i,j,l) 128 END DO 129 END DO 130 END DO 128 500 CONTINUE 131 129 132 130 … … 139 137 C boucle principale sur les niveaux et les latitudes 140 138 C 141 DO L=1,NIV142 DO K=lati,latf139 DO 1 L=1,NIV 140 DO 1 K=lati,latf 143 141 C 144 142 C initialisation … … 146 144 C program assumes periodic boundaries in X 147 145 C 148 DO I=2,LON146 DO 10 I=2,LON 149 147 SMNEW(I)=SM(I,K,L)+(UGRI(I-1,K,L)-UGRI(I,K,L))*DTX 150 END DO148 10 CONTINUE 151 149 SMNEW(1)=SM(1,K,L)+(UGRI(LON,K,L)-UGRI(1,K,L))*DTX 152 150 C … … 156 154 LONK=LON/NUMK 157 155 C 158 IF(NUMK >1) THEN159 C 160 DO I=1,LON156 IF(NUMK.GT.1) THEN 157 C 158 DO 111 I=1,LON 161 159 TM(I)=0. 162 END DO163 DO JV=1,NTRA164 DO I=1,LON160 111 CONTINUE 161 DO 112 JV=1,NTRA 162 DO 1120 I=1,LON 165 163 T0(I,JV)=0. 166 164 TX(I,JV)=0. 167 165 TY(I,JV)=0. 168 166 TZ(I,JV)=0. 169 END DO170 END DO171 C 172 DO I2=1,NUMK173 C 174 DO I=1,LONK167 1120 CONTINUE 168 112 CONTINUE 169 C 170 DO 11 I2=1,NUMK 171 C 172 DO 113 I=1,LONK 175 173 I3=(I-1)*NUMK+I2 176 174 TM(I)=TM(I)+SM(I3,K,L) 177 175 ALF(I)=SM(I3,K,L)/TM(I) 178 176 ALF1(I)=1.-ALF(I) 179 END DO177 113 CONTINUE 180 178 C 181 179 DO JV=1,NTRA … … 192 190 ENDDO 193 191 C 194 END DO192 11 CONTINUE 195 193 C 196 194 ELSE 197 195 C 198 DO I=1,LON196 DO 115 I=1,LON 199 197 TM(I)=SM(I,K,L) 200 END DO201 DO JV=1,NTRA202 DO I=1,LON198 115 CONTINUE 199 DO 116 JV=1,NTRA 200 DO 1160 I=1,LON 203 201 T0(I,JV)=S0(I,K,L,JV) 204 202 TX(I,JV)=sx(I,K,L,JV) 205 203 TY(I,JV)=sy(I,K,L,JV) 206 204 TZ(I,JV)=sz(I,K,L,JV) 207 END DO208 END DO209 C 210 ENDIF 211 C 212 DO I=1,LONK205 1160 CONTINUE 206 116 CONTINUE 207 C 208 ENDIF 209 C 210 DO 117 I=1,LONK 213 211 UEXT(I)=UGRI(I*NUMK,K,L) 214 END DO212 117 CONTINUE 215 213 C 216 214 C place limits on appropriate moments before transport … … 219 217 IF(.NOT.LIMIT) GO TO 13 220 218 C 221 DO JV=1,NTRA222 DO I=1,LONK219 DO 12 JV=1,NTRA 220 DO 120 I=1,LONK 223 221 TX(I,JV)=SIGN(AMIN1(AMAX1(T0(I,JV),0.),ABS(TX(I,JV))),TX(I,JV)) 224 END DO225 END DO222 120 CONTINUE 223 12 CONTINUE 226 224 C 227 225 13 CONTINUE … … 233 231 C flux from IP to I if U(I).lt.0 234 232 C 235 DO I=1,LONK-1236 IF(UEXT(I) <0.) THEN233 DO 140 I=1,LONK-1 234 IF(UEXT(I).LT.0.) THEN 237 235 FM(I)=-UEXT(I)*DTX 238 236 ALF(I)=FM(I)/TM(I+1) 239 237 TM(I+1)=TM(I+1)-FM(I) 240 238 ENDIF 241 END DO239 140 CONTINUE 242 240 C 243 241 I=LONK 244 IF(UEXT(I) <0.) THEN242 IF(UEXT(I).LT.0.) THEN 245 243 FM(I)=-UEXT(I)*DTX 246 244 ALF(I)=FM(I)/TM(1) … … 250 248 C flux from I to IP if U(I).gt.0 251 249 C 252 DO I=1,LONK253 IF(UEXT(I) >=0.) THEN250 DO 141 I=1,LONK 251 IF(UEXT(I).GE.0.) THEN 254 252 FM(I)=UEXT(I)*DTX 255 253 ALF(I)=FM(I)/TM(I) 256 254 TM(I)=TM(I)-FM(I) 257 255 ENDIF 258 END DO259 C 260 DO I=1,LONK256 141 CONTINUE 257 C 258 DO 142 I=1,LONK 261 259 ALFQ(I)=ALF(I)*ALF(I) 262 260 ALF1(I)=1.-ALF(I) 263 261 ALF1Q(I)=ALF1(I)*ALF1(I) 264 END DO265 C 266 DO JV=1,NTRA267 DO I=1,LONK-1268 C 269 IF(UEXT(I) <0.) THEN262 142 CONTINUE 263 C 264 DO 150 JV=1,NTRA 265 DO 1500 I=1,LONK-1 266 C 267 IF(UEXT(I).LT.0.) THEN 270 268 C 271 269 F0(I,JV)=ALF (I)* ( T0(I+1,JV)-ALF1(I)*TX(I+1,JV) ) … … 281 279 ENDIF 282 280 C 283 END DO284 END DO281 1500 CONTINUE 282 150 CONTINUE 285 283 C 286 284 I=LONK 287 IF(UEXT(I) <0.) THEN288 C 289 DO JV=1,NTRA285 IF(UEXT(I).LT.0.) THEN 286 C 287 DO 151 JV=1,NTRA 290 288 C 291 289 F0 (I,JV)=ALF (I)* ( T0(1,JV)-ALF1(I)*TX(1,JV) ) … … 299 297 TZ(1,JV)=TZ(1,JV)-FZ(I,JV) 300 298 C 301 END DO302 C 303 ENDIF 304 C 305 DO JV=1,NTRA306 DO I=1,LONK307 C 308 IF(UEXT(I) >=0.) THEN299 151 CONTINUE 300 C 301 ENDIF 302 C 303 DO 152 JV=1,NTRA 304 DO 1520 I=1,LONK 305 C 306 IF(UEXT(I).GE.0.) THEN 309 307 C 310 308 F0(I,JV)=ALF (I)* ( T0(I,JV)+ALF1(I)*TX(I,JV) ) … … 320 318 ENDIF 321 319 C 322 END DO323 END DO320 1520 CONTINUE 321 152 CONTINUE 324 322 C 325 323 C puts the temporary moments Fi into appropriate neighboring boxes 326 324 C 327 DO I=1,LONK328 IF(UEXT(I) <0.) THEN325 DO 160 I=1,LONK 326 IF(UEXT(I).LT.0.) THEN 329 327 TM(I)=TM(I)+FM(I) 330 328 ALF(I)=FM(I)/TM(I) 331 329 ENDIF 332 END DO333 C 334 DO I=1,LONK-1335 IF(UEXT(I) >=0.) THEN330 160 CONTINUE 331 C 332 DO 161 I=1,LONK-1 333 IF(UEXT(I).GE.0.) THEN 336 334 TM(I+1)=TM(I+1)+FM(I) 337 335 ALF(I)=FM(I)/TM(I+1) 338 336 ENDIF 339 END DO337 161 CONTINUE 340 338 C 341 339 I=LONK 342 IF(UEXT(I) >=0.) THEN340 IF(UEXT(I).GE.0.) THEN 343 341 TM(1)=TM(1)+FM(I) 344 342 ALF(I)=FM(I)/TM(1) 345 343 ENDIF 346 344 C 347 DO I=1,LONK345 DO 162 I=1,LONK 348 346 ALF1(I)=1.-ALF(I) 349 END DO350 C 351 DO JV=1,NTRA352 DO I=1,LONK353 C 354 IF(UEXT(I) <0.) THEN347 162 CONTINUE 348 C 349 DO 170 JV=1,NTRA 350 DO 1700 I=1,LONK 351 C 352 IF(UEXT(I).LT.0.) THEN 355 353 C 356 354 TEMPTM=-ALF(I)*T0(I,JV)+ALF1(I)*F0(I,JV) … … 362 360 ENDIF 363 361 C 364 END DO365 END DO366 C 367 DO JV=1,NTRA368 DO I=1,LONK-1369 C 370 IF(UEXT(I) >=0.) THEN362 1700 CONTINUE 363 170 CONTINUE 364 C 365 DO 171 JV=1,NTRA 366 DO 1710 I=1,LONK-1 367 C 368 IF(UEXT(I).GE.0.) THEN 371 369 C 372 370 TEMPTM=ALF(I)*T0(I+1,JV)-ALF1(I)*F0(I,JV) … … 378 376 ENDIF 379 377 C 380 END DO381 END DO378 1710 CONTINUE 379 171 CONTINUE 382 380 C 383 381 I=LONK 384 IF(UEXT(I) >=0.) THEN385 DO JV=1,NTRA382 IF(UEXT(I).GE.0.) THEN 383 DO 172 JV=1,NTRA 386 384 TEMPTM=ALF(I)*T0(1,JV)-ALF1(I)*F0(I,JV) 387 385 T0(1,JV)=T0(1,JV)+F0(I,JV) … … 389 387 TY(1,JV)=TY(1,JV)+FY(I,JV) 390 388 TZ(1,JV)=TZ(1,JV)+FZ(I,JV) 391 END DO389 172 CONTINUE 392 390 ENDIF 393 391 C 394 392 C retour aux mailles d'origine (passage des Tij aux Sij) 395 393 C 396 IF(NUMK >1) THEN397 C 398 DO I2=1,NUMK399 C 400 DO I=1,LONK394 IF(NUMK.GT.1) THEN 395 C 396 DO 180 I2=1,NUMK 397 C 398 DO 180 I=1,LONK 401 399 C 402 400 I3=I2+(I-1)*NUMK … … 409 407 ALF1Q(I)=ALF1(I)*ALF1(I) 410 408 C 411 END DO 412 END DO 409 180 CONTINUE 413 410 C 414 411 DO JV=1,NTRA … … 434 431 ELSE 435 432 C 436 DO I=1,LON433 DO 190 I=1,LON 437 434 SM(I,K,L)=TM(I) 438 END DO439 DO JV=1,NTRA440 DO I=1,LON435 190 CONTINUE 436 DO 191 JV=1,NTRA 437 DO 1910 I=1,LON 441 438 S0(I,K,L,JV)=T0(I,JV) 442 439 sx(I,K,L,JV)=TX(I,JV) 443 440 sy(I,K,L,JV)=TY(I,JV) 444 441 sz(I,K,L,JV)=TZ(I,JV) 445 END DO 446 END DO 447 C 448 ENDIF 449 C 450 END DO 451 END DO 442 1910 CONTINUE 443 191 CONTINUE 444 C 445 ENDIF 446 C 447 1 CONTINUE 452 448 C 453 449 C ----------- AA Test en fin de ADVX ------ Controle des S* -
LMDZ6/trunk/libf/dyn3d_common/advxp.F
r5077 r5084 126 126 c test 127 127 c ------------------------------------- 128 DO j =1,jjp1128 DO 300 j =1,jjp1 129 129 NUM(j) =1 130 END DO130 300 CONTINUE 131 131 c DO l=1,llm 132 132 c NUM(2,l)=6 … … 150 150 C ugri est en kg/s 151 151 152 DO l = 1,llm153 DO j = 1,jjp1154 DO i = 1,iip1152 DO 500 l = 1,llm 153 DO 500 j = 1,jjp1 154 DO 500 i = 1,iip1 155 155 ugri (i,j,llm+1-l) =pbaru (i,j,l) 156 END DO 157 END DO 158 END DO 156 500 CONTINUE 159 157 160 158 C --------------------------------------------------------- … … 163 161 C boucle principale sur les niveaux et les latitudes 164 162 C 165 DO L=1,NIV166 DO K=lati,latf163 DO 1 L=1,NIV 164 DO 1 K=lati,latf 167 165 168 166 C … … 171 169 C program assumes periodic boundaries in X 172 170 C 173 DO I=2,LON171 DO 10 I=2,LON 174 172 SMNEW(I)=SM(I,K,L)+(UGRI(I-1,K,L)-UGRI(I,K,L))*DTX 175 END DO173 10 CONTINUE 176 174 SMNEW(1)=SM(1,K,L)+(UGRI(LON,K,L)-UGRI(1,K,L))*DTX 177 175 C … … 181 179 LONK=LON/NUMK 182 180 C 183 IF(NUMK >1) THEN184 C 185 DO I=1,LON181 IF(NUMK.GT.1) THEN 182 C 183 DO 111 I=1,LON 186 184 TM(I)=0. 187 END DO188 DO JV=1,NTRA189 DO I=1,LON185 111 CONTINUE 186 DO 112 JV=1,NTRA 187 DO 1120 I=1,LON 190 188 T0 (I,JV)=0. 191 189 TX (I,JV)=0. … … 198 196 TYZ(I,JV)=0. 199 197 TZZ(I,JV)=0. 200 END DO201 END DO202 C 203 DO I2=1,NUMK204 C 205 DO I=1,LONK198 1120 CONTINUE 199 112 CONTINUE 200 C 201 DO 11 I2=1,NUMK 202 C 203 DO 113 I=1,LONK 206 204 I3=(I-1)*NUMK+I2 207 205 TM(I)=TM(I)+SM(I3,K,L) … … 212 210 ALF2(I)=ALF1(I)-ALF(I) 213 211 ALF3(I)=ALF(I)*ALF1(I) 214 END DO215 C 216 DO JV=1,NTRA217 DO I=1,LONK212 113 CONTINUE 213 C 214 DO 114 JV=1,NTRA 215 DO 1140 I=1,LONK 218 216 I3=(I-1)*NUMK+I2 219 217 TEMPTM=-ALF(I)*T0(I,JV)+ALF1(I)*S0(I3,K,L,JV) … … 231 229 TYZ(I,JV)=TYZ(I,JV)+SYZ(I3,K,L,JV) 232 230 TZZ(I,JV)=TZZ(I,JV)+SZZ(I3,K,L,JV) 233 END DO234 END DO235 C 236 END DO231 1140 CONTINUE 232 114 CONTINUE 233 C 234 11 CONTINUE 237 235 C 238 236 ELSE 239 237 C 240 DO I=1,LON238 DO 115 I=1,LON 241 239 TM(I)=SM(I,K,L) 242 END DO243 DO JV=1,NTRA244 DO I=1,LON240 115 CONTINUE 241 DO 116 JV=1,NTRA 242 DO 1160 I=1,LON 245 243 T0 (I,JV)=S0 (I,K,L,JV) 246 244 TX (I,JV)=SSX (I,K,L,JV) … … 253 251 TYZ(I,JV)=SYZ(I,K,L,JV) 254 252 TZZ(I,JV)=SZZ(I,K,L,JV) 255 END DO256 END DO253 1160 CONTINUE 254 116 CONTINUE 257 255 C 258 256 ENDIF 259 257 C 260 DO I=1,LONK258 DO 117 I=1,LONK 261 259 UEXT(I)=UGRI(I*NUMK,K,L) 262 END DO260 117 CONTINUE 263 261 C 264 262 C place limits on appropriate moments before transport … … 267 265 IF(.NOT.LIMIT) GO TO 13 268 266 C 269 DO JV=1,NTRA270 DO I=1,LONK271 IF(T0(I,JV) >0.) THEN267 DO 12 JV=1,NTRA 268 DO 120 I=1,LONK 269 IF(T0(I,JV).GT.0.) THEN 272 270 SLPMAX=T0(I,JV) 273 271 S1MAX=1.5*SLPMAX … … 285 283 TXZ(I,JV)=0. 286 284 ENDIF 287 END DO288 END DO285 120 CONTINUE 286 12 CONTINUE 289 287 C 290 288 13 CONTINUE … … 296 294 C flux from IP to I if U(I).lt.0 297 295 C 298 DO I=1,LONK-1299 IF(UEXT(I) <0.) THEN296 DO 140 I=1,LONK-1 297 IF(UEXT(I).LT.0.) THEN 300 298 FM(I)=-UEXT(I)*DTX 301 299 ALF(I)=FM(I)/TM(I+1) 302 300 TM(I+1)=TM(I+1)-FM(I) 303 301 ENDIF 304 END DO302 140 CONTINUE 305 303 C 306 304 I=LONK 307 IF(UEXT(I) <0.) THEN305 IF(UEXT(I).LT.0.) THEN 308 306 FM(I)=-UEXT(I)*DTX 309 307 ALF(I)=FM(I)/TM(1) … … 313 311 C flux from I to IP if U(I).gt.0 314 312 C 315 DO I=1,LONK316 IF(UEXT(I) >=0.) THEN313 DO 141 I=1,LONK 314 IF(UEXT(I).GE.0.) THEN 317 315 FM(I)=UEXT(I)*DTX 318 316 ALF(I)=FM(I)/TM(I) 319 317 TM(I)=TM(I)-FM(I) 320 318 ENDIF 321 END DO322 C 323 DO I=1,LONK319 141 CONTINUE 320 C 321 DO 142 I=1,LONK 324 322 ALFQ(I)=ALF(I)*ALF(I) 325 323 ALF1(I)=1.-ALF(I) … … 328 326 ALF3(I)=ALF(I)*ALFQ(I) 329 327 ALF4(I)=ALF1(I)*ALF1Q(I) 330 END DO331 C 332 DO JV=1,NTRA333 DO I=1,LONK-1334 C 335 IF(UEXT(I) <0.) THEN328 142 CONTINUE 329 C 330 DO 150 JV=1,NTRA 331 DO 1500 I=1,LONK-1 332 C 333 IF(UEXT(I).LT.0.) THEN 336 334 C 337 335 F0 (I,JV)=ALF (I)* ( T0(I+1,JV)-ALF1(I)* … … 360 358 ENDIF 361 359 C 362 END DO363 END DO360 1500 CONTINUE 361 150 CONTINUE 364 362 C 365 363 I=LONK 366 IF(UEXT(I) <0.) THEN367 C 368 DO JV=1,NTRA364 IF(UEXT(I).LT.0.) THEN 365 C 366 DO 151 JV=1,NTRA 369 367 C 370 368 F0 (I,JV)=ALF (I)* ( T0(1,JV)-ALF1(I)* … … 391 389 TXZ(1,JV)=ALF1Q(I)*TXZ(1,JV) 392 390 C 393 END DO391 151 CONTINUE 394 392 C 395 393 ENDIF 396 394 C 397 DO JV=1,NTRA398 DO I=1,LONK399 C 400 IF(UEXT(I) >=0.) THEN395 DO 152 JV=1,NTRA 396 DO 1520 I=1,LONK 397 C 398 IF(UEXT(I).GE.0.) THEN 401 399 C 402 400 F0 (I,JV)=ALF (I)* ( T0(I,JV)+ALF1(I)* … … 425 423 ENDIF 426 424 C 427 END DO428 END DO425 1520 CONTINUE 426 152 CONTINUE 429 427 C 430 428 C puts the temporary moments Fi into appropriate neighboring boxes 431 429 C 432 DO I=1,LONK433 IF(UEXT(I) <0.) THEN430 DO 160 I=1,LONK 431 IF(UEXT(I).LT.0.) THEN 434 432 TM(I)=TM(I)+FM(I) 435 433 ALF(I)=FM(I)/TM(I) 436 434 ENDIF 437 END DO438 C 439 DO I=1,LONK-1440 IF(UEXT(I) >=0.) THEN435 160 CONTINUE 436 C 437 DO 161 I=1,LONK-1 438 IF(UEXT(I).GE.0.) THEN 441 439 TM(I+1)=TM(I+1)+FM(I) 442 440 ALF(I)=FM(I)/TM(I+1) 443 441 ENDIF 444 END DO442 161 CONTINUE 445 443 C 446 444 I=LONK 447 IF(UEXT(I) >=0.) THEN445 IF(UEXT(I).GE.0.) THEN 448 446 TM(1)=TM(1)+FM(I) 449 447 ALF(I)=FM(I)/TM(1) 450 448 ENDIF 451 449 C 452 DO I=1,LONK450 DO 162 I=1,LONK 453 451 ALF1(I)=1.-ALF(I) 454 452 ALFQ(I)=ALF(I)*ALF(I) … … 456 454 ALF2(I)=ALF1(I)-ALF(I) 457 455 ALF3(I)=ALF(I)*ALF1(I) 458 END DO459 C 460 DO JV=1,NTRA461 DO I=1,LONK462 C 463 IF(UEXT(I) <0.) THEN456 162 CONTINUE 457 C 458 DO 170 JV=1,NTRA 459 DO 1700 I=1,LONK 460 C 461 IF(UEXT(I).LT.0.) THEN 464 462 C 465 463 TEMPTM=-ALF(I)*T0(I,JV)+ALF1(I)*F0(I,JV) … … 480 478 ENDIF 481 479 C 482 END DO483 END DO484 C 485 DO JV=1,NTRA486 DO I=1,LONK-1487 C 488 IF(UEXT(I) >=0.) THEN480 1700 CONTINUE 481 170 CONTINUE 482 C 483 DO 171 JV=1,NTRA 484 DO 1710 I=1,LONK-1 485 C 486 IF(UEXT(I).GE.0.) THEN 489 487 C 490 488 TEMPTM=ALF(I)*T0(I+1,JV)-ALF1(I)*F0(I,JV) … … 505 503 ENDIF 506 504 C 507 END DO508 END DO505 1710 CONTINUE 506 171 CONTINUE 509 507 C 510 508 I=LONK 511 IF(UEXT(I) >=0.) THEN512 DO JV=1,NTRA509 IF(UEXT(I).GE.0.) THEN 510 DO 172 JV=1,NTRA 513 511 TEMPTM=ALF(I)*T0(1,JV)-ALF1(I)*F0(I,JV) 514 512 T0 (1,JV)=T0(1,JV)+F0(I,JV) … … 525 523 TYZ(1,JV)=TYZ(1,JV)+FYZ(I,JV) 526 524 TZZ(1,JV)=TZZ(1,JV)+FZZ(I,JV) 527 END DO525 172 CONTINUE 528 526 ENDIF 529 527 C 530 528 C retour aux mailles d'origine (passage des Tij aux Sij) 531 529 C 532 IF(NUMK >1) THEN533 C 534 DO I2=1,NUMK535 C 536 DO I=1,LONK530 IF(NUMK.GT.1) THEN 531 C 532 DO 18 I2=1,NUMK 533 C 534 DO 180 I=1,LONK 537 535 C 538 536 I3=I2+(I-1)*NUMK … … 548 546 ALF4(I)=ALF1(I)*ALF1Q(I) 549 547 C 550 END DO551 C 552 DO JV=1,NTRA553 DO I=1,LONK548 180 CONTINUE 549 C 550 DO 181 JV=1,NTRA 551 DO 181 I=1,LONK 554 552 C 555 553 I3=I2+(I-1)*NUMK … … 579 577 TXZ(I,JV)=ALF1Q(I)*TXZ(I,JV) 580 578 C 581 END DO 582 END DO 583 C 584 END DO 579 181 CONTINUE 580 C 581 18 CONTINUE 585 582 C 586 583 ELSE 587 584 C 588 DO I=1,LON585 DO 190 I=1,LON 589 586 SM(I,K,L)=TM(I) 590 END DO591 DO JV=1,NTRA592 DO I=1,LON587 190 CONTINUE 588 DO 191 JV=1,NTRA 589 DO 1910 I=1,LON 593 590 S0 (I,K,L,JV)=T0 (I,JV) 594 591 SSX (I,K,L,JV)=TX (I,JV) … … 601 598 SYZ(I,K,L,JV)=TYZ(I,JV) 602 599 SZZ(I,K,L,JV)=TZZ(I,JV) 603 END DO604 END DO600 1910 CONTINUE 601 191 CONTINUE 605 602 C 606 603 ENDIF 607 604 C 608 END DO 609 END DO 605 1 CONTINUE 610 606 C 611 607 C ----------- AA Test en fin de ADVX ------ Controle des S* -
LMDZ6/trunk/libf/dyn3d_common/advy.F
r5079 r5084 121 121 enddo 122 122 123 DO L=1,NIV123 DO 1 L=1,NIV 124 124 C 125 125 C place limits on appropriate moments before transport … … 128 128 IF(.NOT.LIMIT) GO TO 11 129 129 C 130 DO JV=1,NTRA131 DO K=1,LAT132 DO I=1,LON130 DO 10 JV=1,NTRA 131 DO 10 K=1,LAT 132 DO 100 I=1,LON 133 133 sy(I,K,L,JV)=SIGN(AMIN1(AMAX1(S0(I,K,L,JV),0.), 134 134 + ABS(sy(I,K,L,JV))),sy(I,K,L,JV)) 135 END DO 136 END DO 137 END DO 135 100 CONTINUE 136 10 CONTINUE 138 137 C 139 138 11 CONTINUE … … 142 141 C 143 142 SM0=0. 144 DO JV=1,NTRA143 DO 20 JV=1,NTRA 145 144 S00(JV)=0. 146 END DO147 C 148 DO I=1,LON149 C 150 IF(VGRI(I,0,L) <=0.) THEN145 20 CONTINUE 146 C 147 DO 21 I=1,LON 148 C 149 IF(VGRI(I,0,L).LE.0.) THEN 151 150 FM(I,0)=-VGRI(I,0,L)*DTY 152 151 ALF(I,0)=FM(I,0)/SM(I,1,L) … … 159 158 ALF1Q(I,0)=ALF1(I,0)*ALF1(I,0) 160 159 C 161 END DO162 C 163 DO JV=1,NTRA164 DO I=1,LON165 C 166 IF(VGRI(I,0,L) <=0.) THEN160 21 CONTINUE 161 C 162 DO 22 JV=1,NTRA 163 DO 220 I=1,LON 164 C 165 IF(VGRI(I,0,L).LE.0.) THEN 167 166 C 168 167 F0(I,0,JV)=ALF(I,0)* … … 177 176 ENDIF 178 177 C 179 END DO180 END DO181 C 182 DO I=1,LON183 IF(VGRI(I,0,L) >0.) THEN178 220 CONTINUE 179 22 CONTINUE 180 C 181 DO 23 I=1,LON 182 IF(VGRI(I,0,L).GT.0.) THEN 184 183 FM(I,0)=VGRI(I,0,L)*DTY 185 184 ALF(I,0)=FM(I,0)/SM0 186 185 ENDIF 187 END DO188 C 189 DO JV=1,NTRA190 DO I=1,LON191 IF(VGRI(I,0,L) >0.) THEN186 23 CONTINUE 187 C 188 DO 24 JV=1,NTRA 189 DO 240 I=1,LON 190 IF(VGRI(I,0,L).GT.0.) THEN 192 191 F0(I,0,JV)=ALF(I,0)*S00(JV) 193 192 ENDIF 194 END DO195 END DO193 240 CONTINUE 194 24 CONTINUE 196 195 C 197 196 C puts the temporary moments Fi into appropriate neighboring boxes 198 197 C 199 DO I=1,LON200 C 201 IF(VGRI(I,0,L) >0.) THEN198 DO 25 I=1,LON 199 C 200 IF(VGRI(I,0,L).GT.0.) THEN 202 201 SM(I,1,L)=SM(I,1,L)+FM(I,0) 203 202 ALF(I,0)=FM(I,0)/SM(I,1,L) … … 206 205 ALF1(I,0)=1.-ALF(I,0) 207 206 C 208 END DO209 C 210 DO JV=1,NTRA211 DO I=1,LON212 C 213 IF(VGRI(I,0,L) >0.) THEN207 25 CONTINUE 208 C 209 DO 26 JV=1,NTRA 210 DO 260 I=1,LON 211 C 212 IF(VGRI(I,0,L).GT.0.) THEN 214 213 C 215 214 TEMPTM=ALF(I,0)*S0(I,1,L,JV)-ALF1(I,0)*F0(I,0,JV) … … 219 218 ENDIF 220 219 C 221 END DO222 END DO220 260 CONTINUE 221 26 CONTINUE 223 222 C 224 223 C calculate flux and moments between adjacent boxes … … 228 227 C flux from KP to K if V(K).lt.0 and from K to KP if V(K).gt.0 229 228 C 230 DO K=1,LAT-1229 DO 30 K=1,LAT-1 231 230 KP=K+1 232 DO I=1,LON233 C 234 IF(VGRI(I,K,L) <0.) THEN231 DO 300 I=1,LON 232 C 233 IF(VGRI(I,K,L).LT.0.) THEN 235 234 FM(I,K)=-VGRI(I,K,L)*DTY 236 235 ALF(I,K)=FM(I,K)/SM(I,KP,L) … … 246 245 ALF1Q(I,K)=ALF1(I,K)*ALF1(I,K) 247 246 C 248 END DO249 END DO250 C 251 DO JV=1,NTRA252 DO K=1,LAT-1247 300 CONTINUE 248 30 CONTINUE 249 C 250 DO 31 JV=1,NTRA 251 DO 31 K=1,LAT-1 253 252 KP=K+1 254 DO I=1,LON255 C 256 IF(VGRI(I,K,L) <0.) THEN253 DO 310 I=1,LON 254 C 255 IF(VGRI(I,K,L).LT.0.) THEN 257 256 C 258 257 F0(I,K,JV)=ALF (I,K)* … … 282 281 ENDIF 283 282 C 284 END DO 285 END DO 286 END DO 283 310 CONTINUE 284 31 CONTINUE 287 285 C 288 286 C puts the temporary moments Fi into appropriate neighboring boxes 289 287 C 290 DO K=1,LAT-1288 DO 32 K=1,LAT-1 291 289 KP=K+1 292 DO I=1,LON293 C 294 IF(VGRI(I,K,L) <0.) THEN290 DO 320 I=1,LON 291 C 292 IF(VGRI(I,K,L).LT.0.) THEN 295 293 SM(I,K,L)=SM(I,K,L)+FM(I,K) 296 294 ALF(I,K)=FM(I,K)/SM(I,K,L) … … 302 300 ALF1(I,K)=1.-ALF(I,K) 303 301 C 304 END DO305 END DO306 C 307 DO JV=1,NTRA308 DO K=1,LAT-1302 320 CONTINUE 303 32 CONTINUE 304 C 305 DO 33 JV=1,NTRA 306 DO 33 K=1,LAT-1 309 307 KP=K+1 310 DO I=1,LON311 C 312 IF(VGRI(I,K,L) <0.) THEN308 DO 330 I=1,LON 309 C 310 IF(VGRI(I,K,L).LT.0.) THEN 313 311 C 314 312 TEMPTM=-ALF(I,K)*S0(I,K,L,JV)+ALF1(I,K)*F0(I,K,JV) … … 330 328 ENDIF 331 329 C 332 END DO 333 END DO 334 END DO 330 330 CONTINUE 331 33 CONTINUE 335 332 C 336 333 C traitement special pour le pole Sud (idem pole Nord) … … 339 336 C 340 337 SM0=0. 341 DO JV=1,NTRA338 DO 40 JV=1,NTRA 342 339 S00(JV)=0. 343 END DO344 C 345 DO I=1,LON346 C 347 IF(VGRI(I,K,L) >=0.) THEN340 40 CONTINUE 341 C 342 DO 41 I=1,LON 343 C 344 IF(VGRI(I,K,L).GE.0.) THEN 348 345 FM(I,K)=VGRI(I,K,L)*DTY 349 346 ALF(I,K)=FM(I,K)/SM(I,K,L) … … 356 353 ALF1Q(I,K)=ALF1(I,K)*ALF1(I,K) 357 354 C 358 END DO359 C 360 DO JV=1,NTRA361 DO I=1,LON362 C 363 IF(VGRI(I,K,L) >=0.) THEN355 41 CONTINUE 356 C 357 DO 42 JV=1,NTRA 358 DO 420 I=1,LON 359 C 360 IF(VGRI(I,K,L).GE.0.) THEN 364 361 F0 (I,K,JV)=ALF(I,K)* 365 362 + ( S0(I,K,L,JV)+ALF1(I,K)*sy(I,K,L,JV) ) … … 372 369 ENDIF 373 370 C 374 END DO375 END DO376 C 377 DO I=1,LON378 IF(VGRI(I,K,L) <0.) THEN371 420 CONTINUE 372 42 CONTINUE 373 C 374 DO 43 I=1,LON 375 IF(VGRI(I,K,L).LT.0.) THEN 379 376 FM(I,K)=-VGRI(I,K,L)*DTY 380 377 ALF(I,K)=FM(I,K)/SM0 381 378 ENDIF 382 END DO383 C 384 DO JV=1,NTRA385 DO I=1,LON386 IF(VGRI(I,K,L) <0.) THEN379 43 CONTINUE 380 C 381 DO 44 JV=1,NTRA 382 DO 440 I=1,LON 383 IF(VGRI(I,K,L).LT.0.) THEN 387 384 F0(I,K,JV)=ALF(I,K)*S00(JV) 388 385 ENDIF 389 END DO390 END DO386 440 CONTINUE 387 44 CONTINUE 391 388 C 392 389 C puts the temporary moments Fi into appropriate neighboring boxes 393 390 C 394 DO I=1,LON395 C 396 IF(VGRI(I,K,L) <0.) THEN391 DO 45 I=1,LON 392 C 393 IF(VGRI(I,K,L).LT.0.) THEN 397 394 SM(I,K,L)=SM(I,K,L)+FM(I,K) 398 395 ALF(I,K)=FM(I,K)/SM(I,K,L) … … 401 398 ALF1(I,K)=1.-ALF(I,K) 402 399 C 403 END DO404 C 405 DO JV=1,NTRA406 DO I=1,LON407 C 408 IF(VGRI(I,K,L) <0.) THEN400 45 CONTINUE 401 C 402 DO 46 JV=1,NTRA 403 DO 460 I=1,LON 404 C 405 IF(VGRI(I,K,L).LT.0.) THEN 409 406 C 410 407 TEMPTM=-ALF(I,K)*S0(I,K,L,JV)+ALF1(I,K)*F0(I,K,JV) … … 414 411 ENDIF 415 412 C 416 END DO417 END DO418 C 419 END DO413 460 CONTINUE 414 46 CONTINUE 415 C 416 1 CONTINUE 420 417 C 421 418 RETURN -
LMDZ6/trunk/libf/dyn3d_common/advyp.F
r5079 r5084 153 153 C-AA 20/10/94 le signe -1 est necessaire car indexation opposee 154 154 155 DO l = 1,llm156 DO j = 1,jjm157 DO i = 1,iip1155 DO 500 l = 1,llm 156 DO 500 j = 1,jjm 157 DO 500 i = 1,iip1 158 158 vgri (i,j,llm+1-l)=-1.*pbarv (i,j,l) 159 END DO 160 END DO 161 END DO 159 500 CONTINUE 162 160 163 161 CAA Initialisation de flux fictifs aux bords sup. des boites pol. … … 173 171 C boucle sur les niveaux 174 172 C 175 DO L=1,NIV173 DO 1 L=1,NIV 176 174 C 177 175 C place limits on appropriate moments before transport … … 180 178 IF(.NOT.LIMIT) GO TO 11 181 179 C 182 DO JV=1,NTRA183 DO K=1,LAT184 DO I=1,LON185 IF(S0(I,K,L,JV) >0.) THEN180 DO 10 JV=1,NTRA 181 DO 10 K=1,LAT 182 DO 100 I=1,LON 183 IF(S0(I,K,L,JV).GT.0.) THEN 186 184 SLPMAX=AMAX1(S0(I,K,L,JV),0.) 187 185 S1MAX=1.5*SLPMAX … … 199 197 SYZ(I,K,L,JV)=0. 200 198 ENDIF 201 END DO 202 END DO 203 END DO 199 100 CONTINUE 200 10 CONTINUE 204 201 C 205 202 11 CONTINUE … … 208 205 C 209 206 SM0=0. 210 DO JV=1,NTRA207 DO 20 JV=1,NTRA 211 208 S00(JV)=0. 212 END DO213 C 214 DO I=1,LON215 C 216 IF(VGRI(I,0,L) <=0.) THEN209 20 CONTINUE 210 C 211 DO 21 I=1,LON 212 C 213 IF(VGRI(I,0,L).LE.0.) THEN 217 214 FM(I,0)=-VGRI(I,0,L)*DTY 218 215 ALF(I,0)=FM(I,0)/SM(I,1,L) … … 228 225 ALF4(I,0)=ALF1(I,0)*ALF1Q(I,0) 229 226 C 230 END DO227 21 CONTINUE 231 228 c print*,'ADVYP 21' 232 229 C 233 DO JV=1,NTRA234 DO I=1,LON235 C 236 IF(VGRI(I,0,L) <=0.) THEN230 DO 22 JV=1,NTRA 231 DO 220 I=1,LON 232 C 233 IF(VGRI(I,0,L).LE.0.) THEN 237 234 C 238 235 F0(I,0,JV)=ALF(I,0)* ( S0(I,1,L,JV)-ALF1(I,0)* … … 256 253 ENDIF 257 254 C 258 END DO259 END DO260 C 261 DO I=1,LON262 IF(VGRI(I,0,L) >0.) THEN255 220 CONTINUE 256 22 CONTINUE 257 C 258 DO 23 I=1,LON 259 IF(VGRI(I,0,L).GT.0.) THEN 263 260 FM(I,0)=VGRI(I,0,L)*DTY 264 261 ALF(I,0)=FM(I,0)/SM0 265 262 ENDIF 266 END DO267 C 268 DO JV=1,NTRA269 DO I=1,LON270 IF(VGRI(I,0,L) >0.) THEN263 23 CONTINUE 264 C 265 DO 24 JV=1,NTRA 266 DO 240 I=1,LON 267 IF(VGRI(I,0,L).GT.0.) THEN 271 268 F0(I,0,JV)=ALF(I,0)*S00(JV) 272 269 ENDIF 273 END DO274 END DO270 240 CONTINUE 271 24 CONTINUE 275 272 C 276 273 C puts the temporary moments Fi into appropriate neighboring boxes 277 274 C 278 275 c print*,'av ADVYP 25' 279 DO I=1,LON280 C 281 IF(VGRI(I,0,L) >0.) THEN276 DO 25 I=1,LON 277 C 278 IF(VGRI(I,0,L).GT.0.) THEN 282 279 SM(I,1,L)=SM(I,1,L)+FM(I,0) 283 280 ALF(I,0)=FM(I,0)/SM(I,1,L) … … 290 287 ALF3(I,0)=ALF1(I,0)*ALF(I,0) 291 288 C 292 END DO289 25 CONTINUE 293 290 c print*,'av ADVYP 25' 294 291 C 295 DO JV=1,NTRA296 DO I=1,LON297 C 298 IF(VGRI(I,0,L) >0.) THEN292 DO 26 JV=1,NTRA 293 DO 260 I=1,LON 294 C 295 IF(VGRI(I,0,L).GT.0.) THEN 299 296 C 300 297 TEMPTM=ALF(I,0)*S0(I,1,L,JV)-ALF1(I,0)*F0(I,0,JV) … … 308 305 ENDIF 309 306 C 310 END DO311 END DO307 260 CONTINUE 308 26 CONTINUE 312 309 C 313 310 C calculate flux and moments between adjacent boxes … … 318 315 C 319 316 c print*,'av ADVYP 30' 320 DO K=1,LAT-1317 DO 30 K=1,LAT-1 321 318 KP=K+1 322 DO I=1,LON323 C 324 IF(VGRI(I,K,L) <0.) THEN319 DO 300 I=1,LON 320 C 321 IF(VGRI(I,K,L).LT.0.) THEN 325 322 FM(I,K)=-VGRI(I,K,L)*DTY 326 323 ALF(I,K)=FM(I,K)/SM(I,KP,L) … … 339 336 ALF4(I,K)=ALF1(I,K)*ALF1Q(I,K) 340 337 C 341 END DO342 END DO338 300 CONTINUE 339 30 CONTINUE 343 340 c print*,'ap ADVYP 30' 344 341 C 345 DO JV=1,NTRA346 DO K=1,LAT-1342 DO 31 JV=1,NTRA 343 DO 31 K=1,LAT-1 347 344 KP=K+1 348 DO I=1,LON349 C 350 IF(VGRI(I,K,L) <0.) THEN345 DO 310 I=1,LON 346 C 347 IF(VGRI(I,K,L).LT.0.) THEN 351 348 C 352 349 F0 (I,K,JV)=ALF (I,K)* ( S0(I,KP,L,JV)-ALF1(I,K)* … … 406 403 ENDIF 407 404 C 408 END DO 409 END DO 410 END DO 405 310 CONTINUE 406 31 CONTINUE 411 407 c print*,'ap ADVYP 31' 412 408 C 413 409 C puts the temporary moments Fi into appropriate neighboring boxes 414 410 C 415 DO K=1,LAT-1411 DO 32 K=1,LAT-1 416 412 KP=K+1 417 DO I=1,LON418 C 419 IF(VGRI(I,K,L) <0.) THEN413 DO 320 I=1,LON 414 C 415 IF(VGRI(I,K,L).LT.0.) THEN 420 416 SM(I,K,L)=SM(I,K,L)+FM(I,K) 421 417 ALF(I,K)=FM(I,K)/SM(I,K,L) … … 431 427 ALF3(I,K)=ALF1(I,K)*ALF(I,K) 432 428 C 433 END DO434 END DO429 320 CONTINUE 430 32 CONTINUE 435 431 c print*,'ap ADVYP 32' 436 432 C 437 DO JV=1,NTRA438 DO K=1,LAT-1433 DO 33 JV=1,NTRA 434 DO 33 K=1,LAT-1 439 435 KP=K+1 440 DO I=1,LON441 C 442 IF(VGRI(I,K,L) <0.) THEN436 DO 330 I=1,LON 437 C 438 IF(VGRI(I,K,L).LT.0.) THEN 443 439 C 444 440 TEMPTM=-ALF(I,K)*S0(I,K,L,JV)+ALF1(I,K)*F0(I,K,JV) … … 478 474 ENDIF 479 475 C 480 END DO 481 END DO 482 END DO 476 330 CONTINUE 477 33 CONTINUE 483 478 c print*,'ap ADVYP 33' 484 479 C … … 488 483 C 489 484 SM0=0. 490 DO JV=1,NTRA485 DO 40 JV=1,NTRA 491 486 S00(JV)=0. 492 END DO493 C 494 DO I=1,LON495 C 496 IF(VGRI(I,K,L) >=0.) THEN487 40 CONTINUE 488 C 489 DO 41 I=1,LON 490 C 491 IF(VGRI(I,K,L).GE.0.) THEN 497 492 FM(I,K)=VGRI(I,K,L)*DTY 498 493 ALF(I,K)=FM(I,K)/SM(I,K,L) … … 508 503 ALF4(I,K)=ALF1(I,K)*ALF1Q(I,K) 509 504 C 510 END DO505 41 CONTINUE 511 506 c print*,'ap ADVYP 41' 512 507 C 513 DO JV=1,NTRA514 DO I=1,LON515 C 516 IF(VGRI(I,K,L) >=0.) THEN508 DO 42 JV=1,NTRA 509 DO 420 I=1,LON 510 C 511 IF(VGRI(I,K,L).GE.0.) THEN 517 512 F0 (I,K,JV)=ALF(I,K)* ( S0(I,K,L,JV)+ALF1(I,K)* 518 513 + ( SY(I,K,L,JV)+ALF2(I,K)*SYY(I,K,L,JV) ) ) … … 532 527 ENDIF 533 528 C 534 END DO535 END DO529 420 CONTINUE 530 42 CONTINUE 536 531 c print*,'ap ADVYP 42' 537 532 C 538 DO I=1,LON539 IF(VGRI(I,K,L) <0.) THEN533 DO 43 I=1,LON 534 IF(VGRI(I,K,L).LT.0.) THEN 540 535 FM(I,K)=-VGRI(I,K,L)*DTY 541 536 ALF(I,K)=FM(I,K)/SM0 542 537 ENDIF 543 END DO538 43 CONTINUE 544 539 c print*,'ap ADVYP 43' 545 540 C 546 DO JV=1,NTRA547 DO I=1,LON548 IF(VGRI(I,K,L) <0.) THEN541 DO 44 JV=1,NTRA 542 DO 440 I=1,LON 543 IF(VGRI(I,K,L).LT.0.) THEN 549 544 F0(I,K,JV)=ALF(I,K)*S00(JV) 550 545 ENDIF 551 END DO552 END DO546 440 CONTINUE 547 44 CONTINUE 553 548 C 554 549 C puts the temporary moments Fi into appropriate neighboring boxes 555 550 C 556 DO I=1,LON557 C 558 IF(VGRI(I,K,L) <0.) THEN551 DO 45 I=1,LON 552 C 553 IF(VGRI(I,K,L).LT.0.) THEN 559 554 SM(I,K,L)=SM(I,K,L)+FM(I,K) 560 555 ALF(I,K)=FM(I,K)/SM(I,K,L) … … 567 562 ALF3(I,K)=ALF1(I,K)*ALF(I,K) 568 563 C 569 END DO564 45 CONTINUE 570 565 c print*,'ap ADVYP 45' 571 566 C 572 DO JV=1,NTRA573 DO I=1,LON574 C 575 IF(VGRI(I,K,L) <0.) THEN567 DO 46 JV=1,NTRA 568 DO 460 I=1,LON 569 C 570 IF(VGRI(I,K,L).LT.0.) THEN 576 571 C 577 572 TEMPTM=-ALF(I,K)*S0(I,K,L,JV)+ALF1(I,K)*F0(I,K,JV) … … 585 580 ENDIF 586 581 C 587 END DO588 END DO582 460 CONTINUE 583 46 CONTINUE 589 584 c print*,'ap ADVYP 46' 590 585 C 591 END DO586 1 CONTINUE 592 587 593 588 c-------------------------------------------------- -
LMDZ6/trunk/libf/dyn3d_common/advz.F
r5079 r5084 117 117 C Conversion du flux de masse en kg.s-1 118 118 119 DO l = 1,llm120 DO j = 1,jjp1121 DO i = 1,iip1119 DO 500 l = 1,llm 120 DO 500 j = 1,jjp1 121 DO 500 i = 1,iip1 122 122 c wgri (i,j,llm+1-l) = w (i,j,l) / g 123 123 wgri (i,j,llm+1-l) = w (i,j,l) … … 125 125 c wgri (i,j,l) = 0.1 ! w (i,j,l) 126 126 c wgri (i,j,llm) = 0. ! a detruire ult. 127 END DO 128 END DO 129 END DO 127 500 CONTINUE 130 128 DO j = 1,jjp1 131 129 DO i = 1,iip1 … … 139 137 C boucle sur les latitudes 140 138 C 141 DO K=1,LAT139 DO 1 K=1,LAT 142 140 C 143 141 C place limits on appropriate moments before transport … … 146 144 IF(.NOT.LIMIT) GO TO 101 147 145 C 148 DO JV=1,NTRA149 DO L=1,NIV150 DO I=1,LON146 DO 10 JV=1,NTRA 147 DO 10 L=1,NIV 148 DO 100 I=1,LON 151 149 sz(I,K,L,JV)=SIGN(AMIN1(AMAX1(S0(I,K,L,JV),0.), 152 150 + ABS(sz(I,K,L,JV))),sz(I,K,L,JV)) 153 END DO 154 END DO 155 END DO 151 100 CONTINUE 152 10 CONTINUE 156 153 C 157 154 101 CONTINUE … … 165 162 C 2- reajusts moments remaining in the box 166 163 C 167 DO L=1,NIV-1164 DO 11 L=1,NIV-1 168 165 LP=L+1 169 166 C 170 DO I=1,LON171 C 172 IF(WGRI(I,K,L) <0.) THEN167 DO 110 I=1,LON 168 C 169 IF(WGRI(I,K,L).LT.0.) THEN 173 170 FM(I,L)=-WGRI(I,K,L)*DTZ 174 171 ALF(I)=FM(I,L)/SM(I,K,LP) … … 184 181 ALF1Q(I)=ALF1(I)*ALF1(I) 185 182 C 186 END DO187 C 188 DO JV=1,NTRA189 DO I=1,LON190 C 191 IF(WGRI(I,K,L) <0.) THEN183 110 CONTINUE 184 C 185 DO 111 JV=1,NTRA 186 DO 1110 I=1,LON 187 C 188 IF(WGRI(I,K,L).LT.0.) THEN 192 189 C 193 190 F0(I,L,JV)=ALF (I)*( S0(I,K,LP,JV)-ALF1(I)*sz(I,K,LP,JV) ) … … 215 212 ENDIF 216 213 C 217 END DO218 END DO219 C 220 END DO214 1110 CONTINUE 215 111 CONTINUE 216 C 217 11 CONTINUE 221 218 C 222 219 C puts the temporary moments Fi into appropriate neighboring boxes 223 220 C 224 DO L=1,NIV-1221 DO 12 L=1,NIV-1 225 222 LP=L+1 226 223 C 227 DO I=1,LON228 C 229 IF(WGRI(I,K,L) <0.) THEN224 DO 120 I=1,LON 225 C 226 IF(WGRI(I,K,L).LT.0.) THEN 230 227 SM(I,K,L)=SM(I,K,L)+FM(I,L) 231 228 ALF(I)=FM(I,L)/SM(I,K,L) … … 239 236 ALF1Q(I)=ALF1(I)*ALF1(I) 240 237 C 241 END DO242 C 243 DO JV=1,NTRA244 DO I=1,LON245 C 246 IF(WGRI(I,K,L) <0.) THEN238 120 CONTINUE 239 C 240 DO 121 JV=1,NTRA 241 DO 1210 I=1,LON 242 C 243 IF(WGRI(I,K,L).LT.0.) THEN 247 244 C 248 245 TEMPTM=-ALF(I)*S0(I,K,L,JV)+ALF1(I)*F0(I,L,JV) … … 263 260 ENDIF 264 261 C 265 END DO266 END DO267 C 268 END DO262 1210 CONTINUE 263 121 CONTINUE 264 C 265 12 CONTINUE 269 266 C 270 267 C fin de la boucle principale sur les latitudes 271 268 C 272 END DO269 1 CONTINUE 273 270 C 274 271 C------------------------------------------------------------- -
LMDZ6/trunk/libf/dyn3d_common/advzp.F
r5079 r5084 135 135 C Conversion des flux de masses en kg 136 136 137 DO l = 1,llm138 DO j = 1,jjp1139 DO i = 1,iip1137 DO 500 l = 1,llm 138 DO 500 j = 1,jjp1 139 DO 500 i = 1,iip1 140 140 wgri (i,j,llm+1-l) = w (i,j,l) 141 END DO 142 END DO 143 END DO 141 500 CONTINUE 144 142 do j=1,jjp1 145 143 do i=1,iip1 … … 156 154 C boucle sur les latitudes 157 155 C 158 DO K=1,LAT156 DO 1 K=1,LAT 159 157 C 160 158 C place limits on appropriate moments before transport … … 163 161 IF(.NOT.LIMIT) GO TO 101 164 162 C 165 DO JV=1,NTRA166 DO L=1,NIV167 DO I=1,LON168 IF(S0(I,K,L,JV) >0.) THEN163 DO 10 JV=1,NTRA 164 DO 10 L=1,NIV 165 DO 100 I=1,LON 166 IF(S0(I,K,L,JV).GT.0.) THEN 169 167 SLPMAX=S0(I,K,L,JV) 170 168 S1MAX =1.5*SLPMAX … … 182 180 SYZ(I,K,L,JV)=0. 183 181 ENDIF 184 END DO 185 END DO 186 END DO 182 100 CONTINUE 183 10 CONTINUE 187 184 C 188 185 101 CONTINUE … … 196 193 C 2- reajusts moments remaining in the box 197 194 C 198 DO L=1,NIV-1195 DO 11 L=1,NIV-1 199 196 LP=L+1 200 197 C 201 DO I=1,LON202 C 203 IF(WGRI(I,K,L) <0.) THEN198 DO 110 I=1,LON 199 C 200 IF(WGRI(I,K,L).LT.0.) THEN 204 201 FM(I,L)=-WGRI(I,K,L)*DTZ 205 202 ALF(I)=FM(I,L)/SM(I,K,LP) … … 218 215 ALF4 (I)=ALF1(I)*ALF1Q(I) 219 216 C 220 END DO221 C 222 DO JV=1,NTRA223 DO I=1,LON224 C 225 IF(WGRI(I,K,L) <0.) THEN217 110 CONTINUE 218 C 219 DO 111 JV=1,NTRA 220 DO 1110 I=1,LON 221 C 222 IF(WGRI(I,K,L).LT.0.) THEN 226 223 C 227 224 F0 (I,L,JV)=ALF (I)* ( S0(I,K,LP,JV)-ALF1(I)* … … 276 273 ENDIF 277 274 C 278 END DO279 END DO280 C 281 END DO275 1110 CONTINUE 276 111 CONTINUE 277 C 278 11 CONTINUE 282 279 C 283 280 C puts the temporary moments Fi into appropriate neighboring boxes 284 281 C 285 DO L=1,NIV-1282 DO 12 L=1,NIV-1 286 283 LP=L+1 287 284 C 288 DO I=1,LON289 C 290 IF(WGRI(I,K,L) <0.) THEN285 DO 120 I=1,LON 286 C 287 IF(WGRI(I,K,L).LT.0.) THEN 291 288 SM(I,K,L)=SM(I,K,L)+FM(I,L) 292 289 ALF(I)=FM(I,L)/SM(I,K,L) … … 302 299 ALF3(I)=ALF1(I)-ALF(I) 303 300 C 304 END DO305 C 306 DO JV=1,NTRA307 DO I=1,LON308 C 309 IF(WGRI(I,K,L) <0.) THEN301 120 CONTINUE 302 C 303 DO 121 JV=1,NTRA 304 DO 1210 I=1,LON 305 C 306 IF(WGRI(I,K,L).LT.0.) THEN 310 307 C 311 308 TEMPTM=-ALF(I)*S0(I,K,L,JV)+ALF1(I)*F0(I,L,JV) … … 345 342 ENDIF 346 343 C 347 END DO348 END DO349 C 350 END DO344 1210 CONTINUE 345 121 CONTINUE 346 C 347 12 CONTINUE 351 348 C 352 349 C fin de la boucle principale sur les latitudes 353 350 C 354 END DO351 1 CONTINUE 355 352 C 356 353 DO l = 1,llm -
LMDZ6/trunk/libf/dyn3d_common/comdissip.h
r5077 r5084 6 6 7 7 COMMON/comdissip/ & 8 & coefdis,tetavel,tetatemp,gamdissip,niterdis8 & niterdis,coefdis,tetavel,tetatemp,gamdissip 9 9 10 10 -
LMDZ6/trunk/libf/dyn3d_common/extrapol.F
r5079 r5084 58 58 200 CONTINUE 59 59 incre = incre + 1 60 DO j = 1, kylat61 DO i = 1, kxlon62 IF (pfild(i,j) >zwmsk) THEN60 DO 99999 j = 1, kylat 61 DO 99999 i = 1, kxlon 62 IF (pfild(i,j).GT. zwmsk) THEN 63 63 pwork(i,j) = pfild(i,j) 64 64 inbor = 0 … … 89 89 C 90 90 C* Correct latitude bounds if southernmost or northernmost points 91 IF (j ==1) ideb = 492 IF (j ==kylat) ifin = 691 IF (j .EQ. 1) ideb = 4 92 IF (j .EQ. kylat) ifin = 6 93 93 C 94 94 C* Account for periodicity in longitude 95 95 C 96 96 IF (ldper) THEN 97 IF (i ==kxlon) THEN97 IF (i .EQ. kxlon) THEN 98 98 ix(3) = 1 99 99 ix(6) = 1 100 100 ix(9) = 1 101 ELSE IF (i ==1) THEN101 ELSE IF (i .EQ. 1) THEN 102 102 ix(1) = kxlon 103 103 ix(4) = kxlon … … 105 105 ENDIF 106 106 ELSE 107 IF (i ==1) THEN107 IF (i .EQ. 1) THEN 108 108 ix(1) = i 109 109 ix(2) = i + 1 … … 113 113 ix(6) = i + 1 114 114 ENDIF 115 IF (i ==kxlon) THEN115 IF (i .EQ. kxlon) THEN 116 116 ix(1) = i -1 117 117 ix(2) = i … … 122 122 ENDIF 123 123 C 124 IF (i == 1 .OR. i ==kxlon) THEN124 IF (i .EQ. 1 .OR. i .EQ. kxlon) THEN 125 125 jy(1) = MAX (1,j-1) 126 126 jy(2) = MAX (1,j-1) … … 132 132 ideb = 1 133 133 ifin = 6 134 IF (j ==1) ideb = 3135 IF (j ==kylat) ifin = 4134 IF (j .EQ. 1) ideb = 3 135 IF (j .EQ. kylat) ifin = 4 136 136 ENDIF 137 137 ENDIF ! end for ldper test … … 139 139 C* Find unmasked neighbors 140 140 C 141 DO k = ideb, ifin141 DO 230 k = ideb, ifin 142 142 zmask(k) = 0. 143 143 ilon = ix(k) 144 144 jlat = jy(k) 145 IF (pfild(ilon,jlat) <zwmsk) THEN145 IF (pfild(ilon,jlat) .LT. zwmsk) THEN 146 146 zmask(k) = 1. 147 147 inbor = inbor + 1 148 148 ENDIF 149 END DO149 230 CONTINUE 150 150 C 151 151 C* Not enough points around point P are unmasked; interpolation on P 152 152 C will be done in a future call to extrap. 153 153 C 154 IF (inbor >=knbor) THEN154 IF (inbor .GE. knbor) THEN 155 155 pwork(i,j) = 0. 156 156 DO k = ideb, ifin … … 163 163 C 164 164 ENDIF 165 END DO 166 END DO 165 99999 CONTINUE 167 166 C 168 167 C* 3. Writing back unmasked field in pfild … … 177 176 DO j = 1, kylat 178 177 DO i = 1, kxlon 179 IF (pwork(i,j) >zwmsk) idoit = idoit + 1178 IF (pwork(i,j) .GT. zwmsk) idoit = idoit + 1 180 179 pfild(i,j) = pwork(i,j) 181 180 ENDDO 182 181 ENDDO 183 182 c 184 IF (idoit /=0) GOTO 200183 IF (idoit .ne. 0) GOTO 200 185 184 ccc PRINT*, "Number of extrapolation steps incre =", incre 186 185 c -
LMDZ6/trunk/libf/dyn3d_common/grilles_gcm_netcdf_sub.F90
r5075 r5084 14 14 USE comconst_mod, ONLY: cpp, kappa, g, omeg, daysec, rad, pi 15 15 USE comvert_mod, ONLY: presnivs, preff, pa 16 USE lmdz_netcdf, ONLY: nf90_def_var, nf90_int, nf90_float, nf90_put_var, nf_enddef, & 17 nf_put_att_text,nf_def_dim,nf_64bit_offset,nf_clobber,nf_create 16 use netcdf, only: nf90_def_var, nf90_int, nf90_float, nf90_put_var 18 17 19 18 IMPLICIT NONE … … 22 21 INCLUDE "paramet.h" 23 22 INCLUDE "comgeom.h" 23 INCLUDE "netcdf.inc" 24 24 25 25 !======================== … … 232 232 233 233 SUBROUTINE handle_err(status) 234 USE lmdz_netcdf, ONLY: nf_strerror234 INCLUDE "netcdf.inc" 235 235 236 236 INTEGER status 237 IF (status /=nf_noerr) THEN237 IF (status.NE.nf_noerr) THEN 238 238 PRINT *,NF_STRERROR(status) 239 239 CALL abort_gcm('grilles_gcm_netcdf','netcdf error',1) -
LMDZ6/trunk/libf/dyn3d_common/ppm3d.F
r5079 r5084 68 68 implicit none 69 69 70 c rajout de d �clarations70 c rajout de déclarations 71 71 c integer Jmax,kmax,ndt0,nstep,k,j,i,ic,l,js,jn,imh,iad,jad,krd 72 72 c integer iu,iiu,j2,jmr,js0,jt … … 315 315 C 316 316 C *********** Initialization ********************** 317 if(NSTEP ==1) then317 if(NSTEP.eq.1) then 318 318 c 319 319 write(6,*) '------------------------------------ ' … … 325 325 C 326 326 C controles sur les parametres 327 if(NLAY <6) then327 if(NLAY.LT.6) then 328 328 write(6,*) 'NLAY must be >= 6' 329 329 stop 330 330 endif 331 if (JNP <NLAY) then331 if (JNP.LT.NLAY) then 332 332 write(6,*) 'JNP must be >= NLAY' 333 333 stop 334 334 endif 335 335 IMRD2=mod(IMR,2) 336 if (j1 ==2.and.IMRD2/=0) then336 if (j1.eq.2.and.IMRD2.NE.0) then 337 337 write(6,*) 'if j1=2 IMR must be an even integer' 338 338 stop … … 340 340 341 341 C 342 if(Jmax <JNP .or. Kmax<NLAY) then342 if(Jmax.lt.JNP .or. Kmax.lt.NLAY) then 343 343 write(6,*) 'Jmax or Kmax is too small' 344 344 stop … … 354 354 DP = PI / REAL(JMR) 355 355 C 356 if(IGD ==0) then356 if(IGD.eq.0) then 357 357 C Compute analytic cosine at cell edges 358 358 call cosa(cosp,cose,JNP,PI,DP) … … 362 362 endif 363 363 C 364 do J=2,JMR 365 acosp(j) = 1. / cosp(j) 366 END DO 364 do 15 J=2,JMR 365 15 acosp(j) = 1. / cosp(j) 367 366 C 368 367 C Inverse of the Scaled polar cap area. … … 373 372 endif 374 373 C 375 if(NDT0 /=NDT) then374 if(NDT0 .ne. NDT) then 376 375 DT = NDT 377 376 NDT0 = NDT 378 377 379 if(Umax <180.) then378 if(Umax .lt. 180.) then 380 379 write(6,*) 'Umax may be too small!' 381 380 endif … … 383 382 MaxDT = DP*AE / abs(Umax) + 0.5 384 383 write(6,*)'Largest time step for max(V)=',Umax,' is ',MaxDT 385 if(MaxDT <abs(NDT)) then384 if(MaxDT .lt. abs(NDT)) then 386 385 write(6,*) 'Warning!!! NDT maybe too large!' 387 386 endif 388 387 C 389 if(CR1 >=0.95) then388 if(CR1.ge.0.95) then 390 389 JS0 = 0 391 390 JN0 = 0 … … 430 429 431 430 C 432 if(j1 /=2) then433 DO IC=1,NC434 DO L=1,NLAY435 DO I=1,IMR431 if(j1.ne.2) then 432 DO 40 IC=1,NC 433 DO 40 L=1,NLAY 434 DO 40 I=1,IMR 436 435 Q(I, 2,L,IC) = Q(I, 1,L,IC) 437 Q(I,JMR,L,IC) = Q(I,JNP,L,IC) 438 END DO 439 END DO 440 END DO 436 40 Q(I,JMR,L,IC) = Q(I,JNP,L,IC) 441 437 endif 442 438 C 443 439 C Compute "tracer density" 444 DO IC=1,NC 445 DO k=1,NLAY 446 DO j=1,JNP 447 DO i=1,IMR 448 DQ(i,j,k,IC) = Q(i,j,k,IC)*delp1(i,j,k) 449 END DO 450 END DO 451 END DO 452 END DO 453 C 454 do k=1,NLAY 455 C 456 if(IGD==0) then 440 DO 550 IC=1,NC 441 DO 44 k=1,NLAY 442 DO 44 j=1,JNP 443 DO 44 i=1,IMR 444 44 DQ(i,j,k,IC) = Q(i,j,k,IC)*delp1(i,j,k) 445 550 continue 446 C 447 do 1500 k=1,NLAY 448 C 449 if(IGD.eq.0) then 457 450 C Convert winds on A-Grid to Courant # on C-Grid. 458 451 call A2C(U(1,1,k),V(1,1,k),IMR,JMR,j1,j2,CRX,CRY,dtdx5,DTDY5) 459 452 else 460 453 C Convert winds on C-grid to Courant # 461 do j=j1,j2 462 do i=2,IMR 463 CRX(i,J) = dtdx(j)*U(i-1,j,k) 464 END DO 465 END DO 454 do 45 j=j1,j2 455 do 45 i=2,IMR 456 45 CRX(i,J) = dtdx(j)*U(i-1,j,k) 466 457 467 458 C 468 do j=j1,j2 469 CRX(1,J) = dtdx(j)*U(IMR,j,k) 470 END DO 471 C 472 do i=1,IMR*JMR 473 CRY(i,2) = DTDY*V(i,1,k) 474 END DO 459 do 50 j=j1,j2 460 50 CRX(1,J) = dtdx(j)*U(IMR,j,k) 461 C 462 do 55 i=1,IMR*JMR 463 55 CRY(i,2) = DTDY*V(i,1,k) 475 464 endif 476 465 C … … 481 470 do j=JS0,j1+1,-1 482 471 do i=1,IMR 483 if(abs(CRX(i,j)) >1.) then472 if(abs(CRX(i,j)).GT.1.) then 484 473 JS = j 485 474 go to 2222 … … 491 480 do j=JN0,j2-1 492 481 do i=1,IMR 493 if(abs(CRX(i,j)) >1.) then482 if(abs(CRX(i,j)).GT.1.) then 494 483 JN = j 495 484 go to 2233 … … 499 488 2233 continue 500 489 C 501 if(j1 /=2) then ! Enlarged polar cap.490 if(j1.ne.2) then ! Enlarged polar cap. 502 491 do i=1,IMR 503 492 DPI(i, 2,k) = 0. … … 516 505 enddo 517 506 C 518 do j=j1,j2 519 DO i=1,IMR 520 DPI(i,j,k) = (ymass(i,j) - ymass(i,j+1)) * acosp(j) 521 END DO 522 END DO 507 do 95 j=j1,j2 508 DO 95 i=1,IMR 509 95 DPI(i,j,k) = (ymass(i,j) - ymass(i,j+1)) * acosp(j) 523 510 C 524 511 C Poles … … 549 536 enddo 550 537 C 551 do j=j1,j2 552 DO i=1,IMR 553 xmass(i,j) = PU(i,j)*CRX(i,j) 554 END DO 555 END DO 556 C 557 DO j=j1,j2 558 DO i=1,IMR-1 559 DPI(i,j,k) = DPI(i,j,k) + xmass(i,j) - xmass(i+1,j) 560 END DO 561 END DO 562 C 563 DO j=j1,j2 564 DPI(IMR,j,k) = DPI(IMR,j,k) + xmass(IMR,j) - xmass(1,j) 565 END DO 538 do 110 j=j1,j2 539 DO 110 i=1,IMR 540 110 xmass(i,j) = PU(i,j)*CRX(i,j) 541 C 542 DO 120 j=j1,j2 543 DO 120 i=1,IMR-1 544 120 DPI(i,j,k) = DPI(i,j,k) + xmass(i,j) - xmass(i+1,j) 545 C 546 DO 130 j=j1,j2 547 130 DPI(IMR,j,k) = DPI(IMR,j,k) + xmass(IMR,j) - xmass(1,j) 566 548 C 567 549 DO j=j1,j2 … … 587 569 enddo 588 570 C 589 if(j1 ==2) then571 if(j1.eq.2) then 590 572 IMH = IMR/2 591 573 do i=1,IMH … … 600 582 C 601 583 C ****6***0*********0*********0*********0*********0*********0**********72 602 do IC=1,NC584 do 1000 IC=1,NC 603 585 C 604 586 do i=1,IMJM … … 608 590 C 609 591 C E-W advective cross term 610 do j=J1,J2611 if(J >JS .and. J<JN) GO TO 250592 do 250 j=J1,J2 593 if(J.GT.JS .and. J.LT.JN) GO TO 250 612 594 C 613 595 do i=1,IMR … … 620 602 enddo 621 603 C 622 DO i=1,IMR604 DO 230 i=1,IMR 623 605 iu = UA(i,j) 624 606 ru = UA(i,j) - iu 625 607 iiu = i-iu 626 if(UA(i,j) >=0.) then608 if(UA(i,j).GE.0.) then 627 609 wk1(i,j,1) = qtmp(iiu)+ru*(qtmp(iiu-1)-qtmp(iiu)) 628 610 else … … 630 612 endif 631 613 wk1(i,j,1) = wk1(i,j,1) - qtmp(i) 632 END DO 614 230 continue 633 615 250 continue 634 END DO 635 C 636 if(JN/=0) then 616 C 617 if(JN.ne.0) then 637 618 do j=JS+1,JN-1 638 619 C … … 664 645 if(cross) then 665 646 C Add cross terms in the vertical direction. 666 if(IORD >=2) then647 if(IORD .GE. 2) then 667 648 iad = 2 668 649 else … … 670 651 endif 671 652 C 672 if(JORD >=2) then653 if(JORD .GE. 2) then 673 654 jad = 2 674 655 else … … 690 671 & DC2,ymass,WK1(1,1,3),wk1(1,1,4),WK1(1,1,5),WK1(1,1,6),JORD) 691 672 C 692 END DO 693 END DO 673 1000 continue 674 1500 continue 694 675 C 695 676 C ******* Compute vertical mass flux (same unit as PS) *********** … … 697 678 C 1st step: compute total column mass CONVERGENCE. 698 679 C 699 do j=1,JNP 700 do i=1,IMR 701 CRY(i,j) = DPI(i,j,1) 702 END DO 703 END DO 704 C 705 do k=2,NLAY 706 do j=1,JNP 707 do i=1,IMR 680 do 320 j=1,JNP 681 do 320 i=1,IMR 682 320 CRY(i,j) = DPI(i,j,1) 683 C 684 do 330 k=2,NLAY 685 do 330 j=1,JNP 686 do 330 i=1,IMR 708 687 CRY(i,j) = CRY(i,j) + DPI(i,j,k) 709 END DO 710 END DO 711 END DO 712 C 713 do j=1,JNP 714 do i=1,IMR 688 330 continue 689 C 690 do 360 j=1,JNP 691 do 360 i=1,IMR 715 692 C 716 693 C 2nd step: compute PS2 (PS at n+1) using the hydrostatic assumption. … … 723 700 W(i,j,1) = DPI(i,j,1) - DBK(1)*CRY(i,j) 724 701 W(i,j,NLAY) = 0. 725 END DO 726 END DO 727 C 728 do k=2,NLAY-1 729 do j=1,JNP 730 do i=1,IMR 702 360 continue 703 C 704 do 370 k=2,NLAY-1 705 do 370 j=1,JNP 706 do 370 i=1,IMR 731 707 W(i,j,k) = W(i,j,k-1) + DPI(i,j,k) - DBK(k)*CRY(i,j) 732 END DO 733 END DO 734 END DO 735 C 736 DO k=1,NLAY 737 DO j=1,JNP 738 DO i=1,IMR 708 370 continue 709 C 710 DO 380 k=1,NLAY 711 DO 380 j=1,JNP 712 DO 380 i=1,IMR 739 713 delp2(i,j,k) = DAP(k) + DBK(k)*PS2(i,j) 740 END DO 741 END DO 742 END DO 714 380 continue 743 715 C 744 716 KRD = max(3, KORD) 745 do IC=1,NC717 do 4000 IC=1,NC 746 718 C 747 719 C****6***0*********0*********0*********0*********0*********0**********72 … … 766 738 enddo 767 739 C 768 if(j1 /=2) then769 DO k=1,NLAY770 DO I=1,IMR771 c j=1 c'est le p �le Sud, j=JNP c'est le p�le Nord740 if(j1.ne.2) then 741 DO 400 k=1,NLAY 742 DO 400 I=1,IMR 743 c j=1 c'est le pôle Sud, j=JNP c'est le pôle Nord 772 744 Q(I, 2,k,IC) = Q(I, 1,k,IC) 773 745 Q(I,JMR,k,IC) = Q(I,JNP,k,IC) 774 END DO 775 END DO 776 endif 777 END DO 778 C 779 if(j1/=2) then 780 DO k=1,NLAY 781 DO i=1,IMR 746 400 CONTINUE 747 endif 748 4000 continue 749 C 750 if(j1.ne.2) then 751 DO 5000 k=1,NLAY 752 DO 5000 i=1,IMR 782 753 W(i, 2,k) = W(i, 1,k) 783 754 W(i,JMR,k) = W(i,JNP,k) 784 END DO 785 END DO 755 5000 continue 786 756 endif 787 757 C … … 815 785 C ****6***0*********0*********0*********0*********0*********0**********72 816 786 C 817 do k=1,NLAYM1818 do i=1,IMJM787 do 1000 k=1,NLAYM1 788 do 1000 i=1,IMJM 819 789 DQDT(i,1,k) = P(i,1,k+1) - P(i,1,k) 820 END DO 821 END DO 822 C 823 DO k=2,NLAYM1 824 DO I=1,IMJM 790 1000 continue 791 C 792 DO 1220 k=2,NLAYM1 793 DO 1220 I=1,IMJM 825 794 c0 = delp(i,1,k) / (delp(i,1,k-1)+delp(i,1,k)+delp(i,1,k+1)) 826 795 c1 = (delp(i,1,k-1)+0.5*delp(i,1,k))/(delp(i,1,k+1)+delp(i,1,k)) … … 830 799 Qmin = P(i,1,k) - min(P(i,1,k-1),P(i,1,k),P(i,1,k+1)) 831 800 DC(i,1,k) = sign(min(abs(tmp),Qmax,Qmin), tmp) 832 END DO 833 END DO 801 1220 CONTINUE 834 802 835 803 C … … 838 806 C ****6***0*********0*********0*********0*********0*********0**********72 839 807 C 840 DO j=1,JNP841 if((j ==2 .or. j==JMR) .and. j1/=2) goto 2000808 DO 2000 j=1,JNP 809 if((j.eq.2 .or. j.eq.JMR) .and. j1.ne.2) goto 2000 842 810 C 843 811 DO k=1,NLAY … … 860 828 C 861 829 C First guess top edge value 862 DO i=1,IMR830 DO 10 i=1,IMR 863 831 C three-cell PPM 864 832 C Compute a,b, and c of q = aP**2 + bP + c using cell averages and delp … … 872 840 C 873 841 C Check if change sign 874 if(wk1(i,1)*AL(i,1) <=0.) then842 if(wk1(i,1)*AL(i,1).le.0.) then 875 843 AL(i,1) = 0. 876 844 flux(i,1) = 0. … … 878 846 flux(i,1) = wk1(i,1) - AL(i,1) 879 847 endif 880 END DO 848 10 continue 881 849 C 882 850 C Bottom 883 DO i=1,IMR851 DO 15 i=1,IMR 884 852 C 2-cell PPM with zero gradient right at the surface 885 853 C … … 888 856 AR(i,NLAY) = wk1(i,NLAY) + fct 889 857 AL(i,NLAY) = wk1(i,NLAY) - (fct+fct) 890 if(wk1(i,NLAY)*AR(i,NLAY) <=0.) AR(i,NLAY) = 0.858 if(wk1(i,NLAY)*AR(i,NLAY).le.0.) AR(i,NLAY) = 0. 891 859 flux(i,NLAY) = AR(i,NLAY) - wk1(i,NLAY) 892 END DO 860 15 continue 893 861 894 862 C … … 897 865 C****6***0*********0*********0*********0*********0*********0**********72 898 866 C 899 DO k=3,NLAYM1900 DO i=1,IMR867 DO 14 k=3,NLAYM1 868 DO 12 i=1,IMR 901 869 c1 = DQDT(i,j,k-1)*wk2(i,k-1) / (wk2(i,k-1)+wk2(i,k)) 902 870 c2 = 2. / (wk2(i,k-2)+wk2(i,k-1)+wk2(i,k)+wk2(i,k+1)) … … 907 875 & wk2(i,k-1)*A1*flux(i,k) ) 908 876 C print *,'AL1',i,k, AL(i,k) 909 END DO 910 END DO 911 C 912 do i=1,IMR*NLAYM1877 12 CONTINUE 878 14 continue 879 C 880 do 20 i=1,IMR*NLAYM1 913 881 AR(i,1) = AL(i,2) 914 882 C print *,'AR1',i,AR(i,1) 915 END DO 916 C 917 do i=1,IMR*NLAY883 20 continue 884 C 885 do 30 i=1,IMR*NLAY 918 886 A6(i,1) = 3.*(wk1(i,1)+wk1(i,1) - (AL(i,1)+AR(i,1))) 919 887 C print *,'A61',i,A6(i,1) 920 END DO 888 30 continue 921 889 C 922 890 C****6***0*********0*********0*********0*********0*********0**********72 … … 927 895 C 928 896 C Interior depending on KORD 929 if(LMT <=2)897 if(LMT.LE.2) 930 898 & call lmtppm(flux(1,2),A6(1,2),AR(1,2),AL(1,2),wk1(1,2), 931 899 & IMR*(NLAY-2),LMT) … … 933 901 C****6***0*********0*********0*********0*********0*********0**********72 934 902 C 935 DO i=1,IMR*NLAYM1936 IF(wz2(i,1) >0.) then903 DO 140 i=1,IMR*NLAYM1 904 IF(wz2(i,1).GT.0.) then 937 905 CM = wz2(i,1) / wk2(i,1) 938 906 flux(i,2) = AR(i,1)+0.5*CM*(AL(i,1)-AR(i,1)+A6(i,1)*(1.-R23*CM)) … … 944 912 C print *,'test2',i, AL(i,2),AR(i,2),A6(i,2),R23 945 913 endif 946 END DO 947 C 948 DO i=1,IMR*NLAYM1914 140 continue 915 C 916 DO 250 i=1,IMR*NLAYM1 949 917 flux(i,2) = wz2(i,1) * flux(i,2) 950 END DO 951 C 952 do i=1,IMR918 250 continue 919 C 920 do 350 i=1,IMR 953 921 DQ(i,j, 1) = DQ(i,j, 1) - flux(i, 2) 954 922 DQ(i,j,NLAY) = DQ(i,j,NLAY) + flux(i,NLAY) 955 END DO 956 C 957 do k=2,NLAYM1 958 do i=1,IMR 959 DQ(i,j,k) = DQ(i,j,k) + flux(i,k) - flux(i,k+1) 960 END DO 961 END DO 923 350 continue 924 C 925 do 360 k=2,NLAYM1 926 do 360 i=1,IMR 927 360 DQ(i,j,k) = DQ(i,j,k) + flux(i,k) - flux(i,k+1) 962 928 2000 continue 963 END DO964 929 return 965 930 end … … 985 950 j2vl = j2-jvan 986 951 C 987 do j=j1,j2952 do 1310 j=j1,j2 988 953 C 989 954 do i=1,IMR … … 991 956 enddo 992 957 C 993 if(j >=JN .or. j<=JS) goto 2222958 if(j.ge.JN .or. j.le.JS) goto 2222 994 959 C ************* Eulerian ********** 995 960 C … … 999 964 qtmp(IMP+1) = q(2,J) 1000 965 C 1001 IF(IORD ==1 .or. j==j1 .or. j==j2) THEN1002 DO i=1,IMR966 IF(IORD.eq.1 .or. j.eq.j1. or. j.eq.j2) THEN 967 DO 1406 i=1,IMR 1003 968 iu = REAL(i) - uc(i,j) 1004 fx1(i) = qtmp(iu) 1005 END DO 969 1406 fx1(i) = qtmp(iu) 1006 970 ELSE 1007 971 call xmist(IMR,IML,Qtmp,DC) 1008 972 DC(0) = DC(IMR) 1009 973 C 1010 if(IORD ==2 .or. j<=j1vl .or. j>=j2vl) then1011 DO i=1,IMR974 if(IORD.eq.2 .or. j.le.j1vl .or. j.ge.j2vl) then 975 DO 1408 i=1,IMR 1012 976 iu = REAL(i) - uc(i,j) 1013 fx1(i) = qtmp(iu) + DC(iu)*(sign(1.,uc(i,j))-uc(i,j)) 1014 END DO 977 1408 fx1(i) = qtmp(iu) + DC(iu)*(sign(1.,uc(i,j))-uc(i,j)) 1015 978 else 1016 979 call fxppm(IMR,IML,UC(1,j),Qtmp,DC,fx1,IORD) … … 1019 982 ENDIF 1020 983 C 1021 DO i=1,IMR 1022 fx1(i) = fx1(i)*xmass(i,j) 1023 END DO 984 DO 1506 i=1,IMR 985 1506 fx1(i) = fx1(i)*xmass(i,j) 1024 986 C 1025 987 goto 1309 … … 1034 996 enddo 1035 997 C 1036 IF(IORD ==1 .or. j==j1 .or. j==j2) THEN1037 DO i=1,IMR998 IF(IORD.eq.1 .or. j.eq.j1. or. j.eq.j2) THEN 999 DO 1306 i=1,IMR 1038 1000 itmp = INT(uc(i,j)) 1039 1001 ISAVE(i) = i - itmp 1040 1002 iu = i - uc(i,j) 1041 fx1(i) = (uc(i,j) - itmp)*qtmp(iu) 1042 END DO 1003 1306 fx1(i) = (uc(i,j) - itmp)*qtmp(iu) 1043 1004 ELSE 1044 1005 call xmist(IMR,IML,Qtmp,DC) … … 1049 1010 enddo 1050 1011 C 1051 DO i=1,IMR1012 DO 1307 i=1,IMR 1052 1013 itmp = INT(uc(i,j)) 1053 1014 rut = uc(i,j) - itmp 1054 1015 ISAVE(i) = i - itmp 1055 1016 iu = i - uc(i,j) 1056 fx1(i) = rut*(qtmp(iu) + DC(iu)*(sign(1.,rut) - rut)) 1057 END DO 1017 1307 fx1(i) = rut*(qtmp(iu) + DC(iu)*(sign(1.,rut) - rut)) 1058 1018 ENDIF 1059 1019 C 1060 do i=1,IMR1061 IF(uc(i,j) >1.) then1020 do 1308 i=1,IMR 1021 IF(uc(i,j).GT.1.) then 1062 1022 CDIR$ NOVECTOR 1063 1023 do ist = ISAVE(i),i-1 1064 1024 fx1(i) = fx1(i) + qtmp(ist) 1065 1025 enddo 1066 elseIF(uc(i,j) <-1.) then1026 elseIF(uc(i,j).LT.-1.) then 1067 1027 do ist = i,ISAVE(i)-1 1068 1028 fx1(i) = fx1(i) - qtmp(ist) … … 1070 1030 CDIR$ VECTOR 1071 1031 endif 1072 END DO 1032 1308 continue 1073 1033 do i=1,IMR 1074 1034 fx1(i) = PU(i,j)*fx1(i) … … 1078 1038 C 1079 1039 1309 fx1(IMP) = fx1(1) 1080 DO i=1,IMR 1081 DQ(i,j) = DQ(i,j) + fx1(i)-fx1(i+1) 1082 END DO 1040 DO 1215 i=1,IMR 1041 1215 DQ(i,j) = DQ(i,j) + fx1(i)-fx1(i+1) 1083 1042 C 1084 1043 C *************************************** 1085 1044 C 1086 END DO 1045 1310 continue 1087 1046 return 1088 1047 end … … 1120 1079 C endif 1121 1080 C 1122 DO i=1,IMR 1123 AL(i) = 0.5*(p(i-1)+p(i)) + (DC(i-1) - DC(i))*R3 1124 END DO 1125 C 1126 do i=1,IMR-1 1127 AR(i) = AL(i+1) 1128 END DO 1081 DO 10 i=1,IMR 1082 10 AL(i) = 0.5*(p(i-1)+p(i)) + (DC(i-1) - DC(i))*R3 1083 C 1084 do 20 i=1,IMR-1 1085 20 AR(i) = AL(i+1) 1129 1086 AR(IMR) = AL(1) 1130 1087 C 1131 do i=1,IMR 1132 A6(i) = 3.*(p(i)+p(i) - (AL(i)+AR(i))) 1133 END DO 1134 C 1135 if(LMT<=2) call lmtppm(DC(1),A6(1),AR(1),AL(1),P(1),IMR,LMT) 1088 do 30 i=1,IMR 1089 30 A6(i) = 3.*(p(i)+p(i) - (AL(i)+AR(i))) 1090 C 1091 if(LMT.LE.2) call lmtppm(DC(1),A6(1),AR(1),AL(1),P(1),IMR,LMT) 1136 1092 C 1137 1093 AL(0) = AL(IMR) … … 1140 1096 C 1141 1097 DO i=1,IMR 1142 IF(UT(i) >0.) then1098 IF(UT(i).GT.0.) then 1143 1099 flux(i) = AR(i-1) + 0.5*UT(i)*(AL(i-1) - AR(i-1) + 1144 1100 & A6(i-1)*(1.-R23*UT(i)) ) … … 1159 1115 real :: tmp,pmax,pmin 1160 1116 C 1161 do i=1,IMR1117 do 10 i=1,IMR 1162 1118 tmp = R24*(8.*(p(i+1) - p(i-1)) + p(i-2) - p(i+2)) 1163 1119 Pmax = max(P(i-1), p(i), p(i+1)) - p(i) 1164 1120 Pmin = p(i) - min(P(i-1), p(i), p(i+1)) 1165 DC(i) = sign(min(abs(tmp),Pmax,Pmin), tmp) 1166 END DO 1121 10 DC(i) = sign(min(abs(tmp),Pmax,Pmin), tmp) 1167 1122 return 1168 1123 end … … 1183 1138 len = IMR*(J2-J1+2) 1184 1139 C 1185 if(JORD ==1) then1186 DO i=1,len1140 if(JORD.eq.1) then 1141 DO 1000 i=1,len 1187 1142 JT = REAL(J1) - VC(i,J1) 1188 fx(i,j1) = p(i,JT) 1189 END DO 1143 1000 fx(i,j1) = p(i,JT) 1190 1144 else 1191 1145 1192 1146 call ymist(IMR,JNP,j1,P,DC2,4) 1193 1147 C 1194 if(JORD <=0 .or. JORD>=3) then1148 if(JORD.LE.0 .or. JORD.GE.3) then 1195 1149 1196 1150 call fyppm(VC,P,DC2,fx,IMR,JNP,j1,j2,A6,AR,AL,JORD) 1197 1151 1198 1152 else 1199 DO i=1,len1153 DO 1200 i=1,len 1200 1154 JT = REAL(J1) - VC(i,J1) 1201 fx(i,j1) = p(i,JT) + (sign(1.,VC(i,j1))-VC(i,j1))*DC2(i,JT) 1202 END DO 1203 endif 1204 endif 1205 C 1206 DO i=1,len 1207 fx(i,j1) = fx(i,j1)*ymass(i,j1) 1208 END DO 1209 C 1210 DO j=j1,j2 1211 DO i=1,IMR 1212 DQ(i,j) = DQ(i,j) + (fx(i,j) - fx(i,j+1)) * acosp(j) 1213 END DO 1214 END DO 1155 1200 fx(i,j1) = p(i,JT) + (sign(1.,VC(i,j1))-VC(i,j1))*DC2(i,JT) 1156 endif 1157 endif 1158 C 1159 DO 1300 i=1,len 1160 1300 fx(i,j1) = fx(i,j1)*ymass(i,j1) 1161 C 1162 DO 1400 j=j1,j2 1163 DO 1400 i=1,IMR 1164 1400 DQ(i,j) = DQ(i,j) + (fx(i,j) - fx(i,j+1)) * acosp(j) 1215 1165 C 1216 1166 C Poles … … 1229 1179 enddo 1230 1180 C 1231 if(j1 /=2) then1181 if(j1.ne.2) then 1232 1182 do i=1,IMR 1233 1183 DQ(i, 2) = sum1 … … 1251 1201 IJM3 = IMR*(JMR-3) 1252 1202 C 1253 IF(ID ==2) THEN1254 do i=1,IMR*(JMR-1)1203 IF(ID.EQ.2) THEN 1204 do 10 i=1,IMR*(JMR-1) 1255 1205 tmp = 0.25*(p(i,3) - p(i,1)) 1256 1206 Pmax = max(p(i,1),p(i,2),p(i,3)) - p(i,2) 1257 1207 Pmin = p(i,2) - min(p(i,1),p(i,2),p(i,3)) 1258 1208 DC(i,2) = sign(min(abs(tmp),Pmin,Pmax),tmp) 1259 END DO 1209 10 CONTINUE 1260 1210 ELSE 1261 do i=1,IMH1211 do 12 i=1,IMH 1262 1212 C J=2 1263 1213 tmp = (8.*(p(i,3) - p(i,1)) + p(i+IMH,2) - p(i,4))*R24 … … 1270 1220 Pmin = p(i,JMR) - min(p(i,JMR-1),p(i,JMR),p(i,JNP)) 1271 1221 DC(i,JMR) = sign(min(abs(tmp),Pmin,Pmax),tmp) 1272 END DO 1273 do i=IMH+1,IMR1222 12 CONTINUE 1223 do 14 i=IMH+1,IMR 1274 1224 C J=2 1275 1225 tmp = (8.*(p(i,3) - p(i,1)) + p(i-IMH,2) - p(i,4))*R24 … … 1282 1232 Pmin = p(i,JMR) - min(p(i,JMR-1),p(i,JMR),p(i,JNP)) 1283 1233 DC(i,JMR) = sign(min(abs(tmp),Pmin,Pmax),tmp) 1284 END DO 1285 C 1286 do i=1,IJM31234 14 CONTINUE 1235 C 1236 do 15 i=1,IJM3 1287 1237 tmp = (8.*(p(i,4) - p(i,2)) + p(i,1) - p(i,5))*R24 1288 1238 Pmax = max(p(i,2),p(i,3),p(i,4)) - p(i,3) 1289 1239 Pmin = p(i,3) - min(p(i,2),p(i,3),p(i,4)) 1290 1240 DC(i,3) = sign(min(abs(tmp),Pmin,Pmax),tmp) 1291 END DO 1241 15 CONTINUE 1292 1242 ENDIF 1293 1243 C 1294 if(j1 /=2) then1244 if(j1.ne.2) then 1295 1245 do i=1,IMR 1296 1246 DC(i,1) = 0. … … 1300 1250 C Determine slopes in polar caps for scalars! 1301 1251 C 1302 do i=1,IMH1252 do 13 i=1,IMH 1303 1253 C South 1304 1254 tmp = 0.25*(p(i,2) - p(i+imh,2)) … … 1311 1261 Pmin = p(i,JNP) - min(p(i+imh,JMR),p(i,jnp), p(i,JMR)) 1312 1262 DC(i,JNP) = sign(min(abs(tmp),Pmax,pmin),tmp) 1313 END DO 1314 C 1315 do i=imh+1,IMR1263 13 continue 1264 C 1265 do 25 i=imh+1,IMR 1316 1266 DC(i, 1) = - DC(i-imh, 1) 1317 1267 DC(i,JNP) = - DC(i-imh,JNP) 1318 END DO 1268 25 continue 1319 1269 endif 1320 1270 return … … 1358 1308 LMT = JORD - 3 1359 1309 C 1360 DO i=1,IMR*JMR1310 DO 10 i=1,IMR*JMR 1361 1311 AL(i,2) = 0.5*(p(i,1)+p(i,2)) + (DC(i,1) - DC(i,2))*R3 1362 1312 AR(i,1) = AL(i,2) 1363 END DO 1313 10 CONTINUE 1364 1314 C 1365 1315 CPoles: … … 1381 1331 1382 1332 1383 do i=1,len 1384 A6(i,j11) = 3.*(p(i,j11)+p(i,j11) - (AL(i,j11)+AR(i,j11))) 1385 END DO 1386 C 1387 if(LMT<=2) call lmtppm(DC(1,j11),A6(1,j11),AR(1,j11) 1333 do 30 i=1,len 1334 30 A6(i,j11) = 3.*(p(i,j11)+p(i,j11) - (AL(i,j11)+AR(i,j11))) 1335 C 1336 if(LMT.le.2) call lmtppm(DC(1,j11),A6(1,j11),AR(1,j11) 1388 1337 & ,AL(1,j11),P(1,j11),len,LMT) 1389 1338 C 1390 1339 1391 DO i=1,IMJM11392 IF(VC(i,j1) >0.) then1340 DO 140 i=1,IMJM1 1341 IF(VC(i,j1).GT.0.) then 1393 1342 flux(i,j1) = AR(i,j11) + 0.5*VC(i,j1)*(AL(i,j11) - AR(i,j11) + 1394 1343 & A6(i,j11)*(1.-R23*VC(i,j1)) ) … … 1397 1346 & A6(i,j1)*(1.+R23*VC(i,j1))) 1398 1347 endif 1399 END DO 1348 140 continue 1400 1349 return 1401 1350 end … … 1429 1378 c write(*,*) 'toto 1' 1430 1379 C -------------------------------- 1431 IF(IAD ==2) then1380 IF(IAD.eq.2) then 1432 1381 do j=j1-1,j2+1 1433 1382 do i=1,IMR … … 1446 1395 c write(*,*) 'toto 2' 1447 1396 C 1448 ELSEIF(IAD ==1) then1397 ELSEIF(IAD.eq.1) then 1449 1398 do j=j1-1,j2+1 1450 1399 do i=1,imr … … 1455 1404 ENDIF 1456 1405 C 1457 if(j1 /=2) then1406 if(j1.ne.2) then 1458 1407 sum1 = 0. 1459 1408 sum2 = 0. … … 1499 1448 C 1500 1449 JMR = JNP-1 1501 do j=j1,j21502 if(J >JS .and. J<JN) GO TO 13091450 do 1309 j=j1,j2 1451 if(J.GT.JS .and. J.LT.JN) GO TO 1309 1503 1452 C 1504 1453 do i=1,IMR … … 1511 1460 enddo 1512 1461 C 1513 IF(IAD ==2) THEN1462 IF(IAD.eq.2) THEN 1514 1463 DO i=1,IMR 1515 1464 IP = NINT(UA(i,j)) … … 1520 1469 adx(i,j) = qtmp(ip) + ru*(a1*ru + b1) 1521 1470 enddo 1522 ELSEIF(IAD ==1) then1471 ELSEIF(IAD.eq.1) then 1523 1472 DO i=1,IMR 1524 1473 iu = UA(i,j) 1525 1474 ru = UA(i,j) - iu 1526 1475 iiu = i-iu 1527 if(UA(i,j) >=0.) then1476 if(UA(i,j).GE.0.) then 1528 1477 adx(i,j) = qtmp(iiu)+ru*(qtmp(iiu-1)-qtmp(iiu)) 1529 1478 else … … 1537 1486 enddo 1538 1487 1309 continue 1539 END DO1540 1488 C 1541 1489 C Eulerian upwind … … 1550 1498 qtmp(IMR+1) = p(1,J) 1551 1499 C 1552 IF(IAD ==2) THEN1500 IF(IAD.eq.2) THEN 1553 1501 qtmp(-1) = p(IMR-1,J) 1554 1502 qtmp(IMR+2) = p(2,J) … … 1561 1509 adx(i,j) = qtmp(ip)- p(i,j) + ru*(a1*ru + b1) 1562 1510 enddo 1563 ELSEIF(IAD ==1) then1511 ELSEIF(IAD.eq.1) then 1564 1512 C 1st order 1565 1513 DO i=1,IMR … … 1570 1518 enddo 1571 1519 C 1572 if(j1 /=2) then1520 if(j1.ne.2) then 1573 1521 do i=1,IMR 1574 1522 adx(i, 2) = 0. … … 1606 1554 REAL da1,da2,a6da,fmin 1607 1555 C 1608 if(LMT ==0) then1556 if(LMT.eq.0) then 1609 1557 C Full constraint 1610 do i=1,IM1611 if(DC(i) ==0.) then1558 do 100 i=1,IM 1559 if(DC(i).eq.0.) then 1612 1560 AR(i) = p(i) 1613 1561 AL(i) = p(i) … … 1617 1565 da2 = da1**2 1618 1566 A6DA = A6(i)*da1 1619 if(A6DA <-da2) then1567 if(A6DA .lt. -da2) then 1620 1568 A6(i) = 3.*(AL(i)-p(i)) 1621 1569 AR(i) = AL(i) - A6(i) 1622 elseif(A6DA >da2) then1570 elseif(A6DA .gt. da2) then 1623 1571 A6(i) = 3.*(AR(i)-p(i)) 1624 1572 AL(i) = AR(i) - A6(i) 1625 1573 endif 1626 1574 endif 1627 END DO 1628 elseif(LMT ==1) then1575 100 continue 1576 elseif(LMT.eq.1) then 1629 1577 C Semi-monotonic constraint 1630 do i=1,IM1631 if(abs(AR(i)-AL(i)) >=-A6(i)) go to 1501632 if(p(i) <AR(i) .and. p(i)<AL(i)) then1578 do 150 i=1,IM 1579 if(abs(AR(i)-AL(i)) .GE. -A6(i)) go to 150 1580 if(p(i).lt.AR(i) .and. p(i).lt.AL(i)) then 1633 1581 AR(i) = p(i) 1634 1582 AL(i) = p(i) 1635 1583 A6(i) = 0. 1636 elseif(AR(i) >AL(i)) then1584 elseif(AR(i) .gt. AL(i)) then 1637 1585 A6(i) = 3.*(AL(i)-p(i)) 1638 1586 AR(i) = AL(i) - A6(i) … … 1642 1590 endif 1643 1591 150 continue 1644 END DO 1645 elseif(LMT==2) then 1646 do i=1,IM 1647 if(abs(AR(i)-AL(i)) >= -A6(i)) go to 250 1592 elseif(LMT.eq.2) then 1593 do 250 i=1,IM 1594 if(abs(AR(i)-AL(i)) .GE. -A6(i)) go to 250 1648 1595 fmin = p(i) + 0.25*(AR(i)-AL(i))**2/A6(i) + A6(i)*R12 1649 if(fmin >=0.) go to 2501650 if(p(i) <AR(i) .and. p(i)<AL(i)) then1596 if(fmin.ge.0.) go to 250 1597 if(p(i).lt.AR(i) .and. p(i).lt.AL(i)) then 1651 1598 AR(i) = p(i) 1652 1599 AL(i) = p(i) 1653 1600 A6(i) = 0. 1654 elseif(AR(i) >AL(i)) then1601 elseif(AR(i) .gt. AL(i)) then 1655 1602 A6(i) = 3.*(AL(i)-p(i)) 1656 1603 AR(i) = AL(i) - A6(i) … … 1660 1607 endif 1661 1608 250 continue 1662 END DO1663 1609 endif 1664 1610 return … … 1671 1617 integer i,j 1672 1618 C 1673 do j=j1,j2 1674 do i=2,IMR 1675 CRX(i,J) = dtdx5(j)*(U(i,j)+U(i-1,j)) 1676 END DO 1677 END DO 1678 C 1679 do j=j1,j2 1680 CRX(1,J) = dtdx5(j)*(U(1,j)+U(IMR,j)) 1681 END DO 1682 C 1683 do i=1,IMR*JMR 1684 CRY(i,2) = DTDY5*(V(i,2)+V(i,1)) 1685 END DO 1619 do 35 j=j1,j2 1620 do 35 i=2,IMR 1621 35 CRX(i,J) = dtdx5(j)*(U(i,j)+U(i-1,j)) 1622 C 1623 do 45 j=j1,j2 1624 45 CRX(1,J) = dtdx5(j)*(U(1,j)+U(IMR,j)) 1625 C 1626 do 55 i=1,IMR*JMR 1627 55 CRY(i,2) = DTDY5*(V(i,2)+V(i,1)) 1686 1628 return 1687 1629 end … … 1694 1636 real ph5 1695 1637 JMR = JNP-1 1696 do j=2,JNP1638 do 55 j=2,JNP 1697 1639 ph5 = -0.5*PI + (REAL(J-1)-0.5)*DP 1698 cose(j) = cos(ph5) 1699 END DO 1640 55 cose(j) = cos(ph5) 1700 1641 C 1701 1642 JEQ = (JNP+1) / 2 1702 if(JMR ==2*(JMR/2) ) then1643 if(JMR .eq. 2*(JMR/2) ) then 1703 1644 do j=JNP, JEQ+1, -1 1704 1645 cose(j) = cose(JNP+2-j) … … 1712 1653 endif 1713 1654 C 1714 do j=2,JMR 1715 cosp(j) = 0.5*(cose(j)+cose(j+1)) 1716 END DO 1655 do 66 j=2,JMR 1656 66 cosp(j) = 0.5*(cose(j)+cose(j+1)) 1717 1657 cosp(1) = 0. 1718 1658 cosp(JNP) = 0. … … 1728 1668 C 1729 1669 phi = -0.5*PI 1730 do j=2,JNP-11670 do 55 j=2,JNP-1 1731 1671 phi = phi + DP 1732 cosp(j) = cos(phi) 1733 END DO 1672 55 cosp(j) = cos(phi) 1734 1673 cosp( 1) = 0. 1735 1674 cosp(JNP) = 0. 1736 1675 C 1737 do j=2,JNP1676 do 66 j=2,JNP 1738 1677 cose(j) = 0.5*(cosp(j)+cosp(j-1)) 1739 END DO 1740 C 1741 do j=2,JNP-11678 66 CONTINUE 1679 C 1680 do 77 j=2,JNP-1 1742 1681 cosp(j) = 0.5*(cose(j)+cose(j+1)) 1743 END DO 1682 77 CONTINUE 1744 1683 return 1745 1684 end … … 1763 1702 icr = 1 1764 1703 call filns(q(1,1,L),IMR,JNP,j1,j2,cosp,acosp,ipy,tiny) 1765 if(ipy ==0) goto 501704 if(ipy.eq.0) goto 50 1766 1705 call filew(q(1,1,L),qtmp,IMR,JNP,j1,j2,ipx,tiny) 1767 if(ipx ==0) goto 501706 if(ipx.eq.0) goto 50 1768 1707 C 1769 1708 if(cross) then 1770 1709 call filcr(q(1,1,L),IMR,JNP,j1,j2,cosp,acosp,icr,tiny) 1771 1710 endif 1772 if(icr ==0) goto 501711 if(icr.eq.0) goto 50 1773 1712 C 1774 1713 C Vertical filling... 1775 1714 do i=1,len 1776 IF( Q(i,j1,1) <0.) THEN1715 IF( Q(i,j1,1).LT.0.) THEN 1777 1716 ip = ip + 1 1778 1717 Q(i,j1,2) = Q(i,j1,2) + Q(i,j1,1) … … 1782 1721 C 1783 1722 50 continue 1784 DO L = 2,NLAYM11723 DO 225 L = 2,NLAYM1 1785 1724 icr = 1 1786 1725 C 1787 1726 call filns(q(1,1,L),IMR,JNP,j1,j2,cosp,acosp,ipy,tiny) 1788 if(ipy ==0) goto 2251727 if(ipy.eq.0) goto 225 1789 1728 call filew(q(1,1,L),qtmp,IMR,JNP,j1,j2,ipx,tiny) 1790 if(ipx ==0) go to 2251729 if(ipx.eq.0) go to 225 1791 1730 if(cross) then 1792 1731 call filcr(q(1,1,L),IMR,JNP,j1,j2,cosp,acosp,icr,tiny) 1793 1732 endif 1794 if(icr ==0) goto 2251733 if(icr.eq.0) goto 225 1795 1734 C 1796 1735 do i=1,len 1797 IF( Q(I,j1,L) <0.) THEN1736 IF( Q(I,j1,L).LT.0.) THEN 1798 1737 C 1799 1738 ip = ip + 1 … … 1810 1749 ENDDO 1811 1750 225 CONTINUE 1812 END DO1813 1751 C 1814 1752 C BOTTOM LAYER … … 1817 1755 C 1818 1756 call filns(q(1,1,L),IMR,JNP,j1,j2,cosp,acosp,ipy,tiny) 1819 if(ipy ==0) goto 9111757 if(ipy.eq.0) goto 911 1820 1758 call filew(q(1,1,L),qtmp,IMR,JNP,j1,j2,ipx,tiny) 1821 if(ipx ==0) goto 9111759 if(ipx.eq.0) goto 911 1822 1760 C 1823 1761 call filcr(q(1,1,L),IMR,JNP,j1,j2,cosp,acosp,icr,tiny) 1824 if(icr ==0) goto 9111762 if(icr.eq.0) goto 911 1825 1763 C 1826 1764 DO I=1,len 1827 IF( Q(I,j1,L) <0.) THEN1765 IF( Q(I,j1,L).LT.0.) THEN 1828 1766 ip = ip + 1 1829 1767 c … … 1842 1780 911 continue 1843 1781 C 1844 if(ip >IMR) then1782 if(ip.gt.IMR) then 1845 1783 write(6,*) 'IC=',IC,' STEP=',NSTEP, 1846 1784 & ' Vertical filling pts=',ip 1847 1785 endif 1848 1786 C 1849 if(sum >1.e-25) then1787 if(sum.gt.1.e-25) then 1850 1788 write(6,*) IC,NSTEP,' Mass source from the ground=',sum 1851 1789 endif … … 1860 1798 real :: dq,dn,d0,d1,ds,d2 1861 1799 icr = 0 1862 do j=j1+1,j2-11863 DO i=1,IMR-11864 IF(q(i,j) <0.) THEN1800 do 65 j=j1+1,j2-1 1801 DO 50 i=1,IMR-1 1802 IF(q(i,j).LT.0.) THEN 1865 1803 icr = 1 1866 1804 dq = - q(i,j)*cosp(j) … … 1878 1816 q(i,j) = (d2 - dq)*acosp(j) + tiny 1879 1817 endif 1880 END DO 1881 if(icr ==0 .and. q(IMR,j)>=0.) goto 651882 DO i=2,IMR1883 IF(q(i,j) <0.) THEN1818 50 continue 1819 if(icr.eq.0 .and. q(IMR,j).ge.0.) goto 65 1820 DO 55 i=2,IMR 1821 IF(q(i,j).LT.0.) THEN 1884 1822 icr = 1 1885 1823 dq = - q(i,j)*cosp(j) … … 1897 1835 q(i,j) = (d2 - dq)*acosp(j) + tiny 1898 1836 endif 1899 END DO 1837 55 continue 1900 1838 C ***************************************** 1901 1839 C i=1 1902 1840 i=1 1903 IF(q(i,j) <0.) THEN1841 IF(q(i,j).LT.0.) THEN 1904 1842 icr = 1 1905 1843 dq = - q(i,j)*cosp(j) … … 1920 1858 C i=IMR 1921 1859 i=IMR 1922 IF(q(i,j) <0.) THEN1860 IF(q(i,j).LT.0.) THEN 1923 1861 icr = 1 1924 1862 dq = - q(i,j)*cosp(j) … … 1938 1876 C ***************************************** 1939 1877 65 continue 1940 END DO1941 1878 C 1942 1879 do i=1,IMR 1943 if(q(i,j1) <0. .or. q(i,j2)<0.) then1880 if(q(i,j1).lt.0. .or. q(i,j2).lt.0.) then 1944 1881 icr = 1 1945 1882 goto 80 … … 1949 1886 80 continue 1950 1887 C 1951 if(q(1,1) <0. .or. q(1,jnp)<0.) then1888 if(q(1,1).lt.0. .or. q(1,jnp).lt.0.) then 1952 1889 icr = 1 1953 1890 endif … … 1973 1910 C 1974 1911 ipy = 0 1975 do j=j1+1,j2-11976 DO i=1,IMR1977 IF(q(i,j) <0.) THEN1912 do 55 j=j1+1,j2-1 1913 DO 55 i=1,IMR 1914 IF(q(i,j).LT.0.) THEN 1978 1915 ipy = 1 1979 1916 dq = - q(i,j)*cosp(j) … … 1991 1928 q(i,j) = (d2 - dq)*acosp(j) + tiny 1992 1929 endif 1993 END DO 1994 END DO 1930 55 continue 1995 1931 C 1996 1932 do i=1,imr 1997 IF(q(i,j1) <0.) THEN1933 IF(q(i,j1).LT.0.) THEN 1998 1934 ipy = 1 1999 1935 dq = - q(i,j1)*cosp(j1) … … 2009 1945 j = j2 2010 1946 do i=1,imr 2011 IF(q(i,j) <0.) THEN1947 IF(q(i,j).LT.0.) THEN 2012 1948 ipy = 1 2013 1949 dq = - q(i,j)*cosp(j) … … 2022 1958 C 2023 1959 C Check Poles. 2024 if(q(1,1) <0.) then1960 if(q(1,1).lt.0.) then 2025 1961 dq = q(1,1)*cap1/REAL(IMR)*acosp(j1) 2026 1962 do i=1,imr 2027 1963 q(i,1) = 0. 2028 1964 q(i,j1) = q(i,j1) + dq 2029 if(q(i,j1) <0.) ipy = 12030 enddo 2031 endif 2032 C 2033 if(q(1,JNP) <0.) then1965 if(q(i,j1).lt.0.) ipy = 1 1966 enddo 1967 endif 1968 C 1969 if(q(1,JNP).lt.0.) then 2034 1970 dq = q(1,JNP)*cap1/REAL(IMR)*acosp(j2) 2035 1971 do i=1,imr 2036 1972 q(i,JNP) = 0. 2037 1973 q(i,j2) = q(i,j2) + dq 2038 if(q(i,j2) <0.) ipy = 11974 if(q(i,j2).lt.0.) ipy = 1 2039 1975 enddo 2040 1976 endif … … 2052 1988 ipx = 0 2053 1989 C Copy & swap direction for vectorization. 2054 do i=1,imr 2055 do j=j1,j2 2056 qtmp(j,i) = q(i,j) 2057 END DO 2058 END DO 2059 C 2060 do i=2,imr-1 2061 do j=j1,j2 2062 if(qtmp(j,i)<0.) then 1990 do 25 i=1,imr 1991 do 25 j=j1,j2 1992 25 qtmp(j,i) = q(i,j) 1993 C 1994 do 55 i=2,imr-1 1995 do 55 j=j1,j2 1996 if(qtmp(j,i).lt.0.) then 2063 1997 ipx = 1 2064 1998 c west … … 2073 2007 qtmp(j,i) = qtmp(j,i) + d2 + tiny 2074 2008 endif 2075 END DO 2076 END DO 2009 55 continue 2077 2010 c 2078 2011 i=1 2079 do j=j1,j22080 if(qtmp(j,i) <0.) then2012 do 65 j=j1,j2 2013 if(qtmp(j,i).lt.0.) then 2081 2014 ipx = 1 2082 2015 c west … … 2092 2025 qtmp(j,i) = qtmp(j,i) + d2 + tiny 2093 2026 endif 2094 END DO 2027 65 continue 2095 2028 i=IMR 2096 do j=j1,j22097 if(qtmp(j,i) <0.) then2029 do 75 j=j1,j2 2030 if(qtmp(j,i).lt.0.) then 2098 2031 ipx = 1 2099 2032 c west … … 2109 2042 qtmp(j,i) = qtmp(j,i) + d2 + tiny 2110 2043 endif 2111 END DO 2112 C 2113 if(ipx/=0) then 2114 do j=j1,j2 2115 do i=1,imr 2116 q(i,j) = qtmp(j,i) 2117 END DO 2118 END DO 2044 75 continue 2045 C 2046 if(ipx.ne.0) then 2047 do 85 j=j1,j2 2048 do 85 i=1,imr 2049 85 q(i,j) = qtmp(j,i) 2119 2050 else 2120 2051 C 2121 2052 C Poles. 2122 if(q(1,1) <0 .or. q(1,JNP)<0.) ipx = 12053 if(q(1,1).lt.0. or. q(1,JNP).lt.0.) ipx = 1 2123 2054 endif 2124 2055 return … … 2134 2065 integer IC,k,i 2135 2066 C 2136 do IC = 1, nc2137 C 2138 do k=1,km2139 do i=1,im2067 do 4000 IC = 1, nc 2068 C 2069 do 1000 k=1,km 2070 do 1000 i=1,im 2140 2071 qtmp(i,k) = q(i,km+1-k,IC) 2141 END DO 2142 END DO 2143 C 2144 do i=1,im*km 2145 q(i,1,IC) = qtmp(i,1) 2146 END DO 2147 END DO 2072 1000 continue 2073 C 2074 do 2000 i=1,im*km 2075 2000 q(i,1,IC) = qtmp(i,1) 2076 4000 continue 2148 2077 return 2149 2078 end
Note: See TracChangeset
for help on using the changeset viewer.