Back to home page

MITgcm

 
 

    


File indexing completed on 2023-05-28 05:10:06 UTC

view on githubraw file Latest commit b4daa243 on 2023-05-28 03:53:22 UTC
5ed655852f Jean*0001 #include "COST_OPTIONS.h"
a40c19bc02 Patr*0002 
b4daa24319 Shre*0003       subroutine cost_dependent_init( myThid )
a40c19bc02 Patr*0004 
                0005 c     ==================================================================
                0006 c     SUBROUTINE cost_dependent_init
                0007 c     ==================================================================
                0008 c
                0009 c     o Initialise the variable ad cost function part.
                0010 c
                0011 c     started: heimbach@mit.edu 17-Jan-2002
                0012 c
                0013 c     ==================================================================
                0014 c     SUBROUTINE cost_dependent_init
                0015 c     ==================================================================
                0016 
b4daa24319 Shre*0017       IMPLICIT NONE
a40c19bc02 Patr*0018 
                0019 c     == global variables ==
                0020 #include "EEPARAMS.h"
                0021 #include "SIZE.h"
                0022 #include "cost.h"
                0023 #include "adcost.h"
b4daa24319 Shre*0024 #ifdef ALLOW_TAPENADE
                0025 # include "COST_TAP_ADJ.h"
                0026 #endif
a40c19bc02 Patr*0027 
                0028 c     == routine arguments ==
b4daa24319 Shre*0029       integer myThid
a40c19bc02 Patr*0030 
                0031 c     == local variables ==
9f5240b52a Jean*0032 #if ( defined ALLOW_COST_VECTOR || defined  ALLOW_COST_STATE_FINAL )
                0033       integer i
                0034 #endif
                0035 #ifdef ALLOW_COST_STATE_FINAL
                0036       integer j, k
                0037 #endif
a40c19bc02 Patr*0038       integer bi,bj
                0039 c     == end of interface ==
                0040 
092f11c7ee Jean*0041 #ifdef ALLOW_OPENAD
60e3924f90 Patr*0042       fc%v = 0.0
                0043 #else
47717436a5 Patr*0044       fc   = 0. _d 0
60e3924f90 Patr*0045 #endif
a40c19bc02 Patr*0046 
edd57506ae Patr*0047 #ifdef ALLOW_AUTODIFF
a40c19bc02 Patr*0048 
b4daa24319 Shre*0049 #ifdef ALLOW_TAPENADE
                0050       fcb = 1.0
                0051 #endif
                0052 
092f11c7ee Jean*0053 #ifdef ALLOW_OPENAD
60e3924f90 Patr*0054       adfc = 1.0
                0055 #else
47717436a5 Patr*0056       if ( myProcId .EQ. 0 ) then
                0057        adfc = 1. _d 0
                0058       endif
60e3924f90 Patr*0059 #endif
1826cda3a0 Patr*0060 
b4daa24319 Shre*0061       do bj = myByLo(myThid), myByHi(myThid)
                0062        do bi = myBxLo(myThid), myBxHi(myThid)
a40c19bc02 Patr*0063 #ifdef ALLOW_COST_VECTOR
b4daa24319 Shre*0064          do i=1,sNx
                0065           objf_vector(i,bi,bj) = 0. _d 0
                0066           adobjf_vector(i,bi,bj) = 1. _d 0
                0067          enddo
9eb96e5404 Patr*0068 #endif
                0069 #ifdef ALLOW_COST_STATE_FINAL
b4daa24319 Shre*0070          do k=1,4*Nr+1
                0071           do j=1,sNy
                0072            do i=1,sNx
f8659cb5d2 Patr*0073             objf_state_final(i,j,bi,bj,k) = 0. _d 0
                0074            enddo
b4daa24319 Shre*0075           enddo
                0076          enddo
9eb96e5404 Patr*0077 cph No init. of cost_state_final here,
                0078 cph because we need it in ADM*TLM
a40c19bc02 Patr*0079 #endif
b4daa24319 Shre*0080        enddo
a40c19bc02 Patr*0081       enddo
                0082 
edd57506ae Patr*0083 #endif /* ALLOW_AUTODIFF */
a40c19bc02 Patr*0084 
                0085       return
                0086       end