/[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.52 - (show annotations) (download)
Sun Aug 29 19:28:50 2010 UTC (13 years, 8 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint62t, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62k, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l
Changes since 1.51: +9 -8 lines
Documenting ALLOW_GENCOST_CONTRIBUTION in ECCO_CPPOPTIONS.h
(see extract below) and adding the ALLOW_GENCOST_FREEFORM sub-option.

C       >>> ALLOW_GENCOST_CONTRIBUTION: interactive way to add basic 2D cost function terms.
C       > In data.ecco, this requires the specification of data file (name, frequency,
C         etc.), bar file name for corresp. model average, standard error file name, etc.
C       > In addition, adding such cost terms requires editing ecco_cost.h to increase
C         NGENCOST, and editing cost_gencost_customize.F to implement the actual
C         model average (i.e. the bar file content).
#undef ALLOW_GENCOST_CONTRIBUTION
C       >>> free form version of GENCOST: allows one to use otherwise defined elements (e.g.
C         psbar and and topex data) while taking advantage of the cost function/namelist slots
C         that can be made available using ALLOW_GENCOST_CONTRIBUTION. To this end
C         ALLOW_GENCOST_CONTRIBUTION simply switches off tests that check whether all of the
C         gencost elements (e.g. gencost_barfile and gencost_datafile) are specified in data.ecco.
C       > While this option increases flexibility within the gencost framework, it implies more room
C         for error, so it should be used cautiously, and with good knowledge of the rest of pkg/ecco.
C       > It requires providing a specific cost function routine, and editing cost_gencost_all.F accordingly.
#undef ALLOW_GENCOST_FREEFORM

1 C $Header: /u/gcmpack/MITgcm/pkg/ecco/ecco_readparms.F,v 1.51 2010/08/28 18:35:16 gforget Exp $
2 C $Name: $
3
4 #include "COST_CPPOPTIONS.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 #include "ecco_cost.h"
29
30 c == routine arguments ==
31
32 integer mythid
33
34 c == local variables ==
35 C msgBuf - Informational/error meesage buffer
36 C iUnit - Work variable for IO unit number
37 CHARACTER*(MAX_LEN_MBUF) msgBuf
38 INTEGER k, iUnit, num_file, num_var
39
40 c == end of interface ==
41
42 c-- Read the namelist input.
43 namelist /ecco_cost_nml/
44 & data_errfile,
45 & tbarfile, sbarfile,sstbarfile,
46 & psbarfile, bpbarfile,
47 & ubarfile, vbarfile, wbarfile,
48 & tauxbarfile, tauybarfile,
49 & hfluxmeanbarfile, sfluxmeanbarfile,
50 & costTranspDataFile, topexmeanfile,
51 & using_topex, using_ers, using_gfo,
52 & topexstartdate1, topexstartdate2,
53 & topexperiod, topexfile, tpTimeMaskFile,
54 & topexintercept, topexslope, ersTimeMaskFile,
55 & ersstartdate1, ersstartdate2, gfoTimeMaskFile,
56 & ersperiod, ersfile,
57 & ersintercept, ersslope,
58 & gfostartdate1, gfostartdate2,
59 & gfoperiod, gfofile,
60 & gfointercept, gfoslope,
61 & scatstartdate1, scatstartdate2,
62 & scatperiod, scatxdatfile, scatydatfile,
63 & scatx_errfile, scaty_errfile,
64 & ssh_errfile, sshv4cost_scalefile,
65 & sshv4cost_errfile, sshv4cost_errfactor,
66 & tp_errfile, ers_errfile, gfo_errfile,
67 & tmistartdate1, tmistartdate2, tmidatfile,
68 & sststartdate1, sststartdate2, sstdatfile,
69 & sssstartdate1, sssstartdate2, sssdatfile,
70 & bpstartdate1, bpstartdate2, bpdatfile,
71 & tdatfile, sdatfile, ctdtfile, ctdsfile,
72 & ctdtclimfile, ctdsclimfile, xbtfile,
73 & argotstartdate1, argotstartdate2, argotfile,
74 & argosstartdate1, argosstartdate2, argosfile,
75 & udriftfile, vdriftfile,
76 & udrifterrfile, vdrifterrfile,
77 & curmtrufile,curmtrvfile,
78 & salterrfile, temperrfile, velerrfile,
79 & salt0errfile, temp0errfile, vel0errfile,
80 & ssterrfile, ssserrfile, bperrfile,
81 & hflux_errfile, sflux_errfile,
82 & tauu_errfile, tauv_errfile,
83 & atemp_errfile, aqh_errfile,
84 & precip_errfile, swflux_errfile, swdown_errfile,
85 & lwflux_errfile, lwdown_errfile, evap_errfile,
86 & snowprecip_errfile, apressure_errfile,
87 & uwind_errfile, vwind_errfile,
88 & geoid_errfile, geoid_covariancefile,
89 & bottomdrag_errfile,edtau_errfile,
90 & kapgm_errfile,kapredi_errfile,diffkr_errfile,
91 & usercost_datafile, usercost_errfile,
92 & mult_hflux, mult_sflux, mult_tauu, mult_tauv,
93 & mult_hfluxmm, mult_sfluxmm,
94 & mult_atemp, mult_aqh,
95 & mult_precip, mult_swflux, mult_swdown,
96 & mult_lwflux, mult_lwdown, mult_evap,
97 & mult_snowprecip, mult_apressure,
98 & mult_uwind, mult_vwind,
99 & mult_hmean, mult_h, mult_sshv4cost,
100 & mult_tp, mult_ers, mult_gfo,
101 & mult_temp, mult_salt,
102 & mult_tmi, mult_sst, mult_sss, mult_bp,
103 & mult_ctdt, mult_ctds,
104 & mult_ctdtclim, mult_ctdsclim,
105 & mult_xbt, mult_drift,
106 & mult_argot, mult_argos,
107 & mult_scatx, mult_scaty,
108 & mult_sdrift, mult_tdrift, mult_wdrift,
109 & mult_temp0, mult_salt0,
110 & mult_obcsn, mult_obcss,
111 & mult_obcsw, mult_obcse, mult_obcsvol,
112 & mult_curmtr, mult_ageos,
113 & mult_kapgm, mult_kapredi, mult_diffkr,
114 & mult_edtau, mult_bottomdrag,
115 & mult_usercost, mult_transp,
116 & mult_smooth_ic, mult_smooth_bc,
117 & whflux0, wsflux0, wtau0,
118 & wbottomdrag0,
119 & watemp0, waqh0,
120 & wprecip0, wswflux0, wswdown0, wwind0,
121 & wsnowprecip0, wlwflux0, wlwdown0, wevap0,
122 & wapressure0, wdiffkr0, wkapgm0, wedtau0,
123 & wkapredi0, wmean_hflux, wmean_sflux, wmean_tau,
124 & wmean_atemp, wmean_aqh, wmean_precip,
125 & wmean_swflux, wmean_swdown, wmean_wind,
126 & wmean_lwflux, wmean_lwdown, wmean_evap,
127 & wmean_snowprecip, wmean_apressure,
128 & cost_iprec, cost_yftype
129
130 #ifdef ALLOW_GENCOST_CONTRIBUTION
131 namelist /ecco_gencost_nml/
132 & gencost_barfile,
133 & gencost_datafile,
134 & gencost_name,
135 & gencost_scalefile,
136 & gencost_errfile,
137 & gencost_mask,
138 & gencost_spmin,
139 & gencost_spmax,
140 & gencost_spzero,
141 & gencost_avgperiod,
142 & mult_gencost
143 #endif
144
145 _BEGIN_MASTER( myThid )
146
147 c-- Set default values.
148 data_errfile = ' '
149 tbarfile = 'tbar'
150 sbarfile = 'sbar'
151 sstbarfile = 'sstbar'
152 psbarfile = 'psbar'
153 bpbarfile = 'bpbar'
154 ubarfile = 'ubar'
155 vbarfile = 'vbar'
156 wbarfile = 'wbar'
157 tauxbarfile = 'tauxbar'
158 tauybarfile = 'tauybar'
159 hfluxmeanbarfile = 'hfluxmeanbar'
160 sfluxmeanbarfile = 'sfluxmeanbar'
161 costTranspDataFile = ' '
162 using_topex = .false.
163 topexstartdate1 = 0
164 topexstartdate2 = 0
165 topexperiod = 0. _d 0
166 topexintercept = 0. _d 0
167 topexslope = 0. _d 0
168 topexfile = ' '
169 topexmeanfile = ' '
170 using_ers = .false.
171 ersstartdate1 = 0
172 ersstartdate2 = 0
173 ersperiod = 0. _d 0
174 ersintercept = 0. _d 0
175 ersslope = 0. _d 0
176 ersfile = ' '
177 using_gfo = .false.
178 gfostartdate1 = 0
179 gfostartdate2 = 0
180 gfoperiod = 0. _d 0
181 gfointercept = 0. _d 0
182 gfoslope = 0. _d 0
183 gfofile = ' '
184 scatstartdate1 = 0
185 scatstartdate2 = 0
186 scatperiod = 0. _d 0
187 scatxdatfile = ' '
188 scatydatfile = ' '
189 ssh_errfile = ' '
190 tp_errfile = ' '
191 ers_errfile = ' '
192 gfo_errfile = ' '
193 scatx_errfile = ' '
194 scaty_errfile = ' '
195 tmistartdate1 = 0
196 tmistartdate2 = 0
197 tmidatfile = ' '
198 sststartdate1 = 0
199 sststartdate2 = 0
200 sstdatfile = ' '
201 sssstartdate1 = 0
202 sssstartdate2 = 0
203 sssdatfile = ' '
204 bpstartdate1 = 0
205 bpstartdate2 = 0
206 bpdatfile = ' '
207 tdatfile = ' '
208 sdatfile = ' '
209 ctdtfile = ' '
210 ctdsfile = ' '
211 ctdtclimfile = ' '
212 ctdsclimfile = ' '
213 curmtrufile = ' '
214 curmtrvfile = ' '
215 xbtfile = ' '
216 argotstartdate1 = 0
217 argotstartdate2 = 0
218 argotfile = ' '
219 argosstartdate1 = 0
220 argosstartdate2 = 0
221 argosfile = ' '
222 udriftfile = ' '
223 vdriftfile = ' '
224 udrifterrfile = ' '
225 vdrifterrfile = ' '
226 salterrfile = ' '
227 temperrfile = ' '
228 velerrfile = ' '
229 salt0errfile = ' '
230 temp0errfile = ' '
231 vel0errfile = ' '
232 ssterrfile = ' '
233 ssserrfile = ' '
234 bperrfile = ' '
235 hflux_errfile = ' '
236 sflux_errfile = ' '
237 tauu_errfile = ' '
238 tauv_errfile = ' '
239 atemp_errfile = ' '
240 aqh_errfile = ' '
241 precip_errfile = ' '
242 swflux_errfile = ' '
243 swdown_errfile = ' '
244 lwflux_errfile = ' '
245 lwdown_errfile = ' '
246 evap_errfile = ' '
247 snowprecip_errfile = ' '
248 apressure_errfile = ' '
249 uwind_errfile = ' '
250 vwind_errfile = ' '
251 geoid_errfile = ' '
252 geoid_covariancefile = ' '
253 bottomdrag_errfile = ' '
254 edtau_errfile = ' '
255 kapgm_errfile = ' '
256 kapredi_errfile = ' '
257 diffkr_errfile = ' '
258 do k=1,NUSERCOST
259 usercost_datafile(k) = ' '
260 usercost_errfile(k) = ' '
261 enddo
262 do k=1,NSSHV4COST
263 sshv4cost_scalefile(k) = ' '
264 sshv4cost_errfile(k) = ' '
265 sshv4cost_errfactor(k) = 1. _d 0
266 enddo
267 tpTimeMaskFile = ' '
268 ersTimeMaskFile = ' '
269 gfoTimeMaskFile = ' '
270
271 mult_hflux = 0. _d 0
272 mult_sflux = 0. _d 0
273 mult_hfluxmm = 0. _d 0
274 mult_sfluxmm = 0. _d 0
275 mult_tauu = 0. _d 0
276 mult_tauv = 0. _d 0
277 mult_atemp = 0. _d 0
278 mult_aqh = 0. _d 0
279 mult_precip = 0. _d 0
280 mult_swflux = 0. _d 0
281 mult_swdown = 0. _d 0
282 mult_lwflux = 0. _d 0
283 mult_lwdown = 0. _d 0
284 mult_evap = 0. _d 0
285 mult_snowprecip = 0. _d 0
286 mult_apressure = 0. _d 0
287 mult_uwind = 0. _d 0
288 mult_vwind = 0. _d 0
289 mult_hmean = 0. _d 0
290 mult_h = 1. _d 0
291 mult_tp = 0. _d 0
292 mult_ers = 0. _d 0
293 mult_gfo = 0. _d 0
294 mult_temp = 0. _d 0
295 mult_salt = 0. _d 0
296 mult_temp0 = 0. _d 0
297 mult_salt0 = 0. _d 0
298 mult_tmi = 0. _d 0
299 mult_sst = 0. _d 0
300 mult_sss = 0. _d 0
301 mult_bp = 0. _d 0
302 mult_ctdt = 0. _d 0
303 mult_ctds = 0. _d 0
304 mult_ctdtclim = 0. _d 0
305 mult_ctdsclim = 0. _d 0
306 mult_xbt = 0. _d 0
307 mult_argot = 0. _d 0
308 mult_argos = 0. _d 0
309 mult_drift = 0. _d 0
310 mult_tdrift = 0. _d 0
311 mult_sdrift = 0. _d 0
312 mult_wdrift = 0. _d 0
313 mult_scatx = 0. _d 0
314 mult_scaty = 0. _d 0
315 mult_obcsn = 0. _d 0
316 mult_obcss = 0. _d 0
317 mult_obcsw = 0. _d 0
318 mult_obcse = 0. _d 0
319 mult_obcsvol = 0. _d 0
320 mult_ageos = 0. _d 0
321 mult_curmtr = 0. _d 0
322 mult_kapgm = 0. _d 0
323 mult_kapredi = 0. _d 0
324 mult_diffkr = 0. _d 0
325 mult_edtau = 0. _d 0
326 mult_bottomdrag = 0. _d 0
327 do k=1,NUSERCOST
328 mult_usercost(k) = 0. _d 0
329 enddo
330 do k=1,NSSHV4COST
331 mult_sshv4cost(k) = 0. _d 0
332 enddo
333 mult_smooth_ic = 0. _d 0
334 mult_smooth_bc = 0. _d 0
335 mult_transp = 0. _d 0
336 watemp0 = 0. _d 0
337 waqh0 = 0. _d 0
338 wprecip0 = 0. _d 0
339 wswflux0 = 0. _d 0
340 wswdown0 = 0. _d 0
341 wlwflux0 = 0. _d 0
342 wlwdown0 = 0. _d 0
343 wevap0 = 0. _d 0
344 wsnowprecip0 = 0. _d 0
345 wapressure0 = 0. _d 0
346 wwind0 = 0. _d 0
347 wdiffkr0 = 1. _d 0
348 wkapgm0 = 1. _d 0
349 wkapredi0 = 1. _d 0
350 wedtau0 = 1. _d 0
351 whflux0 = 0. _d 0
352 wsflux0 = 0. _d 0
353 wtau0 = 0. _d 0
354 wbottomdrag0 = 1. _d 0
355 wmean_atemp = 0. _d 0
356 wmean_aqh = 0. _d 0
357 wmean_precip = 0. _d 0
358 wmean_swflux = 0. _d 0
359 wmean_swdown = 0. _d 0
360 wmean_lwflux = 0. _d 0
361 wmean_lwdown = 0. _d 0
362 wmean_evap = 0. _d 0
363 wmean_snowprecip = 0. _d 0
364 wmean_apressure = 0. _d 0
365 wmean_wind = 0. _d 0
366 wmean_hflux = 0. _d 0
367 wmean_sflux = 0. _d 0
368 wmean_tau = 0. _d 0
369 cost_iprec = precFloat32
370 cost_yftype = 'RL'
371
372 c-- Next, read the cost data file.
373 WRITE(msgBuf,'(A)') 'ECCO_READPARMS: opening data.ecco'
374 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
375 & SQUEEZE_RIGHT , 1)
376
377 CALL OPEN_COPY_DATA_FILE(
378 I 'data.ecco', 'ECCO_READPARMS',
379 O iUnit,
380 I myThid )
381
382 READ( iUnit, nml = ecco_cost_nml )
383
384 WRITE(msgBuf,'(A)')
385 & 'ECCO_READPARMS: finished reading #1: ecco_cost_nml'
386 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
387 & SQUEEZE_RIGHT , 1)
388
389 C-- Check parameters:
390 IF ( cost_yftype.NE.'RL' ) THEN
391 STOP 'ABNORMAL END: S/R ECCO_READPARMS: invalid cost_yftype'
392 ENDIF
393
394 #ifdef ALLOW_CAL
395 c-- Get the complete dates of the ...
396 c-- ... SST data.
397 WRITE(msgBuf,'(A)') 'ECCO_READPARMS: start assigning cost dates'
398 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
399 & SQUEEZE_RIGHT , 1)
400 c-- ... SST data.
401 if ( sstdatfile .ne. ' ' )
402 & call cal_FullDate( sststartdate1, sststartdate2,
403 & sststartdate, mythid )
404 c-- ... TMI data.
405 if ( tmidatfile .ne. ' ' )
406 & call cal_FullDate( tmistartdate1, tmistartdate2,
407 & tmistartdate, mythid )
408 c-- ... SSS data.
409 if ( sssdatfile .ne. ' ' )
410 & call cal_FullDate( sssstartdate1, sssstartdate2,
411 & sssstartdate, mythid )
412 c-- ... BP data.
413 if ( bpdatfile .ne. ' ' )
414 & call cal_FullDate( bpstartdate1, bpstartdate2,
415 & bpstartdate, mythid )
416 c-- ... T/P data.
417 if ( topexfile .ne. ' ' )
418 & call cal_FullDate( topexstartdate1, topexstartdate2,
419 & topexstartdate, mythid )
420 c-- ... ERS data.
421 if ( ersfile .ne. ' ' )
422 & call cal_FullDate( ersstartdate1, ersstartdate2,
423 & ersstartdate, mythid )
424 c-- ... GFO data.
425 if ( gfofile .ne. ' ' )
426 & call cal_FullDate( gfostartdate1, gfostartdate2,
427 & gfostartdate, mythid )
428 c-- ... SCAT data.
429 if ( scatxdatfile .ne. ' ' )
430 & call cal_FullDate( scatstartdate1, scatstartdate2,
431 & scatxstartdate, mythid )
432 if ( scatydatfile .ne. ' ' )
433 & call cal_FullDate( scatstartdate1, scatstartdate2,
434 & scatystartdate, mythid )
435
436 WRITE(msgBuf,'(A)') 'ECCO_READPARMS: end assigning cost dates'
437 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
438 & SQUEEZE_RIGHT , 1)
439 #endif
440
441 _END_MASTER( myThid )
442
443 #ifdef ALLOW_GENCOST_CONTRIBUTION
444
445 _BEGIN_MASTER( myThid )
446
447 c-- Set default values.
448 do k=1,NGENCOST
449 gencost_avgperiod(k) = ' '
450 gencost_datafile(k) = ' '
451 gencost_name(k) = 'gencost'
452 gencost_scalefile(k) = ' '
453 gencost_errfile(k) = ' '
454 gencost_mask(k) = 'c'
455 cgf write(gencost_barfile(k)(1:8),'(a,i2.2)')
456 cgf & 'genbar', k
457 gencost_barfile(k) = ' '
458 gencost_spmin = 0. _d 0
459 gencost_spmax = 0. _d 0
460 gencost_spzero = 9876. _d 0
461 mult_gencost(k) = 0. _d 0
462 enddo
463
464 READ( iUnit, nml = ecco_gencost_nml )
465
466 WRITE(msgBuf,'(A)')
467 & 'ECCO_READPARMS: finished reading #2: ecco_gencost_nml'
468 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
469 & SQUEEZE_RIGHT , 1)
470
471 C-- Check parameters:
472 #ifndef ALLOW_GENCOST_FREEFORM
473 do k=1,NGENCOST
474
475 if ( gencost_avgperiod(k) .NE. 'day ' .AND.
476 & gencost_avgperiod(k) .NE. 'DAY ' .AND.
477 & gencost_avgperiod(k) .NE. 'month' .AND.
478 & gencost_avgperiod(k) .NE. 'MONTH' .AND.
479 & gencost_avgperiod(k) .NE. 'year ' .AND.
480 & gencost_avgperiod(k) .NE. 'YEAR ' ) then
481 STOP
482 & 'ECCO_READPARMS: gencost_avgperiod not properly set'
483 end if
484
485 if ( gencost_datafile(k) .ne. ' ' ) then
486
487 if ( gencost_spmin(k) .EQ. 0. _d 0 .AND.
488 & gencost_spmax(k) .EQ. 0. _d 0 ) then
489 STOP
490 & 'ECCO_READPARMS: gencost_spmin, gencost_spmax not set'
491 endif
492
493 if ( gencost_spzero(k) .EQ. 9876. _d 0 ) then
494 STOP
495 & 'ECCO_READPARMS: gencost_spzero not set'
496 endif
497
498 endif
499
500 end do
501 #endif
502
503 _END_MASTER( myThid )
504
505 #endif /* ALLOW_GENCOST_CONTRIBUTION */
506
507 _BEGIN_MASTER( myThid )
508
509 CLOSE( iUnit )
510
511 _END_MASTER( myThid )
512
513 WRITE(msgBuf,'(A)')
514 & 'ECCO_READPARMS: done'
515 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
516 & SQUEEZE_RIGHT , 1)
517
518 _BARRIER
519
520 end

  ViewVC Help
Powered by ViewVC 1.1.22