/[MITgcm]/MITgcm_contrib/mlosch/optim_m1qn3/optim_readparms.F
ViewVC logotype

Diff of /MITgcm_contrib/mlosch/optim_m1qn3/optim_readparms.F

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

revision 1.7 by mlosch, Wed May 9 18:33:38 2012 UTC revision 1.10 by mlosch, Tue Jun 2 16:17:08 2015 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2  C $Name$  C $Name$
3    
4  c     Include ECCO_CPPOPTIONS because the ecco_ctrl,cost files  C     ECCO_CPPOPTIONS used to affect maxcvars and defined ALLOW_OBCS?_CONTROL
5  c     have headers with options for OBCS masks.  C#include "ECCO_CPPOPTIONS.h"
6  #include "ECCO_CPPOPTIONS.h"  C     now:
7    C     CTRL_OPTIONS affects maxcvars and may define ALLOW_OBCS?_CONTROL
8    #include "CTRL_OPTIONS.h"
9    
10        subroutine optim_readparms(        subroutine optim_readparms(
11       O                    nn, ff       O                    nn, ff
# Line 85  c--   Preset the optimization parameters Line 87  c--   Preset the optimization parameters
87        ff         = 0.        ff         = 0.
88  cdfer      expId      = 'MIT_CE_000'  cdfer      expId      = 'MIT_CE_000'
89        yctrlid    = 'MIT_CE_000'        yctrlid    = 'MIT_CE_000'
90          yctrlposunpack      = '.opt'
91          yctrlpospack        = '.opt'
92          ctrlname            = 'ecco_ctrl'
93          costname            = 'ecco_cost'
94          scalname            = ' '
95          maskname            = ' '
96          metaname            = ' '
97        coldStart  = .false.        coldStart  = .false.
98    
99        modeldataunit = 14        modeldataunit = 14
# Line 142  c--   Read optimization parameters from Line 151  c--   Read optimization parameters from
151          epsx = eps          epsx = eps
152          epsg = eps          epsg = eps
153        endif        endif
154    c     always force cold start for the 0th cycle
155          if ( optimcycle .eq. 0 ) coldStart=.true.
156    
157        call optim_readdata ( nn, ctrlname, .true., ff, vv)  c     read header from costname rather than ctrlname, because the
158    c     cost function value in costname is what we need, ctrlname only
159    c     contains a valid cost function value for the 0th iteration
160          call optim_readdata ( nn, costname, .true., ff, vv)
161                
162        if ( dfminFrac.lt.0.0 .or. dfminFrac.ge.1.0) then        if ( dfminFrac.lt.0.0 .or. dfminFrac.ge.1.0) then
163         print*, ' OPTIM_READPARMS: dfminFrac = ', dfminFrac,         print*, ' OPTIM_READPARMS: dfminFrac = ', dfminFrac,
# Line 152  c--   Read optimization parameters from Line 166  c--   Read optimization parameters from
166        endif        endif
167        if ( dfminFrac.ne.0.0 ) dfminFrac = 1.0 - dfminFrac        if ( dfminFrac.ne.0.0 ) dfminFrac = 1.0 - dfminFrac
168        if ( fmin.eq.UNSET_RL ) then        if ( fmin.eq.UNSET_RL ) then
169         if ( optimcycle .eq. 0 ) then         if ( coldStart ) then
170  c     only in this case does ff contain the actual cost function value  c     only in this case does ff contain the actual cost function value
171          fmin = dfminFrac*ff          fmin = dfminFrac*ff
172         else         else
# Line 160  c     otherwise we (ab-)use the file ctr Line 174  c     otherwise we (ab-)use the file ctr
174          fmin = ff          fmin = ff
175         endif         endif
176        endif        endif
177        if ( optimcycle.eq.0 ) then        if ( coldStart ) then
178         if ( fmin.le.0.0 ) then         if ( fmin.le.0.0 ) then
179          print '(A,E12.6,A)', ' OPTIM_READPARMS: fmin = ', fmin,          print '(A,E12.6,A)', ' OPTIM_READPARMS: fmin = ', fmin,
180       &       ' should be > 0'       &       ' should be > 0'
# Line 178  c--   Do some final printout. Line 192  c--   Do some final printout.
192        print*, ' OPTIM_READPARMS: Iteration number = ', optimcycle        print*, ' OPTIM_READPARMS: Iteration number = ', optimcycle
193        print*, ' number of control variables       = ', nn        print*, ' number of control variables       = ', nn
194        print*, ' cost function value in ', ctrlname, '  = ', ff        print*, ' cost function value in ', ctrlname, '  = ', ff
195          if ( coldStart ) then
196           print*, ' expected cost function minimum    = ', fmin
197           print*, ' expected cost function decrease   = ', ff-fmin
198          endif
199        print '(a,4a,i4.4)',        print '(a,4a,i4.4)',
200       &        ' Data will be read from the following file: ',       &        ' Data will be read from the following file: ',
201       &     ctrlname,'_',yctrlid(1:10),'.opt', optimcycle       &     ctrlname,'_',yctrlid(1:10),'.opt', optimcycle

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.22