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

Annotation of /MITgcm/optim/optim_numbmod.F

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


Revision 1.5 - (hide annotations) (download)
Tue Jan 25 04:42:21 2005 UTC (19 years, 3 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint57m_post, checkpoint57g_pre, checkpoint57g_post, checkpoint57d_post, checkpoint57i_post, checkpoint57n_post, checkpoint57l_post, checkpoint57f_post, checkpoint57h_pre, checkpoint57h_post, checkpoint57c_post, checkpoint57c_pre, checkpoint57e_post, checkpoint57p_post, checkpoint57q_post, eckpoint57e_pre, checkpoint57h_done, checkpoint57j_post, checkpoint57f_pre, checkpoint57o_post, checkpoint57k_post
Changes since 1.4: +12 -30 lines
Namelists were out-of-date w.r.t. MITgcm packages.

1 heimbach 1.2
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 heimbach 1.3 c release output. The off-line version can, of course, only
33 heimbach 1.2 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     external ilnblnk
111    
112     c == end of interface ==
113    
114     namelist /CTRL_NML/
115     & xx_theta_file,
116     & xx_salt_file,
117     & xx_hflux_file,
118     & xx_hfluxstartdate1, xx_hfluxstartdate2, xx_hfluxperiod,
119     & xx_sflux_file,
120     & xx_sfluxstartdate1, xx_sfluxstartdate2, xx_sfluxperiod,
121     & xx_tauu_file,
122     & xx_tauustartdate1, xx_tauustartdate2, xx_tauuperiod,
123     & xx_tauv_file,
124 mlosch 1.4 & xx_tauvstartdate1, xx_tauvstartdate2, xx_tauvperiod,
125     & xx_atemp_file,
126     & xx_atempstartdate1, xx_atempstartdate2, xx_atempperiod,
127     & xx_aqh_file,
128     & xx_aqhstartdate1, xx_aqhstartdate2, xx_aqhperiod,
129     & xx_uwind_file,
130     & xx_uwindstartdate1, xx_uwindstartdate2, xx_uwindperiod,
131     & xx_vwind_file,
132     & xx_vwindstartdate1, xx_vwindstartdate2, xx_vwindperiod,
133     & xx_obcsn_file,
134     & xx_obcsnstartdate1, xx_obcsnstartdate2, xx_obcsnperiod,
135     & xx_obcss_file,
136     & xx_obcssstartdate1, xx_obcssstartdate2, xx_obcssperiod,
137     & xx_obcsw_file,
138     & xx_obcswstartdate1, xx_obcswstartdate2, xx_obcswperiod,
139     & xx_obcse_file,
140     & xx_obcsestartdate1, xx_obcsestartdate2, xx_obcseperiod,
141     & xx_diffkr_file,
142     & xx_kapgm_file,
143     & xx_tr1_file,
144     & xx_sst_file,
145     & xx_sss_file,
146     & xx_hfacc_file,
147     & xx_efluxy_file,
148     & xx_efluxp_file,
149     & xx_bottomdrag_file,
150 heimbach 1.5 & doInitXX,
151     & doPackDiag,
152     & doZscaleUnpack,
153     & doZscalePack
154 heimbach 1.2
155     namelist /CTRL_PACKNAMES/
156 heimbach 1.5 & yadmark, yctrlid, yctrlposunpack, yctrlpospack,
157 heimbach 1.2 & ctrlname, costname, scalname, maskname, metaname
158    
159 heimbach 1.5 namelist /OPTIM/
160 heimbach 1.2 & optimcycle,
161     & numiter, nfunc, fmin, iprint,
162     & epsf, epsx, epsg,
163     & nupdate, eps
164    
165     c-- Preset the optimization parameters.
166     optimcycle = 0
167     nvars = 0
168     numiter = 1
169     nfunc = 1
170     fmin = 0.0
171     iprint = 10
172     epsx = 1.e-6
173     epsg = 1.e-6
174     eps = -1.e-6
175     nupdate = 1
176     ff = 0.
177 heimbach 1.3 expId = 'MIT_CE_000'
178 heimbach 1.5 yctrlid = expId
179 heimbach 1.2
180     modeldataunit = 14
181     scrunit1 = 11
182    
183     c-- Read control parameters from file.
184     open(unit=scrunit1,status='scratch')
185    
186     open(unit = modeldataunit,file = 'data.ctrl',
187     & status = 'old', iostat = errio)
188     if ( errio .lt. 0 ) then
189     stop ' stopped in optim_numbmod'
190     endif
191    
192     do while ( .true. )
193     read(modeldataunit, fmt='(a)', end=21) record
194     il = max(ilnblnk(record),1)
195     if ( record(1:1) .ne. commentcharacter )
196     & write(unit=scrunit1, fmt='(a)') record(:il)
197     enddo
198     21 continue
199     close( modeldataunit )
200    
201     rewind( scrunit1 )
202     read(unit = scrunit1, nml = ctrl_nml)
203     read(unit = scrunit1, nml = ctrl_packnames)
204     close( scrunit1 )
205     print*, ' OPTIM_NUMBMOD: Control options have been read.'
206    
207 heimbach 1.5 cph(
208     expId = yctrlid
209     cph)
210    
211 heimbach 1.2 c-- Read optimization parameters from file.
212     open(unit=scrunit1,status='scratch')
213    
214     open(unit = modeldataunit,file = 'data.optim',
215     & status = 'old', iostat = errio)
216     if ( errio .lt. 0 ) then
217     stop ' stopped in optim_numbmod'
218     endif
219    
220     do while ( .true. )
221     read(modeldataunit, fmt='(a)', end=22) record
222     il = max(ilnblnk(record),1)
223     if ( record(1:1) .ne. commentcharacter )
224     & write(unit=scrunit1, fmt='(a)') record(:il)
225     enddo
226     22 continue
227     close( modeldataunit )
228    
229     rewind( scrunit1 )
230 heimbach 1.5 read(unit = scrunit1, nml = optim)
231 heimbach 1.2 close( scrunit1 )
232     print*, ' OPTIM_NUMBMOD: Minimization options have been read.'
233    
234     if (eps .gt. 0.0) then
235     epsf = eps
236     epsx = eps
237     epsg = eps
238     endif
239    
240     lheaderonly = .true.
241     call optim_readdata ( nn, ctrlname, lheaderonly, ff, vv)
242    
243     c-- Do some final printout.
244     print*
245     print*, ' OPTIM_NUMBMOD: Iteration number = ', optimcycle
246     print*, ' number of control variables = ', nn
247     print*, ' Data will be read from the following files:'
248     print*
249    
250     ce --> data.err file in case dimensional i/o is used.
251     ce --> scaling file in case dimensional i/o is used.
252    
253     return
254     end

  ViewVC Help
Powered by ViewVC 1.1.22