Back to home page

MITgcm

 
 

    


File indexing completed on 2024-06-06 05:10:26 UTC

view on githubraw file Latest commit af61e5eb on 2024-06-06 03:30:35 UTC
0d7eb15592 Jean*0001 #include "AUTODIFF_OPTIONS.h"
bead363026 Jean*0002 #ifdef ALLOW_CTRL
                0003 # include "CTRL_OPTIONS.h"
                0004 #endif
5728d4a98b Patr*0005 #ifdef ALLOW_OBCS
                0006 # include "OBCS_OPTIONS.h"
                0007 #endif
                0008 #ifdef ALLOW_SEAICE
                0009 # include "SEAICE_OPTIONS.h"
                0010 #endif
bf759c6109 Gael*0011 #ifdef ALLOW_EXF
                0012 # include "EXF_OPTIONS.h"
                0013 #endif
5728d4a98b Patr*0014 
6fe4379e6f Jean*0015       SUBROUTINE AUTODIFF_RESTORE( myThid )
5728d4a98b Patr*0016 
cda1c18f72 Jean*0017 C     ==================================================================
                0018 C     SUBROUTINE autodiff_restore
                0019 C     ==================================================================
                0020 C
                0021 C     packing for checkpoint storage
                0022 C
                0023 C     started: Matt Mazloff mmazloff@mit.edu 03-May-2007
                0024 C
                0025 C     ==================================================================
                0026 C     SUBROUTINE autodiff_restore
                0027 C     ==================================================================
5728d4a98b Patr*0028 
7b94249161 Jean*0029       IMPLICIT NONE
5728d4a98b Patr*0030 
cda1c18f72 Jean*0031 C     == global variables ==
5728d4a98b Patr*0032 
                0033 #include "SIZE.h"
                0034 #include "EEPARAMS.h"
                0035 #include "PARAMS.h"
cda1c18f72 Jean*0036 C**************************************
                0037 C These includes are needed for
                0038 C AD-checkpointing.
                0039 C They provide the fields to be stored.
5728d4a98b Patr*0040 
56a89d1ef6 Mart*0041 #include "GRID.h"
                0042 #include "DYNVARS.h"
                0043 #include "FFIELDS.h"
                0044 #include "SURFACE.h"
5728d4a98b Patr*0045 
e28d7f2731 Gael*0046 #ifdef ALLOW_OBCS
af61e5eb16 Mart*0047 # include "OBCS_PARAMS.h"
e28d7f2731 Gael*0048 # include "OBCS_FIELDS.h"
                0049 # include "OBCS_SEAICE.h"
                0050 #endif
                0051 #ifdef ALLOW_EXF
                0052 # include "EXF_FIELDS.h"
                0053 # ifdef ALLOW_BULKFORMULAE
                0054 #  include "EXF_CONSTANTS.h"
5728d4a98b Patr*0055 # endif
e28d7f2731 Gael*0056 #endif /* ALLOW_EXF */
                0057 #ifdef ALLOW_SEAICE
                0058 # include "SEAICE_SIZE.h"
                0059 # include "SEAICE.h"
                0060 #endif
                0061 #ifdef ALLOW_CTRL
5cf4364659 Mart*0062 # include "CTRL_SIZE.h"
4d72283393 Mart*0063 # include "CTRL.h"
e28d7f2731 Gael*0064 # include "CTRL_OBCS.h"
                0065 #endif
cda1c18f72 Jean*0066 C     it is important that this file is included after SEAICE_SIZE.h
56a89d1ef6 Mart*0067 #include "AUTODIFF_STORE.h"
5728d4a98b Patr*0068 
cda1c18f72 Jean*0069 C     == routine arguments ==
                0070 C     myThid   :: my Thread Id number
6fe4379e6f Jean*0071       INTEGER myThid
5728d4a98b Patr*0072 
a47c7bbdd2 Mart*0073 #ifdef ALLOW_AUTODIFF_TAMC
cda1c18f72 Jean*0074 C     == local variables ==
                0075 #if ( defined AUTODIFF_USE_STORE_RESTORE || \
                0076      ( defined ALLOW_OBCS && defined AUTODIFF_USE_STORE_RESTORE_OBCS ))
                0077       INTEGER bi, bj
                0078       INTEGER I, J, K
                0079 #endif
                0080 C--   == end of interface ==
