Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:37:13 UTC

view on githubraw file Latest commit 4cee17c1 on 2002-11-15 04:03:25 UTC
4cee17c1be Patr*0001 
                0002 c     ==================================================================
                0003 c
                0004 c     prgopti.F: Routines for doing an off-line optimization after the
                0005 c                ECCO forward and adjoint model have been run.
                0006 c
                0007 c     main     - Driver routine.
                0008 c     opti     - Mid-level routine to do the spin up and spin down.
                0009 c     optimum  - Routine that calls the minimization.
                0010 c
                0011 c     Documentation:
                0012 c
                0013 c     The collection of these routines originated mainly from Ralf
                0014 c     Giering. Patrick Heimbach improved and corrected considerable
                0015 c     parts of the original code. Christian Eckert contributed the
                0016 c     interface to the ECCO release of the MITgcmUV in order to get
                0017 c     the offline version going.
                0018 c
                0019 c     How to use the off-line optimization.
                0020 c
                0021 c       Doing an off-line optimization means that one alternately
                0022 c       calls the adjoint model and the optimization routines.
                0023 c
                0024 c       The adjoint model yields at iteration i the cost function
                0025 c       value and the gradient of the cost function with respect to
                0026 c       the control variables. The optimization routines then use
                0027 c       this information to reduce the cost function and give a
                0028 c       new estimate of the control variables which can then be used
                0029 c       in the next cycle to yield a new cost function and the
                0030 c       corresponding gradient.
                0031 c
                0032 c     started:  Ralf Giering      (lsoptv1)
                0033 c
                0034 c               Patrick Heimbach  heimbach@mit.edu  28-Feb-2000
                0035 c
                0036 c               - Corrected and restructured the original lsoptv1
                0037 c                 code.
                0038 c
                0039 c               Christian Eckert  eckert@mit.edu    15-Feb-2000
                0040 c
                0041 c               - Off-line capability and some cosmetic changes
                0042 c                 of the optimization wrapper.
                0043 c
                0044 c     changed:
                0045 c
                0046 c     ==================================================================
                0047 
                0048 
                0049       program optim_main
                0050 
                0051 c     ==================================================================
                0052 c     PROGRAM optim_main
                0053 c     ==================================================================
                0054 c
                0055 c     o Driver routine for the ECCO optimization package.
                0056 c
                0057 c     started: Christian Eckert eckert@mit.edu 15-Feb-2000
                0058 c
                0059 c     changed: Christian Eckert eckert@mit.edu 10-Mar-2000
                0060 c
                0061 c              - Added ECCO layout.
                0062 c
                0063 c     ==================================================================
                0064 c     SUBROUTINE
                0065 c     ==================================================================
                0066 
                0067       implicit none
                0068 
                0069 c     == global variables ==
                0070 
                0071 #include "blas1.h"
                0072 
                0073 c     == routine arguments ==
                0074 
                0075 c     == local variables ==
                0076 
                0077       integer nn
                0078 
                0079 c     == end of interface ==
                0080 
                0081 c--   Headline.
                0082       print*
                0083       print*,' =================================================='
                0084       print*,' Large Scale Optimization with off-line capability.'
                0085       print*,' =================================================='
                0086       print*
                0087       print*,'                Version 2.1.0'
                0088       print*
                0089 
                0090 c--   Get the number of control variables.
                0091       call optim_numbmod( nn )
                0092 
                0093 cph(
                0094       print *, 'pathei: vor optim_sub'
                0095 cph)
                0096 c--   Call the subroutine.
                0097       call optim_sub( nn )
                0098 
                0099 c--   Succesful termination.
                0100       print*
                0101       print*,' ======================================'
                0102       print*,' Large Scale Optimization run finished.'
                0103       print*,' ======================================'
                0104       print*
                0105 
                0106       end
                0107 
                0108 CStartOfInterface
                0109       INTEGER FUNCTION IFNBLNK( string )
                0110 C     /==========================================================\
                0111 C     | FUNCTION IFNBLNK                                         |
                0112 C     | o Find first non-blank in character string.              |
                0113 C     \==========================================================/
                0114       IMPLICIT NONE
                0115 C
                0116       CHARACTER*(*) string
                0117 CEndOfInterface
                0118 C
                0119       INTEGER L, LS
                0120 C
                0121       LS     = LEN(string)
                0122       IFNBLNK = 0
                0123       DO 10 L = 1, LS
                0124        IF ( string(L:L) .EQ. ' ' ) GOTO 10
                0125         IFNBLNK = L
                0126         GOTO 11
                0127    10 CONTINUE
                0128    11 CONTINUE
                0129 C
                0130       RETURN
                0131       END
                0132 
                0133 CStartOfInterface
                0134       INTEGER FUNCTION ILNBLNK( string )
                0135 C     /==========================================================\
                0136 C     | FUNCTION ILNBLNK                                         |
                0137 C     | o Find last non-blank in character string.               |
                0138 C     \==========================================================/
                0139       IMPLICIT NONE
                0140       CHARACTER*(*) string
                0141 CEndOfInterface
                0142       INTEGER L, LS
                0143 C
                0144       LS      = LEN(string)
                0145       ILNBLNK = LS
                0146       DO 10 L = LS, 1, -1
                0147         IF ( string(L:L) .EQ. ' ' ) GOTO 10
                0148          ILNBLNK = L
                0149          GOTO 11
                0150    10 CONTINUE
                0151    11 CONTINUE
                0152 C
                0153       RETURN
                0154       END
                0155