Back to home page

MITgcm

 
 

    


File indexing completed on 2023-07-14 05:10:07 UTC

view on githubraw file Latest commit de57a2ec on 2023-07-13 16:55:13 UTC
6d54cf9ca1 Ed H*0001 #include "AUTODIFF_OPTIONS.h"
22f0d78f5f Patr*0002 
1c93ccf46e Jean*0003 C     ==================================================================
                0004 C     active_file_g.F: Routines to handle the I/O of the active file for
                0005 C                      the tangent linear calculations. All files are
                0006 C                      direct access files.
                0007 C     Routines
                0008 C    o  g_active_read_xy         - Read  an active 2D variable from file.
                0009 C    o  g_active_read_xyz        - Read  an active 3D variable from file.
                0010 C    o  g_active_read_xz         - Read  an active 2D xz-slice from file.
                0011 C    o  g_active_read_yz         - Read  an active 2D yz-slice from file.
04904a066e Timo*0012 C    o  g_active_read_1d         - Read  an active 1D vector from file.
1c93ccf46e Jean*0013 C
                0014 C    o  g_active_write_xy        - Write an active 2D variable to a file.
                0015 C    o  g_active_write_xyz       - Write an active 3D variable to a file.
                0016 C    o  g_active_write_xz        - Write an active 2D xz-slice to a file.
                0017 C    o  g_active_write_yz        - Write an active 2D yz-slice to a file.
04904a066e Timo*0018 C    o  g_active_write_1d        - Write an active 1D vector to a file.
1c93ccf46e Jean*0019 C
                0020 C        changed: Christian Eckert eckert@mit.edu 24-Apr-2000
                0021 C                 - Added routines that do active writes on tiles
                0022 C                   instead of a whole thread.
                0023 C        changed: heimbach@mit.edu 05-Mar-2001
                0024 C                 - added active file handling of xz-/yz-arrays
04904a066e Timo*0025 C        changed: tsmith@oden.utexas.edu 22-Oct-2019
                0026 C                 - added 1D vectors
1c93ccf46e Jean*0027 C     ==================================================================
                0028 
                0029 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
22f0d78f5f Patr*0030 CBOP
                0031 C     !ROUTINE: g_active_read_xy
                0032 C     !INTERFACE:
                0033       subroutine g_active_read_xy(
                0034      I                           active_var_file,
                0035      O                           active_var,
35d16297ce Patr*0036      I                           g_active_var,
1c93ccf46e Jean*0037      I                           iRec,
22f0d78f5f Patr*0038      I                           doglobalread,
                0039      I                           lAdInit,
                0040      I                           myOptimIter,
1c93ccf46e Jean*0041      I                           myThid,
438282c1af Patr*0042      I                           dummy,
                0043      I                           g_dummy
22f0d78f5f Patr*0044      &                         )
                0045 
                0046 C     !DESCRIPTION: \bv
1c93ccf46e Jean*0047 C     ==================================================================
                0048 C     SUBROUTINE g_active_read_xy
                0049 C     ==================================================================
                0050 C     o Read an active 2D (XY) variable from file.
                0051 C     started: Christian Eckert eckert@mit.edu 30-Jun-1999
                0052 C     ==================================================================
                0053 C     SUBROUTINE g_active_read_xy
                0054 C     ==================================================================
22f0d78f5f Patr*0055 C     \ev
                0056 
                0057 C     !USES:
1c93ccf46e Jean*0058       IMPLICIT NONE
22f0d78f5f Patr*0059 
1c93ccf46e Jean*0060 C     == global variables ==
22f0d78f5f Patr*0061 #include "EEPARAMS.h"
                0062 #include "SIZE.h"
                0063 
                0064 C     !INPUT/OUTPUT PARAMETERS:
04904a066e Timo*0065 C     active_var_file:: filename
                0066 C     active_var     :: array
                0067 C     g_active_var   :: tangent linear  array
                0068 C     iRec           :: record number
                0069 C     doglobalread   :: flag for global or local read/write
                0070 C                       (default: .false.)
                0071 C     lAdInit        :: initialisation of corresponding adjoint
                0072 C                       variable and write to active file
                0073 C     myOptimIter    :: number of optimization iteration (default: 0)
                0074 C     myThid         :: thread number for this instance
1c93ccf46e Jean*0075       CHARACTER*(*) active_var_file
                0076       _RL     active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
                0077       _RL     g_active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
                0078       INTEGER iRec
                0079       LOGICAL doglobalread
                0080       LOGICAL lAdInit
04904a066e Timo*0081       INTEGER myOptimIter
                0082       INTEGER myThid
438282c1af Patr*0083       _RL     dummy, g_dummy
22f0d78f5f Patr*0084 
                0085 C     !LOCAL VARIABLES:
1c93ccf46e Jean*0086       CHARACTER*(2) pref
de57a2ec4b Mart*0087       CHARACTER*(MAX_LEN_FNAM) fname
1c93ccf46e Jean*0088       INTEGER myNr
                0089       LOGICAL useCurrentDir