5728d4a98b Patr*0081 
b167b0379c Patr*0082 #ifdef ALLOW_DEBUG
862d160a2f Jean*0083       IF ( debugMode ) CALL DEBUG_ENTER('AUTODIFF_RESTORE',myThid)
5728d4a98b Patr*0084 #endif
0d7eb15592 Jean*0085 
3c775cbf98 Mart*0086 #ifdef AUTODIFF_USE_STORE_RESTORE
5728d4a98b Patr*0087 C--   Over all tiles
                0088       DO bj = myByLo(myThid), myByHi(myThid)
                0089        DO bi = myBxLo(myThid), myBxHi(myThid)
                0090 C-      2D arrays
e4f1c09db9 Jean*0091         DO J=1-OLy,sNy+OLy
                0092          DO I=1-OLx,sNx+OLx
f255f6c083 Jean*0093           etaN(I,J,bi,bj)  = StoreDynVars2D(I,J,bi,bj,1)
                0094           taux0(I,J,bi,bj) = StoreDynVars2D(I,J,bi,bj,2)
                0095           taux1(I,J,bi,bj) = StoreDynVars2D(I,J,bi,bj,3)
                0096           tauy0(I,J,bi,bj) = StoreDynVars2D(I,J,bi,bj,4)
                0097           tauy1(I,J,bi,bj) = StoreDynVars2D(I,J,bi,bj,5)
                0098           qnet0(I,J,bi,bj) = StoreDynVars2D(I,J,bi,bj,6)
                0099           qnet1(I,J,bi,bj) = StoreDynVars2D(I,J,bi,bj,7)
                0100           empmr0(I,J,bi,bj) = StoreDynVars2D(I,J,bi,bj,8)
                0101           empmr1(I,J,bi,bj) = StoreDynVars2D(I,J,bi,bj,9)
                0102           sst0(I,J,bi,bj) = StoreDynVars2D(I,J,bi,bj,10)
                0103           sst1(I,J,bi,bj) = StoreDynVars2D(I,J,bi,bj,11)
                0104           sss0(I,J,bi,bj) = StoreDynVars2D(I,J,bi,bj,12)
                0105           sss1(I,J,bi,bj) = StoreDynVars2D(I,J,bi,bj,13)
                0106           saltflux0(I,J,bi,bj) = StoreDynVars2D(I,J,bi,bj,14)
                0107           saltflux1(I,J,bi,bj) = StoreDynVars2D(I,J,bi,bj,15)
5728d4a98b Patr*0108 #ifdef SHORTWAVE_HEATING
f255f6c083 Jean*0109           qsw0(I,J,bi,bj)    = StoreDynVars2D(I,J,bi,bj,16)
                0110           qsw1(I,J,bi,bj)    = StoreDynVars2D(I,J,bi,bj,17)
5728d4a98b Patr*0111 #endif
                0112 #ifdef ATMOSPHERIC_LOADING
f255f6c083 Jean*0113           pload0(I,J,bi,bj)  = StoreDynVars2D(I,J,bi,bj,18)
                0114           pload1(I,J,bi,bj)  = StoreDynVars2D(I,J,bi,bj,19)
5728d4a98b Patr*0115 #endif
                0116 #ifdef EXACT_CONSERV
f255f6c083 Jean*0117           etaH(I,J,bi,bj)    = StoreDynVars2D(I,J,bi,bj,20)
                0118           dEtaHdt(I,J,bi,bj) = StoreDynVars2D(I,J,bi,bj,21)
                0119           PmEpR(I,J,bi,bj)   = StoreDynVars2D(I,J,bi,bj,22)
5728d4a98b Patr*0120 #endif
                0121          ENDDO
                0122         ENDDO
3c775cbf98 Mart*0123        ENDDO
                0124       ENDDO
c5c9d716eb Patr*0125 
3c775cbf98 Mart*0126 C--   Over all tiles
                0127       DO bj = myByLo(myThid), myByHi(myThid)
                0128        DO bi = myBxLo(myThid), myBxHi(myThid)
5728d4a98b Patr*0129 C-      3D arrays
                0130         DO K=1,Nr
e4f1c09db9 Jean*0131          DO J=1-OLy,sNy+OLy
                0132           DO I=1-OLx,sNx+OLx
507fbacc22 Gael*0133 #ifdef ALLOW_ADAMSBASHFORTH_3
e4f1c09db9 Jean*0134            gtNm(I,J,K,bi,bj,1)   = StoreDynVars3D(I,J,K,bi,bj,1)
                0135            gsNm(I,J,K,bi,bj,1)   = StoreDynVars3D(I,J,K,bi,bj,2)
                0136            guNm(I,J,K,bi,bj,1)   = StoreDynVars3D(I,J,K,bi,bj,3)
                0137            gvNm(I,J,K,bi,bj,1)   = StoreDynVars3D(I,J,K,bi,bj,4)
