Back to home page

darwin3

 
 

    


File indexing completed on 2025-11-15 13:23:56 UTC

view on githubraw file Latest commit 9f36e8d6 on 2025-11-10 06:46:30 UTC
5ed655852f Jean*0001 #include "COST_OPTIONS.h"
a40c19bc02 Patr*0002 
9f36e8d635 Jean*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 ==
9f36e8d635 Jean*0029       INTEGER myThid
a40c19bc02 Patr*0030 
                0031 c     == local variables ==
9f5240b52a Jean*0032 #if ( defined ALLOW_COST_VECTOR || defined  ALLOW_COST_STATE_FINAL )
9f36e8d635 Jean*0033       INTEGER i
9f5240b52a Jean*0034 #endif
                0035 #ifdef ALLOW_COST_STATE_FINAL
9f36e8d635 Jean*0036       INTEGER j, k
9f5240b52a Jean*0037 #endif
9f36e8d635 Jean*0038       INTEGER bi,bj
a40c19bc02 Patr*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
9f36e8d635 Jean*0050       fcb = 0. _d 0
                0051       IF ( myProcId .EQ. 0 ) fcb = 1. _d 0
b4daa24319 Shre*0052 #endif
                0053 
092f11c7ee Jean*0054 #ifdef ALLOW_OPENAD
60e3924f90 Patr*0055       adfc = 1.0
                0056 #else
9f36e8d635 Jean*0057       adfc = 0. _d 0
                0058       IF ( myProcId .EQ. 0 ) adfc = 1. _d 0
60e3924f90 Patr*0059 #endif
1826cda3a0 Patr*0060 
9f36e8d635 Jean*0061       DO bj = myByLo(myThid), myByHi(myThid)
                0062        DO bi = myBxLo(myThid), myBxHi(myThid)
a40c19bc02 Patr*0063 #ifdef ALLOW_COST_VECTOR
9f36e8d635 Jean*0064          DO i=1,sNx
b4daa24319 Shre*0065           objf_vector(i,bi,bj) = 0. _d 0
                0066           adobjf_vector(i,bi,bj) = 1. _d 0
9f36e8d635 Jean*0067          ENDDO
9eb96e5404 Patr*0068 #endif
                0069 #ifdef ALLOW_COST_STATE_FINAL
9f36e8d635 Jean*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
9f36e8d635 Jean*0074            ENDDO
                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
9f36e8d635 Jean*0080        ENDDO
                0081       ENDDO
a40c19bc02 Patr*0082 
edd57506ae Patr*0083 #endif /* ALLOW_AUTODIFF */
a40c19bc02 Patr*0084 
9f36e8d635 Jean*0085       RETURN
                0086       END