/[MITgcm]/MITgcm/pkg/ecco/ecco_readparms.F
ViewVC logotype

Contents of /MITgcm/pkg/ecco/ecco_readparms.F

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


Revision 1.95 - (show annotations) (download)
Wed Aug 9 15:23:38 2017 UTC (6 years, 8 months ago) by mlosch
Branch: MAIN
CVS Tags: checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, HEAD
Changes since 1.94: +7 -3 lines
replace CLOSE(nmlfileUnit) with CLOSE(nmlfileUnit,STATUS='DELETE') to remove
scratchfiles after closing, except for SINGLE_DISK_IO, when everything
stays the same

1 C $Header: /u/gcmpack/MITgcm/pkg/ecco/ecco_readparms.F,v 1.94 2017/04/03 23:16:38 ou.wang Exp $
2 C $Name: BASE $
3
4 #include "ECCO_OPTIONS.h"
5
6 subroutine ecco_readparms( mythid )
7
8 c ==================================================================
9 c SUBROUTINE ecco_readparms
10 c ==================================================================
11 c
12 c o This routine initialises the package cost.
13 c started: Ralf Giering 18-Jan-2001
14 c
15 c ==================================================================
16 c SUBROUTINE ecco_readparms
17 c ==================================================================
18
19 implicit none
20
21 c == global variables ==
22
23 #include "EEPARAMS.h"
24 #include "SIZE.h"
25 #include "GRID.h"
26 #include "PARAMS.h"
27
28 #ifdef ALLOW_ECCO
29 # ifdef ECCO_CTRL_DEPRECATED
30 # include "ecco_cost.h"
31 # else
32 # include "ecco.h"
33 # include "ecco_local_params.h"
34 # endif
35 #endif
36 #ifdef ALLOW_CTRL
37 # include "CTRL_OBCS.h"
38 #endif
39 #ifdef ALLOW_CAL
40 # include "cal.h"
41 #endif
42
43 c == routine arguments ==
44
45 integer mythid
46
47 c == local variables ==
48 C msgBuf - Informational/error meesage buffer
49 C iUnit - Work variable for IO unit number
50 CHARACTER*(MAX_LEN_MBUF) msgBuf
51 INTEGER k, k2, iUnit, num_file, num_var
52 #ifdef ALLOW_GENCOST_CONTRIBUTION
53 INTEGER IL, kk, gencost_k3d, gencost_msk_k3d, ioUnit
54 CHARACTER*(128) tempfile
55 LOGICAL exst
56 _RS dummyRS(1)
57 #endif
58
59 Catn-- retired parameters
60 character*(MAX_LEN_FNAM) topexmeanfile
61 integer nRetired
62
63 c == external functions ==
64
65 integer ilnblnk
66 external ilnblnk
67
68 c == end of interface ==
69
70 c-- Read the namelist input.
71 namelist /ecco_cost_nml/
72 & data_errfile,
73 & tbarfile, sbarfile,sstbarfile,
74 & psbarfile, bpbarfile,iestaubarfile,
75 & ubarfile, vbarfile, wbarfile,
76 & tauxbarfile, tauybarfile,
77 & hfluxmeanbarfile, sfluxmeanbarfile,
78 & costTranspDataFile, mdtdatfile,
79 & mdtstartdate1, mdtstartdate2,
80 & mdtenddate1, mdtenddate2,
81 & using_cost_altim,
82 & using_cost_bp, using_cost_scat,
83 & using_cost_sst, using_cost_seaice,
84 & using_cost_transp,
85 & using_mdt, using_tpj, using_ers, using_gfo,
86 & using_topex,
87 & topexstartdate1, topexstartdate2,
88 & topexperiod, topexfile, tpTimeMaskFile,
89 & topexintercept, topexslope, ersTimeMaskFile,
90 & ersstartdate1, ersstartdate2, gfoTimeMaskFile,
91 & ersperiod, ersfile,
92 & ersintercept, ersslope,
93 & gfostartdate1, gfostartdate2,
94 & gfoperiod, gfofile,
95 & gfointercept, gfoslope,
96 & scatstartdate1, scatstartdate2,
97 & scatperiod, scatxdatfile, scatydatfile,
98 & scatx_errfile, scaty_errfile,
99 & ssh_errfile, sshv4cost_scalefile,
100 & sshv4cost_errfile, sshv4cost_errfactor,
101 & tp_errfile, ers_errfile, gfo_errfile,
102 & tmistartdate1, tmistartdate2, tmidatfile,
103 & sststartdate1, sststartdate2, sstdatfile,
104 & sssstartdate1, sssstartdate2, sssdatfile,
105 & bpstartdate1, bpstartdate2, bpdatfile,
106 & iesstartdate1, iesstartdate2, iesdatfile,
107 & tdatfile, sdatfile, ctdtfile, ctdsfile,
108 & ctdtclimfile, ctdsclimfile, xbtfile,
109 & argotstartdate1, argotstartdate2, argotfile,
110 & argosstartdate1, argosstartdate2, argosfile,
111 & udriftfile, vdriftfile,
112 & udrifterrfile, vdrifterrfile,
113 & curmtrufile,curmtrvfile,
114 & salterrfile, temperrfile, velerrfile,
115 & salt0errfile, temp0errfile, vel0errfile,
116 & etan0errfile, uvel0errfile, vvel0errfile,
117 & ssterrfile, ssserrfile, bperrfile,ieserrfile,
118 & hflux_errfile, sflux_errfile,
119 & tauu_errfile, tauv_errfile,
120 & atemp_errfile, aqh_errfile,
121 & precip_errfile, swflux_errfile, swdown_errfile,
122 & lwflux_errfile, lwdown_errfile, evap_errfile,
123 & snowprecip_errfile, apressure_errfile,
124 & uwind_errfile, vwind_errfile,
125 & geoid_errfile, geoid_covariancefile,
126 & bottomdrag_errfile,edtau_errfile,
127 & kapgm_errfile,kapredi_errfile,diffkr_errfile,
128 & usercost_datafile, usercost_errfile,
129 & mult_hflux, mult_sflux, mult_tauu, mult_tauv,
130 & mult_hfluxmm, mult_sfluxmm,
131 & mult_atemp, mult_aqh,
132 & mult_precip, mult_swflux, mult_swdown,
133 & mult_lwflux, mult_lwdown, mult_evap,
134 & mult_snowprecip, mult_apressure,
135 & mult_uwind, mult_vwind,
136 & mult_hmean, mult_h, mult_sshv4cost,
137 & mult_tp, mult_ers, mult_gfo,
138 & mult_temp, mult_salt,
139 & mult_tmi, mult_sst, mult_sss, mult_bp,
140 & mult_ctdt, mult_ctds, mult_ies,
141 & mult_ctdtclim, mult_ctdsclim,
142 & mult_xbt, mult_drift,
143 & mult_argot, mult_argos,
144 & mult_scatx, mult_scaty,
145 & mult_sdrift, mult_tdrift, mult_wdrift,
146 & mult_temp0, mult_salt0,
147 & mult_etan0, mult_uvel0, mult_vvel0,
148 #if (defined (ALLOW_CTRL) && defined (ALLOW_OBCS))
149 & mult_obcsn, mult_obcss,
150 & mult_obcsw, mult_obcse, mult_obcsvol,
151 & mult_ageos,
152 #endif
153 & mult_curmtr,
154 & mult_kapgm, mult_kapredi, mult_diffkr,
155 & mult_edtau, mult_bottomdrag,
156 & mult_usercost, mult_transp,
157 & mult_smooth_ic, mult_smooth_bc,
158 & whflux0, wsflux0, wtau0,
159 & wbottomdrag0,
160 & watemp0, waqh0,
161 & wprecip0, wswflux0, wswdown0, wwind0,
162 & wsnowprecip0, wlwflux0, wlwdown0, wevap0,
163 & wapressure0, wdiffkr0, wkapgm0, wedtau0,
164 & wkapredi0, wmean_hflux, wmean_sflux, wmean_tau,
165 & wmean_atemp, wmean_aqh, wmean_precip,
166 & wmean_swflux, wmean_swdown, wmean_wind,
167 & wmean_lwflux, wmean_lwdown, wmean_evap,
168 & wmean_snowprecip, wmean_apressure,
169 & cost_iprec, cost_yftype
170 & ,topexmeanfile
171
172 #ifdef ALLOW_GENCOST_CONTRIBUTION
173 namelist /ecco_gencost_nml/
174 & using_gencost,
175 & gencost_barfile,
176 & gencost_datafile,
177 & gencost_name,
178 & gencost_scalefile,
179 & gencost_errfile,
180 & gencost_itracer,
181 & gencost_preproc,
182 & gencost_preproc_c,
183 & gencost_preproc_i,
184 & gencost_preproc_r,
185 & gencost_posproc,
186 & gencost_posproc_c,
187 & gencost_posproc_i,
188 & gencost_posproc_r,
189 & gencost_outputlevel,
190 & gencost_mask,
191 & gencost_spmin,
192 & gencost_spmax,
193 & gencost_spzero,
194 & gencost_wei1d,
195 & gencost_avgperiod,
196 & gencost_nrecperiod,
197 & gencost_startdate1,
198 & gencost_startdate2,
199 & gencost_enddate1,
200 & gencost_enddate2,
201 & gencost_smooth2Ddiffnbt,
202 & gencost_is1d,
203 & gencost_is3d,
204 & gencost_msk_is3d,
205 & gencost_timevaryweight,
206 & mult_gencost
207 #endif /* ALLOW_GENCOST_CONTRIBUTION */
208
209 IF ( .NOT.useECCO ) THEN
210 C- pkg ECCO is not used
211 _BEGIN_MASTER(myThid)
212 C- Track pkg activation status:
213 C print a (weak) warning if data.ecco is found
214 CALL PACKAGES_UNUSED_MSG( 'useECCO', ' ', ' ' )
215 _END_MASTER(myThid)
216 RETURN
217 ENDIF
218
219 _BEGIN_MASTER( myThid )
220
221 c-- Set default values.
222
223 c run time switches for main cost terms
224 #if (defined (ALLOW_SSH_COST_CONTRIBUTION) && \
225 !defined (ALLOW_GENCOST_CONTRIBUTION) )
226 using_cost_altim=.TRUE.
227 #else
228 using_cost_altim=.FALSE.
229 #endif
230 #ifdef ALLOW_SEAICE_COST_CONTRIBUTION
231 using_cost_seaice=.TRUE.
232 #else
233 using_cost_seaice=.FALSE.
234 #endif
235
236 c- set default to false
237 using_cost_transp=.FALSE.
238
239 #ifdef ALLOW_BP_COST_CONTRIBUTION
240 using_cost_bp=.TRUE.
241 #else
242 using_cost_bp=.FALSE.
243 #endif
244 #ifdef ALLOW_SST_COST_CONTRIBUTION
245 using_cost_sst=.TRUE.
246 #else
247 using_cost_sst=.FALSE.
248 #endif
249 #if (defined (ALLOW_SCAT_COST_CONTRIBUTION) || \
250 defined (ALLOW_DAILYSCAT_COST_CONTRIBUTION) )
251 using_cost_scat=.TRUE.
252 #else
253 using_cost_scat=.FALSE.
254 #endif
255
256 c other run time parameters
257 data_errfile = ' '
258 tbarfile = 'tbar'
259 sbarfile = 'sbar'
260 sstbarfile = 'sstbar'
261 psbarfile = 'psbar'
262 bpbarfile = 'bpbar'
263 iestaubarfile = 'iestaubar'
264 ubarfile = 'ubar'
265 vbarfile = 'vbar'
266 wbarfile = 'wbar'
267 tauxbarfile = 'tauxbar'
268 tauybarfile = 'tauybar'
269 hfluxmeanbarfile = 'hfluxmeanbar'
270 sfluxmeanbarfile = 'sfluxmeanbar'
271 costTranspDataFile = ' '
272 using_tpj = .false.
273 topexstartdate1 = 0
274 topexstartdate2 = 0
275 topexperiod = 0. _d 0
276 topexintercept = 0. _d 0
277 topexslope = 0. _d 0
278 topexfile = ' '
279 catn: defaulting mdt[start,end]date1 to pavlis so that
280 catn eccov4 will run without needing to read in these params
281 using_mdt =.FALSE.
282 mdtdatfile = ' '
283 mdtstartdate1 = 19930101
284 mdtstartdate2 = 0
285 mdtenddate1 = 20041231
286 mdtenddate2 = 0
287 using_ers = .false.
288 ersstartdate1 = 0
289 ersstartdate2 = 0
290 ersperiod = 0. _d 0
291 ersintercept = 0. _d 0
292 ersslope = 0. _d 0
293 ersfile = ' '
294 using_gfo = .false.
295 gfostartdate1 = 0
296 gfostartdate2 = 0
297 gfoperiod = 0. _d 0
298 gfointercept = 0. _d 0
299 gfoslope = 0. _d 0
300 gfofile = ' '
301 scatstartdate1 = 0
302 scatstartdate2 = 0
303 scatperiod = 0. _d 0
304 scatxdatfile = ' '
305 scatydatfile = ' '
306 ssh_errfile = ' '
307 tp_errfile = ' '
308 ers_errfile = ' '
309 gfo_errfile = ' '
310 scatx_errfile = ' '
311 scaty_errfile = ' '
312 tmistartdate1 = 0
313 tmistartdate2 = 0
314 tmidatfile = ' '
315 sststartdate1 = 0
316 sststartdate2 = 0
317 sstdatfile = ' '
318 sssstartdate1 = 0
319 sssstartdate2 = 0
320 sssdatfile = ' '
321 bpstartdate1 = 0
322 bpstartdate2 = 0
323 bpdatfile = ' '
324 iesstartdate1 = 0
325 iesstartdate2 = 0
326 iesdatfile = ' '
327 tdatfile = ' '
328 sdatfile = ' '
329 ctdtfile = ' '
330 ctdsfile = ' '
331 ctdtclimfile = ' '
332 ctdsclimfile = ' '
333 curmtrufile = ' '
334 curmtrvfile = ' '
335 xbtfile = ' '
336 argotstartdate1 = 0
337 argotstartdate2 = 0
338 argotfile = ' '
339 argosstartdate1 = 0
340 argosstartdate2 = 0
341 argosfile = ' '
342 udriftfile = ' '
343 vdriftfile = ' '
344 udrifterrfile = ' '
345 vdrifterrfile = ' '
346 salterrfile = ' '
347 temperrfile = ' '
348 velerrfile = ' '
349 salt0errfile = ' '
350 temp0errfile = ' '
351 etan0errfile = ' '
352 uvel0errfile = ' '
353 vvel0errfile = ' '
354 vel0errfile = ' '
355 ssterrfile = ' '
356 ssserrfile = ' '
357 bperrfile = ' '
358 ieserrfile = ' '
359 hflux_errfile = ' '
360 sflux_errfile = ' '
361 tauu_errfile = ' '
362 tauv_errfile = ' '
363 atemp_errfile = ' '
364 aqh_errfile = ' '
365 precip_errfile = ' '
366 swflux_errfile = ' '
367 swdown_errfile = ' '
368 lwflux_errfile = ' '
369 lwdown_errfile = ' '
370 evap_errfile = ' '
371 snowprecip_errfile = ' '
372 apressure_errfile = ' '
373 uwind_errfile = ' '
374 vwind_errfile = ' '
375 geoid_errfile = ' '
376 geoid_covariancefile = ' '
377 bottomdrag_errfile = ' '
378 edtau_errfile = ' '
379 kapgm_errfile = ' '
380 kapredi_errfile = ' '
381 diffkr_errfile = ' '
382 do k=1,NUSERCOST
383 usercost_datafile(k) = ' '
384 usercost_errfile(k) = ' '
385 enddo
386 do k=1,NSSHV4COST
387 sshv4cost_scalefile(k) = ' '
388 sshv4cost_errfile(k) = ' '
389 sshv4cost_errfactor(k) = 1. _d 0
390 enddo
391 tpTimeMaskFile = ' '
392 ersTimeMaskFile = ' '
393 gfoTimeMaskFile = ' '
394
395 mult_hflux = 0. _d 0
396 mult_sflux = 0. _d 0
397 mult_hfluxmm = 0. _d 0
398 mult_sfluxmm = 0. _d 0
399 mult_tauu = 0. _d 0
400 mult_tauv = 0. _d 0
401 mult_atemp = 0. _d 0
402 mult_aqh = 0. _d 0
403 mult_precip = 0. _d 0
404 mult_swflux = 0. _d 0
405 mult_swdown = 0. _d 0
406 mult_lwflux = 0. _d 0
407 mult_lwdown = 0. _d 0
408 mult_evap = 0. _d 0
409 mult_snowprecip = 0. _d 0
410 mult_apressure = 0. _d 0
411 mult_uwind = 0. _d 0
412 mult_vwind = 0. _d 0
413 mult_hmean = 0. _d 0
414 mult_h = 1. _d 0
415 mult_tp = 0. _d 0
416 mult_ers = 0. _d 0
417 mult_gfo = 0. _d 0
418 mult_temp = 0. _d 0
419 mult_salt = 0. _d 0
420 mult_temp0 = 0. _d 0
421 mult_salt0 = 0. _d 0
422 mult_etan0 = 0. _d 0
423 mult_uvel0 = 0. _d 0
424 mult_vvel0 = 0. _d 0
425 mult_tmi = 0. _d 0
426 mult_sst = 0. _d 0
427 mult_sss = 0. _d 0
428 mult_bp = 0. _d 0
429 mult_ies = 0. _d 0
430 mult_ctdt = 0. _d 0
431 mult_ctds = 0. _d 0
432 mult_ctdtclim = 0. _d 0
433 mult_ctdsclim = 0. _d 0
434 mult_xbt = 0. _d 0
435 mult_argot = 0. _d 0
436 mult_argos = 0. _d 0
437 mult_drift = 0. _d 0
438 mult_tdrift = 0. _d 0
439 mult_sdrift = 0. _d 0
440 mult_wdrift = 0. _d 0
441 mult_scatx = 0. _d 0
442 mult_scaty = 0. _d 0
443 #if (defined (ALLOW_CTRL) && defined (ALLOW_OBCS))
444 mult_obcsn = 0. _d 0
445 mult_obcss = 0. _d 0
446 mult_obcsw = 0. _d 0
447 mult_obcse = 0. _d 0
448 mult_obcsvol = 0. _d 0
449 mult_ageos = 0. _d 0
450 #endif
451 mult_curmtr = 0. _d 0
452 mult_kapgm = 0. _d 0
453 mult_kapredi = 0. _d 0
454 mult_diffkr = 0. _d 0
455 mult_edtau = 0. _d 0
456 mult_bottomdrag = 0. _d 0
457 do k=1,NUSERCOST
458 mult_usercost(k) = 0. _d 0
459 enddo
460 do k=1,NSSHV4COST
461 mult_sshv4cost(k) = 0. _d 0
462 enddo
463 mult_smooth_ic = 0. _d 0
464 mult_smooth_bc = 0. _d 0
465 mult_transp = 0. _d 0
466 watemp0 = 0. _d 0
467 waqh0 = 0. _d 0
468 wprecip0 = 0. _d 0
469 wswflux0 = 0. _d 0
470 wswdown0 = 0. _d 0
471 wlwflux0 = 0. _d 0
472 wlwdown0 = 0. _d 0
473 wevap0 = 0. _d 0
474 wsnowprecip0 = 0. _d 0
475 wapressure0 = 0. _d 0
476 wwind0 = 0. _d 0
477 wdiffkr0 = 1. _d 0
478 wkapgm0 = 1. _d 0
479 wkapredi0 = 1. _d 0
480 wedtau0 = 1. _d 0
481 whflux0 = 0. _d 0
482 wsflux0 = 0. _d 0
483 wtau0 = 0. _d 0
484 wbottomdrag0 = 1. _d 0
485 wmean_atemp = 0. _d 0
486 wmean_aqh = 0. _d 0
487 wmean_precip = 0. _d 0
488 wmean_swflux = 0. _d 0
489 wmean_swdown = 0. _d 0
490 wmean_lwflux = 0. _d 0
491 wmean_lwdown = 0. _d 0
492 wmean_evap = 0. _d 0
493 wmean_snowprecip = 0. _d 0
494 wmean_apressure = 0. _d 0
495 wmean_wind = 0. _d 0
496 wmean_hflux = 0. _d 0
497 wmean_sflux = 0. _d 0
498 wmean_tau = 0. _d 0
499 cost_iprec = precFloat32
500 cost_yftype = 'RL'
501
502 Catn-- retired parameters
503 topexmeanfile = ' '
504 nRetired = 0
505
506 c-- Next, read the data.ecco file.
507 WRITE(msgBuf,'(A)') 'ECCO_READPARMS: opening data.ecco'
508 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
509 & SQUEEZE_RIGHT , 1)
510
511 CALL OPEN_COPY_DATA_FILE(
512 I 'data.ecco', 'ECCO_READPARMS',
513 O iUnit,
514 I myThid )
515
516 READ( iUnit, nml = ecco_cost_nml )
517
518 WRITE(msgBuf,'(A)')
519 & 'ECCO_READPARMS: finished reading #1: ecco_cost_nml'
520 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
521 & SQUEEZE_RIGHT , 1)
522
523 C-- Check parameters:
524 IF ( cost_yftype.NE.'RL' ) THEN
525 STOP 'ABNORMAL END: S/R ECCO_READPARMS: invalid cost_yftype'
526 ENDIF
527 Catn -- retired parameters
528 IF ( topexmeanfile .NE. ' ' ) THEN
529 nRetired = nRetired + 1
530 WRITE(msgBuf,'(A,A)')
531 & 'S/R ECCO_READPARMS: "topexmeanfile" ',
532 & 'is no longer allowed in file "data.ecco"'
533 CALL PRINT_ERROR( msgBuf, myThid )
534 WRITE(msgBuf,'(A)')
535 & 'S/R ECCO_READPARMS: set "mdtdatfile" instead'
536 CALL PRINT_ERROR( msgBuf, myThid )
537 STOP 'ABNORMAL END: S/R ECCO_READPARMS'
538 ENDIF
539 IF ( nRetired .GT. 0 ) THEN
540 WRITE(msgBuf,'(2A)') 'S/R ECCO_READPARMS: ',
541 & 'Error reading parameter file "data.ecco"'
542 CALL PRINT_ERROR( msgBuf, myThid )
543 WRITE(msgBuf,'(A)')
544 & 'some out of date parameters were found in the namelist'
545 CALL PRINT_ERROR( msgBuf, myThid )
546 STOP 'ABNORMAL END: S/R ECCO_READPARMS'
547 ENDIF
548
549 _END_MASTER( myThid )
550
551 c empty pre/post-processing :
552 c =========================
553
554 _BEGIN_MASTER( myThid )
555 do k2=1,NGENPPROC
556 no_preproc(k2) = ' '
557 no_preproc_c(k2) = ' '
558 no_preproc_i(k2) = 0
559 no_preproc_r(k2) = 0. _d 0
560 no_posproc(k2) = ' '
561 no_posproc_c(k2) = ' '
562 no_posproc_i(k2) = 0
563 no_posproc_r(k2) = 0. _d 0
564 clim_preproc(k2) = ' '
565 clim_preproc_i(k2) = 0
566 anom_preproc(k2) = ' '
567 enddo
568 clim_preproc(1) = 'clim'
569 clim_preproc_i(1) = 12
570 anom_preproc(1) = 'anom'
571 _END_MASTER( myThid )
572
573 #ifdef ALLOW_GENCOST_CONTRIBUTION
574
575 _BEGIN_MASTER( myThid )
576
577 c-- Set default values.
578 do k=1,NGENCOST
579 using_gencost(k) = .FALSE.
580 gencost_flag(k) = 0
581 gencost_avgperiod(k) = ' '
582 gencost_startdate1(k) = 0
583 gencost_startdate2(k) = 0
584 gencost_enddate1(k) = 0
585 gencost_enddate2(k) = 0
586 gencost_datafile(k) = ' '
587 gencost_name(k) = 'gencost'
588 do k2=1,NGENPPROC
589 gencost_preproc(k2,k) = ' '
590 gencost_preproc_c(k2,k) = ' '
591 gencost_preproc_i(k2,k) = 0
592 gencost_preproc_r(k2,k) = 0. _d 0
593 gencost_posproc(k2,k) = ' '
594 gencost_posproc_c(k2,k) = ' '
595 gencost_posproc_i(k2,k) = 0
596 gencost_posproc_r(k2,k) = 0. _d 0
597 enddo
598 gencost_outputlevel(k)= 0
599 gencost_errfile(k) = ' '
600 gencost_itracer(k) = 1
601 gencost_mask(k) = ' '
602 gencost_barfile(k) = ' '
603 gencost_spmin(k) = 0. _d 0
604 gencost_spmax(k) = 0. _d 0
605 gencost_spzero(k) = 9876. _d 0
606 gencost_wei1d(k) = 0. _d 0
607 mult_gencost(k) = 1. _d 0
608 gencost_is1d(k) = .FALSE.
609 gencost_is3d(k) = .FALSE.
610 gencost_pointer3d(k) = 0
611 gencost_msk_is3d = .FALSE.
612 gencost_msk_pointer3d(k) = 0
613 c boxmean/horflux masks
614 call ecco_zero(gencost_mskCsurf(1-olx,1-oly,1,1,k),
615 & 1,zeroRL,mythid)
616 call ecco_zero(gencost_mskWsurf(1-olx,1-oly,1,1,k),
617 & 1,zeroRL,mythid)
618 call ecco_zero(gencost_mskSsurf(1-olx,1-oly,1,1,k),
619 & 1,zeroRL,mythid)
620 do k2 = 1,nr
621 gencost_mskVertical(k2,k)= 1. _d 0
622 enddo
623 c deprecated:
624 gencost_nrecperiod(k) = 0
625 gencost_scalefile(k) = ' '
626 gencost_smooth2Ddiffnbt(k) = 0
627 gencost_timevaryweight(k) = .FALSE.
628 enddo
629
630 #ifdef ALLOW_GENCOST3D
631 do k=1,NGENCOST3D
632 c boxmean/horflux masks
633 call ecco_zero(gencost_mskC(1-olx,1-oly,1,1,1,k),
634 & Nr,zeroRL,mythid)
635 call ecco_zero(gencost_mskW(1-olx,1-oly,1,1,1,k),
636 & Nr,zeroRL,mythid)
637 call ecco_zero(gencost_mskS(1-olx,1-oly,1,1,1,k),
638 & Nr,zeroRL,mythid)
639 enddo
640 #endif
641
642 READ( iUnit, nml = ecco_gencost_nml )
643
644 WRITE(msgBuf,'(A)')
645 & 'ECCO_READPARMS: finished reading #2: ecco_gencost_nml'
646 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
647 & SQUEEZE_RIGHT , 1)
648
649 gencost_k3d=1
650 gencost_msk_k3d=1
651
652 do k=1,NGENCOST
653
654 c pre-specified generic cost terms using otherwise created barfiles
655 if ( (gencost_name(k).EQ.'sshv4-mdt').OR.
656 & (gencost_name(k).EQ.'sshv4-tp').OR.
657 & (gencost_name(k).EQ.'sshv4-ers').OR.
658 & (gencost_name(k).EQ.'sshv4-gfo').OR.
659 & (gencost_name(k).EQ.'sshv4-lsc').OR.
660 & (gencost_name(k).EQ.'sshv4-gmsl').OR.
661 & (gencost_name(k).EQ.'bpv4-grace').OR.
662 & (gencost_name(k).EQ.'sstv4-amsre').OR.
663 & (gencost_name(k).EQ.'sstv4-amsre-lsc') ) then
664 gencost_flag(k)=-1
665 using_gencost(k)=.TRUE.
666
667 catn move boxmean outside -1 to have its own check
668 catn preserve -2 for potential separate group above into cost
669 catn with and without requirements of datafile or errfile
670 elseif ( (gencost_barfile(k)(1:9).EQ.'m_boxmean').OR.
671 & (gencost_barfile(k)(1:9).EQ.'m_horflux') ) then
672 gencost_flag(k)=-3
673 using_gencost(k)=.TRUE.
674 il=ilnblnk(gencost_name(k))
675 WRITE(msgBuf,'(A,I3,3A,L5)') 'gencost k_boxmean/horflux=',
676 & k,' ',gencost_name(k)(1:il),': ',using_gencost(k)
677 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
678 & SQUEEZE_RIGHT , 1)
679
680 if ( gencost_msk_is3d(k) ) then
681 gencost_msk_pointer3d(k)=gencost_msk_k3d
682 gencost_msk_k3d=gencost_msk_k3d+1
683 endif
684
685 catn add cost global transport using gencost framework
686 elseif ( gencost_name(k)(1:6).EQ.'transp' ) then
687 gencost_flag(k)=-4
688 using_gencost(k)=.TRUE.
689 il=ilnblnk(gencost_name(k))
690 WRITE(msgBuf,'(A,i3,3A,L5)') 'gencost k_transp=',
691 & k,' ',gencost_name(k)(1:il),': ',using_gencost(k)
692 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
693 & SQUEEZE_RIGHT , 1)
694
695 c pre-specified generic cost terms that create their own barfile
696 elseif (
697 & (gencost_name(k).EQ.'siv4-conc').OR.
698 & (gencost_name(k).EQ.'siv4-deconc').OR.
699 & (gencost_name(k).EQ.'siv4-exconc') ) then
700 gencost_flag(k)=2
701 using_gencost(k)=.TRUE.
702 c fully interactive generic cost terms
703 elseif ( gencost_datafile(k) .NE. ' ' ) then
704 gencost_flag(k)=1
705 using_gencost(k)=.TRUE.
706 endif
707
708 c identified three dimensional variables
709 if ( (gencost_barfile(k)(1:7).EQ.'m_theta').OR.
710 & (gencost_barfile(k)(1:6).EQ.'m_salt').OR.
711 & (gencost_barfile(k)(1:8).EQ.'m_diffkr').OR.
712 & (gencost_barfile(k)(1:7).EQ.'m_kapgm').OR.
713 & (gencost_barfile(k)(1:9).EQ.'m_kapredi').OR.
714 & (gencost_barfile(k)(1:7).EQ.'m_trVol').OR.
715 & (gencost_barfile(k)(1:9).EQ.'m_trHeat').OR.
716 & (gencost_barfile(k)(1:9).EQ.'m_trSalt')
717 & )
718 & gencost_is3d(k)=.TRUE.
719
720 c assign a 3D storage array, then increment 3D variables counter
721 if ( gencost_is3d(k) ) then
722 gencost_pointer3d(k)=gencost_k3d
723 gencost_k3d=gencost_k3d+1
724 endif
725
726 enddo
727
728 C-- load masks if needed:
729 do k=1,NGENCOST
730 kk=gencost_msk_pointer3d(k)
731 if ( ( gencost_mask(k) .NE. ' ' ).AND.
732 & (gencost_flag(k).EQ.-3) ) then
733 c
734 il = ilnblnk(gencost_mask(k))
735 write(tempfile(1:128),'(2A)') gencost_mask(k)(1:il),'C'
736 inquire( file=tempfile(1:il+1), exist=exst )
737 if (exst.AND.(.NOT.gencost_msk_is3d(k))) then
738 call mdsreadfield(tempfile,cost_iprec,'RL',1,
739 & gencost_mskCsurf(1-olx,1-oly,1,1,k),1,mythid)
740 #ifdef ALLOW_GENCOST3D
741 elseif (exst.AND.(gencost_msk_pointer3d(k).LE.
742 & NGENCOST3D)) then
743 call mdsreadfield(tempfile,cost_iprec,'RL',Nr,
744 & gencost_mskC(1-olx,1-oly,1,1,1,kk),1,mythid)
745 #endif
746 endif
747 c
748 il = ilnblnk(gencost_mask(k))
749 write(tempfile(1:128),'(2A)') gencost_mask(k)(1:il),'W'
750 inquire( file=tempfile(1:il+1), exist=exst )
751 if (exst.AND.(.NOT.gencost_msk_is3d(k))) then
752 call mdsreadfield(tempfile,cost_iprec,'RL',1,
753 & gencost_mskWsurf(1-olx,1-oly,1,1,k),1,mythid)
754 #ifdef ALLOW_GENCOST3D
755 elseif (exst.AND.(gencost_msk_pointer3d(k).LE.
756 & NGENCOST3D)) then
757 call mdsreadfield(tempfile,cost_iprec,'RL',Nr,
758 & gencost_mskW(1-olx,1-oly,1,1,1,kk),1,mythid)
759 #endif
760 endif
761 c
762 il = ilnblnk(gencost_mask(k))
763 write(tempfile(1:128),'(2A)') gencost_mask(k)(1:il),'S'
764 inquire( file=tempfile(1:il+1), exist=exst )
765 if (exst.AND.(.NOT.gencost_msk_is3d(k))) then
766 call mdsreadfield(tempfile,cost_iprec,'RL',1,
767 & gencost_mskSsurf(1-olx,1-oly,1,1,k),1,mythid)
768 #ifdef ALLOW_GENCOST3D
769 elseif (exst.AND.(gencost_msk_pointer3d(k).LE.
770 & NGENCOST3D)) then
771 call mdsreadfield(tempfile,cost_iprec,'RL',Nr,
772 & gencost_mskS(1-olx,1-oly,1,1,1,kk),1,mythid)
773 #endif
774 endif
775 c
776 il = ilnblnk(gencost_mask(k))
777 write(tempfile(1:128),'(2A)') gencost_mask(k)(1:il),'K'
778 inquire( file=tempfile(1:il+1), exist=exst )
779 if (exst) then
780 ioUnit = 0
781 call MDS_READVEC_LOC(tempfile,cost_iprec,ioUnit,'RL',
782 & nR, gencost_mskVertical(1,k), dummyRS, 0, 0, 1, myThid )
783 endif
784 c
785 endif!errfile
786 enddo
787
788 C-- Check parameters:
789 do k=1,NGENCOST
790
791 cgf ensure backward compatibility:
792 if (gencost_barfile(k).NE.' ') then
793 if (gencost_barfile(k)(1:2).NE.'m_') then
794 il=ilnblnk(gencost_barfile(k))
795 WRITE(msgBuf,'(A,A)') 'm_',gencost_barfile(k)(1:il)
796 gencost_barfile(k)=msgBuf(1:il+2)
797 endif
798 if (gencost_barfile(k)(1:8).EQ.'m_tauZon') then
799 il=ilnblnk(gencost_barfile(k))
800 WRITE(msgBuf,'(A,A)') 'm_ustress',gencost_barfile(k)(9:il)
801 gencost_barfile(k)=msgBuf(1:il+1)
802 endif
803 if (gencost_barfile(k)(1:8).EQ.'m_tauMer') then
804 il=ilnblnk(gencost_barfile(k))
805 WRITE(msgBuf,'(A,A)') 'm_vstress',gencost_barfile(k)(9:il)
806 gencost_barfile(k)=msgBuf(1:il+1)
807 endif
808 endif
809
810 catn separate out blocks of gencost_flag so that each block is checked
811 if ( using_gencost(k)) then
812 if ( gencost_flag(k).GE.1 ) then
813
814 if ( gencost_name(k) .EQ. 'gencost' )
815 & gencost_name(k) = gencost_datafile(k)
816
817 if ( gencost_avgperiod(k) .NE. 'day ' .AND.
818 & gencost_avgperiod(k) .NE. 'DAY ' .AND.
819 & gencost_avgperiod(k) .NE. 'month' .AND.
820 & gencost_avgperiod(k) .NE. 'MONTH' .AND.
821 & gencost_avgperiod(k) .NE. 'step' .AND.
822 & gencost_avgperiod(k) .NE. 'STEP' .AND.
823 & gencost_avgperiod(k) .NE. 'const' .AND.
824 & gencost_avgperiod(k) .NE. 'CONST' .AND.
825 & gencost_avgperiod(k) .NE. 'year ' .AND.
826 & gencost_avgperiod(k) .NE. 'YEAR ' ) then
827
828 il=ilnblnk(gencost_name(k))
829 WRITE(msgBuf,'(A,I2,2A)')
830 & 'ERROR in ECCO_READPARMS: for gencost',k,
831 & ' ',gencost_name(k)(1:il)
832 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
833 & SQUEEZE_RIGHT , 1)
834 STOP
835 & 'ECCO_READPARMS: gencost_avgperiod not properly set'
836 end if
837
838 if ( gencost_spmin(k) .EQ. 0. _d 0 .AND.
839 & gencost_spmax(k) .EQ. 0. _d 0 ) then
840 il=ilnblnk(gencost_name(k))
841 WRITE(msgBuf,'(A,I2,2A)')
842 & 'ERROR in ECCO_READPARMS: for gencost',k,
843 & ' ',gencost_name(k)(1:il)
844 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
845 & SQUEEZE_RIGHT , 1)
846 STOP
847 & 'ECCO_READPARMS: gencost_spmin, gencost_spmax not set'
848 endif
849
850 if ( gencost_spzero(k) .EQ. 9876. _d 0 ) then
851 il=ilnblnk(gencost_name(k))
852 WRITE(msgBuf,'(A,I2,2A)')
853 & 'ERROR in ECCO_READPARMS: for gencost',k,
854 & ' ',gencost_name(k)(1:il)
855 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
856 & SQUEEZE_RIGHT , 1)
857 STOP
858 & 'ECCO_READPARMS: gencost_spzero not set'
859 endif
860
861 catn -- checking for -1 flag
862 elseif( gencost_flag(k) .eq. -1 ) then
863 catn -- checking boxmean and transp
864 elseif( gencost_flag(k).lt.-1) then
865 if ( gencost_avgperiod(k) .NE. 'day ' .AND.
866 & gencost_avgperiod(k) .NE. 'DAY ' .AND.
867 & gencost_avgperiod(k) .NE. 'month' .AND.
868 & gencost_avgperiod(k) .NE. 'MONTH' .AND.
869 & gencost_avgperiod(k) .NE. 'step' .AND.
870 & gencost_avgperiod(k) .NE. 'STEP' .AND.
871 & gencost_avgperiod(k) .NE. 'const' .AND.
872 & gencost_avgperiod(k) .NE. 'CONST' .AND.
873 & gencost_avgperiod(k) .NE. 'year ' .AND.
874 & gencost_avgperiod(k) .NE. 'YEAR ' ) then
875
876 il=ilnblnk(gencost_name(k))
877 WRITE(msgBuf,'(A,I2,2A)')
878 & 'ERROR in ECCO_READPARMS: for gencost',k,
879 & ' ',gencost_name(k)(1:il)
880 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
881 & SQUEEZE_RIGHT , 1)
882 STOP
883 & 'ECCO_READPARMS: gencost_avgperiod not properly set'
884 endif
885 endif !gencost_flag
886 endif !using_gencost
887
888 end do
889
890 _END_MASTER( myThid )
891
892 #endif /* ALLOW_GENCOST_CONTRIBUTION */
893
894 _BEGIN_MASTER( myThid )
895
896 #ifdef SINGLE_DISK_IO
897 CLOSE(iUnit)
898 #else
899 CLOSE(iUnit,STATUS='DELETE')
900 #endif /* SINGLE_DISK_IO */
901
902 _END_MASTER( myThid )
903
904 WRITE(msgBuf,'(A)')
905 & 'ECCO_READPARMS: done'
906 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
907 & SQUEEZE_RIGHT , 1)
908
909 _BARRIER
910
911 end

  ViewVC Help
Powered by ViewVC 1.1.22