/[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.6 - (show annotations) (download)
Wed Sep 7 14:59:00 2005 UTC (15 years, 11 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint57s_post, checkpoint58b_post, checkpoint57y_post, checkpoint57r_post, checkpoint58, checkpoint58f_post, checkpoint58d_post, checkpoint58a_post, checkpoint57z_post, checkpoint58m_post, checkpoint57t_post, checkpoint57v_post, checkpoint57y_pre, checkpoint58o_post, checkpoint58p_post, checkpoint58q_post, checkpoint58e_post, checkpoint58r_post, checkpoint58n_post, checkpint57u_post, checkpoint58k_post, checkpoint58l_post, checkpoint58g_post, checkpoint58h_post, checkpoint58j_post, checkpoint57w_post, checkpoint58i_post, checkpoint57x_post, checkpoint58c_post, checkpoint58s_post
Changes since 1.5: +13 -1 lines
Bring namelist up-to-date with ctrl_readparms.F

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

  ViewVC Help
Powered by ViewVC 1.1.22