Changeset 70 in lmdz_wrf
- Timestamp:
- Jul 24, 2014, 2:27:12 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LMDZ_WRFmeas/WRFV3/lmdz/calltherm.F90
r1 r70 121 121 !$OMP THREADPRIVATE(first) 122 122 !******************************************************** 123 124 ! Lluis 125 INTEGER :: llp 126 CHARACTER(LEN=50) :: lvarname, lfname 127 REAL :: largest 128 129 llp = 734 130 lfname = 'physiq' 131 largest = 10.e5 123 132 if (first) then 124 133 itap=0 … … 133 142 ! print*,'thermiques: WARNING on passe t au lieu de t_seri' 134 143 144 lfname='beginning calltherm' 145 lvarname = 't_seri' 146 CALL check_var3D(lfname, lvarname, t_seri, klon, klev, largest, .FALSE.) 135 147 136 148 ! On prend comme valeur initiale des thermiques la valeur du pas … … 237 249 238 250 ! print*,'THERM iflag_thermas_ed=',iflag_thermals_ed 251 239 252 CALL thermcell_main(itap,klon,klev,zdt & 240 253 & ,pplay,paprs,pphi,debut & … … 270 283 ! Ce serait bien de changer, mai en prenant le temps de vérifier que ca 271 284 ! fait bien ce qu'on croit. 285 lfname='after thermcell_main' 286 lvarname = 't_seri' 287 CALL check_var3D(lfname, lvarname, t_seri, klon, klev, largest, .FALSE.) 288 lvarname = 'd_t_the' 289 CALL check_var3D(lfname, lvarname, d_t_the, klon, klev, largest, .FALSE.) 272 290 273 291 flag_bidouille_stratocu=iflag_thermals<=12.or.iflag_thermals==14.or.iflag_thermals==16.or.iflag_thermals==18 … … 301 319 fm_therm(:,klev+1)=0. 302 320 321 lfname='after transforming from derivate to tendency' 322 lvarname = 't_seri' 323 CALL check_var3D(lfname, lvarname, t_seri, klon, klev, largest, .FALSE.) 324 lvarname = 'd_t_the' 325 CALL check_var3D(lfname, lvarname, d_t_the, klon, klev, largest, .FALSE.) 303 326 304 327 … … 316 339 q_seri(:,:) = q_seri(:,:) + d_q_the(:,:) 317 340 if (prt_level.gt.10) write(lunout,*)'Apres apres thermcell_main OK' 341 lfname='after thermcell_main add tendencies' 342 lvarname = 't_seri' 343 CALL check_var3D(lfname, lvarname, t_seri, klon, klev, largest, .FALSE.) 344 lvarname = 'd_t_the' 345 CALL check_var3D(lfname, lvarname, d_t_the, klon, klev, largest, .FALSE.) 318 346 319 347 DO i=1,klon … … 436 464 437 465 end 466 467 SUBROUTINE check_var(funcn, varn, var, sizev, bigvalue, stoprun) 468 ! Subroutine to check the consistency of a variable 469 ! * NaN value: by definition is variable /= variable 470 ! * bigvalue: threshold for the variable 471 472 IMPLICIT NONE 473 474 #include "dimensions.h" 475 476 INTEGER, INTENT(IN) :: sizev 477 CHARACTER(LEN=50), INTENT(IN) :: funcn, varn 478 REAL, DIMENSION(sizev), INTENT(IN) :: var 479 REAL, INTENT(IN) :: bigvalue 480 LOGICAL, INTENT(IN) :: stoprun 481 482 ! Local 483 INTEGER :: i, wrongi, xpt, ypt 484 CHARACTER(LEN=50) :: errmsg 485 LOGICAL :: found 486 REAL, DIMENSION(sizev) :: wrongvalues 487 INTEGER, DIMENSION(sizev) :: wronggridpt 488 489 !!!!!!! Variables 490 ! funcn: at which functino of part of the program variable is checked 491 ! varn: name of the variable 492 ! var: variable to check 493 ! sizev: size of the variable 494 ! bigvalue: biggest attenaible value for the variable 495 ! stoprun: Should the run stop if it founds a problem? 496 497 errmsg = 'ERROR -- error -- ERROR -- error' 498 499 found = .FALSE. 500 wrongi = 0 501 DO i=1,sizev 502 IF (var(i) /= var(i) .OR. ABS(var(i)) > bigvalue ) THEN 503 IF (wrongi == 0) found = .TRUE. 504 wrongi = wrongi + 1 505 wrongvalues(wrongi) = var(i) 506 wronggridpt(wrongi) = i 507 END IF 508 END DO 509 510 IF (found) THEN 511 PRINT *,TRIM(errmsg) 512 PRINT *," at '" // TRIM(funcn) // "' variable '" //TRIM(varn)// & 513 "' is wrong in Nvalues= ",wrongi,' at i (x, y) value___' 514 DO i=1,wrongi 515 ypt = INT(wronggridpt(i)/wiim) + 1 516 xpt = wronggridpt(i) - (ypt-1)*wiim 517 PRINT *,wronggridpt(i), '(',xpt,', ',ypt,')', wrongvalues(i) 518 END DO 519 IF (stoprun) THEN 520 STOP 521 END IF 522 END IF 523 524 RETURN 525 526 END SUBROUTINE check_var 527 528 SUBROUTINE check_var3D(funcn, varn, var, sizev, zsize, bigvalue, stoprun) 529 ! Subroutine to check the consistency of a 3D LMDSZ - variable (klon, klev) ! 530 ! * NaN value: by definition is variable /= variable 531 ! * bigvalue: threshold for the variable 532 533 IMPLICIT NONE 534 535 #include "dimensions.h" 536 537 INTEGER, INTENT(IN) :: sizev, zsize 538 CHARACTER(LEN=50), INTENT(IN) :: funcn, varn 539 REAL, DIMENSION(sizev,zsize), INTENT(IN) :: var 540 REAL, INTENT(IN) :: bigvalue 541 LOGICAL, INTENT(IN) :: stoprun 542 543 ! Local 544 INTEGER :: i, k, wrongi, xpt, ypt 545 CHARACTER(LEN=50) :: errmsg 546 LOGICAL :: found 547 REAL, DIMENSION(sizev*zsize) :: wrongvalues 548 INTEGER, DIMENSION(sizev*zsize,2) :: wronggridpt 549 550 !!!!!!! Variables 551 ! funcn: at which functino of part of the program variable is checked 552 ! varn: name of the variable 553 ! var: variable to check 554 ! sizev: size of the variable 555 ! zsize: vertical size of the variable 556 ! bigvalue: biggest attenaible value for the variable 557 ! stoprun: Should the run stop if it founds a problem? 558 559 errmsg = 'ERROR -- error -- ERROR -- error' 560 561 found = .FALSE. 562 wrongi = 0 563 DO i=1,sizev 564 DO k=1,zsize 565 IF (var(i,k) /= var(i,k) .OR. ABS(var(i,k)) > bigvalue ) THEN 566 IF (wrongi == 0) found = .TRUE. 567 wrongi = wrongi + 1 568 wrongvalues(wrongi) = var(i,k) 569 wronggridpt(wrongi,1) = i 570 wronggridpt(wrongi,2) = k 571 END IF 572 END DO 573 END DO 574 575 IF (found) THEN 576 PRINT *,TRIM(errmsg) 577 PRINT *," at '" // TRIM(funcn) // "' variable '" //TRIM(varn)// & 578 "' is wrong in Nvalues= ",wrongi,' at i (x,y) k value___' 579 DO i=1,wrongi 580 ypt = INT(wronggridpt(i,1)/wiim) + 1 581 xpt = wronggridpt(i,1) - (ypt-1)*wiim 582 PRINT *,wronggridpt(i,1), '(',xpt,', ',ypt,')', wronggridpt(i,2), wrongvalues(i) 583 END DO 584 IF (stoprun) THEN 585 STOP 586 END IF 587 END IF 588 589 RETURN 590 591 END SUBROUTINE check_var3D 592
Note: See TracChangeset
for help on using the changeset viewer.