507fbacc22 Gael*0138 #else
e4f1c09db9 Jean*0139            gtNm1(I,J,K,bi,bj)    = StoreDynVars3D(I,J,K,bi,bj,1)
                0140            gsNm1(I,J,K,bi,bj)    = StoreDynVars3D(I,J,K,bi,bj,2)
                0141            guNm1(I,J,K,bi,bj)    = StoreDynVars3D(I,J,K,bi,bj,3)
                0142            gvNm1(I,J,K,bi,bj)    = StoreDynVars3D(I,J,K,bi,bj,4)
507fbacc22 Gael*0143 #endif
e4f1c09db9 Jean*0144            theta(I,J,K,bi,bj)    = StoreDynVars3D(I,J,K,bi,bj,5)
                0145            salt(I,J,K,bi,bj)     = StoreDynVars3D(I,J,K,bi,bj,6)
                0146            uVel(I,J,K,bi,bj)     = StoreDynVars3D(I,J,K,bi,bj,7)
                0147            vVel(I,J,K,bi,bj)     = StoreDynVars3D(I,J,K,bi,bj,8)
                0148            wVel(I,J,K,bi,bj)     = StoreDynVars3D(I,J,K,bi,bj,9)
                0149            totPhiHyd(I,J,K,bi,bj)= StoreDynVars3D(I,J,K,bi,bj,10)
507fbacc22 Gael*0150 #ifdef ALLOW_ADAMSBASHFORTH_3
e4f1c09db9 Jean*0151            gtNm(I,J,K,bi,bj,2)   = StoreDynVars3D(I,J,K,bi,bj,11)
                0152            gsNm(I,J,K,bi,bj,2)   = StoreDynVars3D(I,J,K,bi,bj,12)
                0153            guNm(I,J,K,bi,bj,2)   = StoreDynVars3D(I,J,K,bi,bj,13)
                0154            gvNm(I,J,K,bi,bj,2)   = StoreDynVars3D(I,J,K,bi,bj,14)
507fbacc22 Gael*0155 #endif
5728d4a98b Patr*0156           ENDDO
                0157          ENDDO
                0158         ENDDO
                0159        ENDDO
                0160       ENDDO
0d7eb15592 Jean*0161 
5728d4a98b Patr*0162 #ifdef ALLOW_EXF
                0163 C--   Over all tiles
                0164       DO bj = myByLo(myThid), myByHi(myThid)
                0165        DO bi = myBxLo(myThid), myBxHi(myThid)
                0166 C-      2D arrays
e4f1c09db9 Jean*0167          DO J=1-OLy,sNy+OLy
                0168           DO I=1-OLx,sNx+OLx
fc77a29eb0 Patr*0169           hflux0(I,J,bi,bj)            = StoreEXF1(I,J,bi,bj,1)
                0170           hflux1(I,J,bi,bj)            = StoreEXF1(I,J,bi,bj,2)
                0171           sflux0(I,J,bi,bj)            = StoreEXF1(I,J,bi,bj,3)
                0172           sflux1(I,J,bi,bj)            = StoreEXF1(I,J,bi,bj,4)
                0173           ustress0(I,J,bi,bj)          = StoreEXF1(I,J,bi,bj,5)
                0174           ustress1(I,J,bi,bj)          = StoreEXF1(I,J,bi,bj,6)
                0175           vstress0(I,J,bi,bj)          = StoreEXF1(I,J,bi,bj,7)
                0176           vstress1(I,J,bi,bj)          = StoreEXF1(I,J,bi,bj,8)
                0177           wspeed0(I,J,bi,bj)           = StoreEXF1(I,J,bi,bj,9)
                0178           wspeed1(I,J,bi,bj)           = StoreEXF1(I,J,bi,bj,10)
                0179 # ifdef SHORTWAVE_HEATING
                0180           swflux0(I,J,bi,bj)           = StoreEXF1(I,J,bi,bj,11)
                0181           swflux1(I,J,bi,bj)           = StoreEXF1(I,J,bi,bj,12)
                0182 # endif
                0183 # ifdef ALLOW_RUNOFF
                0184           runoff0(I,J,bi,bj)           = StoreEXF1(I,J,bi,bj,13)
                0185           runoff1(I,J,bi,bj)           = StoreEXF1(I,J,bi,bj,14)
                0186 # endif
                0187 # ifdef ATMOSPHERIC_LOADING
                0188           apressure0(I,J,bi,bj)        = StoreEXF1(I,J,bi,bj,15)
                0189           apressure1(I,J,bi,bj)        = StoreEXF1(I,J,bi,bj,16)
                0190           siceload(I,J,bi,bj)          = StoreEXF1(I,J,bi,bj,17)
                0191 # endif
                0192 # ifdef ALLOW_CLIMSSS_RELAXATION
                0193           climsss0(I,J,bi,bj)          = StoreEXF1(I,J,bi,bj,18)
                0194           climsss1(I,J,bi,bj)          = StoreEXF1(I,J,bi,bj,19)
                0195 # endif
                0196 # ifdef ALLOW_CLIMSST_RELAXATION
                0197           climsst0(I,J,bi,bj)          = StoreEXF1(I,J,bi,bj,20)
                0198           climsst1(I,J,bi,bj)          = StoreEXF1(I,J,bi,bj,21)
                0199 # endif
