/[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.2 - (hide annotations) (download)
Fri Nov 15 04:03:25 2002 UTC (21 years, 5 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint51k_post, checkpoint47e_post, checkpoint47c_post, checkpoint50c_post, checkpoint48e_post, checkpoint50c_pre, checkpoint51o_pre, checkpoint51l_post, checkpoint48i_post, checkpoint50d_pre, checkpoint51, checkpoint50, checkpoint50d_post, checkpoint50b_pre, checkpoint51f_post, checkpoint48b_post, checkpoint51d_post, checkpoint48c_pre, checkpoint47d_pre, checkpoint51t_post, checkpoint51n_post, checkpoint51s_post, checkpoint47a_post, checkpoint48d_pre, checkpoint51j_post, checkpoint47i_post, checkpoint51n_pre, checkpoint47d_post, checkpoint48d_post, checkpoint48f_post, checkpoint51l_pre, checkpoint48h_post, checkpoint51q_post, checkpoint51b_pre, checkpoint47g_post, checkpoint51h_pre, checkpoint48a_post, checkpoint50f_post, checkpoint50a_post, checkpoint50f_pre, checkpoint47j_post, branch-exfmods-tag, branchpoint-genmake2, checkpoint51r_post, checkpoint48c_post, checkpoint51i_post, checkpoint51b_post, checkpoint51c_post, checkpoint47b_post, checkpoint50g_post, checkpoint50h_post, checkpoint50e_pre, checkpoint50i_post, checkpoint51i_pre, checkpoint47f_post, checkpoint50e_post, checkpoint51e_post, checkpoint47, checkpoint48, checkpoint49, checkpoint51o_post, checkpoint51f_pre, checkpoint48g_post, checkpoint47h_post, checkpoint51g_post, checkpoint50b_post, checkpoint51m_post, checkpoint51a_post, checkpoint51p_post
Branch point for: branch-exfmods-curt, branch-genmake2, branch-nonh, tg2-branch, checkpoint51n_branch
Changes since 1.1: +245 -0 lines
o Incorporating QNVS line search routines into MITgcm
  (this is separate code, not compiled with MITgcm,
  and therefore not under pkg)
  - lsopt/
  - optim/

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     c release's 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     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    
152     modeldataunit = 14
153     scrunit1 = 11
154    
155     c-- Read ecco parameters from file.
156     open(unit=scrunit1,status='scratch')
157    
158     open(unit = modeldataunit,file = 'data.ecco',
159     & status = 'old', iostat = errio)
160     if ( errio .lt. 0 ) then
161     stop ' stopped in optim_numbmod'
162     endif
163    
164     do while ( .true. )
165     read(modeldataunit, fmt='(a)', end=20) record
166     il = max(ilnblnk(record),1)
167     if ( record(1:1) .ne. commentcharacter )
168     & write(unit=scrunit1, fmt='(a)') record(:il)
169     enddo
170     20 continue
171     close( modeldataunit )
172    
173     rewind( scrunit1 )
174     read(unit = scrunit1, nml = ecco_parms)
175     close( scrunit1 )
176     print*, ' OPTIM_NUMBMOD: ECCO options have been read.'
177    
178     c-- Read control parameters from file.
179     open(unit=scrunit1,status='scratch')
180    
181     open(unit = modeldataunit,file = 'data.ctrl',
182     & status = 'old', iostat = errio)
183     if ( errio .lt. 0 ) then
184     stop ' stopped in optim_numbmod'
185     endif
186    
187     do while ( .true. )
188     read(modeldataunit, fmt='(a)', end=21) record
189     il = max(ilnblnk(record),1)
190     if ( record(1:1) .ne. commentcharacter )
191     & write(unit=scrunit1, fmt='(a)') record(:il)
192     enddo
193     21 continue
194     close( modeldataunit )
195    
196     rewind( scrunit1 )
197     read(unit = scrunit1, nml = ctrl_nml)
198     read(unit = scrunit1, nml = ctrl_packnames)
199     close( scrunit1 )
200     print*, ' OPTIM_NUMBMOD: Control options have been read.'
201    
202     c-- Read optimization parameters from file.
203     open(unit=scrunit1,status='scratch')
204    
205     open(unit = modeldataunit,file = 'data.optim',
206     & status = 'old', iostat = errio)
207     if ( errio .lt. 0 ) then
208     stop ' stopped in optim_numbmod'
209     endif
210    
211     do while ( .true. )
212     read(modeldataunit, fmt='(a)', end=22) record
213     il = max(ilnblnk(record),1)
214     if ( record(1:1) .ne. commentcharacter )
215     & write(unit=scrunit1, fmt='(a)') record(:il)
216     enddo
217     22 continue
218     close( modeldataunit )
219    
220     rewind( scrunit1 )
221     read(unit = scrunit1, nml = ecco_optim)
222     close( scrunit1 )
223     print*, ' OPTIM_NUMBMOD: Minimization options have been read.'
224    
225     if (eps .gt. 0.0) then
226     epsf = eps
227     epsx = eps
228     epsg = eps
229     endif
230    
231     lheaderonly = .true.
232     call optim_readdata ( nn, ctrlname, lheaderonly, ff, vv)
233    
234     c-- Do some final printout.
235     print*
236     print*, ' OPTIM_NUMBMOD: Iteration number = ', optimcycle
237     print*, ' number of control variables = ', nn
238     print*, ' Data will be read from the following files:'
239     print*
240    
241     ce --> data.err file in case dimensional i/o is used.
242     ce --> scaling file in case dimensional i/o is used.
243    
244     return
245     end

  ViewVC Help
Powered by ViewVC 1.1.22