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) |
---|
5 | |
---|
6 | use dimphy, only: klon,klev |
---|
7 | IMPLICIT none |
---|
8 | c====================================================================== |
---|
9 | c Check temperature |
---|
10 | c====================================================================== |
---|
11 | !#include "YOMCST.h" |
---|
12 | REAL,INTENT(IN) :: t(klon,klev), tsol(klon) |
---|
13 | CHARACTER(len=*),INTENT(in):: text |
---|
14 | C |
---|
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 |
---|
23 | c |
---|
24 | LOGICAL,SAVE :: firstcall=.TRUE. |
---|
25 | |
---|
26 | IF (firstcall) THEN |
---|
27 | PRINT*, 'hgardfou checks if temperature is in [15,1200] K' |
---|
28 | firstcall = .FALSE. |
---|
29 | ENDIF |
---|
30 | c |
---|
31 | ok = .TRUE. |
---|
32 | |
---|
33 | !1. Atmospheric temperatures |
---|
34 | DO k = 1, klev |
---|
35 | DO i = 1, klon |
---|
36 | zt(i) = t(i,k) |
---|
37 | ENDDO |
---|
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 |
---|
46 | ENDDO |
---|
47 | |
---|
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 |
---|
54 | |
---|
55 | |
---|
56 | ! Look for temperatures greater than tmax |
---|
57 | #ifdef CRAY |
---|
58 | CALL WHENFGT(klon, zt, 1, tmax, jadrs, jbad) |
---|
59 | #else |
---|
60 | jbad = 0 |
---|
61 | DO i = 1, klon |
---|
62 | IF (zt(i).GT.tmax) THEN |
---|
63 | jbad = jbad + 1 |
---|
64 | jadrs(jbad) = i |
---|
65 | ENDIF |
---|
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 |
---|
74 | |
---|
75 | ! Look for temperatures lower than tmin |
---|
76 | #ifdef CRAY |
---|
77 | CALL WHENFLT(klon, zt, 1, tmin, jadrs, jbad) |
---|
78 | #else |
---|
79 | jbad = 0 |
---|
80 | DO i = 1, klon |
---|
81 | IF (zt(i).LT.tmin) THEN |
---|
82 | jbad = jbad + 1 |
---|
83 | jadrs(jbad) = i |
---|
84 | ENDIF |
---|
85 | ENDDO |
---|
86 | #endif |
---|
87 | IF (jbad .GT. 0) THEN |
---|
88 | ok = .FALSE. |
---|
89 | DO i = 1, jbad |
---|
90 | PRINT *,'i,k,temperature =',jadrs(i),k,zt(jadrs(i)) |
---|
91 | ENDDO |
---|
92 | ENDIF |
---|
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 |
---|
117 | #ifdef CRAY |
---|
118 | CALL WHENFGT(klon, zt, 1, tmax, jadrs, jbad) |
---|
119 | #else |
---|
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 |
---|
127 | #endif |
---|
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 |
---|
153 | c |
---|
154 | IF (.NOT. ok) THEN |
---|
155 | textout='hgardfou stops '//text |
---|
156 | CALL abort_physic("hgardfou", textout, 1) |
---|
157 | ENDIF |
---|
158 | |
---|
159 | END |
---|