Back to home page

MITgcm

 
 

    


File indexing completed on 2024-02-01 06:10:58 UTC

view on githubraw file Latest commit 427e24e1 on 2024-01-31 16:50:14 UTC
5ca83cd8f7 Dani*0001 #include "STREAMICE_OPTIONS.h"
16cc32c739 Mart*0002 #ifdef ALLOW_AUTODIFF
                0003 # include "AUTODIFF_OPTIONS.h"
                0004 #endif
                0005 #include "AD_CONFIG.h"
5ca83cd8f7 Dani*0006 
                0007 CBOP
                0008 C     !ROUTINE: adstreamice_dump
                0009 C     !INTERFACE:
427e24e121 Jean*0010       subroutine adstreamice_dump( myTime, myIter, myThid )
5ca83cd8f7 Dani*0011 
                0012 C     !DESCRIPTION: \bv
                0013 C     *==========================================================*
                0014 C     | SUBROUTINE adstreamice_dump                              |
                0015 C     *==========================================================*
                0016 C     Extract adjoint variable from TAMC/TAF-generated
                0017 C     adjoint common blocks, contained in adcommon.h
                0018 C     and write fields to file;
                0019 C     Make sure common blocks in adcommon.h are up-to-date
                0020 C     w.r.t. current adjoint code.
                0021 C     *==========================================================*
                0022 C     \ev
                0023 
                0024 C     !USES:
                0025       IMPLICIT NONE
                0026 C     == Global variables ===
                0027 #include "SIZE.h"
                0028 #include "EEPARAMS.h"
                0029 #include "PARAMS.h"
                0030 #include "STREAMICE.h"
                0031 #include "GRID.h"
                0032 #ifdef ALLOW_AUTODIFF_MONITOR
                0033 # include "adcommon.h"
                0034 #endif
                0035 
                0036       LOGICAL  DIFFERENT_MULTIPLE
                0037       EXTERNAL DIFFERENT_MULTIPLE
                0038       INTEGER  IO_ERRCOUNT
                0039       EXTERNAL IO_ERRCOUNT
                0040 
                0041 C     !INPUT/OUTPUT PARAMETERS:
                0042 C     myTime - time counter for this thread
427e24e121 Jean*0043 C     myIter - iteration counter for this thread
5ca83cd8f7 Dani*0044 C     myThid - Thread number for this instance of the routine.
427e24e121 Jean*0045       _RL     myTime
                0046       integer myIter
5ca83cd8f7 Dani*0047       integer myThid
                0048 
                0049 #if (defined (ALLOW_ADJOINT_RUN) || defined (ALLOW_ADMTLM))
                0050 
                0051 C     !LOCAL VARIABLES:
                0052 C     suff - Hold suffix part of a filename
                0053 C     beginIOErrCount - Begin and end IO error counts
                0054 C     endIOErrCount
                0055 C     msgBuf - Error message buffer
                0056       CHARACTER*(MAX_LEN_FNAM) suff
                0057       INTEGER beginIOErrCount
                0058       INTEGER endIOErrCount
                0059       CHARACTER*(MAX_LEN_MBUF) msgBuf
                0060 
427e24e121 Jean*0061       double precision :: area_shelf_streamice_ad(1-OLx:sNx+OLx,1-OLy:
                0062      $sNy+OLy,nSx,nSy)
                0063       double precision :: b_glen_ad(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
                0064       double precision :: bdot_streamice_ad(1-OLx:sNx+OLx,1-OLy:sNy+OLy,
                0065      $nSx,nSy)
                0066       double precision :: c_basal_friction_ad(1-OLx:sNx+OLx,1-OLy:sNy+
                0067      $OLy,nSx,nSy)
                0068       double precision :: float_frac_streamice_ad(1-OLx:sNx+OLx,1-OLy:
                0069      $sNy+OLy,nSx,nSy)
                0070       double precision :: h_streamice_ad(1-OLx:sNx+OLx,1-OLy:sNy+OLy,
                0071      $nSx,nSy)
                0072       double precision :: surf_el_streamice_ad(1-OLx:sNx+OLx,1-OLy:sNy+
                0073      $OLy,nSx,nSy)
                0074       double precision :: tau_beta_eff_streamice_ad(1-OLx:sNx+OLx,1-OLy:
                0075      $sNy+OLy,nSx,nSy)
                0076       double precision :: u_streamice_ad(1-OLx:sNx+OLx,1-OLy:sNy+OLy,
                0077      $nSx,nSy)
                0078       double precision :: v_streamice_ad(1-OLx:sNx+OLx,1-OLy:sNy+OLy,
                0079      $nSx,nSy)
                0080       double precision :: visc_streamice_ad(1-OLx:sNx+OLx,1-OLy:sNy+OLy,
                0081      $nSx,nSy)
22e8fae606 Dani*0082       common /streamice_fields_rl_ad/ h_streamice_ad, u_streamice_ad,
                0083      $v_streamice_ad, visc_streamice_ad, tau_beta_eff_streamice_ad,
                0084      $float_frac_streamice_ad, surf_el_streamice_ad,
                0085      $area_shelf_streamice_ad, c_basal_friction_ad, b_glen_ad,
                0086      $bdot_streamice_ad
                0087 
5ca83cd8f7 Dani*0088 #ifdef USE_ALT_RLOW
427e24e121 Jean*0089       double precision :: r_low_si_ad(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,
                0090      $nSy)
22e8fae606 Dani*0091       common /streamice_rlow_ad/ r_low_si_ad
5ca83cd8f7 Dani*0092 #endif
                0093 CEOP
                0094 
                0095       IF (
427e24e121 Jean*0096      &  DIFFERENT_MULTIPLE(streamice_adjDump,myTime,deltaTClock)
5ca83cd8f7 Dani*0097      & ) THEN
                0098 
                0099 C--     Set suffix for this set of data files.
                0100         WRITE(suff,'(I10.10)') myIter
                0101 
                0102 C--     Read IO error counter
                0103         beginIOErrCount = IO_ERRCOUNT(myThid)
                0104 
                0105         CALL WRITE_REC_3D_RL(
                0106      &       'ADJc_basal_friction.'//suff, writeBinaryPrec,
22e8fae606 Dani*0107      &       1,  c_basal_friction_ad, 1, myIter, myThid )
5ca83cd8f7 Dani*0108         CALL WRITE_REC_3D_RL(
                0109      &       'ADJh_streamice.'//suff, writeBinaryPrec,
22e8fae606 Dani*0110      &       1,  h_streamice_ad, 1, myIter, myThid )
5ca83cd8f7 Dani*0111 #ifdef USE_ALT_RLOW
                0112         CALL WRITE_REC_3D_RL(
                0113      &       'ADJr_low.'//suff, writeBinaryPrec,
22e8fae606 Dani*0114      &       1,  r_low_si_ad, 1, myIter, myThid )
5ca83cd8f7 Dani*0115 #endif
                0116         CALL WRITE_REC_3D_RL(
                0117      &       'ADJb_glen.'//suff, writeBinaryPrec,
22e8fae606 Dani*0118      &       1,  b_glen_ad, 1, myIter, myThid )
5ca83cd8f7 Dani*0119         CALL WRITE_REC_3D_RL(
                0120      &       'ADJbdot.'//suff, writeBinaryPrec,
22e8fae606 Dani*0121      &       1,  bdot_streamice_ad, 1, myIter, myThid )
5ca83cd8f7 Dani*0122 
                0123       ENDIF
                0124 
                0125 #endif /* ALLOW_ADJOINT_RUN */
                0126 
                0127       RETURN
                0128       END