Changeset 157 in lmdz_wrf for branches/LMDZ_WRFmeas_develop/WRFV3/lmdz/diagphy_mod.F90
- Timestamp:
- Aug 8, 2014, 11:54:57 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LMDZ_WRFmeas_develop/WRFV3/lmdz/diagphy_mod.F90
r67 r157 388 388 END SUBROUTINE check_var3D 389 389 390 SUBROUTINE threscheck_var3D(funcn, varn, var, sizev, zsize, thresvalue, kthres, 391 stoprun) 392 ! Subroutine to check the consistency of a 3D LMDSZ - variable (klon, klev) ! 393 ! * thresvalue: threshold for the variable 394 395 IMPLICIT NONE 396 397 #include "dimensions.h" 398 399 INTEGER, INTENT(IN) :: sizev, zsize 400 CHARACTER(LEN=50), INTENT(IN) :: funcn, varn 401 REAL, DIMENSION(sizev,zsize), INTENT(IN) :: var 402 REAL, INTENT(IN) :: thresvalue 403 LOGICAL, INTENT(IN) :: stoprun 404 405 ! Local 406 INTEGER :: i, k, wrongi, xpt, ypt 407 CHARACTER(LEN=50) :: errmsg 408 LOGICAL :: found 409 REAL, DIMENSION(sizev*zsize) :: wrongvalues 410 INTEGER, DIMENSION(sizev*zsize,2) :: wronggridpt 411 412 !!!!!!! Variables 413 ! funcn: at which functino of part of the program variable is checked 414 ! varn: name of the variable 415 ! var: variable to check 416 ! sizev: size of the variable 417 ! zsize: vertical size of the variable 418 ! thresvalue: threshold attenaible value for the variable 419 ! kthres: kind of threshold= -1, below wrong, 1: above wrong 420 ! stoprun: Should the run stop if it founds a problem? 421 422 errmsg = 'ERROR -- error -- ERROR -- error' 423 424 found = .FALSE. 425 wrongi = 0 426 DO i=1,sizev 427 DO k=1,zsize 428 IF (kthres == -1 .AND. var(i,k) < thresvalue ) THEN 429 IF (wrongi == 0) found = .TRUE. 430 wrongi = wrongi + 1 431 wrongvalues(wrongi) = var(i,k) 432 wronggridpt(wrongi,1) = i 433 wronggridpt(wrongi,2) = k 434 ELSE IF (kthres == 1 .AND. var(i,k) > thresvalue ) THEN 435 IF (wrongi == 0) found = .TRUE. 436 wrongi = wrongi + 1 437 wrongvalues(wrongi) = var(i,k) 438 wronggridpt(wrongi,1) = i 439 wronggridpt(wrongi,2) = k 440 END IF 441 END DO 442 END DO 443 444 IF (found) THEN 445 PRINT *,TRIM(errmsg) 446 PRINT *," at '" // TRIM(funcn) // "' variable '" //TRIM(varn)// & 447 "' is wrong (threshold: ',thresvalue,') in Nvalues= ",wrongi, & 448 ' at i (x,y) k value___' 449 DO i=1,wrongi 450 ypt = INT(wronggridpt(i,1)/wiim) + 1 451 xpt = wronggridpt(i,1) - (ypt-1)*wiim 452 PRINT *,wronggridpt(i,1), '(',xpt,', ',ypt,')', wronggridpt(i,2), wrongvalues(i) 453 END DO 454 IF (stoprun) THEN 455 STOP 456 END IF 457 END IF 458 459 RETURN 460 461 END SUBROUTINE threscheck_var3D 390 462 391 463 !C======================================================================
Note: See TracChangeset
for help on using the changeset viewer.