22f0d78f5f Patr*0090 CEOP
                0091 
                0092       pref = 'g_'
f9d7cbfb72 Ou W*0093       CALL ADD_PREFIX( pref, active_var_file, fname )
1c93ccf46e Jean*0094       myNr = 1
                0095       useCurrentDir = .FALSE.
                0096 
                0097       CALL ACTIVE_READ_3D_RL(
                0098      &                 active_var_file, active_var, doglobalread,
                0099      &                 useCurrentDir, lAdInit, iRec, myNr,
                0100      &                 FORWARD_SIMULATION, myOptimIter, myThid )
                0101 
                0102       CALL ACTIVE_READ_3D_RL(
                0103      &                 fname, g_active_var, doglobalread,
                0104      &                 useCurrentDir, lAdInit, iRec, myNr,
                0105      &                 TANGENT_SIMULATION, myOptimIter, myThid )
                0106 
                0107       RETURN
                0108       END
                0109 
                0110 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
22f0d78f5f Patr*0111 CBOP
                0112 C     !ROUTINE: g_active_read_xyz
                0113 C     !INTERFACE:
                0114       subroutine g_active_read_xyz(
                0115      I                            active_var_file,
                0116      O                            active_var,
35d16297ce Patr*0117      I                            g_active_var,
1c93ccf46e Jean*0118      I                            iRec,
22f0d78f5f Patr*0119      I                            doglobalread,
                0120      I                            lAdInit,
                0121      I                            myOptimIter,
1c93ccf46e Jean*0122      I                            myThid,
438282c1af Patr*0123      I                            dummy,
                0124      I                            g_dummy
22f0d78f5f Patr*0125      &                           )
                0126 
                0127 C     !DESCRIPTION: \bv
1c93ccf46e Jean*0128 C     ==================================================================
                0129 C     SUBROUTINE g_active_read_xyz
                0130 C     ==================================================================
                0131 C     o Read an active 3D variable from file.
                0132 C     started: Christian Eckert eckert@mit.edu 30-Jun-1999
                0133 C     ==================================================================
                0134 C     SUBROUTINE g_active_read_xyz
                0135 C     ==================================================================
22f0d78f5f Patr*0136 C     \ev
                0137 
                0138 C     !USES:
1c93ccf46e Jean*0139       IMPLICIT NONE
22f0d78f5f Patr*0140 
1c93ccf46e Jean*0141 C     == global variables ==
22f0d78f5f Patr*0142 #include "EEPARAMS.h"
                0143 #include "SIZE.h"
                0144 
                0145 C     !INPUT/OUTPUT PARAMETERS:
04904a066e Timo*0146 C     active_var_file:: filename
                0147 C     active_var     :: array
                0148 C     g_active_var   :: tangent linear  array
                0149 C     iRec           :: record number
                0150 C     doglobalread   :: flag for global or local read/write
                0151 C                       (default: .false.)
                0152 C     lAdInit        :: initialisation of corresponding adjoint
                0153 C                       variable and write to active file
                0154 C     myOptimIter    :: number of optimization iteration (default: 0)
                0155 C     myThid         :: thread number for this instance
1c93ccf46e Jean*0156       CHARACTER*(*) active_var_file
                0157       _RL active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
                0158       _RL g_active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
                0159       INTEGER iRec
                0160       LOGICAL doglobalread
                0161       LOGICAL lAdInit
04904a066e Timo*0162       INTEGER myOptimIter
                0163       INTEGER myThid
438282c1af Patr*0164       _RL     dummy, g_dummy
22f0d78f5f Patr*0165 
                0166 C     !LOCAL VARIABLES:
1c93ccf46e Jean*0167       CHARACTER*(2) pref
de57a2ec4b Mart*0168       CHARACTER*(MAX_LEN_FNAM) fname
1c93ccf46e Jean*0169       INTEGER myNr
                0170       LOGICAL useCurrentDir
22f0d78f5f Patr*0171 CEOP
                0172 
                0173       pref = 'g_'
f9d7cbfb72 Ou W*0174       CALL ADD_PREFIX( pref, active_var_file, fname )
1c93ccf46e Jean*0175       myNr = Nr
                0176       useCurrentDir = .FALSE.
                0177 
                0178       CALL ACTIVE_READ_3D_RL(
                0179      &                 active_var_file, active_var, doglobalread,
                0180      &                 useCurrentDir, lAdInit, iRec, myNr,
                0181      &                 FORWARD_SIMULATION, myOptimIter, myThid )
                0182 
                0183       CALL ACTIVE_READ_3D_RL(
                0184      &                 fname, g_active_var, doglobalread,
                0185      &                 useCurrentDir, lAdInit, iRec, myNr,
                0186      &                 TANGENT_SIMULATION, myOptimIter, myThid )
                0187 
                0188       RETURN
                0189       END
                0190 
                0191 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
