Back to home page

MITgcm

 
 

    


File indexing completed on 2025-08-05 05:09:14 UTC

view on githubraw file Latest commit 13ce79fe on 2025-08-04 21:05:34 UTC
367ecbf006 Gael*0001 #include "PROFILES_OPTIONS.h"
6e4c90fea3 Patr*0002 
13ce79fe94 Ivan*0003 C     ==================================================================
                0004 C
                0005 C     active_files_ad.F: Routines to handle the I/O of the active file
                0006 C                        for the adjoint calculations. All files are
                0007 C                        direct access files.
                0008 C
                0009 C     Routines
                0010 C
                0011 C     o  adactive_read_profile      - Adjoint of active_read_profile
                0012 C     o  adactive_write_profile     - Adjoint of active_write_profile
                0013 C
                0014 C        changed: gforget@ocean.mit.edu 23-Mar-2006
                0015 C
                0016 C     ==================================================================
                0017 
                0018 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0019 CBOP
                0020 C !ROUTINE: ADACTIVE_READ_PROFILE
                0021 
                0022 C !INTERFACE:
                0023       SUBROUTINE ADACTIVE_READ_PROFILE(
6e4c90fea3 Patr*0024      I                              active_num_file,
                0025      I                              nadactive_var,
10434d1dc4 Patr*0026      I                              adactive_var,
71a5587721 Gael*0027      I                              active_varnum,
6e4c90fea3 Patr*0028      I                              irec,
                0029      I                              lAdInit,
13ce79fe94 Ivan*0030      I                              myIter,
71a5587721 Gael*0031      I                              bi,
                0032      I                              bj,
13ce79fe94 Ivan*0033      I                              myThid
6e4c90fea3 Patr*0034      &                            )
                0035 
13ce79fe94 Ivan*0036 C     !DESCRIPTION:
                0037 C     Adjoint of active_read_profile.
6e4c90fea3 Patr*0038 
13ce79fe94 Ivan*0039 C     !USES:
                0040       IMPLICIT NONE
                0041 C     == Global variables ===
6e4c90fea3 Patr*0042 #include "EEPARAMS.h"
                0043 #include "SIZE.h"
                0044 #ifdef ALLOW_PROFILES
6328b73337 Gael*0045 # include "PROFILES_SIZE.h"
6e4c90fea3 Patr*0046 # include "profiles.h"
                0047 #endif
                0048 
13ce79fe94 Ivan*0049 C     !INPUT/OUTPUT PARAMETERS:
                0050 C     active_var_file: filename
                0051 C     nadactive_var:   integer size of adactive_var
                0052 C     adactive_var:    array
                0053 C     irec:            record number
                0054 C     myIter:          number of optimization iteration (default: 0)
                0055 C     myThid:          my thread ID number
                0056 C     doglobalread:    flag for global or local read/write
                0057 C                      (default: .false.)
                0058 C     lAdInit:         initialisation of corresponding adjoint
                0059 C                      variable and write to active file
                0060       INTEGER nadactive_var,active_num_file
                0061       _RL     adactive_var(nadactive_var)
                0062       INTEGER irec,active_varnum
                0063       INTEGER myIter
                0064       INTEGER bi,bj,myThid
                0065       LOGICAL lAdInit
                0066 CEOP
6e4c90fea3 Patr*0067 
                0068 #ifdef ALLOW_PROFILES
                0069 
13ce79fe94 Ivan*0070       CALL ACTIVE_READ_PROFILE_RL( fidadjoint(active_num_file,bi,bj),
6e4c90fea3 Patr*0071      &     active_num_file,
71a5587721 Gael*0072      &     nadactive_var, adactive_var, active_varnum, lAdInit,
                0073      &     irec, prof_ind_glob(active_num_file,irec,bi,bj),
13ce79fe94 Ivan*0074      &     REVERSE_SIMULATION, myIter,bi,bj, myThid)
6e4c90fea3 Patr*0075 
                0076 #endif
                0077 
13ce79fe94 Ivan*0078       RETURN
                0079       END
6e4c90fea3 Patr*0080 
13ce79fe94 Ivan*0081 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0082 CBOP
                0083 C !ROUTINE: ADACTIVE_WRITE_PROFILE
6e4c90fea3 Patr*0084 
13ce79fe94 Ivan*0085 C !INTERFACE:
                0086       SUBROUTINE ADACTIVE_WRITE_PROFILE(
6e4c90fea3 Patr*0087      I                              active_num_file,
                0088      I                              nadactive_var,
10434d1dc4 Patr*0089      I                              adactive_var,
71a5587721 Gael*0090      I                              active_varnum,
6e4c90fea3 Patr*0091      I                              irec,
13ce79fe94 Ivan*0092      I                              myIter,
71a5587721 Gael*0093      I                              bi,
                0094      I                              bj,
13ce79fe94 Ivan*0095      I                              myThid,
6e4c90fea3 Patr*0096      I                              dummy
                0097      &                            )
                0098 
13ce79fe94 Ivan*0099 C     !DESCRIPTION:
                0100 C     Adjoint of active_write_profile.
6e4c90fea3 Patr*0101 
13ce79fe94 Ivan*0102 C     !USES:
                0103       IMPLICIT NONE
                0104 C     == Global variables ===
6e4c90fea3 Patr*0105 #include "EEPARAMS.h"
                0106 #include "SIZE.h"
                0107 #ifdef ALLOW_PROFILES
6328b73337 Gael*0108 # include "PROFILES_SIZE.h"
6e4c90fea3 Patr*0109 # include "profiles.h"
                0110 #endif
                0111 
13ce79fe94 Ivan*0112 C     !INPUT/OUTPUT PARAMETERS:
                0113 C     active_var_file: filename
                0114 C     nadactive_var:   integer size of adactive_var
                0115 C     adactive_var:    array
                0116 C     irec:            record number
                0117 C     myIter:          number of optimization iteration (default: 0)
                0118 C     myThid:          my thread ID number
                0119 C     doglobalread:    flag for global or local read/write
                0120 C                      (default: .false.)
                0121 C     lAdInit:         initialisation of corresponding adjoint
                0122 C                      variable and write to active file
                0123       INTEGER nadactive_var,active_num_file
                0124       _RL     adactive_var(nadactive_var)
                0125       INTEGER irec,active_varnum
                0126       INTEGER myIter
                0127       INTEGER bi,bj,myThid
6e4c90fea3 Patr*0128       _RL     dummy
13ce79fe94 Ivan*0129 CEOP
6e4c90fea3 Patr*0130 
                0131 #ifdef ALLOW_PROFILES
                0132 
13ce79fe94 Ivan*0133       CALL ACTIVE_WRITE_PROFILE_RL( fidadjoint(active_num_file,bi,bj),
6e4c90fea3 Patr*0134      &     active_num_file,
71a5587721 Gael*0135      &     nadactive_var, adactive_var, active_varnum,
                0136      &     irec, prof_ind_glob(active_num_file,irec,bi,bj),
13ce79fe94 Ivan*0137      &     REVERSE_SIMULATION, myIter,bi,bj, myThid)
6e4c90fea3 Patr*0138 
                0139 #endif
                0140 
13ce79fe94 Ivan*0141       RETURN
                0142       END