d217f7c14d Gael*0200 # ifdef ALLOW_SALTFLX
                0201           saltflx0(I,J,bi,bj)          = StoreEXF1(I,J,bi,bj,22)
                0202           saltflx1(I,J,bi,bj)          = StoreEXF1(I,J,bi,bj,23)
                0203 # endif
634ecb5dc5 Jean*0204          ENDDO
                0205         ENDDO
                0206        ENDDO
                0207       ENDDO
0d7eb15592 Jean*0208 
5728d4a98b Patr*0209 C--   Over all tiles
                0210       DO bj = myByLo(myThid), myByHi(myThid)
                0211        DO bi = myBxLo(myThid), myBxHi(myThid)
                0212 C-      2D arrays
e4f1c09db9 Jean*0213         DO J=1-OLy,sNy+OLy
                0214          DO I=1-OLx,sNx+OLx
6fe4379e6f Jean*0215 # ifdef ALLOW_ATM_TEMP
5728d4a98b Patr*0216           aqh0(I,J,bi,bj)            = StoreEXF2(I,J,bi,bj,1)
                0217           aqh1(I,J,bi,bj)            = StoreEXF2(I,J,bi,bj,2)
                0218           atemp0(I,J,bi,bj)          = StoreEXF2(I,J,bi,bj,3)
                0219           atemp1(I,J,bi,bj)          = StoreEXF2(I,J,bi,bj,4)
                0220           precip0(I,J,bi,bj)         = StoreEXF2(I,J,bi,bj,5)
                0221           precip1(I,J,bi,bj)         = StoreEXF2(I,J,bi,bj,6)
0d7eb15592 Jean*0222           lwflux0(I,J,bi,bj)         = StoreEXF2(I,J,bi,bj,7)
5728d4a98b Patr*0223           lwflux1(I,J,bi,bj)         = StoreEXF2(I,J,bi,bj,8)
fead278c20 Patr*0224           snowprecip0(I,J,bi,bj)     = StoreEXF2(I,J,bi,bj,9)
                0225           snowprecip1(I,J,bi,bj)     = StoreEXF2(I,J,bi,bj,10)
0e8df33a35 Jean*0226 #  ifdef ALLOW_READ_TURBFLUXES
                0227           hs0(I,J,bi,bj)             = StoreEXF2(I,J,bi,bj,11)
                0228           hs1(I,J,bi,bj)             = StoreEXF2(I,J,bi,bj,12)
                0229           hl0(I,J,bi,bj)             = StoreEXF2(I,J,bi,bj,13)
                0230           hl1(I,J,bi,bj)             = StoreEXF2(I,J,bi,bj,14)
                0231 #  endif /* ALLOW_READ_TURBFLUXES */
6fe4379e6f Jean*0232 #  ifdef EXF_READ_EVAP
0e8df33a35 Jean*0233           evap0(I,J,bi,bj)           = StoreEXF2(I,J,bi,bj,15)
                0234           evap1(I,J,bi,bj)           = StoreEXF2(I,J,bi,bj,16)
6fe4379e6f Jean*0235 #  else
0e8df33a35 Jean*0236           evap(I,J,bi,bj)            = StoreEXF2(I,J,bi,bj,15)
6fe4379e6f Jean*0237 #  endif /* EXF_READ_EVAP */
                0238 #  ifdef ALLOW_DOWNWARD_RADIATION
0e8df33a35 Jean*0239           swdown0(I,J,bi,bj)         = StoreEXF2(I,J,bi,bj,17)
                0240           swdown1(I,J,bi,bj)         = StoreEXF2(I,J,bi,bj,18)
                0241           lwdown0(I,J,bi,bj)         = StoreEXF2(I,J,bi,bj,19)
                0242           lwdown1(I,J,bi,bj)         = StoreEXF2(I,J,bi,bj,20)