22f0d78f5f Patr*0192 CBOP
                0193 C     !ROUTINE: g_active_read_xz
                0194 C     !INTERFACE:
                0195       subroutine g_active_read_xz(
                0196      I                           active_var_file,
                0197      O                           active_var,
35d16297ce Patr*0198      I                           g_active_var,
1c93ccf46e Jean*0199      I                           iRec,
22f0d78f5f Patr*0200      I                           doglobalread,
                0201      I                           lAdInit,
                0202      I                           myOptimIter,
1c93ccf46e Jean*0203      I                           myThid,
438282c1af Patr*0204      I                           dummy,
                0205      I                           g_dummy
22f0d78f5f Patr*0206      &                         )
                0207 
                0208 C     !DESCRIPTION: \bv
1c93ccf46e Jean*0209 C     ==================================================================
                0210 C     SUBROUTINE g_active_read_xz
                0211 C     ==================================================================
                0212 C     o Read an active 2D xz-slice from file.
                0213 C     started: heimbach@mit.edu 05-Mar-2001
                0214 C     ==================================================================
                0215 C     SUBROUTINE g_active_read_xz
                0216 C     ==================================================================
22f0d78f5f Patr*0217 C     \ev
                0218 
                0219 C     !USES:
1c93ccf46e Jean*0220       IMPLICIT NONE
22f0d78f5f Patr*0221 
1c93ccf46e Jean*0222 C     == global variables ==
22f0d78f5f Patr*0223 #include "EEPARAMS.h"
                0224 #include "SIZE.h"
                0225 
                0226 C     !INPUT/OUTPUT PARAMETERS:
04904a066e Timo*0227 C     active_var_file:: filename
                0228 C     active_var     :: array
                0229 C     g_active_var   :: tangent linear  array
                0230 C     iRec           :: record number
                0231 C     doglobalread   :: flag for global or local read/write
                0232 C                       (default: .false.)
                0233 C     lAdInit        :: initialisation of corresponding adjoint
                0234 C                       variable and write to active file
                0235 C     myOptimIter    :: number of optimization iteration (default: 0)
                0236 C     myThid         :: thread number for this instance
1c93ccf46e Jean*0237       CHARACTER*(*) active_var_file
04904a066e Timo*0238       _RL     active_var(1-OLx:sNx+OLx,Nr,nSx,nSy)
                0239       _RL     g_active_var(1-OLx:sNx+OLx,Nr,nSx,nSy)
1c93ccf46e Jean*0240       INTEGER iRec
                0241       LOGICAL doglobalread
                0242       LOGICAL lAdInit
04904a066e Timo*0243       INTEGER myOptimIter
                0244       INTEGER myThid
438282c1af Patr*0245       _RL     dummy, g_dummy
22f0d78f5f Patr*0246 
                0247 C     !LOCAL VARIABLES:
1c93ccf46e Jean*0248       CHARACTER*(2) pref
de57a2ec4b Mart*0249       CHARACTER*(MAX_LEN_FNAM) fname
1c93ccf46e Jean*0250       INTEGER myNr
                0251       LOGICAL useCurrentDir
22f0d78f5f Patr*0252 CEOP
                0253 
                0254       pref = 'g_'
f9d7cbfb72 Ou W*0255       CALL ADD_PREFIX( pref, active_var_file, fname )
1c93ccf46e Jean*0256       myNr = Nr
                0257       useCurrentDir = .FALSE.
                0258 
                0259       CALL ACTIVE_READ_XZ_RL(
                0260      &                 active_var_file, active_var, doglobalread,
                0261      &                 useCurrentDir, lAdInit, iRec, myNr,
                0262      &                 FORWARD_SIMULATION, myOptimIter, myThid )
                0263 
                0264       CALL ACTIVE_READ_XZ_RL(
                0265      &                 fname, g_active_var, doglobalread,
                0266      &                 useCurrentDir, lAdInit, iRec, myNr,
                0267      &                 TANGENT_SIMULATION, myOptimIter, myThid )
                0268 
                0269       RETURN
                0270       END
                0271 
                0272 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
22f0d78f5f Patr*0273 CBOP
                0274 C     !ROUTINE: g_active_read_yz
                0275 C     !INTERFACE:
                0276        subroutine g_active_read_yz(
                0277      I                           active_var_file,
                0278      O                           active_var,
35d16297ce Patr*0279      I                           g_active_var,
1c93ccf46e Jean*0280      I                           iRec,
22f0d78f5f Patr*0281      I                           doglobalread,
                0282      I                           lAdInit,
                0283      I                           myOptimIter,
1c93ccf46e Jean*0284      I                           myThid,
438282c1af Patr*0285      I                           dummy,
                0286      I                           g_dummy
22f0d78f5f Patr*0287      &                         )
                0288 
                0289 C     !DESCRIPTION: \bv
