/[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.1.2.2 - (hide annotations) (download)
Wed May 28 21:53:58 2003 UTC (20 years, 11 months ago) by heimbach
Branch: ecco-branch
CVS Tags: ecco_c50_e32, ecco_c50_e33, ecco_c51_e34d, ecco_c51_e34e, ecco_c51_e34f, ecco_c51_e34g, ecco_c51_e34a, ecco_c51_e34b, ecco_c51_e34c, ecco_c50_e33a, ecco_c51_e34
Changes since 1.1.2.1: +2 -1 lines
a first minuscule step towards cleaning up lsopt/ optim/

1 heimbach 1.1.2.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 heimbach 1.1.2.2 c release output. The off-line version can, of course, only
33 heimbach 1.1.2.1 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     & xx_tauvstartdate1, xx_tauvstartdate2, xx_tauvperiod
125    
126     namelist /CTRL_PACKNAMES/
127     & yadmark,
128     & ctrlname, costname, scalname, maskname, metaname
129    
130     namelist /ECCO_PARMS/
131     & expId
132    
133     namelist /ECCO_OPTIM/
134     & optimcycle,
135     & numiter, nfunc, fmin, iprint,
136     & epsf, epsx, epsg,
137     & nupdate, eps
138    
139     c-- Preset the optimization parameters.
140     optimcycle = 0
141     nvars = 0
142     numiter = 1
143     nfunc = 1
144     fmin = 0.0
145     iprint = 10
146     epsx = 1.e-6
147     epsg = 1.e-6
148     eps = -1.e-6
149     nupdate = 1
150     ff = 0.
151 heimbach 1.1.2.2 expId = 'MIT_CE_000'
152 heimbach 1.1.2.1
153     modeldataunit = 14
154     scrunit1 = 11
155    
156     c-- Read ecco parameters from file.
157     open(unit=scrunit1,status='scratch')
158    
159     open(unit = modeldataunit,file = 'data.ecco',
160     & status = 'old', iostat = errio)
161     if ( errio .lt. 0 ) then
162     stop ' stopped in optim_numbmod'
163     endif
164    
165     do while ( .true. )
166     read(modeldataunit, fmt='(a)', end=20) record
167     il = max(ilnblnk(record),1)
168     if ( record(1:1) .ne. commentcharacter )
169     & write(unit=scrunit1, fmt='(a)') record(:il)
170     enddo
171     20 continue
172     close( modeldataunit )
173    
174     rewind( scrunit1 )
175     read(unit = scrunit1, nml = ecco_parms)
176     close( scrunit1 )
177     print*, ' OPTIM_NUMBMOD: ECCO options have been read.'
178    
179     c-- Read control parameters from file.
180     open(unit=scrunit1,status='scratch')
181    
182     open(unit = modeldataunit,file = 'data.ctrl',
183     & status = 'old', iostat = errio)
184     if ( errio .lt. 0 ) then
185     stop ' stopped in optim_numbmod'
186     endif
187    
188     do while ( .true. )
189     read(modeldataunit, fmt='(a)', end=21) record
190     il = max(ilnblnk(record),1)
191     if ( record(1:1) .ne. commentcharacter )
192     & write(unit=scrunit1, fmt='(a)') record(:il)
193     enddo
194     21 continue
195     close( modeldataunit )
196    
197     rewind( scrunit1 )
198     read(unit = scrunit1, nml = ctrl_nml)
199     read(unit = scrunit1, nml = ctrl_packnames)
200     close( scrunit1 )
201     print*, ' OPTIM_NUMBMOD: Control options have been read.'
202    
203     c-- Read optimization parameters from file.
204     open(unit=scrunit1,status='scratch')
205    
206     open(unit = modeldataunit,file = 'data.optim',
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=22) 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     22 continue
219     close( modeldataunit )
220    
221     rewind( scrunit1 )
222     read(unit = scrunit1, nml = ecco_optim)
223     close( scrunit1 )
224     print*, ' OPTIM_NUMBMOD: Minimization options have been read.'
225    
226     if (eps .gt. 0.0) then
227     epsf = eps
228     epsx = eps
229     epsg = eps
230     endif
231    
232     lheaderonly = .true.
233     call optim_readdata ( nn, ctrlname, lheaderonly, ff, vv)
234    
235     c-- Do some final printout.
236     print*
237     print*, ' OPTIM_NUMBMOD: Iteration number = ', optimcycle
238     print*, ' number of control variables = ', nn
239     print*, ' Data will be read from the following files:'
240     print*
241    
242     ce --> data.err file in case dimensional i/o is used.
243     ce --> scaling file in case dimensional i/o is used.
244    
245     return
246     end

  ViewVC Help
Powered by ViewVC 1.1.22