3 |
|
|
4 |
#include "EXF_OPTIONS.h" |
#include "EXF_OPTIONS.h" |
5 |
|
|
6 |
SUBROUTINE EXF_CHECK_RANGE( mytime, myiter, mythid ) |
SUBROUTINE EXF_CHECK_RANGE( myTime, myIter, myThid ) |
7 |
|
|
8 |
c ================================================================== |
C ================================================================== |
9 |
c SUBROUTINE EXF_CHECK_RANGE |
C SUBROUTINE EXF_CHECK_RANGE |
10 |
c ================================================================== |
C ================================================================== |
|
c |
|
|
implicit none |
|
11 |
|
|
12 |
c == global variables == |
IMPLICIT NONE |
13 |
|
|
14 |
|
C == global variables == |
15 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
16 |
#include "SIZE.h" |
#include "SIZE.h" |
|
#include "FFIELDS.h" |
|
17 |
#include "GRID.h" |
#include "GRID.h" |
18 |
|
|
19 |
#include "EXF_PARAM.h" |
#include "EXF_PARAM.h" |
20 |
#include "EXF_CONSTANTS.h" |
c#include "EXF_CONSTANTS.h" |
21 |
#include "EXF_FIELDS.h" |
#include "EXF_FIELDS.h" |
|
c == routine arguments == |
|
22 |
|
|
23 |
c mythid - thread number for this instance of the routine. |
C == routine arguments == |
24 |
|
C myThid - thread number for this instance of the routine. |
25 |
|
_RL myTime |
26 |
|
INTEGER myIter, myThid |
27 |
|
|
28 |
|
C == local variables == |
29 |
|
INTEGER i, j, bi, bj |
30 |
|
INTEGER exferr |
31 |
|
|
32 |
_RL mytime |
C == end of interface == |
|
integer myiter, mythid |
|
|
|
|
|
c == local variables == |
|
|
|
|
|
integer bi,bj |
|
|
integer i,j |
|
|
integer jtlo |
|
|
integer jthi |
|
|
integer itlo |
|
|
integer ithi |
|
|
integer jmin |
|
|
integer jmax |
|
|
integer imin |
|
|
integer imax |
|
|
integer exferr |
|
|
|
|
|
c == end of interface == |
|
33 |
|
|
34 |
exferr = 0 |
exferr = 0 |
35 |
|
|
|
c jtlo = mybylo(mythid) |
|
|
c jthi = mybyhi(mythid) |
|
|
c itlo = mybxlo(mythid) |
|
|
c ithi = mybxhi(mythid) |
|
36 |
C-- Only master thread can safely write directly to standard output: |
C-- Only master thread can safely write directly to standard output: |
37 |
_BARRIER |
_BARRIER |
38 |
_BEGIN_MASTER( myThid ) |
_BEGIN_MASTER( myThid ) |
39 |
jtlo = 1 |
|
40 |
jthi = nSy |
c DO bj = myByLo(myThid), myByHi(myThid) |
41 |
itlo = 1 |
c DO bi = myBxLo(myThid), myBxHi(myThid) |
42 |
ithi = nSx |
DO bj = 1, nSy |
43 |
|
DO bi = 1, nSx |
44 |
|
|
45 |
C Change checking range because some atmospheric fields will |
C Change checking range because some atmospheric fields will |
46 |
C not always have valid values in the tile edges. |
C not always have valid values in the tile edges. |
47 |
C jmin = 1-oly |
c DO j = 1-OLy, sNy+OLy |
48 |
C jmax = sny+oly |
c DO i = 1-OLx, sNx+OLx |
49 |
C imin = 1-olx |
DO j = 1, sNy |
50 |
C imax = snx+olx |
DO i = 1, sNx |
51 |
jmin = 1 |
|
52 |
jmax = sny |
C Heat flux. |
53 |
imin = 1 |
IF ( ( hflux(i,j,bi,bj) .GT. 1600. .OR. |
|
imax = snx |
|
|
|
|
|
do bj = jtlo,jthi |
|
|
do bi = itlo,ithi |
|
|
|
|
|
do j = jmin,jmax |
|
|
do i = imin,imax |
|
|
c |
|
|
c Heat flux. |
|
|
if ( ( hflux(i,j,bi,bj) .GT. 1600. .OR. |
|
54 |
& hflux(i,j,bi,bj) .LT. -500. ) .AND. |
& hflux(i,j,bi,bj) .LT. -500. ) .AND. |
55 |
& maskC(i,j,1,bi,bj) .NE. 0. ) then |
& maskC(i,j,1,bi,bj) .NE. 0. ) THEN |
56 |
write(standardmessageunit,'(A,5(1X,I6),2X,D22.15)') |
WRITE(standardMessageUnit,'(A,5(1X,I6),2X,D22.15)') |
57 |
& 'EXF WARNING: hflux out of range for bi,bj,i,j,it= ', |
& 'EXF WARNING: hflux out of range for bi,bj,i,j,it= ', |
58 |
& bi, bj, i, j, myiter, hflux(i,j,bi,bj) |
& bi, bj, i, j, myIter, hflux(i,j,bi,bj) |
59 |
exferr = 1 |
exferr = 1 |
60 |
endif |
ENDIF |
61 |
c |
|
62 |
c Freshwater flux. |
C Freshwater flux. |
63 |
if ( ABS(sflux(i,j,bi,bj)) .GT. 1.E-6 .AND. |
IF ( ABS(sflux(i,j,bi,bj)) .GT. 1.E-6 .AND. |
64 |
& maskC(i,j,1,bi,bj) .NE. 0. ) then |
& maskC(i,j,1,bi,bj) .NE. 0. ) THEN |
65 |
write(standardmessageunit,'(A,5(1X,I6),2X,D22.15)') |
WRITE(standardMessageUnit,'(A,5(1X,I6),2X,D22.15)') |
66 |
& 'EXF WARNING: sflux out of range for bi,bj,i,j,it= ', |
& 'EXF WARNING: sflux out of range for bi,bj,i,j,it= ', |
67 |
& bi, bj, i, j, myiter, sflux(i,j,bi,bj) |
& bi, bj, i, j, myIter, sflux(i,j,bi,bj) |
68 |
exferr = 1 |
exferr = 1 |
69 |
endif |
ENDIF |
70 |
c |
|
71 |
c Zonal wind stress. |
C Zonal wind stress. |
72 |
if ( ABS(ustress(i,j,bi,bj)) .GT. 2.7 .AND. |
IF ( ABS(ustress(i,j,bi,bj)) .GT. 2.7 .AND. |
73 |
& maskW(i,j,1,bi,bj) .NE. 0. ) then |
& maskW(i,j,1,bi,bj) .NE. 0. ) THEN |
74 |
write(standardmessageunit,'(A,5(1X,I6),2X,D22.15)') |
WRITE(standardMessageUnit,'(A,5(1X,I6),2X,D22.15)') |
75 |
& 'EXF WARNING: ustress out of range for bi,bj,i,j,it= ', |
& 'EXF WARNING: ustress out of range for bi,bj,i,j,it= ', |
76 |
& bi, bj, i, j, myiter, ustress(i,j,bi,bj) |
& bi, bj, i, j, myIter, ustress(i,j,bi,bj) |
77 |
exferr = 1 |
exferr = 1 |
78 |
endif |
ENDIF |
79 |
c |
|
80 |
c Meridional wind stress. |
C Meridional wind stress. |
81 |
if ( ABS(vstress(i,j,bi,bj)) .GT. 2.3 .AND. |
IF ( ABS(vstress(i,j,bi,bj)) .GT. 2.3 .AND. |
82 |
& maskS(i,j,1,bi,bj) .NE. 0. ) then |
& maskS(i,j,1,bi,bj) .NE. 0. ) THEN |
83 |
write(standardmessageunit,'(A,5(1X,I6),2X,D22.15)') |
WRITE(standardMessageUnit,'(A,5(1X,I6),2X,D22.15)') |
84 |
& 'EXF WARNING: vstress out of range for bi,bj,i,j,it= ', |
& 'EXF WARNING: vstress out of range for bi,bj,i,j,it= ', |
85 |
& bi, bj, i, j, myiter, vstress(i,j,bi,bj) |
& bi, bj, i, j, myIter, vstress(i,j,bi,bj) |
86 |
exferr = 1 |
exferr = 1 |
87 |
endif |
ENDIF |
88 |
c |
|
89 |
IF ( useAtmWind ) THEN |
IF ( useAtmWind ) THEN |
90 |
c zonal wind speed |
C zonal wind speed |
91 |
if ( ABS(uwind(i,j,bi,bj)) .GT. 100. .AND. |
IF ( ABS(uwind(i,j,bi,bj)) .GT. 100. .AND. |
92 |
& maskW(i,j,1,bi,bj) .NE. 0. ) then |
& maskW(i,j,1,bi,bj) .NE. 0. ) THEN |
93 |
write(standardmessageunit,'(A,5(1X,I6),2X,D22.15)') |
WRITE(standardMessageUnit,'(A,5(1X,I6),2X,D22.15)') |
94 |
& 'EXF WARNING: uwind out of range for bi,bj,i,j,it= ', |
& 'EXF WARNING: uwind out of range for bi,bj,i,j,it= ', |
95 |
& bi, bj, i, j, myiter, uwind(i,j,bi,bj) |
& bi, bj, i, j, myIter, uwind(i,j,bi,bj) |
96 |
exferr = 1 |
exferr = 1 |
97 |
endif |
ENDIF |
98 |
c |
|
99 |
c zonal wind speed |
C zonal wind speed |
100 |
if ( ABS(vwind(i,j,bi,bj)) .GT. 100. .AND. |
IF ( ABS(vwind(i,j,bi,bj)) .GT. 100. .AND. |
101 |
& maskS(i,j,1,bi,bj) .NE. 0. ) then |
& maskS(i,j,1,bi,bj) .NE. 0. ) THEN |
102 |
write(standardmessageunit,'(A,5(1X,I6),2X,D22.15)') |
WRITE(standardMessageUnit,'(A,5(1X,I6),2X,D22.15)') |
103 |
& 'EXF WARNING: vwind out of range for bi,bj,i,j,it= ', |
& 'EXF WARNING: vwind out of range for bi,bj,i,j,it= ', |
104 |
& bi, bj, i, j, myiter, vwind(i,j,bi,bj) |
& bi, bj, i, j, myIter, vwind(i,j,bi,bj) |
105 |
exferr = 1 |
exferr = 1 |
106 |
endif |
ENDIF |
107 |
ENDIF |
ENDIF |
108 |
c |
|
109 |
c wind speed modulus |
C wind speed modulus |
110 |
if ( ( wspeed(i,j,bi,bj) .LT. 0. .OR. |
IF ( ( wspeed(i,j,bi,bj) .LT. 0. .OR. |
111 |
& wspeed(i,j,bi,bj) .GT. 100. ) .AND. |
& wspeed(i,j,bi,bj) .GT. 100. ) .AND. |
112 |
& maskS(i,j,1,bi,bj) .NE. 0. ) then |
& maskS(i,j,1,bi,bj) .NE. 0. ) THEN |
113 |
write(standardmessageunit,'(A,5(1X,I6),2X,D22.15)') |
WRITE(standardMessageUnit,'(A,5(1X,I6),2X,D22.15)') |
114 |
& 'EXF WARNING: wspeed out of range for bi,bj,i,j,it= ', |
& 'EXF WARNING: wspeed out of range for bi,bj,i,j,it= ', |
115 |
& bi, bj, i, j, myiter, wspeed(i,j,bi,bj) |
& bi, bj, i, j, myIter, wspeed(i,j,bi,bj) |
116 |
exferr = 1 |
exferr = 1 |
117 |
endif |
ENDIF |
118 |
|
|
119 |
#ifdef ALLOW_ATM_TEMP |
#ifdef ALLOW_ATM_TEMP |
120 |
c 2-m air temperature |
C 2-m air temperature |
121 |
if ( (atemp(i,j,bi,bj) .LT. 183 .OR. |
IF ( (atemp(i,j,bi,bj) .LT. 183 .OR. |
122 |
& atemp(i,j,bi,bj) .GT. 343 ) .AND. |
& atemp(i,j,bi,bj) .GT. 343 ) .AND. |
123 |
& maskC(i,j,1,bi,bj) .NE. 0. ) then |
& maskC(i,j,1,bi,bj) .NE. 0. ) THEN |
124 |
write(standardmessageunit,'(2A,5(1X,I6),2X,D22.15)') |
WRITE(standardMessageUnit,'(2A,5(1X,I6),2X,D22.15)') |
125 |
& 'EXF WARNING: atemp + exf_offset_atemp ', |
& 'EXF WARNING: atemp + exf_offset_atemp ', |
126 |
& 'out of range for bi,bj,i,j,it= ', |
& 'out of range for bi,bj,i,j,it= ', |
127 |
& bi, bj, i, j, myiter, atemp(i,j,bi,bj) |
& bi, bj, i, j, myIter, atemp(i,j,bi,bj) |
128 |
exferr = 1 |
exferr = 1 |
129 |
endif |
ENDIF |
130 |
c |
|
131 |
c 2-m specific humidity |
C 2-m specific humidity |
132 |
if ( (aqh(i,j,bi,bj) .LT. 0. .OR. |
IF ( (aqh(i,j,bi,bj) .LT. 0. .OR. |
133 |
& aqh(i,j,bi,bj) .GT. 0.1 ) .AND. |
& aqh(i,j,bi,bj) .GT. 0.1 ) .AND. |
134 |
& maskC(i,j,1,bi,bj) .NE. 0. ) then |
& maskC(i,j,1,bi,bj) .NE. 0. ) THEN |
135 |
write(standardmessageunit,'(A,5(1X,I6),2X,D22.15)') |
WRITE(standardMessageUnit,'(A,5(1X,I6),2X,D22.15)') |
136 |
& 'EXF WARNING: aqh out of range for bi,bj,i,j,it= ', |
& 'EXF WARNING: aqh out of range for bi,bj,i,j,it= ', |
137 |
& bi, bj, i, j, myiter, aqh(i,j,bi,bj) |
& bi, bj, i, j, myIter, aqh(i,j,bi,bj) |
138 |
exferr = 1 |
exferr = 1 |
139 |
endif |
ENDIF |
140 |
c |
|
141 |
c precipitation rate |
C precipitation rate |
142 |
if ( (precip(i,j,bi,bj) .LT. 0. .OR. |
IF ( (precip(i,j,bi,bj) .LT. 0. .OR. |
143 |
& precip(i,j,bi,bj) .GT. 2.E-6 ) .AND. |
& precip(i,j,bi,bj) .GT. 2.E-6 ) .AND. |
144 |
& maskC(i,j,1,bi,bj) .NE. 0. ) then |
& maskC(i,j,1,bi,bj) .NE. 0. ) THEN |
145 |
write(standardmessageunit,'(A,5(1X,I6),2X,D22.15)') |
WRITE(standardMessageUnit,'(A,5(1X,I6),2X,D22.15)') |
146 |
& 'EXF WARNING: precip out of range for bi,bj,i,j,it= ', |
& 'EXF WARNING: precip out of range for bi,bj,i,j,it= ', |
147 |
& bi, bj, i, j, myiter, precip(i,j,bi,bj) |
& bi, bj, i, j, myIter, precip(i,j,bi,bj) |
148 |
exferr = 1 |
exferr = 1 |
149 |
endif |
ENDIF |
150 |
c |
|
151 |
c snow |
C snow |
152 |
if ( (snowprecip(i,j,bi,bj) .LT. 0. .OR. |
IF ( (snowprecip(i,j,bi,bj) .LT. 0. .OR. |
153 |
& snowprecip(i,j,bi,bj) .GT. 2.E-6 ) .AND. |
& snowprecip(i,j,bi,bj) .GT. 2.E-6 ) .AND. |
154 |
& maskC(i,j,1,bi,bj) .NE. 0. ) then |
& maskC(i,j,1,bi,bj) .NE. 0. ) THEN |
155 |
write(standardmessageunit,'(2A,5(1X,I6),2X,D22.15)') |
WRITE(standardMessageUnit,'(2A,5(1X,I6),2X,D22.15)') |
156 |
& 'EXF WARNING: snowprecip out of range ', |
& 'EXF WARNING: snowprecip out of range ', |
157 |
& 'for bi,bj,i,j,it= ', |
& 'for bi,bj,i,j,it= ', |
158 |
& bi, bj, i, j, myiter, snowprecip(i,j,bi,bj) |
& bi, bj, i, j, myIter, snowprecip(i,j,bi,bj) |
159 |
exferr = 1 |
exferr = 1 |
160 |
endif |
ENDIF |
161 |
#endif |
#endif |
162 |
|
|
163 |
#ifdef SHORTWAVE_HEATING |
#ifdef SHORTWAVE_HEATING |
164 |
c Short wave radiative flux. |
C Short wave radiative flux. |
165 |
if ( (swflux(i,j,bi,bj) .GT. 1. .OR. |
IF ( (swflux(i,j,bi,bj) .GT. 1. .OR. |
166 |
& swflux(i,j,bi,bj) .LT. -1000. ) .AND. |
& swflux(i,j,bi,bj) .LT. -1000. ) .AND. |
167 |
& maskC(i,j,1,bi,bj) .NE. 0. ) then |
& maskC(i,j,1,bi,bj) .NE. 0. ) THEN |
168 |
write(standardmessageunit,'(A,5(1X,I6),2X,D22.15)') |
WRITE(standardMessageUnit,'(A,5(1X,I6),2X,D22.15)') |
169 |
& 'EXF WARNING: swflux out of range for bi,bj,i,j,it= ', |
& 'EXF WARNING: swflux out of range for bi,bj,i,j,it= ', |
170 |
& bi, bj, i, j, myiter, swflux(i,j,bi,bj) |
& bi, bj, i, j, myIter, swflux(i,j,bi,bj) |
171 |
exferr = 1 |
exferr = 1 |
172 |
endif |
ENDIF |
173 |
#endif |
#endif |
174 |
|
|
175 |
#ifdef ALLOW_RUNOFF |
#ifdef ALLOW_RUNOFF |
176 |
c Runoff. |
C Runoff. |
177 |
if ( (runoff(i,j,bi,bj) .LT. 0. .OR. |
IF ( (runoff(i,j,bi,bj) .LT. 0. .OR. |
178 |
& runoff(i,j,bi,bj) .GT. 1.E-6 ) .AND. |
& runoff(i,j,bi,bj) .GT. 1.E-6 ) .AND. |
179 |
& maskC(i,j,1,bi,bj) .NE. 0. ) then |
& maskC(i,j,1,bi,bj) .NE. 0. ) THEN |
180 |
write(standardmessageunit,'(A,5(1X,I6),2X,D22.15)') |
WRITE(standardMessageUnit,'(A,5(1X,I6),2X,D22.15)') |
181 |
& 'EXF WARNING: runoff out of range for bi,bj,i,j,it= ', |
& 'EXF WARNING: runoff out of range for bi,bj,i,j,it= ', |
182 |
& bi, bj, i, j, myiter, runoff(i,j,bi,bj) |
& bi, bj, i, j, myIter, runoff(i,j,bi,bj) |
183 |
write(standardmessageunit,'(A)') |
WRITE(standardMessageUnit,'(A)') |
184 |
& 'Please note that input units for runoff are' |
& 'Please note that input units for runoff are' |
185 |
write(standardmessageunit,'(A)') |
WRITE(standardMessageUnit,'(A)') |
186 |
& 'm/s not m/yr. If input file is in m/yr, set' |
& 'm/s not m/yr. If input file is in m/yr, set' |
187 |
write(standardmessageunit,'(A)') |
WRITE(standardMessageUnit,'(A)') |
188 |
& 'exf_inscal_runoff=3.170979198E-8' |
& 'exf_inscal_runoff=3.170979198E-8' |
189 |
write(standardmessageunit,'(A)') |
WRITE(standardMessageUnit,'(A)') |
190 |
& 'in the data.exf input file.' |
& 'in the data.exf input file.' |
191 |
exferr = 1 |
exferr = 1 |
192 |
endif |
ENDIF |
193 |
# ifdef ALLOW_RUNOFTEMP |
# ifdef ALLOW_RUNOFTEMP |
194 |
c Runoff temperature. |
C Runoff temperature. |
195 |
if ( (runoftemp(i,j,bi,bj) .LT. -2. .OR. |
IF ( (runoftemp(i,j,bi,bj) .LT. -2. .OR. |
196 |
& runoff(i,j,bi,bj) .GT. 36 ) .AND. |
& runoff(i,j,bi,bj) .GT. 36 ) .AND. |
197 |
& maskC(i,j,1,bi,bj) .NE. 0. ) then |
& maskC(i,j,1,bi,bj) .NE. 0. ) THEN |
198 |
write(standardmessageunit,'(A,5(1X,I6),2X,D22.15)') |
WRITE(standardMessageUnit,'(A,5(1X,I6),2X,D22.15)') |
199 |
& 'EXF WARNING: runoftemp out of range at bi,bj,i,j,it= ', |
& 'EXF WARNING: runoftemp out of range at bi,bj,i,j,it= ', |
200 |
& bi, bj, i, j, myiter, runoff(i,j,bi,bj) |
& bi, bj, i, j, myIter, runoff(i,j,bi,bj) |
201 |
exferr = 1 |
exferr = 1 |
202 |
endif |
ENDIF |
203 |
# endif /* ALLOW_RUNOFTEMP */ |
# endif /* ALLOW_RUNOFTEMP */ |
204 |
#endif /* ALLOW_RUNOFF */ |
#endif /* ALLOW_RUNOFF */ |
205 |
enddo |
ENDDO |
206 |
enddo |
ENDDO |
|
c |
|
|
enddo |
|
|
enddo |
|
207 |
|
|
208 |
if ( exferr .NE. 0 ) then |
ENDDO |
209 |
write(standardmessageunit,'(A)') |
ENDDO |
210 |
|
|
211 |
|
IF ( exferr .NE. 0 ) THEN |
212 |
|
WRITE(standardMessageUnit,'(A)') |
213 |
& 'EXF WARNING: If you think these values are OK ' |
& 'EXF WARNING: If you think these values are OK ' |
214 |
write(standardmessageunit,'(A)') |
WRITE(standardMessageUnit,'(A)') |
215 |
& 'EXF WARNING: then set useExfCheckRange=.FALSE.' |
& 'EXF WARNING: then set useExfCheckRange=.FALSE.' |
216 |
STOP 'ABNORMAL END: S/R EXF_CHECK_RANGE' |
STOP 'ABNORMAL END: S/R EXF_CHECK_RANGE' |
217 |
endif |
ENDIF |
218 |
_END_MASTER( myThid ) |
_END_MASTER( myThid ) |
219 |
|
|
220 |
RETURN |
RETURN |