1c93ccf46e Jean*0290 C     ==================================================================
                0291 C     SUBROUTINE g_active_read_yz
                0292 C     ==================================================================
                0293 C     o Read an active 2D yz-slice from file.
                0294 C     started: heimbach@mit.edu 05-Mar-2001
                0295 C     ==================================================================
                0296 C     SUBROUTINE g_active_read_yz
                0297 C     ==================================================================
22f0d78f5f Patr*0298 C     \ev
                0299 
                0300 C     !USES:
1c93ccf46e Jean*0301       IMPLICIT NONE
22f0d78f5f Patr*0302 
1c93ccf46e Jean*0303 C     == global variables ==
22f0d78f5f Patr*0304 #include "EEPARAMS.h"
                0305 #include "SIZE.h"
                0306 
                0307 C     !INPUT/OUTPUT PARAMETERS:
04904a066e Timo*0308 C     active_var_file:: filename
                0309 C     active_var     :: array
                0310 C     g_active_var   :: tangent linear  array
                0311 C     iRec           :: record number
                0312 C     doglobalread   :: flag for global or local read/write
                0313 C                       (default: .false.)
                0314 C     lAdInit        :: initialisation of corresponding adjoint
                0315 C                       variable and write to active file
                0316 C     myOptimIter    :: number of optimization iteration (default: 0)
                0317 C     myThid         :: thread number for this instance
1c93ccf46e Jean*0318       CHARACTER*(*) active_var_file
04904a066e Timo*0319       _RL     active_var(1-OLy:sNy+OLy,Nr,nSx,nSy)
                0320       _RL     g_active_var(1-OLy:sNy+OLy,Nr,nSx,nSy)
1c93ccf46e Jean*0321       INTEGER iRec
                0322       LOGICAL doglobalread
                0323       LOGICAL lAdInit
04904a066e Timo*0324       INTEGER myOptimIter
                0325       INTEGER myThid
438282c1af Patr*0326       _RL     dummy, g_dummy
22f0d78f5f Patr*0327 
                0328 C     !LOCAL VARIABLES:
1c93ccf46e Jean*0329       CHARACTER*(2) pref
de57a2ec4b Mart*0330       CHARACTER*(MAX_LEN_FNAM) fname
1c93ccf46e Jean*0331       INTEGER myNr
                0332       LOGICAL useCurrentDir
22f0d78f5f Patr*0333 CEOP
                0334 
                0335       pref = 'g_'
f9d7cbfb72 Ou W*0336       CALL ADD_PREFIX( pref, active_var_file, fname )
1c93ccf46e Jean*0337       myNr = Nr
                0338       useCurrentDir = .FALSE.
                0339 
                0340       CALL ACTIVE_READ_YZ_RL(
                0341      &                 active_var_file, active_var, doglobalread,
                0342      &                 useCurrentDir, lAdInit, iRec, myNr,
                0343      &                 FORWARD_SIMULATION, myOptimIter, myThid )
                0344 
                0345       CALL ACTIVE_READ_YZ_RL(
                0346      &                 fname, g_active_var, doglobalread,
                0347      &                 useCurrentDir, lAdInit, iRec, myNr,
                0348      &                 TANGENT_SIMULATION, myOptimIter, myThid )
                0349 
                0350       RETURN
                0351       END
                0352 
                0353 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
22f0d78f5f Patr*0354 CBOP
04904a066e Timo*0355 C     !ROUTINE: g_active_read_1d
                0356 C     !INTERFACE:
                0357       subroutine g_active_read_1d(
                0358      I                           active_var_file,
                0359      O                           active_var,
                0360      I                           g_active_var,
                0361      I                           active_var_length,
                0362      I                           iRec,
                0363      I                           lAdInit,
                0364      I                           myOptimIter,
                0365      I                           myThid,
                0366      I                           dummy,
                0367      I                           g_dummy
                0368      &                         )
                0369 
                0370 C     !DESCRIPTION: \bv
                0371 C     ==================================================================
                0372 C     SUBROUTINE g_active_read_1d
                0373 C     ==================================================================
                0374 C     o Read an active 1D vector from file.
                0375 C     started: Tim Smith tsmith@oden.utexas.edu 22-Oct-2019
                0376 C     ==================================================================
                0377 C     SUBROUTINE active_read_1d
                0378 C     ==================================================================
                0379 C     \ev
                0380 
                0381 C     !USES:
                0382       IMPLICIT NONE
                0383 
                0384 C     == global variables ==
                0385 #include "EEPARAMS.h"
                0386 #include "SIZE.h"
                0387 
                0388 C     !INPUT/OUTPUT PARAMETERS:
                0389 C     active_var_file:: filename
                0390 C     active_var     :: array
                0391 C     g_active_var   :: tangent linear  array
                0392 C     active_var_length :: array length
                0393 C     iRec           :: record number
                0394 C     lAdInit        :: initialisation of corresponding adjoint
                0395 C                       variable and write to active file
                0396 C     myOptimIter    :: number of optimization iteration (default: 0)
                0397 C     myThid         :: thread number for this instance
                0398       CHARACTER*(*) active_var_file
                0399       _RL     active_var(*)
                0400       _RL     g_active_var(*)
                0401       INTEGER active_var_length
                0402       INTEGER iRec
                0403       LOGICAL lAdInit
                0404       INTEGER myOptimIter
                0405       INTEGER myThid
                0406       _RL     dummy
                0407       _RL     g_dummy
                0408 
                0409 C     !FUNCTIONS:
                0410       INTEGER  ILNBLNK
                0411       EXTERNAL ILNBLNK
                0412 
                0413 C     !LOCAL VARIABLES:
                0414       CHARACTER*(2) pref