6fe4379e6f Jean*0243 #  endif
                0244 # endif /* ALLOW_ATM_TEMP */
0e8df33a35 Jean*0245           uwind0(I,J,bi,bj)          = StoreEXF2(I,J,bi,bj,21)
                0246           uwind1(I,J,bi,bj)          = StoreEXF2(I,J,bi,bj,22)
                0247           vwind0(I,J,bi,bj)          = StoreEXF2(I,J,bi,bj,23)
                0248           vwind1(I,J,bi,bj)          = StoreEXF2(I,J,bi,bj,24)
634ecb5dc5 Jean*0249          ENDDO
                0250         ENDDO
                0251        ENDDO
                0252       ENDDO
5728d4a98b Patr*0253 #endif /* ALLOW_EXF */
                0254 
3c775cbf98 Mart*0255 #ifdef ALLOW_SEAICE
                0256 C--   Over all tiles
                0257       DO bj = myByLo(myThid), myByHi(myThid)
                0258        DO bi = myBxLo(myThid), myBxHi(myThid)
                0259 C-      2D arrays
                0260         DO J=1-OLy,sNy+OLy
                0261          DO I=1-OLx,sNx+OLx
                0262           AREA  (I,J,bi,bj)            = StoreSEAICE(I,J,bi,bj, 1)
                0263           HEFF  (I,J,bi,bj)            = StoreSEAICE(I,J,bi,bj, 2)
                0264           HSNOW (I,J,bi,bj)            = StoreSEAICE(I,J,bi,bj, 3)
                0265           RUNOFF(I,J,bi,bj)            = StoreSEAICE(I,J,bi,bj, 4)
                0266           UICE  (I,J,bi,bj)            = StoreSEAICE(I,J,bi,bj, 5)
                0267           VICE  (I,J,bi,bj)            = StoreSEAICE(I,J,bi,bj, 6)
                0268           ZETA  (I,J,bi,bj)            = StoreSEAICE(I,J,bi,bj, 7)
                0269           ETA   (I,J,bi,bj)            = StoreSEAICE(I,J,bi,bj, 8)
                0270 # ifdef SEAICE_CGRID
                0271           dwatn(I,J,bi,bj)             = StoreSEAICE(I,J,bi,bj, 9)
                0272 #  ifdef SEAICE_ALLOW_BOTTOMDRAG
                0273           cbotc(I,J,bi,bj)             = StoreSEAICE(I,J,bi,bj,10)
                0274 #  endif /* SEAICE_ALLOW_BOTTOMDRAG */
                0275           stressDivergenceX(I,J,bi,bj) = StoreSEAICE(I,J,bi,bj,11)
                0276           stressDivergenceY(I,J,bi,bj) = StoreSEAICE(I,J,bi,bj,12)
                0277 # endif /* SEAICE_CGRID */
                0278 # ifdef SEAICE_ALLOW_EVP
                0279           seaice_sigma1    (I,J,bi,bj) = StoreSEAICE(I,J,bi,bj,13)
                0280           seaice_sigma2    (I,J,bi,bj) = StoreSEAICE(I,J,bi,bj,14)
                0281           seaice_sigma12   (I,J,bi,bj) = StoreSEAICE(I,J,bi,bj,15)
                0282 # endif /* SEAICE_ALLOW_EVP */
                0283 # ifdef SEAICE_VARIABLE_SALINITY
                0284           HSALT            (I,J,bi,bj) = StoreSEAICE(I,J,bi,bj,16)
                0285 # endif
                0286          ENDDO
                0287         ENDDO
                0288 C--   this 3D array comes last because it has a variable size nITD
cda1c18f72 Jean*0289         DO K=1,nITD
3c775cbf98 Mart*0290          DO J=1-OLy,sNy+OLy
                0291           DO I=1-OLx,sNx+OLx
cda1c18f72 Jean*0292            TICES(I,J,K,bi,bj) = StoreSEAICE(I,J,bi,bj,16+K)
3c775cbf98 Mart*0293           ENDDO
                0294          ENDDO
                0295         ENDDO
                0296 C
                0297        ENDDO
                0298       ENDDO
                0299 #endif /* ALLOW_SEAICE */
                0300 
                0301 #endif /* AUTODIFF_USE_STORE_RESTORE */
                0302 
                0303 #if ( defined ALLOW_OBCS && defined AUTODIFF_USE_STORE_RESTORE_OBCS )
5728d4a98b Patr*0304 # ifdef ALLOW_OBCS_NORTH
                0305 C--   Over all tiles
                0306       DO bj = myByLo(myThid), myByHi(myThid)
                0307        DO bi = myBxLo(myThid), myBxHi(myThid)
                0308 C-      2D arrays
                0309         DO K=1,Nr
