Changeset 138 in lmdz_wrf


Ignore:
Timestamp:
Jul 29, 2014, 11:36:55 AM (10 years ago)
Author:
lfita
Message:

Removing checkings of NaNs?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/LMDZ_WRFmeas/WRFV3/lmdz/physiq.F90

    r89 r138  
    12991299      integer iostat
    13001300
    1301 ! Lluis
    1302       INTEGER                                            :: llp
    1303       CHARACTER(LEN=50)                                  :: lvarname, lfname
    1304       REAL                                               :: largest
    1305 
    1306       llp = 734
    1307       lfname = 'physiq'
    1308       largest = 10.e5
    1309 
    13101301!c======================================================================
    13111302! Gestion calendrier : mise a jour du module phys_cal_mod
    13121303!
    13131304      CALL phys_cal_update(jD_cur,jH_cur)
    1314       PRINT *,'  Lluis physiq: jD_cur: ',jD_cur, ' jH_cur: ',jH_cur, &
    1315         ' days_elapsed: ',days_elapsed
    13161305
    13171306!c======================================================================
     
    27692758!c      detr_therm(:,:)=0.
    27702759!c
    2771       lfname='physiq before thermals'
    2772       lvarname = 't_seri'
    2773       CALL check_var3D(lfname, lvarname, t_seri, klon, klev, largest, .FALSE.)
    2774       lvarname = 'q_seri'
    2775       CALL check_var3D(lfname, lvarname, q_seri, klon, klev, largest, .FALSE.)
    2776       lvarname = 'd_t_ajs'
    2777       CALL check_var3D(lfname, lvarname, d_t_ajs, klon, klev, largest, .FALSE.)
    2778       lvarname = 'd_q_ajs'
    2779       CALL check_var3D(lfname, lvarname, d_q_ajs, klon, klev, largest, .FALSE.)
    27802760
    27812761      IF(prt_level>9)WRITE(lunout,*)                                                 &
     
    28282808       &      ,zqla,ztva )
    28292809
    2830       lfname='physiq just after thermals'
    2831       lvarname = 't_seri'
    2832       CALL check_var3D(lfname, lvarname, t_seri, klon, klev, largest, .FALSE.)
    2833       lvarname = 'q_seri'
    2834       CALL check_var3D(lfname, lvarname, q_seri, klon, klev, largest, .FALSE.)
    2835       lvarname = 'd_t_ajs'
    2836       CALL check_var3D(lfname, lvarname, d_t_ajs, klon, klev, largest, .FALSE.)
    2837       lvarname = 'd_q_ajs'
    2838       CALL check_var3D(lfname, lvarname, d_q_ajs, klon, klev, largest, .FALSE.)
    2839 
    28402810!ccc nrlmd le 10/04/2012
    28412811!c-----------Stochastic triggering-----------
     
    29762946
    29772947      endif
    2978       lfname='after thermals'
    2979       lvarname = 't_seri'
    2980       CALL check_var3D(lfname, lvarname, t_seri, klon, klev, largest, .FALSE.)
    2981       lvarname = 'q_seri'
    2982       CALL check_var3D(lfname, lvarname, q_seri, klon, klev, largest, .FALSE.)
    2983       lvarname = 'd_t_ajsb'
    2984       CALL check_var3D(lfname, lvarname, d_t_ajsb, klon, klev, largest, .FALSE.)
    2985       lvarname = 'd_q_ajsb'
    2986       CALL check_var3D(lfname, lvarname, d_q_ajsb, klon, klev, largest, .FALSE.)
    29872948
    29882949!c
     
    43844345      RETURN
    43854346      END SUBROUTINE gr_fi_ecrit
    4386 
    4387 SUBROUTINE check_var(funcn, varn, var, sizev, bigvalue, stoprun)
    4388 !  Subroutine to check the consistency of a variable
    4389 !    * NaN value: by definition is variable /= variable
    4390 !    * bigvalue: threshold for the variable
    4391 
    4392   IMPLICIT NONE
    4393 
    4394 #include "dimensions.h"
    4395 
    4396   INTEGER, INTENT(IN)                                    :: sizev
    4397   CHARACTER(LEN=50), INTENT(IN)                          :: funcn, varn
    4398   REAL, DIMENSION(sizev), INTENT(IN)                     :: var
    4399   REAL, INTENT(IN)                                       :: bigvalue
    4400   LOGICAL, INTENT(IN)                                    :: stoprun
    4401 
    4402 ! Local
    4403   INTEGER                                                :: i, wrongi, xpt, ypt
    4404   CHARACTER(LEN=50)                                      :: errmsg
    4405   LOGICAL                                                :: found
    4406   REAL, DIMENSION(sizev)                                 :: wrongvalues
    4407   INTEGER, DIMENSION(sizev)                              :: wronggridpt
    4408 
    4409 !!!!!!! Variables
    4410 ! funcn: at which functino of part of the program variable is checked
    4411 ! varn: name of the variable
    4412 ! var: variable to check
    4413 ! sizev: size of the variable
    4414 ! bigvalue: biggest attenaible value for the variable
    4415 ! stoprun: Should the run stop if it founds a problem?
    4416 
    4417   errmsg = 'ERROR -- error -- ERROR -- error'
    4418 
    4419   found = .FALSE.
    4420   wrongi = 0
    4421   DO i=1,sizev
    4422     IF (var(i) /= var(i) .OR. ABS(var(i)) > bigvalue ) THEN
    4423       IF (wrongi == 0) found = .TRUE.
    4424       wrongi = wrongi + 1
    4425       wrongvalues(wrongi) = var(i)
    4426       wronggridpt(wrongi) = i
    4427     END IF
    4428   END DO
    4429 
    4430   IF (found) THEN
    4431     PRINT *,TRIM(errmsg)
    4432     PRINT *,"  at '" // TRIM(funcn) // "' variable '" //TRIM(varn)//                 &
    4433       "' is wrong in Nvalues= ",wrongi,' at i (x, y) value___', bigvalue
    4434     DO i=1,wrongi
    4435        ypt = INT(wronggridpt(i)/wiim) + 1
    4436        xpt = wronggridpt(i) - (ypt-1)*wiim
    4437       PRINT *,wronggridpt(i), '(',xpt,', ',ypt,')', wrongvalues(i)
    4438     END DO
    4439     IF (stoprun) THEN
    4440       STOP
    4441     END IF
    4442   END IF
    4443 
    4444   RETURN
    4445 
    4446 END SUBROUTINE check_var
    4447 
    4448 SUBROUTINE check_var3D(funcn, varn, var, sizev, zsize, bigvalue, stoprun)
    4449 !  Subroutine to check the consistency of a 3D LMDSZ - variable (klon, klev) !
    4450 !    * NaN value: by definition is variable /= variable
    4451 !    * bigvalue: threshold for the variable
    4452 
    4453   IMPLICIT NONE
    4454 
    4455 #include "dimensions.h"
    4456 
    4457   INTEGER, INTENT(IN)                                    :: sizev, zsize
    4458   CHARACTER(LEN=50), INTENT(IN)                          :: funcn, varn
    4459   REAL, DIMENSION(sizev,zsize), INTENT(IN)               :: var
    4460   REAL, INTENT(IN)                                       :: bigvalue
    4461   LOGICAL, INTENT(IN)                                    :: stoprun
    4462 
    4463 ! Local
    4464   INTEGER                                                :: i, k, wrongi, xpt, ypt
    4465   CHARACTER(LEN=50)                                      :: errmsg
    4466   LOGICAL                                                :: found
    4467   REAL, DIMENSION(sizev*zsize)                           :: wrongvalues
    4468   INTEGER, DIMENSION(sizev*zsize,2)                      :: wronggridpt
    4469 
    4470 !!!!!!! Variables
    4471 ! funcn: at which functino of part of the program variable is checked
    4472 ! varn: name of the variable
    4473 ! var: variable to check
    4474 ! sizev: size of the variable
    4475 ! zsize: vertical size of the variable
    4476 ! bigvalue: biggest attenaible value for the variable
    4477 ! stoprun: Should the run stop if it founds a problem?
    4478 
    4479   errmsg = 'ERROR -- error -- ERROR -- error'
    4480 
    4481   found = .FALSE.
    4482   wrongi = 0
    4483   DO i=1,sizev
    4484     DO k=1,zsize
    4485       IF (var(i,k) /= var(i,k) .OR. ABS(var(i,k)) > bigvalue ) THEN
    4486         IF (wrongi == 0) found = .TRUE.
    4487         wrongi = wrongi + 1
    4488         wrongvalues(wrongi) = var(i,k)
    4489         wronggridpt(wrongi,1) = i
    4490         wronggridpt(wrongi,2) = k
    4491       END IF
    4492     END DO
    4493   END DO
    4494 
    4495   IF (found) THEN
    4496     PRINT *,TRIM(errmsg)
    4497     PRINT *,"  at '" // TRIM(funcn) // "' variable '" //TRIM(varn)//                 &
    4498       "' is wrong in Nvalues= ",wrongi,' at i (x,y) k value___'
    4499     DO i=1,wrongi
    4500        ypt = INT(wronggridpt(i,1)/wiim) + 1
    4501        xpt = wronggridpt(i,1) - (ypt-1)*wiim
    4502       PRINT *,wronggridpt(i,1), '(',xpt,', ',ypt,')', wronggridpt(i,2), wrongvalues(i)
    4503     END DO
    4504     IF (stoprun) THEN
    4505       STOP
    4506     END IF
    4507   END IF
    4508 
    4509   RETURN
    4510 
    4511 END SUBROUTINE check_var3D
    4512 
Note: See TracChangeset for help on using the changeset viewer.