de57a2ec4b Mart*0415       CHARACTER*(MAX_LEN_FNAM) fname
04904a066e Timo*0416       INTEGER il
                0417 CEOP
                0418 
                0419       pref = 'g_'
                0420       il   = ILNBLNK( active_var_file )
de57a2ec4b Mart*0421       WRITE(fname,'(2A)') pref, active_var_file(1:il)
04904a066e Timo*0422 
                0423       CALL ACTIVE_READ_1D_RL(
                0424      &                 active_var_file, active_var, active_var_length,
                0425      &                 lAdInit, iRec,
                0426      &                 FORWARD_SIMULATION, myOptimIter, myThid )
                0427 
                0428       CALL ACTIVE_READ_1D_RL(
                0429      &                 fname, g_active_var, active_var_length,
                0430      &                 lAdInit, iRec,
                0431      &                 TANGENT_SIMULATION, myOptimIter, myThid )
                0432 
                0433       RETURN
                0434       END
                0435 
                0436 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0437 CBOP
22f0d78f5f Patr*0438 C     !ROUTINE: g_active_write_xy
                0439 C     !INTERFACE:
                0440       subroutine g_active_write_xy(
                0441      I                            active_var_file,
                0442      I                            active_var,
35d16297ce Patr*0443      I                            g_active_var,
1c93ccf46e Jean*0444      I                            iRec,
22f0d78f5f Patr*0445      I                            myOptimIter,
1c93ccf46e Jean*0446      I                            myThid,
7109a141b2 Patr*0447      I                            dummy,
                0448      I                            g_dummy
22f0d78f5f Patr*0449      &                          )
                0450 
                0451 C     !DESCRIPTION: \bv
1c93ccf46e Jean*0452 C     ==================================================================
                0453 C     SUBROUTINE g_active_write_xy
                0454 C     ==================================================================
                0455 C     o Write an active 2D variable to a file.
                0456 C     started: Christian Eckert eckert@mit.edu 30-Jun-1999
                0457 C     ==================================================================
                0458 C     SUBROUTINE g_active_write_xy
                0459 C     ==================================================================
22f0d78f5f Patr*0460 C     \ev
                0461 
                0462 C     !USES:
1c93ccf46e Jean*0463       IMPLICIT NONE
22f0d78f5f Patr*0464 
1c93ccf46e Jean*0465 C     == global variables ==
22f0d78f5f Patr*0466 #include "EEPARAMS.h"
                0467 #include "SIZE.h"
                0468 
1c93ccf46e Jean*0469 C     !INPUT/OUTPUT PARAMETERS:
04904a066e Timo*0470 C     active_var_file:: filename
                0471 C     active_var     :: array
                0472 C     g_active_var   :: tangent linear  array
                0473 C     iRec           :: record number
                0474 C     myOptimIter    :: number of optimization iteration (default: 0)
                0475 C     myThid         :: thread number for this instance
1c93ccf46e Jean*0476       CHARACTER*(*) active_var_file
                0477       _RL     active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
                0478       _RL     g_active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
                0479       INTEGER iRec
                0480       INTEGER myOptimIter
                0481       INTEGER myThid
22f0d78f5f Patr*0482       _RL     dummy
7109a141b2 Patr*0483       _RL     g_dummy
22f0d78f5f Patr*0484 
                0485 C     !LOCAL VARIABLES:
1c93ccf46e Jean*0486       CHARACTER*(2) pref
de57a2ec4b Mart*0487       CHARACTER*(MAX_LEN_FNAM) fname
1c93ccf46e Jean*0488       INTEGER myNr
                0489       LOGICAL globalFile
                0490       LOGICAL useCurrentDir
22f0d78f5f Patr*0491 CEOP
                0492 
                0493       pref = 'g_'
f9d7cbfb72 Ou W*0494       CALL ADD_PREFIX( pref, active_var_file, fname )
1c93ccf46e Jean*0495       myNr = 1
                0496       globalFile = .FALSE.
                0497       useCurrentDir = .FALSE.
                0498 
                0499       CALL ACTIVE_WRITE_3D_RL(
                0500      &                 active_var_file, active_var, globalFile,
                0501      &                 useCurrentDir, iRec, myNr,
                0502      &                 FORWARD_SIMULATION, myOptimIter, myThid )
                0503 
                0504       CALL ACTIVE_WRITE_3D_RL(
                0505      &                 fname, g_active_var, globalFile,
                0506      &                 useCurrentDir, iRec, myNr,
                0507      &                 TANGENT_SIMULATION, myOptimIter, myThid )
                0508 
                0509       RETURN
                0510       END
                0511 
                0512 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