e4f1c09db9 Jean*0310          DO I=1-OLx,sNx+OLx
634ecb5dc5 Jean*0311           OBNu(I,K,bi,bj)    = StoreOBCSN(I,K,bi,bj,1)
                0312           OBNv(I,K,bi,bj)    = StoreOBCSN(I,K,bi,bj,2)
                0313           OBNt(I,K,bi,bj)    = StoreOBCSN(I,K,bi,bj,3)
                0314           OBNs(I,K,bi,bj)    = StoreOBCSN(I,K,bi,bj,4)
7b94249161 Jean*0315 #  ifdef ALLOW_OBCS_PRESCRIBE
634ecb5dc5 Jean*0316           OBNu0(I,K,bi,bj)   = StoreOBCSN(I,K,bi,bj,5)
                0317           OBNv0(I,K,bi,bj)   = StoreOBCSN(I,K,bi,bj,6)
                0318           OBNt0(I,K,bi,bj)   = StoreOBCSN(I,K,bi,bj,7)
                0319           OBNs0(I,K,bi,bj)   = StoreOBCSN(I,K,bi,bj,8)
                0320           OBNu1(I,K,bi,bj)   = StoreOBCSN(I,K,bi,bj,9)
                0321           OBNv1(I,K,bi,bj)   = StoreOBCSN(I,K,bi,bj,10)
                0322           OBNt1(I,K,bi,bj)   = StoreOBCSN(I,K,bi,bj,11)
                0323           OBNs1(I,K,bi,bj)   = StoreOBCSN(I,K,bi,bj,12)
7b94249161 Jean*0324 #  endif
5728d4a98b Patr*0325 #  ifdef ALLOW_OBCSN_CONTROL
634ecb5dc5 Jean*0326           xx_obcsn0(I,K,bi,bj,1)   = StoreOBCSN(I,K,bi,bj,13)
                0327           xx_obcsn0(I,K,bi,bj,2)   = StoreOBCSN(I,K,bi,bj,14)
                0328           xx_obcsn0(I,K,bi,bj,3)   = StoreOBCSN(I,K,bi,bj,15)
                0329           xx_obcsn0(I,K,bi,bj,4)   = StoreOBCSN(I,K,bi,bj,16)
                0330           xx_obcsn1(I,K,bi,bj,1)   = StoreOBCSN(I,K,bi,bj,17)
                0331           xx_obcsn1(I,K,bi,bj,2)   = StoreOBCSN(I,K,bi,bj,18)
                0332           xx_obcsn1(I,K,bi,bj,3)   = StoreOBCSN(I,K,bi,bj,19)
                0333           xx_obcsn1(I,K,bi,bj,4)   = StoreOBCSN(I,K,bi,bj,20)
5728d4a98b Patr*0334 #  endif
634ecb5dc5 Jean*0335          ENDDO
                0336         ENDDO
                0337        ENDDO
                0338       ENDDO
0d7eb15592 Jean*0339 # endif /* ALLOW_OBCS_NORTH */
5728d4a98b Patr*0340 
                0341 # ifdef ALLOW_OBCS_SOUTH
                0342 C--   Over all tiles
                0343       DO bj = myByLo(myThid), myByHi(myThid)
                0344        DO bi = myBxLo(myThid), myBxHi(myThid)
                0345 C-      2D arrays
                0346         DO K=1,Nr
e4f1c09db9 Jean*0347          DO I=1-OLx,sNx+OLx
634ecb5dc5 Jean*0348           OBSu(I,K,bi,bj)       = StoreOBCSS(I,K,bi,bj,1)
                0349           OBSv(I,K,bi,bj)       = StoreOBCSS(I,K,bi,bj,2)
                0350           OBSt(I,K,bi,bj)       = StoreOBCSS(I,K,bi,bj,3)
                0351           OBSs(I,K,bi,bj)       = StoreOBCSS(I,K,bi,bj,4)
7b94249161 Jean*0352 #  ifdef ALLOW_OBCS_PRESCRIBE
634ecb5dc5 Jean*0353           OBSu0(I,K,bi,bj)      = StoreOBCSS(I,K,bi,bj,5)
                0354           OBSv0(I,K,bi,bj)      = StoreOBCSS(I,K,bi,bj,6)
                0355           OBSt0(I,K,bi,bj)      = StoreOBCSS(I,K,bi,bj,7)
                0356           OBSs0(I,K,bi,bj)      = StoreOBCSS(I,K,bi,bj,8)
                0357           OBSu1(I,K,bi,bj)      = StoreOBCSS(I,K,bi,bj,9)
                0358           OBSv1(I,K,bi,bj)      = StoreOBCSS(I,K,bi,bj,10)
                0359           OBSt1(I,K,bi,bj)      = StoreOBCSS(I,K,bi,bj,11)
                0360           OBSs1(I,K,bi,bj)      = StoreOBCSS(I,K,bi,bj,12)
