- Timestamp:
- Jul 24, 2014, 2:32:26 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LMDZ_WRFmeas/WRFV3/lmdz/calltherm.F90
r70 r71 464 464 465 465 end 466 467 SUBROUTINE check_var(funcn, varn, var, sizev, bigvalue, stoprun)468 ! Subroutine to check the consistency of a variable469 ! * NaN value: by definition is variable /= variable470 ! * bigvalue: threshold for the variable471 472 IMPLICIT NONE473 474 #include "dimensions.h"475 476 INTEGER, INTENT(IN) :: sizev477 CHARACTER(LEN=50), INTENT(IN) :: funcn, varn478 REAL, DIMENSION(sizev), INTENT(IN) :: var479 REAL, INTENT(IN) :: bigvalue480 LOGICAL, INTENT(IN) :: stoprun481 482 ! Local483 INTEGER :: i, wrongi, xpt, ypt484 CHARACTER(LEN=50) :: errmsg485 LOGICAL :: found486 REAL, DIMENSION(sizev) :: wrongvalues487 INTEGER, DIMENSION(sizev) :: wronggridpt488 489 !!!!!!! Variables490 ! funcn: at which functino of part of the program variable is checked491 ! varn: name of the variable492 ! var: variable to check493 ! sizev: size of the variable494 ! bigvalue: biggest attenaible value for the variable495 ! stoprun: Should the run stop if it founds a problem?496 497 errmsg = 'ERROR -- error -- ERROR -- error'498 499 found = .FALSE.500 wrongi = 0501 DO i=1,sizev502 IF (var(i) /= var(i) .OR. ABS(var(i)) > bigvalue ) THEN503 IF (wrongi == 0) found = .TRUE.504 wrongi = wrongi + 1505 wrongvalues(wrongi) = var(i)506 wronggridpt(wrongi) = i507 END IF508 END DO509 510 IF (found) THEN511 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,wrongi515 ypt = INT(wronggridpt(i)/wiim) + 1516 xpt = wronggridpt(i) - (ypt-1)*wiim517 PRINT *,wronggridpt(i), '(',xpt,', ',ypt,')', wrongvalues(i)518 END DO519 IF (stoprun) THEN520 STOP521 END IF522 END IF523 524 RETURN525 526 END SUBROUTINE check_var527 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 /= variable531 ! * bigvalue: threshold for the variable532 533 IMPLICIT NONE534 535 #include "dimensions.h"536 537 INTEGER, INTENT(IN) :: sizev, zsize538 CHARACTER(LEN=50), INTENT(IN) :: funcn, varn539 REAL, DIMENSION(sizev,zsize), INTENT(IN) :: var540 REAL, INTENT(IN) :: bigvalue541 LOGICAL, INTENT(IN) :: stoprun542 543 ! Local544 INTEGER :: i, k, wrongi, xpt, ypt545 CHARACTER(LEN=50) :: errmsg546 LOGICAL :: found547 REAL, DIMENSION(sizev*zsize) :: wrongvalues548 INTEGER, DIMENSION(sizev*zsize,2) :: wronggridpt549 550 !!!!!!! Variables551 ! funcn: at which functino of part of the program variable is checked552 ! varn: name of the variable553 ! var: variable to check554 ! sizev: size of the variable555 ! zsize: vertical size of the variable556 ! bigvalue: biggest attenaible value for the variable557 ! stoprun: Should the run stop if it founds a problem?558 559 errmsg = 'ERROR -- error -- ERROR -- error'560 561 found = .FALSE.562 wrongi = 0563 DO i=1,sizev564 DO k=1,zsize565 IF (var(i,k) /= var(i,k) .OR. ABS(var(i,k)) > bigvalue ) THEN566 IF (wrongi == 0) found = .TRUE.567 wrongi = wrongi + 1568 wrongvalues(wrongi) = var(i,k)569 wronggridpt(wrongi,1) = i570 wronggridpt(wrongi,2) = k571 END IF572 END DO573 END DO574 575 IF (found) THEN576 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,wrongi580 ypt = INT(wronggridpt(i,1)/wiim) + 1581 xpt = wronggridpt(i,1) - (ypt-1)*wiim582 PRINT *,wronggridpt(i,1), '(',xpt,', ',ypt,')', wronggridpt(i,2), wrongvalues(i)583 END DO584 IF (stoprun) THEN585 STOP586 END IF587 END IF588 589 RETURN590 591 END SUBROUTINE check_var3D592
Note: See TracChangeset
for help on using the changeset viewer.