22f0d78f5f Patr*0513 CBOP
                0514 C     !ROUTINE: g_active_write_xyz
                0515 C     !INTERFACE:
                0516       subroutine g_active_write_xyz(
                0517      I                             active_var_file,
                0518      I                             active_var,
35d16297ce Patr*0519      I                             g_active_var,
1c93ccf46e Jean*0520      I                             iRec,
22f0d78f5f Patr*0521      I                             myOptimIter,
1c93ccf46e Jean*0522      I                             myThid,
7109a141b2 Patr*0523      I                             dummy,
                0524      I                             g_dummy
22f0d78f5f Patr*0525      &                           )
                0526 
                0527 C     !DESCRIPTION: \bv
1c93ccf46e Jean*0528 C     ==================================================================
                0529 C     SUBROUTINE g_active_write_xyz
                0530 C     ==================================================================
                0531 C     o Write an active 3D variable to a file.
                0532 C     started: Christian Eckert eckert@mit.edu 30-Jun-1999
                0533 C     ==================================================================
                0534 C     SUBROUTINE g_active_write_xyz
                0535 C     ==================================================================
22f0d78f5f Patr*0536 C     \ev
                0537 
                0538 C     !USES:
1c93ccf46e Jean*0539       IMPLICIT NONE
22f0d78f5f Patr*0540 
1c93ccf46e Jean*0541 C     == global variables ==
22f0d78f5f Patr*0542 #include "EEPARAMS.h"
                0543 #include "SIZE.h"
                0544 
1c93ccf46e Jean*0545 C     !INPUT/OUTPUT PARAMETERS:
04904a066e Timo*0546 C     active_var_file:: filename
                0547 C     active_var     :: array
                0548 C     g_active_var   :: tangent linear  array
                0549 C     iRec           :: record number
                0550 C     myOptimIter    :: number of optimization iteration (default: 0)
                0551 C     myThid         :: thread number for this instance
1c93ccf46e Jean*0552       CHARACTER*(*) active_var_file
                0553       _RL active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
                0554       _RL g_active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
                0555       INTEGER iRec
                0556       INTEGER myOptimIter
                0557       INTEGER myThid
22f0d78f5f Patr*0558       _RL     dummy
7109a141b2 Patr*0559       _RL     g_dummy
22f0d78f5f Patr*0560 
                0561 C     !LOCAL VARIABLES:
1c93ccf46e Jean*0562       CHARACTER*(2) pref
de57a2ec4b Mart*0563       CHARACTER*(MAX_LEN_FNAM) fname
1c93ccf46e Jean*0564       INTEGER myNr
                0565       LOGICAL globalFile
                0566       LOGICAL useCurrentDir
22f0d78f5f Patr*0567 CEOP
                0568 
                0569       pref = 'g_'
f9d7cbfb72 Ou W*0570       CALL ADD_PREFIX( pref, active_var_file, fname )
1c93ccf46e Jean*0571       myNr = Nr
                0572       globalFile = .FALSE.
                0573       useCurrentDir = .FALSE.
                0574 
                0575       CALL ACTIVE_WRITE_3D_RL(
                0576      &                 active_var_file, active_var, globalFile,
                0577      &                 useCurrentDir, iRec, myNr,
                0578      &                 FORWARD_SIMULATION, myOptimIter, myThid )
                0579 
                0580       CALL ACTIVE_WRITE_3D_RL(
                0581      &                 fname, g_active_var, globalFile,
                0582      &                 useCurrentDir, iRec, myNr,
                0583      &                 TANGENT_SIMULATION, myOptimIter, myThid )
                0584 
                0585       RETURN
                0586       END
                0587 
                0588 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
22f0d78f5f Patr*0589 CBOP
                0590 C     !ROUTINE: g_active_write_xz
                0591 C     !INTERFACE:
                0592       subroutine g_active_write_xz(
                0593      I                            active_var_file,
                0594      I                            active_var,
35d16297ce Patr*0595      I                            g_active_var,
1c93ccf46e Jean*0596      I                            iRec,
22f0d78f5f Patr*0597      I                            myOptimIter,
1c93ccf46e Jean*0598      I                            myThid,
7109a141b2 Patr*0599      I                            dummy,
                0600      I                            g_dummy
22f0d78f5f Patr*0601      &                          )
                0602 
                0603 C     !DESCRIPTION: \bv
