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

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

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

revision 1.1 by mlosch, Thu Apr 26 11:10:06 2012 UTC revision 1.3 by mlosch, Mon May 7 12:07:09 2012 UTC
# Line 48  c     == local variables == Line 48  c     == local variables ==
48    
49        _RL   objf        _RL   objf
50    
51  #if defined (DYNAMIC)  #ifdef DYNAMIC
52        _RL   xx(nn)        _RL, dimension(:), allocatable :: xx, adxx
       _RL   adxx(nn)  
 #elif defined (USE_POINTER) || (MAX_INDEPEND == 0)  
       _RL   xx  
       _RL   adxx  
       pointer (pxx,xx(1))  
       pointer (padxx,adxx(1))  
53  #else  #else
54        integer nmax        integer nmax
55        parameter( nmax = MAX_INDEPEND )        parameter( nmax = MAX_INDEPEND )
# Line 63  c     == local variables == Line 57  c     == local variables ==
57        _RL   adxx(nmax)        _RL   adxx(nmax)
58  #endif  #endif
59    
60          logical coldStart
61  c     formal parameters of m1qn3  c     formal parameters of m1qn3
62        integer reverse        integer reverse
63        integer impres,imode(3),omode,niter,nsim,iz(5),indic        integer impres,imode(3),omode,niter,nsim,iz(5),indic
64        _RL dxmin,df1        _RL dxmin,df1
65        character*3 normtype        character*3 normtype
66  c     work arrays  c     work arrays
67        integer ndz, mupdate        integer ndz
68  CML      _RL dz(ndz)  CML      _RL dz(ndz)
69        double precision, dimension(:), allocatable :: dz        double precision, dimension(:), allocatable :: dz
70  c     extra dummy variables  c     extra dummy variables
# Line 90  c     == end of interface == Line 85  c     == end of interface ==
85    
86  c--   Allocate memory for the control variables and the gradient vector.  c--   Allocate memory for the control variables and the gradient vector.
87  #if defined(DYNAMIC)  #if defined(DYNAMIC)
88  #elif defined(USE_POINTER) || (MAX_INDEPEND == 0)        allocate(   xx(nn) )
89        call myalloc( pxx  ,  nn*REAL_BYTE )        allocate( adxx(nn) )
       call myalloc( padxx,  nn*REAL_BYTE )  
90  #endif  #endif
91    
92  #if defined (DYNAMIC)  #ifndef DYNAMIC
 #elif defined(USE_POINTER) || (MAX_INDEPEND == 0)  
 #else  
93        if (nn .gt. nmax) then        if (nn .gt. nmax) then
94          print*,' OPTIMUM: Not enough space.'          print*,' OPTIMUM: Not enough space.'
95          print*,'          nmax = ',nmax          print*,'          nmax = ',nmax
# Line 146  c     initialise the dummy arguments tha Line 138  c     initialise the dummy arguments tha
138        rzs(1)=UNSET_RS        rzs(1)=UNSET_RS
139        dzs(1)=UNSET_RL        dzs(1)=UNSET_RL
140    
141        if ( optimcycle .eq. 0 ) then        coldStart=.false.
142          if ( optimcycle .eq. 0 ) coldStart=.true.
143          if ( coldStart ) then
144  c--   cold start  c--   cold start
145         print *, ' OPTIM_SUB: cold start, optimcycle =', optimcycle         print *, ' OPTIM_SUB: cold start, optimcycle =', optimcycle
146         imode(2) = 0         imode(2) = 0
# Line 213  c     mistakes it for the real one Line 207  c     mistakes it for the real one
207        call optim_writedata( nn, ctrlname, .false., -9999., xx )        call optim_writedata( nn, ctrlname, .false., -9999., xx )
208    
209  c     clean up  c     clean up
210    #ifdef DYNAMIC
211          deallocate(xx, adxx)
212    #endif /* DYNAMIC */
213        deallocate(dz)        deallocate(dz)
214    
215  c     stopping criterion  c     stopping criterion

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.22