Back to home page

MITgcm

 
 

    


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

view on githubraw file Latest commit b4daa243 on 2023-05-28 03:53:22 UTC
b4daa24319 Shre*0001 #include "CPP_EEOPTIONS.h"
                0002 C--   File active_write_tap.F: Active write with Tapenade.
                0003 C--    Contents:
                0004 C--    o ACTIVE_WRITE_XY_D
                0005 C--    o ACTIVE_WRITE_XYZ_D
                0006 C--    o ACTIVE_WRITE_XY_B
                0007 C--    o ACTIVE_WRITE_XYZ_B
                0008 
                0009 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0010 
                0011 CBOP
                0012 C     !ROUTINE: ACTIVE_WRITE_XY_D
                0013 C     !INTERFACE:
                0014       subroutine ACTIVE_WRITE_XY_D(
                0015      I                            active_var_file,
                0016      I                            active_var,
                0017      I                            active_vard,
                0018      I                            iRec,
                0019      I                            myOptimIter,
                0020      I                            myThid,
                0021      I                            dummy,
                0022      I                            dummyd
                0023      &                          )
                0024 
                0025 C     *==========================================================*
                0026 C     | SUBROUTINE ACTIVE_WRITE_XY_D
                0027 C     | o Forward differentiation of ACTIVE_WRITE_XY.
                0028 C     *==========================================================*
                0029 C     | written by Shreyas Gaikwad, Laurent Hascoet in Nov 2022
                0030 C     *==========================================================*
                0031 C     \ev
                0032 
                0033 C     !USES:
                0034       IMPLICIT NONE
                0035 
                0036 C     == global variables ==
                0037 #include "SIZE.h"
                0038 
                0039 C     !INPUT/OUTPUT PARAMETERS:
                0040 C     active_var_file:: filename
                0041 C     active_var     :: array
                0042 C     active_vard    :: forward derivative of active_var
                0043 C     iRec           :: record number
                0044 C     myOptimIter    :: number of optimization iteration (default: 0)
                0045 C     myThid         :: thread number for this instance
                0046       CHARACTER*(*) active_var_file
                0047       Real*8     active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
                0048       Real*8     active_vard(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
                0049       INTEGER iRec
                0050       INTEGER myOptimIter
                0051       INTEGER myThid
                0052       Real*8     dummy
                0053       Real*8     dummyd
                0054 
                0055 C     !LOCAL VARIABLES:
                0056       CHARACTER*(2) pref
                0057       CHARACTER*(80) fname
                0058       INTEGER myNr
                0059       LOGICAL globalFile
                0060       LOGICAL useCurrentDir
                0061 CEOP
                0062 
                0063       pref = 'g_'
                0064       CALL ADD_PREFIX( pref, active_var_file, fname )
                0065       myNr = 1
                0066       globalFile = .FALSE.
                0067       useCurrentDir = .FALSE.
                0068 
                0069       call active_write_3d_rl(
                0070      &                 active_var_file, active_var, globalFile,
                0071      &                 useCurrentDir, iRec, myNr,
                0072      &                 0, myOptimIter, myThid )
                0073 
                0074       call active_write_3d_rl(
                0075      &                 fname, active_vard, globalFile,
                0076      &                 useCurrentDir, iRec, myNr,
                0077      &                 2, myOptimIter, myThid )
                0078 
                0079       RETURN
                0080       END
                0081 
                0082 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0083 
                0084 CBOP
                0085 C     !ROUTINE: ACTIVE_WRITE_XYZ_D
                0086 C     !INTERFACE:
                0087       subroutine ACTIVE_WRITE_XYZ_D(
                0088      I                            active_var_file,
                0089      I                            active_var,
                0090      I                            active_vard,
                0091      I                            iRec,
                0092      I                            myOptimIter,
                0093      I                            myThid,
                0094      I                            dummy,
                0095      I                            dummyd
                0096      &                          )
                0097 
                0098 C     *==========================================================*
                0099 C     | SUBROUTINE ACTIVE_WRITE_XYZ_D
                0100 C     | o Forward differentiation of ACTIVE_WRITE_XYZ.
                0101 C     *==========================================================*
                0102 C     | written by Shreyas Gaikwad, Laurent Hascoet in Nov 2022
                0103 C     *==========================================================*
                0104 C     \ev
                0105 
                0106 C     !USES:
                0107       IMPLICIT NONE
                0108 
                0109 C     == global variables ==
                0110 #include "SIZE.h"
                0111 
                0112 C     !INPUT/OUTPUT PARAMETERS:
                0113 C     active_var_file:: filename
                0114 C     active_var     :: array
                0115 C     active_vard    :: forward derivative of active_var
                0116 C     iRec           :: record number
                0117 C     myOptimIter    :: number of optimization iteration (default: 0)
                0118 C     myThid         :: thread number for this instance
                0119       CHARACTER*(*) active_var_file
                0120       Real*8     active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
                0121       Real*8     active_vard(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
                0122       INTEGER iRec
                0123       INTEGER myOptimIter
                0124       INTEGER myThid
                0125       Real*8     dummy
                0126       Real*8     dummyd
                0127 
                0128 C     !LOCAL VARIABLES:
                0129       CHARACTER*(2) pref
                0130       CHARACTER*(80) fname
                0131       INTEGER myNr
                0132       LOGICAL globalFile
                0133       LOGICAL useCurrentDir
                0134 CEOP
                0135 
                0136       pref = 'g_'
                0137       CALL ADD_PREFIX( pref, active_var_file, fname )
                0138       myNr = Nr
                0139       globalFile = .FALSE.
                0140       useCurrentDir = .FALSE.
                0141 
                0142       call active_write_3d_rl(
                0143      &                 active_var_file, active_var, globalFile,
                0144      &                 useCurrentDir, iRec, myNr,
                0145      &                 0, myOptimIter, myThid )
                0146 
                0147       call active_write_3d_rl(
                0148      &                 fname, active_vard, globalFile,
                0149      &                 useCurrentDir, iRec, myNr,
                0150      &                 2, myOptimIter, myThid )
                0151 
                0152       RETURN
                0153       END
                0154 
                0155 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0156 
                0157 CBOP
                0158 C     !ROUTINE: ACTIVE_WRITE_XY_B
                0159 C     !INTERFACE:
                0160       subroutine ACTIVE_WRITE_XY_B(
                0161      I                              active_var_file,
                0162      I                              active_var,
                0163      U                              active_varb,
                0164      I                              iRec,
                0165      I                              myOptimIter,
                0166      I                              myThid,
                0167      I                              dummy,
                0168      O                              dummyb
                0169      &                            )
                0170 
                0171 C     *==========================================================*
                0172 C     | SUBROUTINE ACTIVE_WRITE_XY_B
                0173 C     | o Reverse differentiation of ACTIVE_WRITE_XY.
                0174 C     *==========================================================*
                0175 C     | written by Shreyas Gaikwad, Laurent Hascoet in Nov 2022
                0176 C     *==========================================================*
                0177 C     \ev
                0178 
                0179 C     !USES:
                0180       IMPLICIT NONE
                0181 
                0182 C     == global variables ==
                0183 #include "SIZE.h"
                0184 
                0185 C     !INPUT/OUTPUT PARAMETERS:
                0186 C     active_var_file:: filename
                0187 C     active_var     :: array
                0188 C     active_varb    :: reverse derivative of active_var
                0189 C     iRec           :: record number
                0190 C     myOptimIter    :: number of optimization iteration (default: 0)
                0191 C     myThid         :: thread number for this instance
                0192       CHARACTER*(80) active_var_file
                0193       Real*8     active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
                0194       Real*8     active_varb(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
                0195       INTEGER iRec
                0196       INTEGER myOptimIter
                0197       INTEGER myThid
                0198       Real*8     dummy
                0199       Real*8     dummyb
                0200 
                0201 C     !LOCAL VARIABLES:
                0202       CHARACTER*(2) adpref
                0203       CHARACTER*(80) fname
                0204       INTEGER myNr
                0205       LOGICAL globalFile
                0206       LOGICAL useCurrentDir
                0207 CEOP
                0208       adpref = 'ad'
                0209       CALL ADD_PREFIX( adpref, active_var_file, fname )
                0210       myNr = 1
                0211       globalFile = .FALSE.
                0212       useCurrentDir = .FALSE.
                0213       CALL ACTIVE_WRITE_3D_RL(
                0214      &                 fname, active_varb, globalFile,
                0215      &                 useCurrentDir, iRec, myNr,
                0216      &                 1, myOptimIter, myThid )
                0217       RETURN
                0218       END
                0219 
                0220 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0221 
                0222 CBOP
                0223 C     !ROUTINE: ACTIVE_WRITE_XYZ_B
                0224 C     !INTERFACE:
                0225       subroutine ACTIVE_WRITE_XYZ_B(
                0226      I                              active_var_file,
                0227      I                              active_var,
                0228      U                              active_varb,
                0229      I                              iRec,
                0230      I                              myOptimIter,
                0231      I                              myThid,
                0232      I                              dummy,
                0233      O                              dummyb
                0234      &                            )
                0235 
                0236 C     *==========================================================*
                0237 C     | SUBROUTINE ACTIVE_WRITE_XYZ_B
                0238 C     | o Reverse differentiation of ACTIVE_WRITE_XYZ.
                0239 C     *==========================================================*
                0240 C     | written by Shreyas Gaikwad, Laurent Hascoet in Nov 2022
                0241 C     *==========================================================*
                0242 C     \ev
                0243 
                0244 C     !USES:
                0245       IMPLICIT NONE
                0246 
                0247 C     == global variables ==
                0248 #include "SIZE.h"
                0249 
                0250 C     !INPUT/OUTPUT PARAMETERS:
                0251 C     active_var_file:: filename
                0252 C     active_var     :: array
                0253 C     active_varb    :: reverse derivative of active_var
                0254 C     iRec           :: record number
                0255 C     myOptimIter    :: number of optimization iteration (default: 0)
                0256 C     myThid         :: thread number for this instance
                0257       CHARACTER*(80) active_var_file
                0258       Real*8     active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
                0259       Real*8     active_varb(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
                0260       INTEGER iRec
                0261       INTEGER myOptimIter
                0262       INTEGER myThid
                0263       Real*8     dummy
                0264       Real*8     dummyb
                0265 
                0266 C     !FUNCTIONS:
                0267       INTEGER  ILNBLNK
                0268       EXTERNAL ILNBLNK
                0269 
                0270 C     !LOCAL VARIABLES:
                0271       CHARACTER*(2) adpref
                0272       CHARACTER*(80) fname
                0273       INTEGER il
                0274       INTEGER myNr
                0275       LOGICAL globalFile
                0276       LOGICAL useCurrentDir
                0277 CEOP
                0278       adpref = 'ad'
                0279       CALL ADD_PREFIX( adpref, active_var_file, fname )
                0280       myNr = Nr
                0281       globalFile = .FALSE.
                0282       useCurrentDir = .FALSE.
                0283       CALL ACTIVE_WRITE_3D_RL(
                0284      &                 fname, active_varb, globalFile,
                0285      &                 useCurrentDir, iRec, myNr,
                0286      &                 1, myOptimIter, myThid )
                0287       RETURN
                0288       END