7b94249161 Jean*0361 #  endif
5728d4a98b Patr*0362 #  ifdef ALLOW_OBCSS_CONTROL
634ecb5dc5 Jean*0363           xx_obcss0(I,K,bi,bj,1)   = StoreOBCSS(I,K,bi,bj,13)
                0364           xx_obcss0(I,K,bi,bj,2)   = StoreOBCSS(I,K,bi,bj,14)
                0365           xx_obcss0(I,K,bi,bj,3)   = StoreOBCSS(I,K,bi,bj,15)
                0366           xx_obcss0(I,K,bi,bj,4)   = StoreOBCSS(I,K,bi,bj,16)
                0367           xx_obcss1(I,K,bi,bj,1)   = StoreOBCSS(I,K,bi,bj,17)
                0368           xx_obcss1(I,K,bi,bj,2)   = StoreOBCSS(I,K,bi,bj,18)
                0369           xx_obcss1(I,K,bi,bj,3)   = StoreOBCSS(I,K,bi,bj,19)
                0370           xx_obcss1(I,K,bi,bj,4)   = StoreOBCSS(I,K,bi,bj,20)
5728d4a98b Patr*0371 #  endif
634ecb5dc5 Jean*0372          ENDDO
                0373         ENDDO
                0374        ENDDO
                0375       ENDDO
0d7eb15592 Jean*0376 # endif /* ALLOW_OBCS_SOUTH */
5728d4a98b Patr*0377 
                0378 # ifdef ALLOW_OBCS_EAST
                0379 C--   Over all tiles
                0380       DO bj = myByLo(myThid), myByHi(myThid)
                0381        DO bi = myBxLo(myThid), myBxHi(myThid)
                0382 C-      2D arrays
                0383         DO K=1,Nr
e4f1c09db9 Jean*0384          DO J=1-OLy,sNy+OLy
634ecb5dc5 Jean*0385           OBEu(J,K,bi,bj)      = StoreOBCSE(J,K,bi,bj,1)
                0386           OBEv(J,K,bi,bj)      = StoreOBCSE(J,K,bi,bj,2)
                0387           OBEt(J,K,bi,bj)      = StoreOBCSE(J,K,bi,bj,3)
                0388           OBEs(J,K,bi,bj)      = StoreOBCSE(J,K,bi,bj,4)
7b94249161 Jean*0389 #  ifdef ALLOW_OBCS_PRESCRIBE
634ecb5dc5 Jean*0390           OBEu0(J,K,bi,bj)     = StoreOBCSE(J,K,bi,bj,5)
                0391           OBEv0(J,K,bi,bj)     = StoreOBCSE(J,K,bi,bj,6)
                0392           OBEt0(J,K,bi,bj)     = StoreOBCSE(J,K,bi,bj,7)
                0393           OBEs0(J,K,bi,bj)     = StoreOBCSE(J,K,bi,bj,8)
                0394           OBEu1(J,K,bi,bj)     = StoreOBCSE(J,K,bi,bj,9)
                0395           OBEv1(J,K,bi,bj)     = StoreOBCSE(J,K,bi,bj,10)
                0396           OBEt1(J,K,bi,bj)     = StoreOBCSE(J,K,bi,bj,11)
                0397           OBEs1(J,K,bi,bj)     = StoreOBCSE(J,K,bi,bj,12)
7b94249161 Jean*0398 #  endif
5728d4a98b Patr*0399 #  ifdef ALLOW_OBCSE_CONTROL
634ecb5dc5 Jean*0400           xx_obcse0(J,K,bi,bj,1)     = StoreOBCSE(J,K,bi,bj,13)
                0401           xx_obcse0(J,K,bi,bj,2)     = StoreOBCSE(J,K,bi,bj,14)
                0402           xx_obcse0(J,K,bi,bj,3)     = StoreOBCSE(J,K,bi,bj,15)
                0403           xx_obcse0(J,K,bi,bj,4)     = StoreOBCSE(J,K,bi,bj,16)
                0404           xx_obcse1(J,K,bi,bj,1)     = StoreOBCSE(J,K,bi,bj,17)
                0405           xx_obcse1(J,K,bi,bj,2)     = StoreOBCSE(J,K,bi,bj,18)
                0406           xx_obcse1(J,K,bi,bj,3)     = StoreOBCSE(J,K,bi,bj,19)
                0407           xx_obcse1(J,K,bi,bj,4)     = StoreOBCSE(J,K,bi,bj,20)
