[3] | 1 | ! |
---|
| 2 | ! $Header: /home/cvsroot/LMDZ4/libf/phylmd/hgardfou.F,v 1.1.1.1 2004/05/19 12:53:07 lmdzadmin Exp $ |
---|
| 3 | ! |
---|
| 4 | SUBROUTINE hgardfou (t,tsol,text) |
---|
[101] | 5 | |
---|
[2430] | 6 | use dimphy, only: klon,klev |
---|
[3] | 7 | IMPLICIT none |
---|
| 8 | c====================================================================== |
---|
[2430] | 9 | c Check temperature |
---|
[3] | 10 | c====================================================================== |
---|
[2430] | 11 | !#include "YOMCST.h" |
---|
| 12 | REAL,INTENT(IN) :: t(klon,klev), tsol(klon) |
---|
| 13 | CHARACTER(len=*),INTENT(in):: text |
---|
[3] | 14 | C |
---|
[2430] | 15 | INTEGER :: i, k |
---|
| 16 | REAL :: zt(klon) ! to locally store temperature fields |
---|
| 17 | REAL,PARAMETER :: tmin=15.0 ! Minimum temperature |
---|
| 18 | REAL,PARAMETER :: tmax=1200.0 ! Maximum temperature |
---|
| 19 | INTEGER :: jbad ! number of problematic points |
---|
| 20 | INTEGER :: jadrs(klon) ! stored index of problematic points |
---|
| 21 | LOGICAL :: ok ! .true. as long as everything OK |
---|
| 22 | CHARACTER(len=100) :: textout |
---|
[3] | 23 | c |
---|
[2430] | 24 | LOGICAL,SAVE :: firstcall=.TRUE. |
---|
| 25 | |
---|
[3] | 26 | IF (firstcall) THEN |
---|
[2430] | 27 | PRINT*, 'hgardfou checks if temperature is in [15,1200] K' |
---|
[3] | 28 | firstcall = .FALSE. |
---|
| 29 | ENDIF |
---|
| 30 | c |
---|
| 31 | ok = .TRUE. |
---|
[2430] | 32 | |
---|
| 33 | !1. Atmospheric temperatures |
---|
[3] | 34 | DO k = 1, klev |
---|
| 35 | DO i = 1, klon |
---|
| 36 | zt(i) = t(i,k) |
---|
| 37 | ENDDO |
---|
[2430] | 38 | |
---|
| 39 | ! Look for temperatures that are not numbers (NaN, Infinity, etc.) |
---|
| 40 | jbad=0 |
---|
| 41 | DO i=1,klon |
---|
| 42 | IF (zt(i).NE.zt(i)) THEN |
---|
| 43 | jbad = jbad + 1 |
---|
| 44 | jadrs(jbad) = i |
---|
| 45 | ENDIF |
---|
[3] | 46 | ENDDO |
---|
[2430] | 47 | |
---|
[3] | 48 | IF (jbad .GT. 0) THEN |
---|
| 49 | ok = .FALSE. |
---|
| 50 | DO i = 1, jbad |
---|
| 51 | PRINT *,'i,k,temperature =',jadrs(i),k,zt(jadrs(i)) |
---|
| 52 | ENDDO |
---|
| 53 | ENDIF |
---|
[2430] | 54 | |
---|
| 55 | |
---|
| 56 | ! Look for temperatures greater than tmax |
---|
[3] | 57 | #ifdef CRAY |
---|
[2430] | 58 | CALL WHENFGT(klon, zt, 1, tmax, jadrs, jbad) |
---|
[3] | 59 | #else |
---|
| 60 | jbad = 0 |
---|
| 61 | DO i = 1, klon |
---|
[2430] | 62 | IF (zt(i).GT.tmax) THEN |
---|
[3] | 63 | jbad = jbad + 1 |
---|
| 64 | jadrs(jbad) = i |
---|
[2430] | 65 | ENDIF |
---|
[3] | 66 | ENDDO |
---|
| 67 | #endif |
---|
| 68 | IF (jbad .GT. 0) THEN |
---|
| 69 | ok = .FALSE. |
---|
| 70 | DO i = 1, jbad |
---|
| 71 | PRINT *,'i,k,temperature =',jadrs(i),k,zt(jadrs(i)) |
---|
| 72 | ENDDO |
---|
| 73 | ENDIF |
---|
[2430] | 74 | |
---|
| 75 | ! Look for temperatures lower than tmin |
---|
[3] | 76 | #ifdef CRAY |
---|
[2430] | 77 | CALL WHENFLT(klon, zt, 1, tmin, jadrs, jbad) |
---|
[3] | 78 | #else |
---|
| 79 | jbad = 0 |
---|
| 80 | DO i = 1, klon |
---|
[2430] | 81 | IF (zt(i).LT.tmin) THEN |
---|
[3] | 82 | jbad = jbad + 1 |
---|
| 83 | jadrs(jbad) = i |
---|
[2430] | 84 | ENDIF |
---|
[3] | 85 | ENDDO |
---|
| 86 | #endif |
---|
| 87 | IF (jbad .GT. 0) THEN |
---|
| 88 | ok = .FALSE. |
---|
| 89 | DO i = 1, jbad |
---|
[2430] | 90 | PRINT *,'i,k,temperature =',jadrs(i),k,zt(jadrs(i)) |
---|
[3] | 91 | ENDDO |
---|
| 92 | ENDIF |
---|
[2430] | 93 | ENDDO ! of DO k = 1, klev |
---|
| 94 | |
---|
| 95 | !2. surface temperatures |
---|
| 96 | DO i = 1, klon |
---|
| 97 | zt(i) = tsol(i) |
---|
| 98 | ENDDO |
---|
| 99 | |
---|
| 100 | ! Look for temperatures that are not numbers (NaN, Infinity, etc.) |
---|
| 101 | jbad=0 |
---|
| 102 | DO i=1,klon |
---|
| 103 | IF (zt(i).NE.zt(i)) THEN |
---|
| 104 | jbad = jbad + 1 |
---|
| 105 | jadrs(jbad) = i |
---|
| 106 | ENDIF |
---|
| 107 | ENDDO |
---|
| 108 | |
---|
| 109 | IF (jbad .GT. 0) THEN |
---|
| 110 | ok = .FALSE. |
---|
| 111 | DO i = 1, jbad |
---|
| 112 | PRINT *,'i,temperature =',jadrs(i),zt(jadrs(i)) |
---|
| 113 | ENDDO |
---|
| 114 | ENDIF |
---|
| 115 | |
---|
| 116 | ! Look for temperatures greater then tmax |
---|
[3] | 117 | #ifdef CRAY |
---|
[2430] | 118 | CALL WHENFGT(klon, zt, 1, tmax, jadrs, jbad) |
---|
[3] | 119 | #else |
---|
[2430] | 120 | jbad = 0 |
---|
| 121 | DO i = 1, klon |
---|
| 122 | IF (zt(i).GT.tmax) THEN |
---|
| 123 | jbad = jbad + 1 |
---|
| 124 | jadrs(jbad) = i |
---|
| 125 | ENDIF |
---|
| 126 | ENDDO |
---|
[3] | 127 | #endif |
---|
[2430] | 128 | IF (jbad .GT. 0) THEN |
---|
| 129 | ok = .FALSE. |
---|
| 130 | DO i = 1, jbad |
---|
| 131 | PRINT *,'i,temperature =',jadrs(i),zt(jadrs(i)) |
---|
| 132 | ENDDO |
---|
| 133 | ENDIF |
---|
| 134 | |
---|
| 135 | ! Look for temperatures lower than tmin |
---|
| 136 | #ifdef CRAY |
---|
| 137 | CALL WHENFLT(klon, zt, 1, tmin, jadrs, jbad) |
---|
| 138 | #else |
---|
| 139 | jbad = 0 |
---|
| 140 | DO i = 1, klon |
---|
| 141 | IF (zt(i).LT.tmin) THEN |
---|
| 142 | jbad = jbad + 1 |
---|
| 143 | jadrs(jbad) = i |
---|
| 144 | ENDIF |
---|
| 145 | ENDDO |
---|
| 146 | #endif |
---|
| 147 | IF (jbad .GT. 0) THEN |
---|
| 148 | ok = .FALSE. |
---|
| 149 | DO i = 1, jbad |
---|
| 150 | PRINT *,'i,temperature =',jadrs(i),zt(jadrs(i)) |
---|
| 151 | ENDDO |
---|
| 152 | ENDIF |
---|
[3] | 153 | c |
---|
| 154 | IF (.NOT. ok) THEN |
---|
[2430] | 155 | textout='hgardfou stops '//text |
---|
| 156 | CALL abort_physic("hgardfou", textout, 1) |
---|
[3] | 157 | ENDIF |
---|
| 158 | |
---|
| 159 | END |
---|