/[MITgcm]/MITgcm/optim/optim_numbmod.F
ViewVC logotype

Contents of /MITgcm/optim/optim_numbmod.F

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


Revision 1.13 - (show annotations) (download)
Fri Mar 11 20:01:55 2016 UTC (4 years, 2 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65v, checkpoint65w, checkpoint65u, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, HEAD
Changes since 1.12: +1 -2 lines
Change header to compile.

1
2 #include "CTRL_OPTIONS.h"
3
4 cph #ifdef TARGET_CRAY_VECTOR
5 cph # define NML_OPTIM ECCO_OPTIM
6 cph # define NML_ECCO ECCO_PARMS
7 cph #else
8 cph # define NML_OPTIM NML=ECCO_OPTIM
9 cph # define NML_ECCO NML=ECCO_PARMS
10 cph #endif
11
12 c ==================================================================
13 c
14 c optim.F: Routines for doing an off-line optimization after the
15 c ECCO forward and adjoint model have been run.
16 c
17 c numbmod - Returns number of variables.
18 c simul - Mid-level routine that calls the model and its
19 c adjoint
20 c model - Forward model.
21 c admodel - Modified forward model and adjoint model.
22 c initmod - Initialisation routine.
23 c postmod - Final routine that prints results.
24 c
25 c
26 c Documentation:
27 c
28 c The collection of these routines originated mainly from Ralf
29 c Giering. Patrick Heimbach improved and corrected some parts of
30 c the original code. Christian Eckert contributed the interface
31 c to the ECCO release of the MITgcmUV in order to get the off-
32 c line version going. The on-line optimisation uses a simple
33 c example, whereas the off-line version deals with the ECCO
34 c release output. The off-line version can, of course, only
35 c do one optimization step at a time.
36 c
37 c started: Christian Eckert eckert@mit.edu 15-Feb-2000
38 c
39 c - On-line and off-line capability and some cosmetic
40 c changes.
41 c
42 c changed: Patrick Heimbach heimbach@mit.edu 19-Jun-2000
43 c - finished, revised and debugged
44 c
45 c ==================================================================
46
47
48 subroutine optim_numbmod(
49 O nn
50 & )
51
52 c ==================================================================
53 c SUBROUTINE optim_numbmod
54 c ==================================================================
55 c
56 c o Set the number of control variables.
57 c
58 c started: Christian Eckert eckert@mit.edu 15-Feb-2000
59 c
60 c changed: Christian Eckert eckert@mit.edu 09-Mar-2000
61 c
62 c - Added ECCO layout.
63 c
64 c changed: Patrick Heimbach heimbach@mit.edu 19-Jun-2000
65 c - finished, revised and debugged
66 c
67 c ==================================================================
68 c SUBROUTINE optim_numbmod
69 c ==================================================================
70
71 IMPLICIT NONE
72
73 c == global variables ==
74
75 #include "EEPARAMS.h"
76 #include "SIZE.h"
77
78 #include "ctrl.h"
79 #include "optim.h"
80 #include "minimization.h"
81 #include "CTRL_OBCS.h"
82 #ifndef ECCO_CTRL_DEPRECATED
83 # include "ctrl_local_params.h"
84 #endif
85
86 c == routine arguments ==
87
88 integer nn
89
90 c == local variables ==
91
92 integer il
93 integer errio
94
95 _RL ff
96
97 #if defined (DYNAMIC)
98 _RL vv(nn)
99 #elif defined (USE_POINTER) || (MAX_INDEPEND == 0)
100 _RL vv
101 pointer (pvv,vv(1))
102 #else
103 integer nmax
104 parameter( nmax = MAX_INDEPEND )
105 _RL vv(nmax)
106 #endif
107
108 character*(max_len_prec) record
109
110 logical lheaderonly
111
112 c == external ==
113
114 integer ilnblnk
115
116 c == end of interface ==
117
118 namelist /CTRL_NML/
119 & xx_theta_file, xx_salt_file,
120 & xx_hflux_file, xx_hflux_remo_intercept, xx_hflux_remo_slope,
121 & xx_hfluxstartdate1, xx_hfluxstartdate2, xx_hfluxperiod,
122 & xx_sflux_file, xx_sflux_remo_intercept, xx_sflux_remo_slope,
123 & xx_sfluxstartdate1, xx_sfluxstartdate2, xx_sfluxperiod,
124 & xx_tauu_file, xx_tauu_remo_intercept, xx_tauu_remo_slope,
125 & xx_tauustartdate1, xx_tauustartdate2, xx_tauuperiod,
126 & xx_tauv_file, xx_tauv_remo_intercept, xx_tauv_remo_slope,
127 & xx_tauvstartdate1, xx_tauvstartdate2, xx_tauvperiod,
128 & xx_atemp_file, xx_atemp_remo_intercept, xx_atemp_remo_slope,
129 & xx_atempstartdate1, xx_atempstartdate2, xx_atempperiod,
130 & xx_aqh_file, xx_aqh_remo_intercept, xx_aqh_remo_slope,
131 & xx_aqhstartdate1, xx_aqhstartdate2, xx_aqhperiod,
132 & xx_precip_file, xx_precip_remo_intercept, xx_precip_remo_slope,
133 & xx_precipstartdate1, xx_precipstartdate2, xx_precipperiod,
134 & xx_swflux_file, xx_swflux_remo_intercept, xx_swflux_remo_slope,
135 & xx_swfluxstartdate1, xx_swfluxstartdate2, xx_swfluxperiod,
136 & xx_swdown_file, xx_swdown_remo_intercept, xx_swdown_remo_slope,
137 & xx_swdownstartdate1, xx_swdownstartdate2, xx_swdownperiod,
138 & xx_lwflux_file, xx_lwflux_remo_intercept, xx_lwflux_remo_slope,
139 & xx_lwfluxstartdate1, xx_lwfluxstartdate2, xx_lwfluxperiod,
140 & xx_lwdown_file, xx_lwdown_remo_intercept, xx_lwdown_remo_slope,
141 & xx_lwdownstartdate1, xx_lwdownstartdate2, xx_lwdownperiod,
142 & xx_evap_file, xx_evap_remo_intercept, xx_evap_remo_slope,
143 & xx_evapstartdate1, xx_evapstartdate2, xx_evapperiod,
144 & xx_snowprecip_file, xx_snowprecip_remo_intercept,
145 & xx_snowprecip_remo_slope, xx_snowprecipperiod,
146 & xx_snowprecipstartdate1, xx_snowprecipstartdate2,
147 & xx_apressure_file, xx_apressure_remo_intercept,
148 & xx_apressure_remo_slope, xx_apressureperiod,
149 & xx_apressurestartdate1, xx_apressurestartdate2,
150 & xx_runoff_file, xx_runoff_remo_intercept, xx_runoff_remo_slope,
151 & xx_runoffstartdate1, xx_runoffstartdate2, xx_runoffperiod,
152 & xx_uwind_file, xx_uwind_remo_intercept, xx_uwind_remo_slope,
153 & xx_uwindstartdate1, xx_uwindstartdate2, xx_uwindperiod,
154 & xx_vwind_file, xx_vwind_remo_intercept, xx_vwind_remo_slope,
155 & xx_vwindstartdate1, xx_vwindstartdate2, xx_vwindperiod,
156 & xx_obcsn_file, xx_obcss_file, xx_obcsw_file, xx_obcse_file,
157 & xx_obcsnstartdate1, xx_obcsnstartdate2, xx_obcsnperiod,
158 & xx_obcssstartdate1, xx_obcssstartdate2, xx_obcssperiod,
159 & xx_obcswstartdate1, xx_obcswstartdate2, xx_obcswperiod,
160 & xx_obcsestartdate1, xx_obcsestartdate2, xx_obcseperiod,
161 & xx_diffkr_file, xx_kapgm_file, xx_tr1_file,
162 & xx_sst_file, xx_sss_file,
163 & xx_sststartdate1, xx_sststartdate2, xx_sstperiod,
164 & xx_sssstartdate1, xx_sssstartdate2, xx_sssperiod,
165 & xx_depth_file, xx_efluxy_file, xx_efluxp_file,
166 & xx_bottomdrag_file, xx_edtaux_file, xx_edtauy_file,
167 & xx_uvel_file, xx_vvel_file, xx_etan_file,
168 & xx_shifwflx_file,
169 & xx_shifwflx_remo_intercept, xx_shifwflx_remo_slope,
170 & xx_shifwflxstartdate1, xx_shifwflxstartdate2, xx_shifwflxperiod,
171 & doInitXX, doPackDiag, doZscaleUnpack, doZscalePack,
172 & doMainUnpack, doMainPack, doAdmtlmBypassAD, delZexp,
173 & xx_hfluxm_file, doSinglePrecTapelev
174
175 namelist /CTRL_PACKNAMES/
176 & yadmark, yctrlid, yctrlposunpack, yctrlpospack,
177 & ctrlname, costname, scalname, maskname, metaname
178
179 namelist /OPTIM/
180 & optimcycle,
181 & numiter, nfunc, fmin, iprint,
182 & epsf, epsx, epsg,
183 & nupdate, eps
184
185 c-- Preset the optimization parameters.
186 optimcycle = 0
187 nvars = 0
188 numiter = 1
189 nfunc = 1
190 fmin = 0.0
191 iprint = 10
192 epsx = 1.e-6
193 epsg = 1.e-6
194 eps = -1.e-6
195 nupdate = 1
196 ff = 0.
197 cdfer expId = 'MIT_CE_000'
198 yctrlid = 'MIT_CE_000'
199
200 modeldataunit = 14
201 scrunit1 = 11
202
203 c-- Read control parameters from file.
204 open(unit=scrunit1,status='scratch')
205
206 open(unit = modeldataunit,file = 'data.ctrl',
207 & status = 'old', iostat = errio)
208 if ( errio .lt. 0 ) then
209 stop ' stopped in optim_numbmod'
210 endif
211
212 do while ( .true. )
213 read(modeldataunit, fmt='(a)', end=21) record
214 il = max(ilnblnk(record),1)
215 if ( record(1:1) .ne. commentcharacter )
216 & write(unit=scrunit1, fmt='(a)') record(:il)
217 enddo
218 21 continue
219 close( modeldataunit )
220
221 rewind( scrunit1 )
222 read(unit = scrunit1, nml = ctrl_nml)
223 read(unit = scrunit1, nml = ctrl_packnames)
224 close( scrunit1 )
225 print*, ' OPTIM_NUMBMOD: Control options have been read.'
226
227 cph(
228 cdfer expId = yctrlid
229 cph)
230
231 c-- Read optimization parameters from file.
232 open(unit=scrunit1,status='scratch')
233
234 open(unit = modeldataunit,file = 'data.optim',
235 & status = 'old', iostat = errio)
236 if ( errio .lt. 0 ) then
237 stop ' stopped in optim_numbmod'
238 endif
239
240 do while ( .true. )
241 read(modeldataunit, fmt='(a)', end=22) record
242 il = max(ilnblnk(record),1)
243 if ( record(1:1) .ne. commentcharacter )
244 & write(unit=scrunit1, fmt='(a)') record(:il)
245 enddo
246 22 continue
247 close( modeldataunit )
248
249 rewind( scrunit1 )
250 read(unit = scrunit1, nml = optim)
251 close( scrunit1 )
252 print*, ' OPTIM_NUMBMOD: Minimization options have been read.'
253
254 if (eps .gt. 0.0) then
255 epsf = eps
256 epsx = eps
257 epsg = eps
258 endif
259
260 lheaderonly = .true.
261 call optim_readdata ( nn, ctrlname, lheaderonly, ff, vv)
262
263 c-- Do some final printout.
264 print*
265 print*, ' OPTIM_NUMBMOD: Iteration number = ', optimcycle
266 print*, ' number of control variables = ', nn
267 print*, ' Data will be read from the following files:'
268 print*
269
270 ce --> data.err file in case dimensional i/o is used.
271 ce --> scaling file in case dimensional i/o is used.
272
273 return
274 end

  ViewVC Help
Powered by ViewVC 1.1.22