1 |
C $Header: /u/gcmpack/MITgcm/pkg/exf/exf_check.F,v 1.33 2017/03/13 23:13:46 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "EXF_OPTIONS.h" |
5 |
|
6 |
C-- File exf_check.F: Routines to check EXF settings |
7 |
C-- Contents |
8 |
C-- o EXF_CHECK |
9 |
C-- o EXF_CHECK_INTERP |
10 |
|
11 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
12 |
CBOP |
13 |
C !ROUTINE: EXF_CHECK |
14 |
C !INTERFACE: |
15 |
|
16 |
SUBROUTINE EXF_CHECK( myThid ) |
17 |
|
18 |
C !DESCRIPTION: \bv |
19 |
C *==========================================================* |
20 |
C | S/R EXF_CHECK |
21 |
C | o Check parameters and other package dependences |
22 |
C *==========================================================* |
23 |
C \ev |
24 |
|
25 |
C !USES: |
26 |
IMPLICIT NONE |
27 |
|
28 |
C == Global variables === |
29 |
#include "EEPARAMS.h" |
30 |
#include "SIZE.h" |
31 |
#include "PARAMS.h" |
32 |
|
33 |
#include "EXF_PARAM.h" |
34 |
#include "EXF_CONSTANTS.h" |
35 |
|
36 |
C !INPUT/OUTPUT PARAMETERS: |
37 |
C myThid :: my Thread Id number |
38 |
INTEGER myThid |
39 |
|
40 |
C !LOCAL VARIABLES: |
41 |
C msgBuf :: Informational/error message buffer |
42 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
43 |
INTEGER errCount |
44 |
CEOP |
45 |
|
46 |
_BEGIN_MASTER(myThid) |
47 |
errCount = 0 |
48 |
|
49 |
WRITE(msgBuf,'(A)') 'EXF_CHECK: #define ALLOW_EXF' |
50 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
51 |
& SQUEEZE_RIGHT, myThid ) |
52 |
|
53 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
54 |
C-- Check for consistency, main parameters |
55 |
IF (.NOT. |
56 |
& (exf_iprec.EQ.precFloat32 .OR. exf_iprec.EQ.precFloat64) |
57 |
& ) THEN |
58 |
WRITE(msgBuf,'(A)') |
59 |
& 'S/R EXF_CHECK: value of exf_iprec not allowed' |
60 |
CALL PRINT_ERROR( msgBuf, myThid ) |
61 |
errCount = errCount + 1 |
62 |
ENDIF |
63 |
|
64 |
IF ( repeatPeriod.LT.0. ) THEN |
65 |
C- Note: should check all {fld}RepCycle (not just common defaut repeatPeriod) |
66 |
WRITE(msgBuf,'(A)') |
67 |
& 'S/R EXF_CHECK: repeatPeriod must be positive' |
68 |
CALL PRINT_ERROR( msgBuf, myThid ) |
69 |
errCount = errCount + 1 |
70 |
ENDIF |
71 |
|
72 |
IF ( useExfYearlyFields ) THEN |
73 |
IF ( .NOT.useCAL ) THEN |
74 |
WRITE(msgBuf,'(2A)') 'EXF_CHECK: ', |
75 |
& 'useExfYearlyFields requires to use pkg/cal (useCAL=T)' |
76 |
CALL PRINT_ERROR( msgBuf, myThid ) |
77 |
errCount = errCount + 1 |
78 |
ENDIF |
79 |
IF ( repeatPeriod.NE.0. ) THEN |
80 |
C- Note: should check all obcs{N,S,E,W}repCycle (not just default repeatPeriod) |
81 |
WRITE(msgBuf,'(2A)') 'EXF_CHECK: The use of ', |
82 |
& 'useExfYearlyFields AND repeatPeriod is not implemented' |
83 |
CALL PRINT_ERROR( msgBuf, myThid ) |
84 |
errCount = errCount + 1 |
85 |
ENDIF |
86 |
ENDIF |
87 |
IF ( useOBCS .AND. useOBCSYearlyFields ) THEN |
88 |
IF ( .NOT.useCAL ) THEN |
89 |
WRITE(msgBuf,'(2A)') 'EXF_CHECK: ', |
90 |
& 'useOBCSYearlyFields requires to use pkg/cal (useCAL=T)' |
91 |
CALL PRINT_ERROR( msgBuf, myThid ) |
92 |
errCount = errCount + 1 |
93 |
ENDIF |
94 |
IF ( repeatPeriod.NE.0. ) THEN |
95 |
C- Note: should check all siob{N,S,E,W}repCycle (not just default repeatPeriod) |
96 |
WRITE(msgBuf,'(2A)') 'EXF_CHECK: ', |
97 |
& 'useOBCSYearlyFields not implemented for repeatPeriod <> 0' |
98 |
CALL PRINT_ERROR( msgBuf, myThid ) |
99 |
errCount = errCount + 1 |
100 |
ENDIF |
101 |
ENDIF |
102 |
|
103 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
104 |
C-- For each field, check for parameter consistency: |
105 |
C a) stop when file is specified but not read-in; |
106 |
C b) print warning when file is read-in but not used within pkg/exf |
107 |
|
108 |
C- Check wind parameters: |
109 |
IF ( useAtmWind ) THEN |
110 |
IF ( ustressfile .NE. ' ' .OR. vstressfile .NE. ' ' ) THEN |
111 |
WRITE(msgBuf,'(A)') |
112 |
& 'EXF_CHECK: use u,v_wind components but not wind-stress' |
113 |
CALL PRINT_ERROR( msgBuf, myThid ) |
114 |
errCount = errCount + 1 |
115 |
ENDIF |
116 |
IF ( useRelativeWind .AND. |
117 |
& ( uwindfile .EQ. ' ' .OR. uwindperiod.EQ.0. .OR. |
118 |
& vwindfile .EQ. ' ' .OR. vwindperiod.EQ.0. ) ) THEN |
119 |
WRITE(msgBuf,'(2A)') 'EXF_CHECK: useRelativeWind ', |
120 |
& 'requires to update u/vwind' |
121 |
CALL PRINT_ERROR( msgBuf, myThid ) |
122 |
errCount = errCount + 1 |
123 |
ENDIF |
124 |
ENDIF |
125 |
|
126 |
IF ( .NOT.useAtmWind ) THEN |
127 |
IF ( uwindfile .NE. ' ' .OR. vwindfile .NE. ' ' ) THEN |
128 |
WRITE(msgBuf,'(A)') |
129 |
& 'EXF_CHECK: read-in wind-stress but not u,v_wind components' |
130 |
CALL PRINT_ERROR( msgBuf, myThid ) |
131 |
errCount = errCount + 1 |
132 |
ENDIF |
133 |
ENDIF |
134 |
|
135 |
#if !(defined ALLOW_ATM_TEMP) || !(defined ALLOW_BULKFORMULAE) |
136 |
IF ( wspeedfile.NE.' ' .AND. .NOT.useAtmWind ) THEN |
137 |
WRITE(msgBuf,'(3A)') '** WARNING ** EXF_CHECK: "wspeed" ', |
138 |
& 'field is loaded from file but not used within pkg/exf' |
139 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
140 |
& SQUEEZE_RIGHT, myThid ) |
141 |
ENDIF |
142 |
#endif |
143 |
|
144 |
C- Check other field parameters: |
145 |
|
146 |
#ifdef ALLOW_ATM_TEMP |
147 |
IF ( hfluxfile.NE.' ' ) THEN |
148 |
WRITE(msgBuf,'(3A)') '** WARNING ** EXF_CHECK: "hflux" ', |
149 |
& 'field is loaded from file but not used within pkg/exf' |
150 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
151 |
& SQUEEZE_RIGHT, myThid ) |
152 |
ENDIF |
153 |
IF ( sfluxfile.NE.' ' ) THEN |
154 |
WRITE(msgBuf,'(3A)') '** WARNING ** EXF_CHECK: "sflux" ', |
155 |
& 'field is loaded from file but not used within pkg/exf' |
156 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
157 |
& SQUEEZE_RIGHT, myThid ) |
158 |
ENDIF |
159 |
|
160 |
# ifndef ALLOW_BULKFORMULAE |
161 |
C- atemp might be used (outside Bulk-Formulae), e.g. to make snow |
162 |
c IF ( atempfile.NE.' ' ) THEN |
163 |
c WRITE(msgBuf,'(2A)') '** WARNING ** EXF_CHECK: "atemp" ', |
164 |
c & 'field is loaded from file but not used within pkg/exf' |
165 |
c CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
166 |
c & SQUEEZE_RIGHT, myThid ) |
167 |
c ENDIF |
168 |
IF ( aqhfile.NE.' ' ) THEN |
169 |
WRITE(msgBuf,'(2A)') '** WARNING ** EXF_CHECK: "aqh" ', |
170 |
& 'field is loaded from file but not used within pkg/exf' |
171 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
172 |
& SQUEEZE_RIGHT, myThid ) |
173 |
ENDIF |
174 |
# endif /* ndef ALLOW_BULKFORMULAE */ |
175 |
#else /* ALLOW_ATM_TEMP */ |
176 |
IF ( atempfile.NE.' ' ) THEN |
177 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
178 |
& '"atemp" with #undef ALLOW_ATM_TEMP' |
179 |
CALL PRINT_ERROR( msgBuf, myThid ) |
180 |
errCount = errCount + 1 |
181 |
ENDIF |
182 |
IF ( aqhfile.NE.' ' ) THEN |
183 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
184 |
& '"aqh" with #undef ALLOW_ATM_TEMP' |
185 |
CALL PRINT_ERROR( msgBuf, myThid ) |
186 |
errCount = errCount + 1 |
187 |
ENDIF |
188 |
#endif /* ALLOW_ATM_TEMP */ |
189 |
|
190 |
#if (defined ALLOW_ATM_TEMP) && (defined ALLOW_READ_TURBFLUXES) |
191 |
# ifdef ALLOW_BULKFORMULAE |
192 |
IF ( hs_file.NE.' ' ) THEN |
193 |
WRITE(msgBuf,'(2A)') '** WARNING ** EXF_CHECK: "hs" ', |
194 |
& 'field is loaded from file but not used within pkg/exf' |
195 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
196 |
& SQUEEZE_RIGHT, myThid ) |
197 |
ENDIF |
198 |
IF ( hl_file.NE.' ' ) THEN |
199 |
WRITE(msgBuf,'(2A)') '** WARNING ** EXF_CHECK: "hl" ', |
200 |
& 'field is loaded from file but not used within pkg/exf' |
201 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
202 |
& SQUEEZE_RIGHT, myThid ) |
203 |
ENDIF |
204 |
# endif /* ALLOW_BULKFORMULAE */ |
205 |
#else /* ALLOW_ATM_TEMP and ALLOW_READ_TURBFLUXES */ |
206 |
IF ( hs_file.NE.' ' ) THEN |
207 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
208 |
& '"hs" without ALLOW_ATM_TEMP and ALLOW_READ_TURBFLUXES' |
209 |
CALL PRINT_ERROR( msgBuf, myThid ) |
210 |
errCount = errCount + 1 |
211 |
ENDIF |
212 |
IF ( hl_file.NE.' ' ) THEN |
213 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
214 |
& '"hl" without ALLOW_ATM_TEMP and ALLOW_READ_TURBFLUXES' |
215 |
CALL PRINT_ERROR( msgBuf, myThid ) |
216 |
errCount = errCount + 1 |
217 |
ENDIF |
218 |
#endif /* ALLOW_ATM_TEMP and ALLOW_READ_TURBFLUXES */ |
219 |
|
220 |
#if !(defined ALLOW_ATM_TEMP) || !(defined EXF_READ_EVAP) |
221 |
IF ( evapfile.NE.' ' ) THEN |
222 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
223 |
& '"evap" without ALLOW_ATM_TEMP and EXF_READ_EVAP' |
224 |
CALL PRINT_ERROR( msgBuf, myThid ) |
225 |
errCount = errCount + 1 |
226 |
ENDIF |
227 |
#endif /* ndef ALLOW_ATM_TEMP or ndef EXF_READ_EVAP */ |
228 |
|
229 |
#ifndef ALLOW_ATM_TEMP |
230 |
IF ( precipfile.NE.' ' ) THEN |
231 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
232 |
& '"precip" with #undef ALLOW_ATM_TEMP' |
233 |
CALL PRINT_ERROR( msgBuf, myThid ) |
234 |
errCount = errCount + 1 |
235 |
ENDIF |
236 |
IF ( snowprecipfile.NE.' ' ) THEN |
237 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
238 |
& '"snowprecip" with #undef ALLOW_ATM_TEMP' |
239 |
CALL PRINT_ERROR( msgBuf, myThid ) |
240 |
errCount = errCount + 1 |
241 |
ENDIF |
242 |
# ifndef SHORTWAVE_HEATING |
243 |
IF ( swfluxfile.NE.' ' ) THEN |
244 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
245 |
& '"swflux" without ALLOW_ATM_TEMP or SHORTWAVE_HEATING' |
246 |
CALL PRINT_ERROR( msgBuf, myThid ) |
247 |
errCount = errCount + 1 |
248 |
ENDIF |
249 |
IF ( swdownfile.NE.' ' ) THEN |
250 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
251 |
& '"swdown" without ALLOW_ATM_TEMP or SHORTWAVE_HEATING' |
252 |
CALL PRINT_ERROR( msgBuf, myThid ) |
253 |
errCount = errCount + 1 |
254 |
ENDIF |
255 |
# endif /* ndef SHORTWAVE_HEATING */ |
256 |
IF ( lwfluxfile.NE.' ' ) THEN |
257 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
258 |
& '"lwflux" with #undef ALLOW_ATM_TEMP' |
259 |
CALL PRINT_ERROR( msgBuf, myThid ) |
260 |
errCount = errCount + 1 |
261 |
ENDIF |
262 |
IF ( lwdownfile.NE.' ' ) THEN |
263 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
264 |
& '"lwdown" with #undef ALLOW_ATM_TEMP' |
265 |
CALL PRINT_ERROR( msgBuf, myThid ) |
266 |
errCount = errCount + 1 |
267 |
ENDIF |
268 |
#endif /* ndef ALLOW_ATM_TEMP */ |
269 |
|
270 |
#ifdef ALLOW_DOWNWARD_RADIATION |
271 |
# if defined(ALLOW_ATM_TEMP) || defined(SHORTWAVE_HEATING) |
272 |
IF ( swdownfile.NE.' ' .AND. swfluxfile.NE.' ' ) THEN |
273 |
WRITE(msgBuf,'(2A)') '** WARNING ** EXF_CHECK: "swdown" ', |
274 |
& 'field is loaded from file but not used within pkg/exf' |
275 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
276 |
& SQUEEZE_RIGHT, myThid ) |
277 |
ENDIF |
278 |
# endif /* ALLOW_ATM_TEMP or SHORTWAVE_HEATING */ |
279 |
# ifdef ALLOW_ATM_TEMP |
280 |
IF ( lwdownfile.NE.' ' .AND. lwfluxfile.NE.' ' ) THEN |
281 |
WRITE(msgBuf,'(2A)') '** WARNING ** EXF_CHECK: "lwdown" ', |
282 |
& 'field is loaded from file but not used within pkg/exf' |
283 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
284 |
& SQUEEZE_RIGHT, myThid ) |
285 |
ENDIF |
286 |
# endif /* ALLOW_ATM_TEMP or SHORTWAVE_HEATING */ |
287 |
#else /* ALLOW_DOWNWARD_RADIATION */ |
288 |
IF ( swdownfile.NE.' ' ) THEN |
289 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
290 |
& '"swdown" with #undef ALLOW_DOWNWARD_RADIATION' |
291 |
CALL PRINT_ERROR( msgBuf, myThid ) |
292 |
errCount = errCount + 1 |
293 |
ENDIF |
294 |
IF ( lwdownfile.NE.' ' ) THEN |
295 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
296 |
& '"lwdown" with #undef ALLOW_DOWNWARD_RADIATION' |
297 |
CALL PRINT_ERROR( msgBuf, myThid ) |
298 |
errCount = errCount + 1 |
299 |
ENDIF |
300 |
#endif /* ALLOW_DOWNWARD_RADIATION */ |
301 |
|
302 |
#ifndef ATMOSPHERIC_LOADING |
303 |
IF ( apressurefile.NE.' ' ) THEN |
304 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
305 |
& '"apressure" with #undef ATMOSPHERIC_LOADING' |
306 |
CALL PRINT_ERROR( msgBuf, myThid ) |
307 |
errCount = errCount + 1 |
308 |
ENDIF |
309 |
#endif /* ndef ATMOSPHERIC_LOADING */ |
310 |
|
311 |
#ifndef EXF_SEAICE_FRACTION |
312 |
IF ( areamaskfile.NE.' ' ) THEN |
313 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
314 |
& '"areamask" with #undef EXF_SEAICE_FRACTION' |
315 |
CALL PRINT_ERROR( msgBuf, myThid ) |
316 |
errCount = errCount + 1 |
317 |
ENDIF |
318 |
#endif /* ndef EXF_SEAICE_FRACTION */ |
319 |
|
320 |
#ifndef ALLOW_RUNOFF |
321 |
IF ( runofffile.NE.' ' ) THEN |
322 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
323 |
& '"runoff" with #undef ALLOW_RUNOFF' |
324 |
CALL PRINT_ERROR( msgBuf, myThid ) |
325 |
errCount = errCount + 1 |
326 |
ENDIF |
327 |
#endif /* ndef ALLOW_RUNOFF */ |
328 |
|
329 |
IF ( runoftempfile.NE.' ' ) THEN |
330 |
#ifndef ALLOW_RUNOFTEMP |
331 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
332 |
& '"runoftemp" with #undef ALLOW_RUNOFTEMP' |
333 |
CALL PRINT_ERROR( msgBuf, myThid ) |
334 |
errCount = errCount + 1 |
335 |
#endif /* ndef ALLOW_RUNOFTEMP */ |
336 |
IF ( runofffile.EQ.' ' ) THEN |
337 |
WRITE(msgBuf,'(2A)') '** WARNING ** EXF_CHECK: "runoftemp" ', |
338 |
& 'field is loaded from file but not used within pkg/exf' |
339 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
340 |
& SQUEEZE_RIGHT, myThid ) |
341 |
ENDIF |
342 |
ENDIF |
343 |
|
344 |
IF ( saltflxfile.NE.' ' ) THEN |
345 |
#ifndef ALLOW_SALTFLX |
346 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ', |
347 |
& '"saltflx" with #undef ALLOW_SALTFLX' |
348 |
CALL PRINT_ERROR( msgBuf, myThid ) |
349 |
errCount = errCount + 1 |
350 |
#endif /* ndef ALLOW_SALTFLX */ |
351 |
IF ( useSEAICE .OR. useThSIce ) THEN |
352 |
WRITE(msgBuf,'(2A)') 'EXF_CHECK: exf salt flux is not', |
353 |
& ' allowed when using either pkg/seaice or pkg/thsice' |
354 |
CALL PRINT_ERROR( msgBuf, myThid ) |
355 |
errCount = errCount + 1 |
356 |
ENDIF |
357 |
ENDIF |
358 |
|
359 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
360 |
|
361 |
#ifdef ALLOW_ZENITHANGLE |
362 |
IF ( ( useExfZenIncoming .OR. select_ZenAlbedo.NE.0 ) .AND. |
363 |
& ( usingCartesianGrid .OR. usingCylindricalGrid ) ) THEN |
364 |
WRITE(msgBuf,'(A,A)') 'EXF_CHECK: ZENITHANGLE code ', |
365 |
& 'does not work for cartesian and cylindrical grids' |
366 |
CALL PRINT_ERROR( msgBuf, myThid ) |
367 |
errCount = errCount + 1 |
368 |
ENDIF |
369 |
IF ( select_ZenAlbedo.LT.0 .OR. select_ZenAlbedo.GT.3 ) THEN |
370 |
WRITE(msgBuf,'(A,A)') 'EXF_CHECK: unsupported ', |
371 |
& 'select_ZenAlbedo choice' |
372 |
CALL PRINT_ERROR( msgBuf, myThid ) |
373 |
errCount = errCount + 1 |
374 |
ENDIF |
375 |
IF ( select_ZenAlbedo.EQ.2 ) THEN |
376 |
WRITE(msgBuf,'(A,A)') |
377 |
& '** WARNING ** EXF_CHECK: for daily mean albedo, ', |
378 |
& 'it is advised to use select_ZenAlbedo.EQ.1 instead of 2' |
379 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
380 |
& SQUEEZE_RIGHT, myThid ) |
381 |
ENDIF |
382 |
IF ( select_ZenAlbedo.EQ.3 .AND. swdownperiod.GT.21600. ) THEN |
383 |
WRITE(msgBuf,'(A,A)') 'EXF_CHECK: using diurnal albedo ', |
384 |
& 'formula requires diurnal downward shortwave forcing' |
385 |
CALL PRINT_ERROR( msgBuf, myThid ) |
386 |
errCount = errCount + 1 |
387 |
ENDIF |
388 |
IF ( select_ZenAlbedo.EQ.3 .AND. swdownperiod.GT.3600. ) THEN |
389 |
WRITE(msgBuf,'(3A)') '** WARNING ** EXF_CHECK: ', |
390 |
& 'the diurnal albedo formula is likely not safe for such ', |
391 |
& 'coarse temporal resolution downward shortwave forcing' |
392 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
393 |
& SQUEEZE_RIGHT, myThid ) |
394 |
ENDIF |
395 |
#else /* ALLOW_ZENITHANGLE */ |
396 |
IF ( useExfZenIncoming .OR. select_ZenAlbedo.NE.0 ) THEN |
397 |
WRITE(msgBuf,'(A,A)') 'EXF_CHECK: unsupported option', |
398 |
& ' when ALLOW_ZENITHANGLE is not defined' |
399 |
CALL PRINT_ERROR( msgBuf, myThid ) |
400 |
errCount = errCount + 1 |
401 |
ENDIF |
402 |
#endif /* ALLOW_ZENITHANGLE */ |
403 |
|
404 |
#ifdef USE_EXF_INTERPOLATION |
405 |
IF ( usingCartesianGrid ) THEN |
406 |
WRITE(msgBuf,'(A,A)') 'EXF_CHECK: ', |
407 |
& 'USE_EXF_INTERPOLATION assumes latitude/longitude' |
408 |
CALL PRINT_ERROR( msgBuf, myThid ) |
409 |
WRITE(msgBuf,'(A,A)') 'EXF_CHECK: ', |
410 |
& 'input and output coordinates. Trivial to extend to' |
411 |
CALL PRINT_ERROR( msgBuf, myThid ) |
412 |
WRITE(msgBuf,'(A,A)') 'EXF_CHECK: ', |
413 |
& 'cartesian coordinates, but has not yet been done.' |
414 |
CALL PRINT_ERROR( msgBuf, myThid ) |
415 |
errCount = errCount + 1 |
416 |
ENDIF |
417 |
|
418 |
CALL EXF_CHECK_INTERP( 'ustress', ustressfile, |
419 |
& ustress_interpMethod, ustress_nlat, |
420 |
& ustress_nlon, ustress_lon_inc, errCount, myThid ) |
421 |
CALL EXF_CHECK_INTERP( 'vstress', vstressfile, |
422 |
& vstress_interpMethod, vstress_nlat, |
423 |
& vstress_nlon, vstress_lon_inc, errCount, myThid ) |
424 |
CALL EXF_CHECK_INTERP( 'hflux', hfluxfile, hflux_interpMethod, |
425 |
& hflux_nlat, hflux_nlon, hflux_lon_inc, errCount, myThid ) |
426 |
CALL EXF_CHECK_INTERP( 'sflux', sfluxfile, sflux_interpMethod, |
427 |
& sflux_nlat, sflux_nlon, sflux_lon_inc, errCount, myThid ) |
428 |
CALL EXF_CHECK_INTERP( 'swflux', swfluxfile, swflux_interpMethod, |
429 |
& swflux_nlat, swflux_nlon, swflux_lon_inc, errCount, myThid ) |
430 |
CALL EXF_CHECK_INTERP( 'runoff', runofffile, runoff_interpMethod, |
431 |
& runoff_nlat, runoff_nlon, runoff_lon_inc, errCount, myThid ) |
432 |
CALL EXF_CHECK_INTERP( 'saltflx', saltflxfile, |
433 |
& saltflx_interpMethod, saltflx_nlat, |
434 |
& saltflx_nlon, saltflx_lon_inc, errCount, myThid ) |
435 |
CALL EXF_CHECK_INTERP( 'atemp', atempfile, atemp_interpMethod, |
436 |
& atemp_nlat, atemp_nlon, atemp_lon_inc, errCount, myThid ) |
437 |
CALL EXF_CHECK_INTERP( 'aqh', aqhfile, aqh_interpMethod, |
438 |
& aqh_nlat, aqh_nlon, aqh_lon_inc, errCount, myThid ) |
439 |
CALL EXF_CHECK_INTERP( 'hs', hs_file, hs_interpMethod, |
440 |
& hs_nlat, hs_nlon, hs_lon_inc, errCount, myThid ) |
441 |
CALL EXF_CHECK_INTERP( 'hl', hl_file, hl_interpMethod, |
442 |
& hl_nlat, hl_nlon, hl_lon_inc, errCount, myThid ) |
443 |
CALL EXF_CHECK_INTERP( 'evap', evapfile, evap_interpMethod, |
444 |
& evap_nlat, evap_nlon, evap_lon_inc, errCount, myThid ) |
445 |
CALL EXF_CHECK_INTERP( 'precip', precipfile, precip_interpMethod, |
446 |
& precip_nlat, precip_nlon, precip_lon_inc, errCount, myThid ) |
447 |
CALL EXF_CHECK_INTERP( 'snowprecip', snowprecipfile, |
448 |
& snowprecip_interpMethod, snowprecip_nlat, |
449 |
& snowprecip_nlon, snowprecip_lon_inc, errCount, myThid ) |
450 |
CALL EXF_CHECK_INTERP( 'uwind', uwindfile, uwind_interpMethod, |
451 |
& uwind_nlat, uwind_nlon, uwind_lon_inc, errCount, myThid ) |
452 |
CALL EXF_CHECK_INTERP( 'vwind', vwindfile, vwind_interpMethod, |
453 |
& vwind_nlat, vwind_nlon, vwind_lon_inc, errCount, myThid ) |
454 |
CALL EXF_CHECK_INTERP( 'wspeed', wspeedfile, wspeed_interpMethod, |
455 |
& wspeed_nlat, wspeed_nlon, wspeed_lon_inc, errCount, myThid ) |
456 |
CALL EXF_CHECK_INTERP( 'lwflux', lwfluxfile, lwflux_interpMethod, |
457 |
& lwflux_nlat, lwflux_nlon, lwflux_lon_inc, errCount, myThid ) |
458 |
CALL EXF_CHECK_INTERP( 'swdown', swdownfile, swdown_interpMethod, |
459 |
& swdown_nlat, swdown_nlon, swdown_lon_inc, errCount, myThid ) |
460 |
CALL EXF_CHECK_INTERP( 'lwdown', lwdownfile, lwdown_interpMethod, |
461 |
& lwdown_nlat, lwdown_nlon, lwdown_lon_inc, errCount, myThid ) |
462 |
CALL EXF_CHECK_INTERP( 'apressure', apressurefile, |
463 |
& apressure_interpMethod, apressure_nlat, |
464 |
& apressure_nlon, apressure_lon_inc, errCount, myThid ) |
465 |
CALL EXF_CHECK_INTERP( 'areamask', areamaskfile, |
466 |
& areamask_interpMethod, areamask_nlat, |
467 |
& areamask_nlon, areamask_lon_inc, errCount, myThid ) |
468 |
CALL EXF_CHECK_INTERP( 'climsst', climsstfile, |
469 |
& climsst_interpMethod, climsst_nlat, |
470 |
& climsst_nlon, climsst_lon_inc, errCount, myThid ) |
471 |
CALL EXF_CHECK_INTERP( 'climsss', climsssfile, |
472 |
& climsss_interpMethod, climsss_nlat, |
473 |
& climsss_nlon, climsss_lon_inc, errCount, myThid ) |
474 |
CALL EXF_CHECK_INTERP( 'climustr', climustrfile, |
475 |
& climustr_interpMethod, climustr_nlat, |
476 |
& climustr_nlon, climustr_lon_inc, errCount,myThid ) |
477 |
CALL EXF_CHECK_INTERP( 'climvstr', climvstrfile, |
478 |
& climvstr_interpMethod, climvstr_nlat, |
479 |
& climvstr_nlon, climvstr_lon_inc, errCount, myThid ) |
480 |
|
481 |
C- some restrictions on 2-component vector field (might be relaxed later on) |
482 |
IF ( ( uwind_interpMethod.GE.1 .AND. uwindfile.NE.' ' ) .OR. |
483 |
& ( vwind_interpMethod.GE.1 .AND. vwindfile.NE.' ' ) ) THEN |
484 |
IF ( usingCurvilinearGrid .OR. rotateGrid ) THEN |
485 |
IF ( uwind_interpMethod.EQ.0 .OR. uwindfile.EQ.' ' .OR. |
486 |
& vwind_interpMethod.EQ.0 .OR. vwindfile.EQ.' ' ) THEN |
487 |
C- stop if one expects interp+rotation (Curvilin-G) which will not happen |
488 |
WRITE(msgBuf,'(A)') |
489 |
& 'EXF_CHECK: interp. needs 2 components (wind)' |
490 |
CALL PRINT_ERROR( msgBuf, myThid ) |
491 |
errCount = errCount + 1 |
492 |
ENDIF |
493 |
IF ( uwindStartTime .NE. vwindStartTime .OR. |
494 |
& uwindperiod .NE. vwindperiod .OR. |
495 |
& uwindRepCycle .NE. vwindRepCycle ) THEN |
496 |
WRITE(msgBuf,'(A,A)') 'EXF_CHECK: ', |
497 |
& 'For CurvilinearGrid/RotatedGrid, the u and v wind ' |
498 |
CALL PRINT_ERROR( msgBuf, myThid ) |
499 |
WRITE(msgBuf,'(A,A,A)') 'EXF_CHECK: ', |
500 |
& 'files have to have the same StartTime,period & Cycle ', |
501 |
& 'because S/R EXF_SET_UV assumes that.' |
502 |
CALL PRINT_ERROR( msgBuf, myThid ) |
503 |
errCount = errCount + 1 |
504 |
ENDIF |
505 |
ENDIF |
506 |
ENDIF |
507 |
IF ( (ustress_interpMethod.GE.1 .AND. ustressfile.NE.' ') .OR. |
508 |
& (vstress_interpMethod.GE.1 .AND. vstressfile.NE.' ') ) THEN |
509 |
IF ( readStressOnCgrid ) THEN |
510 |
WRITE(msgBuf,'(A,A)') |
511 |
& 'EXF_CHECK: readStressOnCgrid=.TRUE. ', |
512 |
& 'and interp wind-stress (=A-grid) are not compatible' |
513 |
CALL PRINT_ERROR( msgBuf, myThid ) |
514 |
errCount = errCount + 1 |
515 |
ENDIF |
516 |
IF ( usingCurvilinearGrid .OR. rotateGrid ) THEN |
517 |
IF ( ustress_interpMethod.EQ.0 .OR. ustressfile.EQ.' ' .OR. |
518 |
& vstress_interpMethod.EQ.0 .OR. vstressfile.EQ.' ' ) THEN |
519 |
C- stop if one expects interp+rotation (Curvilin-G) which will not happen |
520 |
WRITE(msgBuf,'(A)') |
521 |
& 'EXF_CHECK: interp. needs 2 components (wind-stress)' |
522 |
CALL PRINT_ERROR( msgBuf, myThid ) |
523 |
errCount = errCount + 1 |
524 |
ENDIF |
525 |
IF ( ustressStartTime .NE. vstressStartTime .OR. |
526 |
& ustressperiod .NE. vstressperiod .OR. |
527 |
& ustressRepCycle .NE. vstressRepCycle ) THEN |
528 |
WRITE(msgBuf,'(A,A)') 'EXF_CHECK: ', |
529 |
& 'For CurvilinearGrid/RotatedGrid, the u and v wind stress ' |
530 |
CALL PRINT_ERROR( msgBuf, myThid ) |
531 |
WRITE(msgBuf,'(A,A,A)') 'EXF_CHECK: ', |
532 |
& 'have to have the same StartTime,period & Cycle ', |
533 |
& 'because S/R EXF_SET_UV assumes that.' |
534 |
CALL PRINT_ERROR( msgBuf, myThid ) |
535 |
errCount = errCount + 1 |
536 |
ENDIF |
537 |
ENDIF |
538 |
ENDIF |
539 |
|
540 |
IF ( (ustress_interpMethod.EQ.0 .AND. ustressfile.NE.' ') .OR. |
541 |
& (vstress_interpMethod.EQ.0 .AND. vstressfile.NE.' ') ) THEN |
542 |
#else /* ndef USE_EXF_INTERPOLATION */ |
543 |
IF ( ustressfile .NE. ' ' .OR. vstressfile .NE. ' ' ) THEN |
544 |
#endif /* USE_EXF_INTERPOLATION */ |
545 |
IF ( (readStressOnAgrid.AND.readStressOnCgrid) .OR. |
546 |
& .NOT.(readStressOnAgrid.OR.readStressOnCgrid) ) THEN |
547 |
WRITE(msgBuf,'(A)') |
548 |
& 'EXF_CHECK: Select 1 wind-stress position: A or C-grid' |
549 |
CALL PRINT_ERROR( msgBuf, myThid ) |
550 |
errCount = errCount + 1 |
551 |
ENDIF |
552 |
IF (rotateStressOnAgrid.AND..NOT.readStressOnAgrid) THEN |
553 |
WRITE(msgBuf,'(2A)') 'EXF_CHECK: rotateStressOnAgrid ', |
554 |
& 'only applies to cases readStressOnAgrid is true' |
555 |
CALL PRINT_ERROR( msgBuf, myThid ) |
556 |
errCount = errCount + 1 |
557 |
ENDIF |
558 |
IF ( rotateStressOnAgrid .AND. |
559 |
& ( ustressfile .EQ. ' ' .OR. ustressperiod .EQ. 0. .OR. |
560 |
& vstressfile .EQ. ' ' .OR. vstressperiod .EQ. 0. ) ) THEN |
561 |
WRITE(msgBuf,'(2A)') 'EXF_CHECK: rotateStressOnAgrid ', |
562 |
& 'requires to update u/vstress' |
563 |
CALL PRINT_ERROR( msgBuf, myThid ) |
564 |
errCount = errCount + 1 |
565 |
ENDIF |
566 |
|
567 |
ELSE |
568 |
IF ( readStressOnAgrid .OR. readStressOnCgrid .OR. |
569 |
& rotateStressOnAgrid ) THEN |
570 |
WRITE(msgBuf,'(2A)') '** WARNING ** EXF_CHECK: ', |
571 |
& 'wind-stress position irrelevant' |
572 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
573 |
& SQUEEZE_RIGHT, myThid ) |
574 |
ENDIF |
575 |
ENDIF |
576 |
|
577 |
#ifdef USE_NO_INTERP_RUNOFF |
578 |
WRITE(msgBuf,'(A)') |
579 |
& 'EXF_CHECK: USE_NO_INTERP_RUNOFF code has been removed;' |
580 |
CALL PRINT_ERROR( msgBuf, myThid ) |
581 |
WRITE(msgBuf,'(A,A)') |
582 |
& 'EXF_CHECK: use instead "runoff_interpMethod=0"', |
583 |
& ' in "data.exf" (EXF_NML_04)' |
584 |
CALL PRINT_ERROR( msgBuf, myThid ) |
585 |
errCount = errCount + 1 |
586 |
#endif /* USE_NO_INTERP_RUNOFF */ |
587 |
|
588 |
#ifdef ALLOW_CLIMTEMP_RELAXATION |
589 |
WRITE(msgBuf,'(A,A)') 'EXF_CHECK: ', |
590 |
& 'ALLOW_CLIMTEMP_RELAXATION no longer supported. Use pkg/rbcs' |
591 |
CALL PRINT_ERROR( msgBuf, myThid ) |
592 |
errCount = errCount + 1 |
593 |
#endif /* ALLOW_CLIMTEMP_RELAXATION */ |
594 |
|
595 |
#ifdef ALLOW_CLIMSALT_RELAXATION |
596 |
WRITE(msgBuf,'(A,A)') 'EXF_CHECK: ', |
597 |
& 'ALLOW_CLIMSALT_RELAXATION no longer supported. Use pkg/rbcs' |
598 |
CALL PRINT_ERROR( msgBuf, myThid ) |
599 |
errCount = errCount + 1 |
600 |
#endif /* ALLOW_CLIMSALT_RELAXATION */ |
601 |
|
602 |
IF ( climsstTauRelax.NE.0. ) THEN |
603 |
#ifndef ALLOW_CLIMSST_RELAXATION |
604 |
WRITE(msgBuf,'(A)') 'EXF_CHECK: climsstTauRelax > 0' |
605 |
CALL PRINT_ERROR( msgBuf, myThid ) |
606 |
WRITE(msgBuf,'(A)') |
607 |
& 'EXF_CHECK: but ALLOW_CLIMSST_RELAXATION is not defined' |
608 |
CALL PRINT_ERROR( msgBuf, myThid ) |
609 |
errCount = errCount + 1 |
610 |
#endif /* ndef ALLOW_CLIMSST_RELAXATION */ |
611 |
IF ( climsstfile.EQ.' ' ) THEN |
612 |
WRITE(msgBuf,'(A)') 'EXF_CHECK: climsstTauRelax > 0 but' |
613 |
CALL PRINT_ERROR( msgBuf, myThid ) |
614 |
WRITE(msgBuf,'(A)') 'EXF_CHECK: climsstfile is not set' |
615 |
CALL PRINT_ERROR( msgBuf, myThid ) |
616 |
errCount = errCount + 1 |
617 |
ENDIf |
618 |
ENDIf |
619 |
|
620 |
IF ( climsssTauRelax.NE.0. ) THEN |
621 |
#ifndef ALLOW_CLIMSSS_RELAXATION |
622 |
WRITE(msgBuf,'(A)') 'EXF_CHECK: climsssTauRelax > 0' |
623 |
CALL PRINT_ERROR( msgBuf, myThid ) |
624 |
WRITE(msgBuf,'(A)') |
625 |
& 'EXF_CHECK: but ALLOW_CLIMSSS_RELAXATION is not defined' |
626 |
CALL PRINT_ERROR( msgBuf, myThid ) |
627 |
errCount = errCount + 1 |
628 |
#endif /* ALLOW_CLIMSSS_RELAXATION */ |
629 |
IF ( climsssfile.EQ.' ' ) THEN |
630 |
WRITE(msgBuf,'(A)') 'EXF_CHECK: climsssTauRelax > 0 but' |
631 |
CALL PRINT_ERROR( msgBuf, myThid ) |
632 |
WRITE(msgBuf,'(A)') 'EXF_CHECK: climsssfile is not set' |
633 |
CALL PRINT_ERROR( msgBuf, myThid ) |
634 |
errCount = errCount + 1 |
635 |
ENDIF |
636 |
ENDIF |
637 |
|
638 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
639 |
|
640 |
IF ( errCount.GE.1 ) THEN |
641 |
WRITE(msgBuf,'(A,I3,A)') |
642 |
& 'EXF_CHECK: detected', errCount,' fatal error(s)' |
643 |
CALL PRINT_ERROR( msgBuf, myThid ) |
644 |
CALL ALL_PROC_DIE( 0 ) |
645 |
STOP 'ABNORMAL END: S/R EXF_CHECK' |
646 |
ENDIF |
647 |
|
648 |
_END_MASTER(myThid) |
649 |
|
650 |
RETURN |
651 |
END |
652 |
|
653 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
654 |
|
655 |
CBOP |
656 |
C !ROUTINE: EXF_CHECK_INTERP |
657 |
C !INTERFACE: |
658 |
|
659 |
SUBROUTINE EXF_CHECK_INTERP( |
660 |
I loc_name, loc_file, loc_interpMethod, |
661 |
I loc_nlat, loc_nlon, loc_lon_inc, |
662 |
U errCount, |
663 |
I myThid ) |
664 |
|
665 |
C !DESCRIPTION: \bv |
666 |
C *==========================================================* |
667 |
C | S/R EXF_CHECK_INTERP |
668 |
C | o Check parameters for one of the pkg/exf variable |
669 |
C *==========================================================* |
670 |
C \ev |
671 |
|
672 |
C !USES: |
673 |
IMPLICIT NONE |
674 |
|
675 |
C == Global variables === |
676 |
#include "EEPARAMS.h" |
677 |
#include "EXF_INTERP_SIZE.h" |
678 |
#include "EXF_PARAM.h" |
679 |
|
680 |
C !INPUT/OUTPUT PARAMETERS: |
681 |
C fldName :: field short name (to print mesg) |
682 |
C fldFile :: file-name for this field |
683 |
C loc_interpMethod :: select interpolation method |
684 |
C loc_nlat :: size in y direction of original input grid |
685 |
C loc_nlon :: size in x direction of original input grid |
686 |
C fld_lon_inc :: scalar x-grid increment |
687 |
C errCount :: error counter |
688 |
C myThid :: my Thread Id number |
689 |
CHARACTER*(*) loc_name |
690 |
CHARACTER*(*) loc_file |
691 |
INTEGER loc_interpMethod |
692 |
INTEGER loc_nlat |
693 |
INTEGER loc_nlon |
694 |
_RL loc_lon_inc |
695 |
INTEGER errCount |
696 |
INTEGER myThid |
697 |
|
698 |
C !LOCAL VARIABLES: |
699 |
C msgBuf :: Informational/error message buffer |
700 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
701 |
CEOP |
702 |
|
703 |
IF ( loc_interpMethod.GE.1 .AND. loc_file.NE.' ' ) THEN |
704 |
IF ( loc_nlat .GT. (MAX_LAT_INC+1) ) THEN |
705 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK_INTERP: ',loc_name, |
706 |
& '_nlat > (MAX_LAT_INC+1)' |
707 |
CALL PRINT_ERROR( msgBuf, myThid ) |
708 |
errCount = errCount + 1 |
709 |
ENDIF |
710 |
#ifndef EXF_INTERP_USE_DYNALLOC |
711 |
C- Check buffer size: |
712 |
IF ( loc_nlon.GT.exf_max_nLon ) THEN |
713 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK_INTERP: ',loc_name, |
714 |
& '_nlon > exf_max_nLon' |
715 |
CALL PRINT_ERROR( msgBuf, myThid ) |
716 |
errCount = errCount + 1 |
717 |
ENDIF |
718 |
IF ( loc_nlat.GT.exf_max_nLat ) THEN |
719 |
WRITE(msgBuf,'(3A)') 'EXF_CHECK_INTERP: ',loc_name, |
720 |
& '_nlat > exf_max_nLat' |
721 |
CALL PRINT_ERROR( msgBuf, myThid ) |
722 |
errCount = errCount + 1 |
723 |
ENDIF |
724 |
IF ( (loc_nlon+4)*(loc_nlat+4).GT.exf_interp_bufferSize ) THEN |
725 |
WRITE(msgBuf,'(6A)') 'EXF_CHECK_INTERP: ', |
726 |
& 'exf_interp_bufferSize too small for ', |
727 |
& loc_name, '_nlon & ', loc_name, '_nlat' |
728 |
CALL PRINT_ERROR( msgBuf, myThid ) |
729 |
errCount = errCount + 1 |
730 |
ENDIF |
731 |
#endif /* ndef EXF_INTERP_USE_DYNALLOC */ |
732 |
IF ( loc_lon_inc.GT.500. ) THEN |
733 |
WRITE(msgBuf,'(4A,1PE16.8)') 'EXF_CHECK_INTERP: ', |
734 |
& 'Invalid value for: ',loc_name,'_lon_inc =', loc_lon_inc |
735 |
CALL PRINT_ERROR( msgBuf, myThid ) |
736 |
WRITE(msgBuf,'(4A)') 'EXF_CHECK_INTERP: Fix it ', |
737 |
& 'or Turn off ',loc_name,'-interp (interpMethod=0)' |
738 |
CALL PRINT_ERROR( msgBuf, myThid ) |
739 |
errCount = errCount + 1 |
740 |
ENDIF |
741 |
ENDIF |
742 |
|
743 |
RETURN |
744 |
END |