/[MITgcm]/MITgcm/pkg/exf/exf_check.F
ViewVC logotype

Contents of /MITgcm/pkg/exf/exf_check.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.35 - (show annotations) (download)
Fri Oct 6 00:03:56 2017 UTC (6 years, 7 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, HEAD
Changes since 1.34: +13 -1 lines
- add specific forcing field for tides to feed model new geopotential anomaly
  forcing, for now within #ifdef EXF_ALLOW_TIDES.

1 C $Header: /u/gcmpack/MITgcm/pkg/exf/exf_check.F,v 1.34 2017/05/12 00:09:21 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_ALLOW_TIDES
312 IF ( tidePotFile.NE.' ' ) THEN
313 WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ',
314 & '"tidePot" with #undef EXF_ALLOW_TIDES'
315 CALL PRINT_ERROR( msgBuf, myThid )
316 errCount = errCount + 1
317 ENDIF
318 #endif /* ndef EXF_SEAICE_FRACTION */
319
320 #ifndef EXF_SEAICE_FRACTION
321 IF ( areamaskfile.NE.' ' ) THEN
322 WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ',
323 & '"areamask" with #undef EXF_SEAICE_FRACTION'
324 CALL PRINT_ERROR( msgBuf, myThid )
325 errCount = errCount + 1
326 ENDIF
327 #endif /* ndef EXF_SEAICE_FRACTION */
328
329 #ifndef ALLOW_RUNOFF
330 IF ( runofffile.NE.' ' ) THEN
331 WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ',
332 & '"runoff" with #undef ALLOW_RUNOFF'
333 CALL PRINT_ERROR( msgBuf, myThid )
334 errCount = errCount + 1
335 ENDIF
336 #endif /* ndef ALLOW_RUNOFF */
337
338 IF ( runoftempfile.NE.' ' ) THEN
339 #ifndef ALLOW_RUNOFTEMP
340 WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ',
341 & '"runoftemp" with #undef ALLOW_RUNOFTEMP'
342 CALL PRINT_ERROR( msgBuf, myThid )
343 errCount = errCount + 1
344 #endif /* ndef ALLOW_RUNOFTEMP */
345 IF ( runofffile.EQ.' ' ) THEN
346 WRITE(msgBuf,'(2A)') '** WARNING ** EXF_CHECK: "runoftemp" ',
347 & 'field is loaded from file but not used within pkg/exf'
348 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
349 & SQUEEZE_RIGHT, myThid )
350 ENDIF
351 ENDIF
352
353 IF ( saltflxfile.NE.' ' ) THEN
354 #ifndef ALLOW_SALTFLX
355 WRITE(msgBuf,'(3A)') 'EXF_CHECK: Cannot read-in field ',
356 & '"saltflx" with #undef ALLOW_SALTFLX'
357 CALL PRINT_ERROR( msgBuf, myThid )
358 errCount = errCount + 1
359 #endif /* ndef ALLOW_SALTFLX */
360 IF ( useSEAICE .OR. useThSIce ) THEN
361 WRITE(msgBuf,'(2A)') 'EXF_CHECK: exf salt flux is not',
362 & ' allowed when using either pkg/seaice or pkg/thsice'
363 CALL PRINT_ERROR( msgBuf, myThid )
364 errCount = errCount + 1
365 ENDIF
366 ENDIF
367
368 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
369
370 #ifdef ALLOW_ZENITHANGLE
371 IF ( ( useExfZenIncoming .OR. select_ZenAlbedo.NE.0 ) .AND.
372 & ( usingCartesianGrid .OR. usingCylindricalGrid ) ) THEN
373 WRITE(msgBuf,'(A,A)') 'EXF_CHECK: ZENITHANGLE code ',
374 & 'does not work for cartesian and cylindrical grids'
375 CALL PRINT_ERROR( msgBuf, myThid )
376 errCount = errCount + 1
377 ENDIF
378 IF ( select_ZenAlbedo.LT.0 .OR. select_ZenAlbedo.GT.3 ) THEN
379 WRITE(msgBuf,'(A,A)') 'EXF_CHECK: unsupported ',
380 & 'select_ZenAlbedo choice'
381 CALL PRINT_ERROR( msgBuf, myThid )
382 errCount = errCount + 1
383 ENDIF
384 IF ( select_ZenAlbedo.EQ.2 ) THEN
385 WRITE(msgBuf,'(A,A)')
386 & '** WARNING ** EXF_CHECK: for daily mean albedo, ',
387 & 'it is advised to use select_ZenAlbedo.EQ.1 instead of 2'
388 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
389 & SQUEEZE_RIGHT, myThid )
390 ENDIF
391 IF ( select_ZenAlbedo.EQ.3 .AND. swdownperiod.GT.21600. ) THEN
392 WRITE(msgBuf,'(A,A)') 'EXF_CHECK: using diurnal albedo ',
393 & 'formula requires diurnal downward shortwave forcing'
394 CALL PRINT_ERROR( msgBuf, myThid )
395 errCount = errCount + 1
396 ENDIF
397 IF ( select_ZenAlbedo.EQ.3 .AND. swdownperiod.GT.3600. ) THEN
398 WRITE(msgBuf,'(3A)') '** WARNING ** EXF_CHECK: ',
399 & 'the diurnal albedo formula is likely not safe for such ',
400 & 'coarse temporal resolution downward shortwave forcing'
401 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
402 & SQUEEZE_RIGHT, myThid )
403 ENDIF
404 #else /* ALLOW_ZENITHANGLE */
405 IF ( useExfZenIncoming .OR. select_ZenAlbedo.NE.0 ) THEN
406 WRITE(msgBuf,'(A,A)') 'EXF_CHECK: unsupported option',
407 & ' when ALLOW_ZENITHANGLE is not defined'
408 CALL PRINT_ERROR( msgBuf, myThid )
409 errCount = errCount + 1
410 ENDIF
411 #endif /* ALLOW_ZENITHANGLE */
412
413 #ifdef USE_EXF_INTERPOLATION
414 IF ( usingCartesianGrid ) THEN
415 WRITE(msgBuf,'(A,A)') 'EXF_CHECK: ',
416 & 'USE_EXF_INTERPOLATION assumes latitude/longitude'
417 CALL PRINT_ERROR( msgBuf, myThid )
418 WRITE(msgBuf,'(A,A)') 'EXF_CHECK: ',
419 & 'input and output coordinates. Trivial to extend to'
420 CALL PRINT_ERROR( msgBuf, myThid )
421 WRITE(msgBuf,'(A,A)') 'EXF_CHECK: ',
422 & 'cartesian coordinates, but has not yet been done.'
423 CALL PRINT_ERROR( msgBuf, myThid )
424 errCount = errCount + 1
425 ENDIF
426
427 CALL EXF_CHECK_INTERP( 'ustress', ustressfile,
428 & ustress_interpMethod, ustress_nlat,
429 & ustress_nlon, ustress_lon_inc, errCount, myThid )
430 CALL EXF_CHECK_INTERP( 'vstress', vstressfile,
431 & vstress_interpMethod, vstress_nlat,
432 & vstress_nlon, vstress_lon_inc, errCount, myThid )
433 CALL EXF_CHECK_INTERP( 'hflux', hfluxfile, hflux_interpMethod,
434 & hflux_nlat, hflux_nlon, hflux_lon_inc, errCount, myThid )
435 CALL EXF_CHECK_INTERP( 'sflux', sfluxfile, sflux_interpMethod,
436 & sflux_nlat, sflux_nlon, sflux_lon_inc, errCount, myThid )
437 CALL EXF_CHECK_INTERP( 'swflux', swfluxfile, swflux_interpMethod,
438 & swflux_nlat, swflux_nlon, swflux_lon_inc, errCount, myThid )
439 CALL EXF_CHECK_INTERP( 'runoff', runofffile, runoff_interpMethod,
440 & runoff_nlat, runoff_nlon, runoff_lon_inc, errCount, myThid )
441 CALL EXF_CHECK_INTERP( 'saltflx', saltflxfile,
442 & saltflx_interpMethod, saltflx_nlat,
443 & saltflx_nlon, saltflx_lon_inc, errCount, myThid )
444 CALL EXF_CHECK_INTERP( 'atemp', atempfile, atemp_interpMethod,
445 & atemp_nlat, atemp_nlon, atemp_lon_inc, errCount, myThid )
446 CALL EXF_CHECK_INTERP( 'aqh', aqhfile, aqh_interpMethod,
447 & aqh_nlat, aqh_nlon, aqh_lon_inc, errCount, myThid )
448 CALL EXF_CHECK_INTERP( 'hs', hs_file, hs_interpMethod,
449 & hs_nlat, hs_nlon, hs_lon_inc, errCount, myThid )
450 CALL EXF_CHECK_INTERP( 'hl', hl_file, hl_interpMethod,
451 & hl_nlat, hl_nlon, hl_lon_inc, errCount, myThid )
452 CALL EXF_CHECK_INTERP( 'evap', evapfile, evap_interpMethod,
453 & evap_nlat, evap_nlon, evap_lon_inc, errCount, myThid )
454 CALL EXF_CHECK_INTERP( 'precip', precipfile, precip_interpMethod,
455 & precip_nlat, precip_nlon, precip_lon_inc, errCount, myThid )
456 CALL EXF_CHECK_INTERP( 'snowprecip', snowprecipfile,
457 & snowprecip_interpMethod, snowprecip_nlat,
458 & snowprecip_nlon, snowprecip_lon_inc, errCount, myThid )
459 CALL EXF_CHECK_INTERP( 'uwind', uwindfile, uwind_interpMethod,
460 & uwind_nlat, uwind_nlon, uwind_lon_inc, errCount, myThid )
461 CALL EXF_CHECK_INTERP( 'vwind', vwindfile, vwind_interpMethod,
462 & vwind_nlat, vwind_nlon, vwind_lon_inc, errCount, myThid )
463 CALL EXF_CHECK_INTERP( 'wspeed', wspeedfile, wspeed_interpMethod,
464 & wspeed_nlat, wspeed_nlon, wspeed_lon_inc, errCount, myThid )
465 CALL EXF_CHECK_INTERP( 'lwflux', lwfluxfile, lwflux_interpMethod,
466 & lwflux_nlat, lwflux_nlon, lwflux_lon_inc, errCount, myThid )
467 CALL EXF_CHECK_INTERP( 'swdown', swdownfile, swdown_interpMethod,
468 & swdown_nlat, swdown_nlon, swdown_lon_inc, errCount, myThid )
469 CALL EXF_CHECK_INTERP( 'lwdown', lwdownfile, lwdown_interpMethod,
470 & lwdown_nlat, lwdown_nlon, lwdown_lon_inc, errCount, myThid )
471 CALL EXF_CHECK_INTERP( 'apressure', apressurefile,
472 & apressure_interpMethod, apressure_nlat,
473 & apressure_nlon, apressure_lon_inc, errCount, myThid )
474 CALL EXF_CHECK_INTERP( 'tidePot', tidePotFile,
475 & tidePot_interpMethod, tidePot_nlat,
476 & tidePot_nlon, tidePot_lon_inc, errCount, myThid )
477 CALL EXF_CHECK_INTERP( 'areamask', areamaskfile,
478 & areamask_interpMethod, areamask_nlat,
479 & areamask_nlon, areamask_lon_inc, errCount, myThid )
480 CALL EXF_CHECK_INTERP( 'climsst', climsstfile,
481 & climsst_interpMethod, climsst_nlat,
482 & climsst_nlon, climsst_lon_inc, errCount, myThid )
483 CALL EXF_CHECK_INTERP( 'climsss', climsssfile,
484 & climsss_interpMethod, climsss_nlat,
485 & climsss_nlon, climsss_lon_inc, errCount, myThid )
486 CALL EXF_CHECK_INTERP( 'climustr', climustrfile,
487 & climustr_interpMethod, climustr_nlat,
488 & climustr_nlon, climustr_lon_inc, errCount,myThid )
489 CALL EXF_CHECK_INTERP( 'climvstr', climvstrfile,
490 & climvstr_interpMethod, climvstr_nlat,
491 & climvstr_nlon, climvstr_lon_inc, errCount, myThid )
492
493 C- some restrictions on 2-component vector field (might be relaxed later on)
494 IF ( ( uwind_interpMethod.GE.1 .AND. uwindfile.NE.' ' ) .OR.
495 & ( vwind_interpMethod.GE.1 .AND. vwindfile.NE.' ' ) ) THEN
496 IF ( usingCurvilinearGrid .OR. rotateGrid ) THEN
497 IF ( uwind_interpMethod.EQ.0 .OR. uwindfile.EQ.' ' .OR.
498 & vwind_interpMethod.EQ.0 .OR. vwindfile.EQ.' ' ) THEN
499 C- stop if one expects interp+rotation (Curvilin-G) which will not happen
500 WRITE(msgBuf,'(A)')
501 & 'EXF_CHECK: interp. needs 2 components (wind)'
502 CALL PRINT_ERROR( msgBuf, myThid )
503 errCount = errCount + 1
504 ENDIF
505 IF ( uwindStartTime .NE. vwindStartTime .OR.
506 & uwindperiod .NE. vwindperiod .OR.
507 & uwindRepCycle .NE. vwindRepCycle ) THEN
508 WRITE(msgBuf,'(A,A)') 'EXF_CHECK: ',
509 & 'For CurvilinearGrid/RotatedGrid, the u and v wind '
510 CALL PRINT_ERROR( msgBuf, myThid )
511 WRITE(msgBuf,'(A,A,A)') 'EXF_CHECK: ',
512 & 'files have to have the same StartTime,period & Cycle ',
513 & 'because S/R EXF_SET_UV assumes that.'
514 CALL PRINT_ERROR( msgBuf, myThid )
515 errCount = errCount + 1
516 ENDIF
517 ENDIF
518 ENDIF
519 IF ( (ustress_interpMethod.GE.1 .AND. ustressfile.NE.' ') .OR.
520 & (vstress_interpMethod.GE.1 .AND. vstressfile.NE.' ') ) THEN
521 IF ( readStressOnCgrid ) THEN
522 WRITE(msgBuf,'(A,A)')
523 & 'EXF_CHECK: readStressOnCgrid=.TRUE. ',
524 & 'and interp wind-stress (=A-grid) are not compatible'
525 CALL PRINT_ERROR( msgBuf, myThid )
526 errCount = errCount + 1
527 ENDIF
528 IF ( usingCurvilinearGrid .OR. rotateGrid ) THEN
529 IF ( ustress_interpMethod.EQ.0 .OR. ustressfile.EQ.' ' .OR.
530 & vstress_interpMethod.EQ.0 .OR. vstressfile.EQ.' ' ) THEN
531 C- stop if one expects interp+rotation (Curvilin-G) which will not happen
532 WRITE(msgBuf,'(A)')
533 & 'EXF_CHECK: interp. needs 2 components (wind-stress)'
534 CALL PRINT_ERROR( msgBuf, myThid )
535 errCount = errCount + 1
536 ENDIF
537 IF ( ustressStartTime .NE. vstressStartTime .OR.
538 & ustressperiod .NE. vstressperiod .OR.
539 & ustressRepCycle .NE. vstressRepCycle ) THEN
540 WRITE(msgBuf,'(A,A)') 'EXF_CHECK: ',
541 & 'For CurvilinearGrid/RotatedGrid, the u and v wind stress '
542 CALL PRINT_ERROR( msgBuf, myThid )
543 WRITE(msgBuf,'(A,A,A)') 'EXF_CHECK: ',
544 & 'have to have the same StartTime,period & Cycle ',
545 & 'because S/R EXF_SET_UV assumes that.'
546 CALL PRINT_ERROR( msgBuf, myThid )
547 errCount = errCount + 1
548 ENDIF
549 ENDIF
550 ENDIF
551
552 IF ( (ustress_interpMethod.EQ.0 .AND. ustressfile.NE.' ') .OR.
553 & (vstress_interpMethod.EQ.0 .AND. vstressfile.NE.' ') ) THEN
554 #else /* ndef USE_EXF_INTERPOLATION */
555 IF ( ustressfile .NE. ' ' .OR. vstressfile .NE. ' ' ) THEN
556 #endif /* USE_EXF_INTERPOLATION */
557 IF ( (readStressOnAgrid.AND.readStressOnCgrid) .OR.
558 & .NOT.(readStressOnAgrid.OR.readStressOnCgrid) ) THEN
559 WRITE(msgBuf,'(A)')
560 & 'EXF_CHECK: Select 1 wind-stress position: A or C-grid'
561 CALL PRINT_ERROR( msgBuf, myThid )
562 errCount = errCount + 1
563 ENDIF
564 IF (rotateStressOnAgrid.AND..NOT.readStressOnAgrid) THEN
565 WRITE(msgBuf,'(2A)') 'EXF_CHECK: rotateStressOnAgrid ',
566 & 'only applies to cases readStressOnAgrid is true'
567 CALL PRINT_ERROR( msgBuf, myThid )
568 errCount = errCount + 1
569 ENDIF
570 IF ( rotateStressOnAgrid .AND.
571 & ( ustressfile .EQ. ' ' .OR. ustressperiod .EQ. 0. .OR.
572 & vstressfile .EQ. ' ' .OR. vstressperiod .EQ. 0. ) ) THEN
573 WRITE(msgBuf,'(2A)') 'EXF_CHECK: rotateStressOnAgrid ',
574 & 'requires to update u/vstress'
575 CALL PRINT_ERROR( msgBuf, myThid )
576 errCount = errCount + 1
577 ENDIF
578
579 ELSE
580 IF ( readStressOnAgrid .OR. readStressOnCgrid .OR.
581 & rotateStressOnAgrid ) THEN
582 WRITE(msgBuf,'(2A)') '** WARNING ** EXF_CHECK: ',
583 & 'wind-stress position irrelevant'
584 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
585 & SQUEEZE_RIGHT, myThid )
586 ENDIF
587 ENDIF
588
589 #ifdef USE_NO_INTERP_RUNOFF
590 WRITE(msgBuf,'(A)')
591 & 'EXF_CHECK: USE_NO_INTERP_RUNOFF code has been removed;'
592 CALL PRINT_ERROR( msgBuf, myThid )
593 WRITE(msgBuf,'(A,A)')
594 & 'EXF_CHECK: use instead "runoff_interpMethod=0"',
595 & ' in "data.exf" (EXF_NML_04)'
596 CALL PRINT_ERROR( msgBuf, myThid )
597 errCount = errCount + 1
598 #endif /* USE_NO_INTERP_RUNOFF */
599
600 #ifdef ALLOW_CLIMTEMP_RELAXATION
601 WRITE(msgBuf,'(A,A)') 'EXF_CHECK: ',
602 & 'ALLOW_CLIMTEMP_RELAXATION no longer supported. Use pkg/rbcs'
603 CALL PRINT_ERROR( msgBuf, myThid )
604 errCount = errCount + 1
605 #endif /* ALLOW_CLIMTEMP_RELAXATION */
606
607 #ifdef ALLOW_CLIMSALT_RELAXATION
608 WRITE(msgBuf,'(A,A)') 'EXF_CHECK: ',
609 & 'ALLOW_CLIMSALT_RELAXATION no longer supported. Use pkg/rbcs'
610 CALL PRINT_ERROR( msgBuf, myThid )
611 errCount = errCount + 1
612 #endif /* ALLOW_CLIMSALT_RELAXATION */
613
614 IF ( climsstTauRelax.NE.0. ) THEN
615 #ifndef ALLOW_CLIMSST_RELAXATION
616 WRITE(msgBuf,'(A)') 'EXF_CHECK: climsstTauRelax > 0'
617 CALL PRINT_ERROR( msgBuf, myThid )
618 WRITE(msgBuf,'(A)')
619 & 'EXF_CHECK: but ALLOW_CLIMSST_RELAXATION is not defined'
620 CALL PRINT_ERROR( msgBuf, myThid )
621 errCount = errCount + 1
622 #endif /* ndef ALLOW_CLIMSST_RELAXATION */
623 IF ( climsstfile.EQ.' ' ) THEN
624 WRITE(msgBuf,'(A)') 'EXF_CHECK: climsstTauRelax > 0 but'
625 CALL PRINT_ERROR( msgBuf, myThid )
626 WRITE(msgBuf,'(A)') 'EXF_CHECK: climsstfile is not set'
627 CALL PRINT_ERROR( msgBuf, myThid )
628 errCount = errCount + 1
629 ENDIf
630 ENDIf
631
632 IF ( climsssTauRelax.NE.0. ) THEN
633 #ifndef ALLOW_CLIMSSS_RELAXATION
634 WRITE(msgBuf,'(A)') 'EXF_CHECK: climsssTauRelax > 0'
635 CALL PRINT_ERROR( msgBuf, myThid )
636 WRITE(msgBuf,'(A)')
637 & 'EXF_CHECK: but ALLOW_CLIMSSS_RELAXATION is not defined'
638 CALL PRINT_ERROR( msgBuf, myThid )
639 errCount = errCount + 1
640 #endif /* ALLOW_CLIMSSS_RELAXATION */
641 IF ( climsssfile.EQ.' ' ) THEN
642 WRITE(msgBuf,'(A)') 'EXF_CHECK: climsssTauRelax > 0 but'
643 CALL PRINT_ERROR( msgBuf, myThid )
644 WRITE(msgBuf,'(A)') 'EXF_CHECK: climsssfile is not set'
645 CALL PRINT_ERROR( msgBuf, myThid )
646 errCount = errCount + 1
647 ENDIF
648 ENDIF
649
650 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
651
652 IF ( errCount.GE.1 ) THEN
653 WRITE(msgBuf,'(A,I3,A)')
654 & 'EXF_CHECK: detected', errCount,' fatal error(s)'
655 CALL PRINT_ERROR( msgBuf, myThid )
656 CALL ALL_PROC_DIE( 0 )
657 STOP 'ABNORMAL END: S/R EXF_CHECK'
658 ENDIF
659
660 _END_MASTER(myThid)
661
662 RETURN
663 END
664
665 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
666
667 CBOP
668 C !ROUTINE: EXF_CHECK_INTERP
669 C !INTERFACE:
670
671 SUBROUTINE EXF_CHECK_INTERP(
672 I loc_name, loc_file, loc_interpMethod,
673 I loc_nlat, loc_nlon, loc_lon_inc,
674 U errCount,
675 I myThid )
676
677 C !DESCRIPTION: \bv
678 C *==========================================================*
679 C | S/R EXF_CHECK_INTERP
680 C | o Check parameters for one of the pkg/exf variable
681 C *==========================================================*
682 C \ev
683
684 C !USES:
685 IMPLICIT NONE
686
687 C == Global variables ===
688 #include "EEPARAMS.h"
689 #include "EXF_INTERP_SIZE.h"
690 #include "EXF_PARAM.h"
691
692 C !INPUT/OUTPUT PARAMETERS:
693 C fldName :: field short name (to print mesg)
694 C fldFile :: file-name for this field
695 C loc_interpMethod :: select interpolation method
696 C loc_nlat :: size in y direction of original input grid
697 C loc_nlon :: size in x direction of original input grid
698 C fld_lon_inc :: scalar x-grid increment
699 C errCount :: error counter
700 C myThid :: my Thread Id number
701 CHARACTER*(*) loc_name
702 CHARACTER*(*) loc_file
703 INTEGER loc_interpMethod
704 INTEGER loc_nlat
705 INTEGER loc_nlon
706 _RL loc_lon_inc
707 INTEGER errCount
708 INTEGER myThid
709
710 C !LOCAL VARIABLES:
711 C msgBuf :: Informational/error message buffer
712 CHARACTER*(MAX_LEN_MBUF) msgBuf
713 CEOP
714
715 IF ( loc_interpMethod.GE.1 .AND. loc_file.NE.' ' ) THEN
716 IF ( loc_nlat .GT. (MAX_LAT_INC+1) ) THEN
717 WRITE(msgBuf,'(3A)') 'EXF_CHECK_INTERP: ',loc_name,
718 & '_nlat > (MAX_LAT_INC+1)'
719 CALL PRINT_ERROR( msgBuf, myThid )
720 errCount = errCount + 1
721 ENDIF
722 #ifndef EXF_INTERP_USE_DYNALLOC
723 C- Check buffer size:
724 IF ( loc_nlon.GT.exf_max_nLon ) THEN
725 WRITE(msgBuf,'(3A)') 'EXF_CHECK_INTERP: ',loc_name,
726 & '_nlon > exf_max_nLon'
727 CALL PRINT_ERROR( msgBuf, myThid )
728 errCount = errCount + 1
729 ENDIF
730 IF ( loc_nlat.GT.exf_max_nLat ) THEN
731 WRITE(msgBuf,'(3A)') 'EXF_CHECK_INTERP: ',loc_name,
732 & '_nlat > exf_max_nLat'
733 CALL PRINT_ERROR( msgBuf, myThid )
734 errCount = errCount + 1
735 ENDIF
736 IF ( (loc_nlon+4)*(loc_nlat+4).GT.exf_interp_bufferSize ) THEN
737 WRITE(msgBuf,'(6A)') 'EXF_CHECK_INTERP: ',
738 & 'exf_interp_bufferSize too small for ',
739 & loc_name, '_nlon & ', loc_name, '_nlat'
740 CALL PRINT_ERROR( msgBuf, myThid )
741 errCount = errCount + 1
742 ENDIF
743 #endif /* ndef EXF_INTERP_USE_DYNALLOC */
744 IF ( loc_lon_inc.GT.500. ) THEN
745 WRITE(msgBuf,'(4A,1PE16.8)') 'EXF_CHECK_INTERP: ',
746 & 'Invalid value for: ',loc_name,'_lon_inc =', loc_lon_inc
747 CALL PRINT_ERROR( msgBuf, myThid )
748 WRITE(msgBuf,'(4A)') 'EXF_CHECK_INTERP: Fix it ',
749 & 'or Turn off ',loc_name,'-interp (interpMethod=0)'
750 CALL PRINT_ERROR( msgBuf, myThid )
751 errCount = errCount + 1
752 ENDIF
753 ENDIF
754
755 RETURN
756 END

  ViewVC Help
Powered by ViewVC 1.1.22