/[MITgcm]/MITgcm/pkg/ctrl/ctrl_readparms.F
ViewVC logotype

Contents of /MITgcm/pkg/ctrl/ctrl_readparms.F

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


Revision 1.49 - (show annotations) (download)
Fri Jun 27 14:20:58 2014 UTC (9 years, 10 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint64z, checkpoint65, checkpoint65b, checkpoint65c, checkpoint65a
Changes since 1.48: +14 -1 lines
- introduce useSmoothCorrel2DinAdMode run time parameter
- the logic is put here rather than autodiff_readparms.F
  because ctrl_readparms.F comes later than
  autodiff_readparms.F and reads smoothCorrel2d

1 C $Header: /u/gcmpack/MITgcm/pkg/ctrl/ctrl_readparms.F,v 1.48 2014/04/04 21:19:04 jmc Exp $
2 C $Name: $
3
4 #include "CTRL_OPTIONS.h"
5 #include "AD_CONFIG.h"
6
7 subroutine ctrl_readparms( mythid )
8
9 c ==================================================================
10 c SUBROUTINE ctrl_readparms
11 c ==================================================================
12 c
13 c o read ctrl parameters
14 c
15 c ==================================================================
16 c SUBROUTINE ctrl_readparms
17 c ==================================================================
18
19 implicit none
20
21 c == global variables ==
22
23 #include "EEPARAMS.h"
24 #include "SIZE.h"
25 #include "PARAMS.h"
26 #include "CTRL_SIZE.h"
27 #include "ctrl.h"
28 #include "CTRL_GENARR.h"
29 #ifdef ALLOW_AUTODIFF
30 #include "AUTODIFF_PARAMS.h"
31 #endif
32
33 c == routine arguments ==
34
35 integer mythid
36
37 c == local variables ==
38
39 integer bi,bj
40 integer i,j,k
41 integer ntmp
42 integer ivarindex
43 integer iUnit
44 integer iobcs
45 integer il
46 integer errio
47 integer startrec
48 integer endrec
49 integer difftime(4)
50 _RL diffsecs
51 _RL dummy
52
53 character*(80) ymaskobcs
54 character*(max_len_prec) record
55 character*(max_len_mbuf) msgbuf
56
57 integer nwetc3d
58 integer iarr
59
60 c == external ==
61
62 integer ilnblnk
63 external ilnblnk
64
65 c == end of interface ==
66
67 c-- Read the namelist input.
68 namelist /ctrl_nml/
69 & xx_theta_file, xx_salt_file,
70 & xx_hflux_file, xx_hflux_remo_intercept, xx_hflux_remo_slope,
71 & xx_hfluxstartdate1, xx_hfluxstartdate2, xx_hfluxperiod,
72 & xx_sflux_file, xx_sflux_remo_intercept, xx_sflux_remo_slope,
73 & xx_sfluxstartdate1, xx_sfluxstartdate2, xx_sfluxperiod,
74 & xx_tauu_file, xx_tauu_remo_intercept, xx_tauu_remo_slope,
75 & xx_tauustartdate1, xx_tauustartdate2, xx_tauuperiod,
76 & xx_tauv_file, xx_tauv_remo_intercept, xx_tauv_remo_slope,
77 & xx_tauvstartdate1, xx_tauvstartdate2, xx_tauvperiod,
78 & xx_atemp_file, xx_atemp_remo_intercept, xx_atemp_remo_slope,
79 & xx_atempstartdate1, xx_atempstartdate2, xx_atempperiod,
80 & xx_aqh_file, xx_aqh_remo_intercept, xx_aqh_remo_slope,
81 & xx_aqhstartdate1, xx_aqhstartdate2, xx_aqhperiod,
82 & xx_precip_file, xx_precip_remo_intercept, xx_precip_remo_slope,
83 & xx_precipstartdate1, xx_precipstartdate2, xx_precipperiod,
84 & xx_swflux_file, xx_swflux_remo_intercept, xx_swflux_remo_slope,
85 & xx_swfluxstartdate1, xx_swfluxstartdate2, xx_swfluxperiod,
86 & xx_swdown_file, xx_swdown_remo_intercept, xx_swdown_remo_slope,
87 & xx_swdownstartdate1, xx_swdownstartdate2, xx_swdownperiod,
88 & xx_lwflux_file, xx_lwflux_remo_intercept, xx_lwflux_remo_slope,
89 & xx_lwfluxstartdate1, xx_lwfluxstartdate2, xx_lwfluxperiod,
90 & xx_lwdown_file, xx_lwdown_remo_intercept, xx_lwdown_remo_slope,
91 & xx_lwdownstartdate1, xx_lwdownstartdate2, xx_lwdownperiod,
92 & xx_evap_file, xx_evap_remo_intercept, xx_evap_remo_slope,
93 & xx_evapstartdate1, xx_evapstartdate2, xx_evapperiod,
94 & xx_snowprecip_file, xx_snowprecip_remo_intercept,
95 & xx_snowprecip_remo_slope, xx_snowprecipperiod,
96 & xx_snowprecipstartdate1, xx_snowprecipstartdate2,
97 & xx_apressure_file, xx_apressure_remo_intercept,
98 & xx_apressure_remo_slope, xx_apressureperiod,
99 & xx_apressurestartdate1, xx_apressurestartdate2,
100 & xx_runoff_file, xx_runoff_remo_intercept, xx_runoff_remo_slope,
101 & xx_runoffstartdate1, xx_runoffstartdate2, xx_runoffperiod,
102 & xx_uwind_file, xx_uwind_remo_intercept, xx_uwind_remo_slope,
103 & xx_uwindstartdate1, xx_uwindstartdate2, xx_uwindperiod,
104 & xx_vwind_file, xx_vwind_remo_intercept, xx_vwind_remo_slope,
105 & xx_vwindstartdate1, xx_vwindstartdate2, xx_vwindperiod,
106 & xx_aqh_mean_file, xx_atemp_mean_file, xx_precip_mean_file,
107 & xx_swdown_mean_file, xx_uwind_mean_file, xx_vwind_mean_file,
108 & xx_obcsn_file,
109 & xx_obcsnstartdate1, xx_obcsnstartdate2, xx_obcsnperiod,
110 & xx_obcss_file,
111 & xx_obcssstartdate1, xx_obcssstartdate2, xx_obcssperiod,
112 & xx_obcsw_file,
113 & xx_obcswstartdate1, xx_obcswstartdate2, xx_obcswperiod,
114 & xx_obcse_file,
115 & xx_obcsestartdate1, xx_obcsestartdate2, xx_obcseperiod,
116 & xx_diffkr_file, xx_kapgm_file, xx_kapredi_file, xx_tr1_file,
117 & xx_sst_file, xx_sst_remo_intercept, xx_sst_remo_slope,
118 & xx_sss_file, xx_sss_remo_intercept, xx_sss_remo_slope,
119 & xx_sststartdate1, xx_sststartdate2, xx_sstperiod,
120 & xx_sssstartdate1, xx_sssstartdate2, xx_sssperiod,
121 & xx_depth_file, xx_gen2d_file, xx_gen3d_file,
122 & xx_efluxy_file, xx_efluxp_file, xx_bottomdrag_file,
123 & xx_edtaux_file, xx_edtauy_file,
124 & xx_uvel_file, xx_vvel_file, xx_etan_file,
125 & xx_siarea_file, xx_siheff_file, xx_sihsnow_file,
126 & xx_shifwflx_file,
127 & xx_shifwflx_remo_intercept, xx_shifwflx_remo_slope,
128 & xx_shifwflxstartdate1, xx_shifwflxstartdate2, xx_shifwflxperiod,
129 & doInitXX, ctrlSmoothCorrel3D, ctrlSmoothCorrel2D,
130 & doPackDiag,
131 & doZscaleUnpack, doZscalePack,
132 & doMainUnpack, doMainPack,
133 & doSinglePrecTapelev,
134 & doAdmtlmBypassAD,
135 & delZexp, forcingPrecond
136 cHFLUXM_CONTROL
137 & ,xx_hfluxm_file
138 cHFLUXM_CONTROL
139
140 namelist /ctrl_packnames/
141 & yadmark, yctrlid, yctrlposunpack, yctrlpospack,
142 & ctrlname, costname, scalname, maskname, metaname
143
144 #if (defined (ALLOW_GENARR2D_CONTROL) || defined (ALLOW_GENARR3D_CONTROL) || defined (ALLOW_GENTIM2D_CONTROL))
145 namelist /ctrl_nml_genarr/
146 & xx_genarr2d_file, xx_genarr3d_file, xx_gentim2d_file,
147 & xx_genarr2d_weight, xx_genarr3d_weight, xx_gentim2d_weight,
148 & xx_gentim2d_startdate1, xx_gentim2d_startdate2,
149 & xx_gentim2d_startdate, xx_gentim2d_period,
150 & xx_gentim2d_cumsum,xx_gentim2d_glosum,
151 & genarr2dPrecond, gentim2dPrecond,mult_gentim2d
152 #endif
153
154 _BEGIN_MASTER( myThid )
155
156 c-- Set default values.
157 doInitXX = .TRUE.
158 #ifdef ALLOW_SMOOTH_CORREL3D
159 ctrlSmoothCorrel3D = .TRUE.
160 #else
161 ctrlSmoothCorrel3D = .FALSE.
162 #endif
163 #ifdef ALLOW_SMOOTH_CORREL2D
164 ctrlSmoothCorrel2D = .TRUE.
165 #else
166 ctrlSmoothCorrel2D = .FALSE.
167 #endif
168 #ifdef ALLOW_ADMTLM
169 doAdmTlm = .TRUE.
170 #else
171 doAdmTlm = .FALSE.
172 #endif
173 doPackDiag = .FALSE.
174 doZscaleUnpack = .FALSE.
175 doZscalePack = .FALSE.
176 doMainUnpack = .TRUE.
177 #if (defined (ALLOW_ADJOINT_RUN)||defined (ALLOW_TANGENTLINEAR_RUN))
178 doMainPack = .TRUE.
179 #else
180 doMainPack = .FALSE.
181 #endif
182 doSinglePrecTapelev = .FALSE.
183 doAdmtlmBypassAD = .FALSE.
184
185 delZexp = 0.
186 forcingPrecond = 1. _d 0
187
188 xx_theta_file = 'xx_theta'
189 xx_salt_file = 'xx_salt'
190 c
191 xx_gen2d_file = 'xx_gen2d'
192 xx_gen3d_file = 'xx_gen3d'
193
194 #if (defined (ALLOW_GENARR2D_CONTROL) || defined (ALLOW_GENARR3D_CONTROL) || defined (ALLOW_GENTIM2D_CONTROL))
195 do iarr = 1, maxCtrlArr2D
196 write(xx_genarr2d_file(iarr)(1:14),'(a,i2.2)')
197 & 'xx_genarr2d_', iarr
198 write(xx_genarr2d_file(iarr)(15:MAX_LEN_FNAM),'(a)') ' '
199 write(xx_genarr2d_weight(iarr)(1:MAX_LEN_FNAM),'(a)') ' '
200 genarr2dPrecond(iarr) = 1. _d 0
201 enddo
202 c
203 do iarr = 1, maxCtrlArr3D
204 write(xx_genarr3d_file(iarr)(1:14),'(a,i2.2)')
205 & 'xx_genarr3d_', iarr
206 write(xx_genarr3d_file(iarr)(15:MAX_LEN_FNAM),'(a)') ' '
207 write(xx_genarr3d_weight(iarr)(1:MAX_LEN_FNAM),'(a)') ' '
208 enddo
209 c
210 do iarr = 1, maxCtrlTim2D
211 write(xx_gentim2d_file(iarr)(1:14),'(a,i2.2)')
212 & 'xx_gentim2d_', iarr
213 write(xx_gentim2d_file(iarr)(15:MAX_LEN_FNAM),'(a)') ' '
214 write(xx_gentim2d_weight(iarr)(1:MAX_LEN_FNAM),'(a)') ' '
215 xx_gentim2d_startdate1(iarr) = 0
216 xx_gentim2d_startdate2(iarr) = 0
217 xx_gentim2d_period(iarr) = 0. _d 0
218 xx_gentim2d_cumsum(iarr) = .FALSE.
219 xx_gentim2d_glosum(iarr) = .FALSE.
220 gentim2dPrecond(iarr) = 1. _d 0
221 mult_gentim2d(iarr) = 0. _d 0
222 enddo
223 #endif
224 c
225 xx_hfluxstartdate1 = 0
226 xx_hfluxstartdate2 = 0
227 xx_hfluxperiod = 0. _d 0
228 xx_hflux_file = 'xx_hfl'
229 xx_hflux_remo_intercept = 0. _d 0
230 xx_hflux_remo_slope = 0. _d 0
231 c
232 xx_sfluxstartdate1 = 0
233 xx_sfluxstartdate2 = 0
234 xx_sfluxperiod = 0. _d 0
235 xx_sflux_file = 'xx_sfl'
236 xx_sflux_remo_intercept = 0. _d 0
237 xx_sflux_remo_slope = 0. _d 0
238 c
239 xx_tauustartdate1 = 0
240 xx_tauustartdate2 = 0
241 xx_tauuperiod = 0. _d 0
242 xx_tauu_file = 'xx_tauu'
243 xx_tauu_remo_intercept = 0. _d 0
244 xx_tauu_remo_slope = 0. _d 0
245 c
246 xx_tauvstartdate1 = 0
247 xx_tauvstartdate2 = 0
248 xx_tauvperiod = 0. _d 0
249 xx_tauv_file = 'xx_tauv'
250 xx_tauv_remo_intercept = 0. _d 0
251 xx_tauv_remo_slope = 0. _d 0
252 c
253 xx_atempstartdate1 = 0
254 xx_atempstartdate2 = 0
255 xx_atempperiod = 0. _d 0
256 xx_atemp_file = 'xx_atemp'
257 xx_atemp_mean_file = 'xx_atemp_mean'
258 xx_atemp_remo_intercept = 0. _d 0
259 xx_atemp_remo_slope = 0. _d 0
260 c
261 xx_aqhstartdate1 = 0
262 xx_aqhstartdate2 = 0
263 xx_aqhperiod = 0. _d 0
264 xx_aqh_file = 'xx_aqh'
265 xx_aqh_mean_file = 'xx_aqh_mean'
266 xx_aqh_remo_intercept = 0. _d 0
267 xx_aqh_remo_slope = 0. _d 0
268 c
269 xx_precipstartdate1 = 0
270 xx_precipstartdate2 = 0
271 xx_precipperiod = 0. _d 0
272 xx_precip_file = 'xx_precip'
273 xx_precip_mean_file = 'xx_precip_mean'
274 xx_precip_remo_intercept = 0. _d 0
275 xx_precip_remo_slope = 0. _d 0
276 c
277 xx_swfluxstartdate1 = 0
278 xx_swfluxstartdate2 = 0
279 xx_swfluxperiod = 0. _d 0
280 xx_swflux_file = 'xx_swflux'
281 xx_swflux_remo_intercept = 0. _d 0
282 xx_swflux_remo_slope = 0. _d 0
283 c
284 xx_swdownstartdate1 = 0
285 xx_swdownstartdate2 = 0
286 xx_swdownperiod = 0. _d 0
287 xx_swdown_file = 'xx_swdown'
288 xx_swdown_mean_file = 'xx_swdown_mean'
289 xx_swdown_remo_intercept = 0. _d 0
290 xx_swdown_remo_slope = 0. _d 0
291 c
292 xx_lwfluxstartdate1 = 0
293 xx_lwfluxstartdate2 = 0
294 xx_lwfluxperiod = 0. _d 0
295 xx_lwflux_file = 'xx_lwflux'
296 xx_lwflux_remo_intercept = 0. _d 0
297 xx_lwflux_remo_slope = 0. _d 0
298 c
299 xx_lwdownstartdate1 = 0
300 xx_lwdownstartdate2 = 0
301 xx_lwdownperiod = 0. _d 0
302 xx_lwdown_file = 'xx_lwdown'
303 xx_lwdown_remo_intercept = 0. _d 0
304 xx_lwdown_remo_slope = 0. _d 0
305 c
306 xx_evapstartdate1 = 0
307 xx_evapstartdate2 = 0
308 xx_evapperiod = 0. _d 0
309 xx_evap_file = 'xx_evap'
310 xx_evap_remo_intercept = 0. _d 0
311 xx_evap_remo_slope = 0. _d 0
312 c
313 xx_snowprecipstartdate1 = 0
314 xx_snowprecipstartdate2 = 0
315 xx_snowprecipperiod = 0. _d 0
316 xx_snowprecip_file = 'xx_snowprecip'
317 xx_snowprecip_remo_intercept = 0. _d 0
318 xx_snowprecip_remo_slope = 0. _d 0
319 c
320 xx_apressurestartdate1 = 0
321 xx_apressurestartdate2 = 0
322 xx_apressureperiod = 0. _d 0
323 xx_apressure_file = 'xx_apressure'
324 xx_apressure_remo_intercept = 0. _d 0
325 xx_apressure_remo_slope = 0. _d 0
326 c
327 xx_runoffstartdate1 = 0
328 xx_runoffstartdate2 = 0
329 xx_runoffperiod = 0. _d 0
330 xx_runoff_file = 'xx_runoff'
331 xx_runoff_remo_intercept = 0. _d 0
332 xx_runoff_remo_slope = 0. _d 0
333 c
334 xx_uwindstartdate1 = 0
335 xx_uwindstartdate2 = 0
336 xx_uwindperiod = 0. _d 0
337 xx_uwind_file = 'xx_uwind'
338 xx_uwind_mean_file = 'xx_uwind_mean'
339 xx_uwind_remo_intercept = 0. _d 0
340 xx_uwind_remo_slope = 0. _d 0
341 c
342 xx_vwindstartdate1 = 0
343 xx_vwindstartdate2 = 0
344 xx_vwindperiod = 0. _d 0
345 xx_vwind_file = 'xx_vwind'
346 xx_vwind_mean_file = 'xx_vwind_mean'
347 xx_vwind_remo_intercept = 0. _d 0
348 xx_vwind_remo_slope = 0. _d 0
349 c
350 xx_obcsnstartdate1 = 0
351 xx_obcsnstartdate2 = 0
352 xx_obcsnperiod = 0. _d 0
353 xx_obcsn_file = 'xx_obcsn'
354 c
355 xx_obcssstartdate1 = 0
356 xx_obcssstartdate2 = 0
357 xx_obcssperiod = 0. _d 0
358 xx_obcss_file = 'xx_obcss'
359 c
360 xx_obcswstartdate1 = 0
361 xx_obcswstartdate2 = 0
362 xx_obcswperiod = 0. _d 0
363 xx_obcsw_file = 'xx_obcsw'
364 c
365 xx_obcsestartdate1 = 0
366 xx_obcsestartdate2 = 0
367 xx_obcseperiod = 0. _d 0
368 xx_obcse_file = 'xx_obcse'
369 c
370 xx_sststartdate1 = 0
371 xx_sststartdate2 = 0
372 xx_sstperiod = 0. _d 0
373 xx_sst_file = 'xx_sst'
374 xx_sst_remo_intercept = 0. _d 0
375 xx_sst_remo_slope = 0. _d 0
376 c
377 xx_sssstartdate1 = 0
378 xx_sssstartdate2 = 0
379 xx_sssperiod = 0. _d 0
380 xx_sss_file = 'xx_sss'
381 xx_sss_remo_intercept = 0. _d 0
382 xx_sss_remo_slope = 0. _d 0
383 c
384 xx_shifwflxstartdate1 = 0
385 xx_shifwflxstartdate2 = 0
386 xx_shifwflxperiod = 0. _d 0
387 xx_shifwflx_file = 'xx_shifwflx'
388 xx_shifwflx_remo_intercept=0. _d 0
389 xx_shifwflx_remo_slope = 0. _d 0
390 c
391 xx_diffkr_file = 'xx_diffkr'
392 xx_kapgm_file = 'xx_kapgm'
393 xx_kapredi_file = 'xx_kapredi'
394 xx_tr1_file = 'xx_ptr'
395 xx_depth_file = 'xx_depth'
396 xx_efluxy_file = 'xx_efluxy'
397 xx_efluxp_file = 'xx_efluxp'
398 xx_bottomdrag_file = 'xx_bottomdrag'
399 xx_edtaux_file = 'xx_edtaux'
400 xx_edtauy_file = 'xx_edtauy'
401 xx_uvel_file = 'xx_uvel'
402 xx_vvel_file = 'xx_vvel'
403 xx_etan_file = 'xx_etan'
404 xx_siarea_file = 'xx_siarea'
405 xx_siheff_file = 'xx_siheff'
406 xx_sihsnow_file = 'xx_sihsnow'
407 cHFLUXM_CONTROL
408 xx_hfluxm_file = 'xx_hfluxm'
409 cHFLUXM_CONTROL
410
411 #ifdef ALLOW_TANGENTLINEAR_RUN
412 yadprefix = 'g_'
413 yadmark = 'g_'
414 #else
415 yadprefix = 'ad'
416 yadmark = 'ad'
417 #endif
418 yctrlid = 'MIT_CE_000'
419 yctrlposunpack = '.opt'
420 yctrlpospack = '.opt'
421 ctrlname = 'ecco_ctrl'
422 costname = 'ecco_cost'
423 scalname = ' '
424 maskname = ' '
425 metaname = ' '
426
427 c-- Next, read the cost data file.
428 WRITE(msgBuf,'(A)') 'CTRL_READPARMS: opening data.ctrl'
429 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
430 & SQUEEZE_RIGHT , 1)
431
432 CALL OPEN_COPY_DATA_FILE(
433 I 'data.ctrl', 'CTRL_READPARMS',
434 O iUnit,
435 I myThid )
436
437 READ(unit = iUnit, nml = ctrl_nml)
438 READ(unit = iUnit, nml = ctrl_packnames)
439 #if (defined (ALLOW_GENARR2D_CONTROL) || defined (ALLOW_GENARR3D_CONTROL) || defined (ALLOW_GENTIM2D_CONTROL))
440 READ(unit = iUnit, nml = ctrl_nml_genarr)
441 #endif
442
443 WRITE(msgBuf,'(A)')
444 & 'CTRL_READPARMS: finished reading data.ctrl'
445 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
446 & SQUEEZE_RIGHT , 1)
447
448 CLOSE( iUnit )
449
450 #ifdef ALLOW_AUTODIFF
451 c allow for switching off correl2d in adjoint
452 useSmoothCorrel2DinFwdMode = ctrlSmoothCorrel2D
453 useSmoothCorrel2DinAdMode =
454 & useSmoothCorrel2DinAdMode .AND. ctrlSmoothCorrel2D
455 CALL WRITE_0D_L( useSmoothCorrel2DinAdMode, INDEX_NONE,
456 & 'useSmoothCorrel2DinAdMode =',
457 & ' /* use ctrlSmoothCorrel2D in adjoint mode */')
458 #endif
459
460 _END_MASTER( myThid )
461
462 _BARRIER
463
464 return
465 end

  ViewVC Help
Powered by ViewVC 1.1.22