5728d4a98b Patr*0408 #  endif
634ecb5dc5 Jean*0409           ENDDO
                0410         ENDDO
                0411        ENDDO
                0412       ENDDO
0d7eb15592 Jean*0413 # endif /* ALLOW_OBCS_EAST */
5728d4a98b Patr*0414 
                0415 # ifdef ALLOW_OBCS_WEST
                0416 C--   Over all tiles
                0417       DO bj = myByLo(myThid), myByHi(myThid)
                0418        DO bi = myBxLo(myThid), myBxHi(myThid)
                0419 C-      2D arrays
                0420         DO K=1,Nr
e4f1c09db9 Jean*0421          DO J=1-OLy,sNy+OLy
634ecb5dc5 Jean*0422           OBWu(J,K,bi,bj)      = StoreOBCSW(J,K,bi,bj,1)
                0423           OBWv(J,K,bi,bj)      = StoreOBCSW(J,K,bi,bj,2)
                0424           OBWt(J,K,bi,bj)      = StoreOBCSW(J,K,bi,bj,3)
                0425           OBWs(J,K,bi,bj)      = StoreOBCSW(J,K,bi,bj,4)
7b94249161 Jean*0426 #  ifdef ALLOW_OBCS_PRESCRIBE
634ecb5dc5 Jean*0427           OBWu0(J,K,bi,bj)     = StoreOBCSW(J,K,bi,bj,5)
                0428           OBWv0(J,K,bi,bj)     = StoreOBCSW(J,K,bi,bj,6)
                0429           OBWt0(J,K,bi,bj)     = StoreOBCSW(J,K,bi,bj,7)
                0430           OBWs0(J,K,bi,bj)     = StoreOBCSW(J,K,bi,bj,8)
                0431           OBWu1(J,K,bi,bj)     = StoreOBCSW(J,K,bi,bj,9)
                0432           OBWv1(J,K,bi,bj)     = StoreOBCSW(J,K,bi,bj,10)
                0433           OBWt1(J,K,bi,bj)     = StoreOBCSW(J,K,bi,bj,11)
                0434           OBWs1(J,K,bi,bj)     = StoreOBCSW(J,K,bi,bj,12)
7b94249161 Jean*0435 #  endif
5728d4a98b Patr*0436 #  ifdef ALLOW_OBCSW_CONTROL
634ecb5dc5 Jean*0437           xx_obcsw0(J,K,bi,bj,1) = StoreOBCSW(J,K,bi,bj,13)
                0438           xx_obcsw0(J,K,bi,bj,2) = StoreOBCSW(J,K,bi,bj,14)
                0439           xx_obcsw0(J,K,bi,bj,3) = StoreOBCSW(J,K,bi,bj,15)
                0440           xx_obcsw0(J,K,bi,bj,4) = StoreOBCSW(J,K,bi,bj,16)
                0441           xx_obcsw1(J,K,bi,bj,1) = StoreOBCSW(J,K,bi,bj,17)
                0442           xx_obcsw1(J,K,bi,bj,2) = StoreOBCSW(J,K,bi,bj,18)
                0443           xx_obcsw1(J,K,bi,bj,3) = StoreOBCSW(J,K,bi,bj,19)
                0444           xx_obcsw1(J,K,bi,bj,4) = StoreOBCSW(J,K,bi,bj,20)
5728d4a98b Patr*0445 #  endif
634ecb5dc5 Jean*0446           ENDDO
                0447         ENDDO
                0448        ENDDO
                0449       ENDDO
5728d4a98b Patr*0450 # endif /* ALLOW_OBCS_WEST */
cda1c18f72 Jean*0451 #endif /* ALLOW_OBCS & AUTODIFF_USE_STORE_RESTORE_OBCS */
5728d4a98b Patr*0452 
b167b0379c Patr*0453 #ifdef ALLOW_DEBUG
862d160a2f Jean*0454       IF ( debugMode ) CALL DEBUG_LEAVE('AUTODIFF_RESTORE',myThid)
5728d4a98b Patr*0455 #endif
                0456 
                0457 #endif /* ALLOW_AUTODIFF_TAMC */
cda1c18f72 Jean*0458 C**************************************
5728d4a98b Patr*0459 
6fe4379e6f Jean*0460       RETURN
                0461       END