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
b4daa24319 Shre*0001 #include "PROFILES_OPTIONS.h"
                0002 
13ce79fe94 Ivan*0003 C     ==================================================================
                0004 C
                0005 C     active_files_tap_adj.F: Routines to handle the I/O of the active file
                0006 C                        for the adjoint calculations with Tapenade.
                0007 C                        All files are direct access files.
                0008 C
                0009 C     Routines
                0010 C     o  active_read_profile_b      - Adjoint of active_read_profile
                0011 C     o  active_write_profile_b     - Adjoint of active_write_profile
                0012 C
                0013 C        changed: shreyasg911@gmail.com 26-Mar-2023
                0014 C
                0015 C     ==================================================================
                0016 
                0017 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0018 CBOP
                0019 C !ROUTINE: ACTIVE_READ_PROFILE_B
                0020 
                0021 C !INTERFACE:
                0022       SUBROUTINE ACTIVE_READ_PROFILE_B(
b4daa24319 Shre*0023      I                              active_num_file,
                0024      I                              nadactive_var,
                0025      I                              active_var,
                0026      I                              adactive_var,
                0027      I                              active_varnum,
                0028      I                              irec,
                0029      I                              lAdInit,
13ce79fe94 Ivan*0030      I                              myIter,
b4daa24319 Shre*0031      I                              bi,
                0032      I                              bj,
13ce79fe94 Ivan*0033      I                              myThid,
b4daa24319 Shre*0034      I                              dummy,
                0035      I                              dummyb
                0036      &                            )
                0037 
13ce79fe94 Ivan*0038 C     !DESCRIPTION:
                0039 C     Adjoint of active_read_profile.
b4daa24319 Shre*0040 
13ce79fe94 Ivan*0041 C     !USES:
                0042       IMPLICIT NONE
                0043 C     == Global variables ===
b4daa24319 Shre*0044 #include "EEPARAMS.h"
                0045 #include "SIZE.h"
                0046 #ifdef ALLOW_PROFILES
                0047 # include "PROFILES_SIZE.h"
                0048 # include "profiles.h"
                0049 #endif
                0050 
13ce79fe94 Ivan*0051 C     !INPUT PARAMETERS:
                0052 C     active_var_file: filename
                0053 C     nadactive_var:   integer size of adactive_var
                0054 C     adactive_var:    array
                0055 C     irec:            record number
                0056 C     lAdInit:         initialisation of corresponding adjoint
                0057 C                      variable and write to active file
                0058 C     myIter:          number of optimization iteration (default: 0)
                0059 C     myThid:          my thread ID number
                0060       INTEGER active_num_file, nadactive_var
                0061       _RL     active_var(nadactive_var), adactive_var(nadactive_var)
                0062       INTEGER active_varnum
                0063       INTEGER irec
                0064       LOGICAL lAdInit
                0065       INTEGER myIter
                0066       INTEGER bi, bj, myThid
                0067       _RL     dummy
                0068       _RL     dummyb
                0069 C     !OUTPUT PARAMETERS:
                0070 CEOP
b4daa24319 Shre*0071 
                0072 #ifdef ALLOW_PROFILES
                0073 
13ce79fe94 Ivan*0074       CALL ACTIVE_READ_PROFILE_RL( fidadjoint(active_num_file,bi,bj),
b4daa24319 Shre*0075      &     active_num_file,
                0076      &     nadactive_var, adactive_var, active_varnum, lAdInit,
                0077      &     irec, prof_ind_glob(active_num_file,irec,bi,bj),
13ce79fe94 Ivan*0078      &     REVERSE_SIMULATION, myIter,bi,bj, myThid)
b4daa24319 Shre*0079 
                0080 #endif
                0081 
13ce79fe94 Ivan*0082       RETURN
                0083       END
b4daa24319 Shre*0084 
                0085 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
13ce79fe94 Ivan*0086 CBOP
                0087 C !ROUTINE: ACTIVE_WRITE_PROFILE_B
b4daa24319 Shre*0088 
13ce79fe94 Ivan*0089 C !INTERFACE:
                0090       SUBROUTINE ACTIVE_WRITE_PROFILE_B(
b4daa24319 Shre*0091      I                              active_num_file,
                0092      I                              nadactive_var,
                0093      I                              active_var,
                0094      I                              adactive_var,
                0095      I                              active_varnum,
                0096      I                              irec,
13ce79fe94 Ivan*0097      I                              myIter,
b4daa24319 Shre*0098      I                              bi,
                0099      I                              bj,
13ce79fe94 Ivan*0100      I                              myThid,
b4daa24319 Shre*0101      I                              dummy,
                0102      I                              dummyb
                0103      &                            )
                0104 
13ce79fe94 Ivan*0105 C     !DESCRIPTION:
                0106 C     Adjoint of active_write_profile.
b4daa24319 Shre*0107 
13ce79fe94 Ivan*0108 C     !USES:
                0109       IMPLICIT NONE
                0110 C     == Global variables ===
b4daa24319 Shre*0111 #include "EEPARAMS.h"
                0112 #include "SIZE.h"
                0113 #ifdef ALLOW_PROFILES
                0114 # include "PROFILES_SIZE.h"
                0115 # include "profiles.h"
                0116 #endif
                0117 
13ce79fe94 Ivan*0118 C     !INPUT PARAMETERS:
                0119 C     active_var_file: filename
                0120 C     nadactive_var:   integer size of adactive_var
                0121 C     adactive_var:    array
                0122 C     irec:            record number
                0123 C     myIter:          number of optimization iteration (default: 0)
                0124 C     myThid:          my thread ID number
                0125       INTEGER active_num_file, nadactive_var
                0126       _RL     active_var(nadactive_var), adactive_var(nadactive_var)
                0127       INTEGER active_varnum
                0128       INTEGER irec
                0129       INTEGER myIter
                0130       INTEGER bi, bj, myThid
b4daa24319 Shre*0131       _RL     dummy
                0132       _RL     dummyb
13ce79fe94 Ivan*0133 C     !OUTPUT PARAMETERS:
                0134 CEOP
b4daa24319 Shre*0135 
                0136 #ifdef ALLOW_PROFILES
                0137 
13ce79fe94 Ivan*0138       CALL ACTIVE_WRITE_PROFILE_RL( fidadjoint(active_num_file,bi,bj),
b4daa24319 Shre*0139      &     active_num_file,
                0140      &     nadactive_var, adactive_var, active_varnum,
                0141      &     irec, prof_ind_glob(active_num_file,irec,bi,bj),
13ce79fe94 Ivan*0142      &     REVERSE_SIMULATION, myIter,bi,bj, myThid)
b4daa24319 Shre*0143 
                0144 #endif
                0145 
13ce79fe94 Ivan*0146       RETURN
                0147       END