1c93ccf46e Jean*0604 C     ==================================================================
                0605 C     SUBROUTINE g_active_write_xz
                0606 C     ==================================================================
                0607 C     o Write an active 2D xz-slice to a file.
                0608 C     started: heimbach@mit.edu 05-Mar-2001
                0609 C     ==================================================================
                0610 C     SUBROUTINE g_active_write_xz
                0611 C     ==================================================================
22f0d78f5f Patr*0612 C     \ev
                0613 
                0614 C     !USES:
1c93ccf46e Jean*0615       IMPLICIT NONE
22f0d78f5f Patr*0616 
1c93ccf46e Jean*0617 C     == global variables ==
22f0d78f5f Patr*0618 #include "EEPARAMS.h"
                0619 #include "SIZE.h"
                0620 
1c93ccf46e Jean*0621 C     !INPUT/OUTPUT PARAMETERS:
04904a066e Timo*0622 C     active_var_file:: filename
                0623 C     active_var     :: array
                0624 C     g_active_var   :: tangent linear  array
                0625 C     iRec           :: record number
                0626 C     myOptimIter    :: number of optimization iteration (default: 0)
                0627 C     myThid         :: thread number for this instance
1c93ccf46e Jean*0628       CHARACTER*(*) active_var_file
04904a066e Timo*0629       _RL     active_var(1-OLx:sNx+OLx,Nr,nSx,nSy)
                0630       _RL     g_active_var(1-OLx:sNx+OLx,Nr,nSx,nSy)
1c93ccf46e Jean*0631       INTEGER iRec
                0632       INTEGER myOptimIter
                0633       INTEGER myThid
22f0d78f5f Patr*0634       _RL     dummy
7109a141b2 Patr*0635       _RL     g_dummy
22f0d78f5f Patr*0636 
                0637 C     !LOCAL VARIABLES:
1c93ccf46e Jean*0638       CHARACTER*(2) pref
de57a2ec4b Mart*0639       CHARACTER*(MAX_LEN_FNAM) fname
1c93ccf46e Jean*0640       INTEGER myNr
                0641       LOGICAL globalFile
                0642       LOGICAL useCurrentDir
22f0d78f5f Patr*0643 CEOP
                0644 
                0645       pref = 'g_'
f9d7cbfb72 Ou W*0646       CALL ADD_PREFIX( pref, active_var_file, fname )
1c93ccf46e Jean*0647       myNr = Nr
                0648       globalFile = .FALSE.
                0649       useCurrentDir = .FALSE.
                0650 
                0651       CALL ACTIVE_WRITE_XZ_RL(
                0652      &                 active_var_file, active_var, globalFile,
                0653      &                 useCurrentDir, iRec, myNr,
                0654      &                 FORWARD_SIMULATION, myOptimIter, myThid )
                0655 
                0656       CALL ACTIVE_WRITE_XZ_RL(
                0657      &                 fname, g_active_var, globalFile,
                0658      &                 useCurrentDir, iRec, myNr,
                0659      &                 TANGENT_SIMULATION, myOptimIter, myThid )
                0660 
                0661       RETURN
                0662       END
                0663 
                0664 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
22f0d78f5f Patr*0665 CBOP
                0666 C     !ROUTINE: g_active_write_yz
                0667 C     !INTERFACE:
                0668       subroutine g_active_write_yz(
                0669      I                            active_var_file,
                0670      I                            active_var,
35d16297ce Patr*0671      I                            g_active_var,
1c93ccf46e Jean*0672      I                            iRec,
22f0d78f5f Patr*0673      I                            myOptimIter,
1c93ccf46e Jean*0674      I                            myThid,
7109a141b2 Patr*0675      I                            dummy,
                0676      I                            g_dummy
22f0d78f5f Patr*0677      &                          )
                0678 
                0679 C     !DESCRIPTION: \bv
1c93ccf46e Jean*0680 C     ==================================================================
                0681 C     SUBROUTINE g_active_write_yz
                0682 C     ==================================================================
                0683 C     o Write an active 2D variable to a file.
                0684 C     started: heimbach@mit.edu 05-Mar-2001
                0685 C     ==================================================================
                0686 C     SUBROUTINE g_active_write_yz
                0687 C     ==================================================================
22f0d78f5f Patr*0688 C     \ev
                0689 
                0690 C     !USES:
1c93ccf46e Jean*0691       IMPLICIT NONE
22f0d78f5f Patr*0692 
1c93ccf46e Jean*0693 C     == global variables ==
22f0d78f5f Patr*0694 #include "EEPARAMS.h"
                0695 #include "SIZE.h"
                0696 
1c93ccf46e Jean*0697 C     !INPUT/OUTPUT PARAMETERS:
04904a066e Timo*0698 C     active_var_file:: filename
                0699 C     active_var     :: array
                0700 C     g_active_var   :: tangent linear  array
                0701 C     iRec           :: record number
                0702 C     myOptimIter    :: number of optimization iteration (default: 0)
                0703 C     myThid         :: thread number for this instance
1c93ccf46e Jean*0704       CHARACTER*(*) active_var_file
04904a066e Timo*0705       _RL     active_var(1-OLy:sNy+OLy,Nr,nSx,nSy)
                0706       _RL     g_active_var(1-OLy:sNy+OLy,Nr,nSx,nSy)
1c93ccf46e Jean*0707       INTEGER iRec
                0708       INTEGER myOptimIter
                0709       INTEGER myThid
22f0d78f5f Patr*0710       _RL     dummy
7109a141b2 Patr*0711       _RL     g_dummy
22f0d78f5f Patr*0712 
                0713 C     !LOCAL VARIABLES:
1c93ccf46e Jean*0714       CHARACTER*(2) pref
de57a2ec4b Mart*0715       CHARACTER*(MAX_LEN_FNAM) fname
1c93ccf46e Jean*0716       INTEGER myNr
                0717       LOGICAL globalFile
                0718       LOGICAL useCurrentDir
22f0d78f5f Patr*0719 CEOP
                0720 
                0721       pref = 'g_'
f9d7cbfb72 Ou W*0722       CALL ADD_PREFIX( pref, active_var_file, fname )
1c93ccf46e Jean*0723       myNr = Nr
                0724       globalFile = .FALSE.
                0725       useCurrentDir = .FALSE.
                0726 
                0727       CALL ACTIVE_WRITE_YZ_RL(
                0728      &                 active_var_file, active_var, globalFile,
                0729      &                 useCurrentDir, iRec, myNr,
                0730      &                 FORWARD_SIMULATION, myOptimIter, myThid )
                0731 
                0732       CALL ACTIVE_WRITE_YZ_RL(
                0733      &                 fname, g_active_var, globalFile,
                0734      &                 useCurrentDir, iRec, myNr,
                0735      &                 TANGENT_SIMULATION, myOptimIter, myThid )
                0736 
                0737       RETURN
                0738       END
04904a066e Timo*0739 
                0740 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0741 CBOP
                0742 C     !ROUTINE: g_active_write_1d
                0743 C     !INTERFACE:
                0744       subroutine g_active_write_1d(
                0745      I                           active_var_file,
                0746      I                           active_var,
                0747      I                           g_active_var,
                0748      I                           active_var_length,
                0749      I                           iRec,
                0750      I                           myOptimIter,
                0751      I                           myThid,
                0752      I                           dummy,
                0753      I                           g_dummy
                0754      &                         )
                0755 
                0756 C     !DESCRIPTION: \bv
                0757 C     ==================================================================
                0758 C     SUBROUTINE g_active_write_1d
                0759 C     ==================================================================
                0760 C     o Write an active 1D vector to file.
                0761 C     started: Tim Smith tsmith@oden.utexas.edu 22-Oct-2019
                0762 C     ==================================================================
                0763 C     SUBROUTINE active_write_1d
                0764 C     ==================================================================
                0765 C     \ev
                0766 
                0767 C     !USES:
                0768       IMPLICIT NONE
                0769 
                0770 C     == global variables ==
                0771 #include "EEPARAMS.h"
                0772 #include "SIZE.h"
                0773 
                0774 C     !INPUT/OUTPUT PARAMETERS:
                0775 C     active_var_file:: filename
                0776 C     active_var     :: array
                0777 C     g_active_var   :: tangent linear  array
                0778 C     active_var_length :: array length
                0779 C     iRec           :: record number
                0780 C     myOptimIter    :: number of optimization iteration (default: 0)
                0781 C     myThid         :: thread number for this instance
                0782       CHARACTER*(*) active_var_file
                0783       _RL     active_var(*)
                0784       _RL     g_active_var(*)
                0785       INTEGER active_var_length
                0786       INTEGER iRec
                0787       INTEGER myOptimIter
                0788       INTEGER myThid
                0789       _RL     dummy
                0790       _RL     g_dummy
                0791 
                0792 C     !FUNCTIONS:
                0793       INTEGER  ILNBLNK
                0794       EXTERNAL ILNBLNK
                0795 
                0796 C     !LOCAL VARIABLES:
                0797       CHARACTER*(2) pref
de57a2ec4b Mart*0798       CHARACTER*(MAX_LEN_FNAM) fname
04904a066e Timo*0799       INTEGER il
                0800 CEOP
                0801 
                0802       pref = 'g_'
                0803       il   = ILNBLNK( active_var_file )
de57a2ec4b Mart*0804       WRITE(fname,'(2A)') pref, active_var_file(1:il)
04904a066e Timo*0805 
                0806       CALL ACTIVE_WRITE_1D_RL(
                0807      &                 active_var_file, active_var, active_var_length,
                0808      &                 iRec, FORWARD_SIMULATION, myOptimIter, myThid )
                0809 
                0810       CALL ACTIVE_WRITE_1D_RL(
                0811      &                 fname, g_active_var, active_var_length,
                0812      &                 iRec, TANGENT_SIMULATION, myOptimIter, myThid )
                0813 
                0814       RETURN
                0815       END