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_STORE( myThid )
5728d4a98b Patr*0016 
cda1c18f72 Jean*0017 C     ==================================================================
                0018 C     SUBROUTINE autodiff_store
                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_store
                0027 C     ==================================================================
5728d4a98b Patr*0028 
6fe4379e6f 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 
e28d7f2731 Gael*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
0d7eb15592 Jean*0080 
cda1c18f72 Jean*0081 C--   == end of interface ==
5728d4a98b Patr*0082 
3e55964de2 Patr*0083 #ifdef ALLOW_DEBUG
862d160a2f Jean*0084       IF ( debugMode ) CALL DEBUG_ENTER('AUTODIFF_STORE',myThid)
5728d4a98b Patr*0085 #endif
0d7eb15592 Jean*0086 
3c775cbf98 Mart*0087 #ifdef AUTODIFF_USE_STORE_RESTORE
5728d4a98b Patr*0088 C--   Over all tiles
                0089       DO bj = myByLo(myThid), myByHi(myThid)
                0090        DO bi = myBxLo(myThid), myBxHi(myThid)
                0091 C-      2D arrays
e4f1c09db9 Jean*0092         DO J=1-OLy,sNy+OLy
                0093          DO I=1-OLx,sNx+OLx
                0094           StoreDynVars2D(I,J,bi,bj,1) = etaN(I,J,bi,bj)
f255f6c083 Jean*0095           StoreDynVars2D(I,J,bi,bj,2) = taux0(I,J,bi,bj)
                0096           StoreDynVars2D(I,J,bi,bj,3) = taux1(I,J,bi,bj)
                0097           StoreDynVars2D(I,J,bi,bj,4) = tauy0(I,J,bi,bj)
                0098           StoreDynVars2D(I,J,bi,bj,5) = tauy1(I,J,bi,bj)
                0099           StoreDynVars2D(I,J,bi,bj,6) = qnet0(I,J,bi,bj)
                0100           StoreDynVars2D(I,J,bi,bj,7) = qnet1(I,J,bi,bj)
                0101           StoreDynVars2D(I,J,bi,bj,8)  = empmr0(I,J,bi,bj)
                0102           StoreDynVars2D(I,J,bi,bj,9) = empmr1(I,J,bi,bj)
                0103           StoreDynVars2D(I,J,bi,bj,10) = sst0(I,J,bi,bj)
                0104           StoreDynVars2D(I,J,bi,bj,11) = sst1(I,J,bi,bj)
                0105           StoreDynVars2D(I,J,bi,bj,12) = sss0(I,J,bi,bj)
                0106           StoreDynVars2D(I,J,bi,bj,13) = sss1(I,J,bi,bj)
                0107           StoreDynVars2D(I,J,bi,bj,14) = saltflux0(I,J,bi,bj)
                0108           StoreDynVars2D(I,J,bi,bj,15) = saltflux1(I,J,bi,bj)
5728d4a98b Patr*0109 #ifdef SHORTWAVE_HEATING
f255f6c083 Jean*0110           StoreDynVars2D(I,J,bi,bj,16) = qsw0(I,J,bi,bj)
                0111           StoreDynVars2D(I,J,bi,bj,17) = qsw1(I,J,bi,bj)
5728d4a98b Patr*0112 #else
f255f6c083 Jean*0113           StoreDynVars2D(I,J,bi,bj,16) = 0.
5728d4a98b Patr*0114           StoreDynVars2D(I,J,bi,bj,17) = 0.
                0115 #endif
                0116 #ifdef ATMOSPHERIC_LOADING
f255f6c083 Jean*0117           StoreDynVars2D(I,J,bi,bj,18) = pload0(I,J,bi,bj)
                0118           StoreDynVars2D(I,J,bi,bj,19) = pload1(I,J,bi,bj)
5728d4a98b Patr*0119 #else
f255f6c083 Jean*0120           StoreDynVars2D(I,J,bi,bj,18) = 0.
5728d4a98b Patr*0121           StoreDynVars2D(I,J,bi,bj,19) = 0.
                0122 #endif
                0123 #ifdef EXACT_CONSERV
f255f6c083 Jean*0124           StoreDynVars2D(I,J,bi,bj,20) = etaH(I,J,bi,bj)
                0125           StoreDynVars2D(I,J,bi,bj,21) = dEtaHdt(I,J,bi,bj)
                0126           StoreDynVars2D(I,J,bi,bj,22) = PmEpR(I,J,bi,bj)
5728d4a98b Patr*0127 #else
f255f6c083 Jean*0128           StoreDynVars2D(I,J,bi,bj,20) = 0.
5728d4a98b Patr*0129           StoreDynVars2D(I,J,bi,bj,21) = 0.
                0130           StoreDynVars2D(I,J,bi,bj,22) = 0.
                0131 #endif
                0132          ENDDO
                0133         ENDDO
3c775cbf98 Mart*0134        ENDDO
                0135       ENDDO
c5c9d716eb Patr*0136 
3c775cbf98 Mart*0137 C--   Over all tiles
                0138       DO bj = myByLo(myThid), myByHi(myThid)
                0139        DO bi = myBxLo(myThid), myBxHi(myThid)
5728d4a98b Patr*0140 C-      3D arrays
                0141         DO K=1,Nr
e4f1c09db9 Jean*0142          DO J=1-OLy,sNy+OLy
                0143           DO I=1-OLx,sNx+OLx
507fbacc22 Gael*0144 #ifdef ALLOW_ADAMSBASHFORTH_3
e4f1c09db9 Jean*0145            StoreDynVars3D(I,J,K,bi,bj,1)  = gtNm(I,J,K,bi,bj,1)
                0146            StoreDynVars3D(I,J,K,bi,bj,2)  = gsNm(I,J,K,bi,bj,1)
                0147            StoreDynVars3D(I,J,K,bi,bj,3)  = guNm(I,J,K,bi,bj,1)
                0148            StoreDynVars3D(I,J,K,bi,bj,4)  = gvNm(I,J,K,bi,bj,1)
507fbacc22 Gael*0149 #else
e4f1c09db9 Jean*0150            StoreDynVars3D(I,J,K,bi,bj,1)  = gtNm1(I,J,K,bi,bj)
                0151            StoreDynVars3D(I,J,K,bi,bj,2)  = gsNm1(I,J,K,bi,bj)
                0152            StoreDynVars3D(I,J,K,bi,bj,3)  = guNm1(I,J,K,bi,bj)
                0153            StoreDynVars3D(I,J,K,bi,bj,4)  = gvNm1(I,J,K,bi,bj)
507fbacc22 Gael*0154 #endif
e4f1c09db9 Jean*0155            StoreDynVars3D(I,J,K,bi,bj,5)  = theta(I,J,K,bi,bj)
                0156            StoreDynVars3D(I,J,K,bi,bj,6)  = salt(I,J,K,bi,bj)
                0157            StoreDynVars3D(I,J,K,bi,bj,7)  = uVel(I,J,K,bi,bj)
                0158            StoreDynVars3D(I,J,K,bi,bj,8)  = vVel(I,J,K,bi,bj)
                0159            StoreDynVars3D(I,J,K,bi,bj,9)  = wVel(I,J,K,bi,bj)
                0160            StoreDynVars3D(I,J,K,bi,bj,10) = totPhiHyd(I,J,K,bi,bj)
507fbacc22 Gael*0161 #ifdef ALLOW_ADAMSBASHFORTH_3
e4f1c09db9 Jean*0162            StoreDynVars3D(I,J,K,bi,bj,11) = gtNm(I,J,K,bi,bj,2)
                0163            StoreDynVars3D(I,J,K,bi,bj,12) = gsNm(I,J,K,bi,bj,2)
                0164            StoreDynVars3D(I,J,K,bi,bj,13) = guNm(I,J,K,bi,bj,2)
                0165            StoreDynVars3D(I,J,K,bi,bj,14) = gvNm(I,J,K,bi,bj,2)
507fbacc22 Gael*0166 #endif
5728d4a98b Patr*0167           ENDDO
                0168          ENDDO
                0169         ENDDO
                0170        ENDDO
                0171       ENDDO
0d7eb15592 Jean*0172 
5728d4a98b Patr*0173 #ifdef ALLOW_EXF
                0174 C--   Over all tiles
                0175       DO bj = myByLo(myThid), myByHi(myThid)
                0176        DO bi = myBxLo(myThid), myBxHi(myThid)
                0177 C-      2D arrays
e4f1c09db9 Jean*0178         DO J=1-OLy,sNy+OLy
                0179          DO I=1-OLx,sNx+OLx
0e8df33a35 Jean*0180           StoreEXF1(I,J,bi,bj,1)  = hflux0(I,J,bi,bj)
                0181           StoreEXF1(I,J,bi,bj,2)  = hflux1(I,J,bi,bj)
                0182           StoreEXF1(I,J,bi,bj,3)  = sflux0(I,J,bi,bj)
                0183           StoreEXF1(I,J,bi,bj,4)  = sflux1(I,J,bi,bj)
                0184           StoreEXF1(I,J,bi,bj,5)  = ustress0(I,J,bi,bj)
                0185           StoreEXF1(I,J,bi,bj,6)  = ustress1(I,J,bi,bj)
                0186           StoreEXF1(I,J,bi,bj,7)  = vstress0(I,J,bi,bj)
                0187           StoreEXF1(I,J,bi,bj,8)  = vstress1(I,J,bi,bj)
                0188           StoreEXF1(I,J,bi,bj,9)  = wspeed0(I,J,bi,bj)
fc77a29eb0 Patr*0189           StoreEXF1(I,J,bi,bj,10) = wspeed1(I,J,bi,bj)
                0190 # ifdef SHORTWAVE_HEATING
                0191           StoreEXF1(I,J,bi,bj,11) = swflux0(I,J,bi,bj)
                0192           StoreEXF1(I,J,bi,bj,12) = swflux1(I,J,bi,bj)
                0193 # else
                0194           StoreEXF1(I,J,bi,bj,11) = 0.0
                0195           StoreEXF1(I,J,bi,bj,12) = 0.0
                0196 # endif
                0197 # ifdef ALLOW_RUNOFF
                0198           StoreEXF1(I,J,bi,bj,13) = runoff0(I,J,bi,bj)
                0199           StoreEXF1(I,J,bi,bj,14) = runoff1(I,J,bi,bj)
                0200 # else
5728d4a98b Patr*0201           StoreEXF1(I,J,bi,bj,13) = 0.0
                0202           StoreEXF1(I,J,bi,bj,14) = 0.0
fc77a29eb0 Patr*0203 # endif
                0204 # ifdef ATMOSPHERIC_LOADING
                0205           StoreEXF1(I,J,bi,bj,15) = apressure0(I,J,bi,bj)
                0206           StoreEXF1(I,J,bi,bj,16) = apressure1(I,J,bi,bj)
                0207           StoreEXF1(I,J,bi,bj,17) = siceload(I,J,bi,bj)
                0208 # else
5728d4a98b Patr*0209           StoreEXF1(I,J,bi,bj,15) = 0.0
                0210           StoreEXF1(I,J,bi,bj,16) = 0.0
fc77a29eb0 Patr*0211           StoreEXF1(I,J,bi,bj,17) = 0.0
                0212 # endif
                0213 # ifdef ALLOW_CLIMSSS_RELAXATION
                0214           StoreEXF1(I,J,bi,bj,18) = climsss0(I,J,bi,bj)
                0215           StoreEXF1(I,J,bi,bj,19) = climsss1(I,J,bi,bj)
                0216 # else
                0217           StoreEXF1(I,J,bi,bj,18) = 0.0
                0218           StoreEXF1(I,J,bi,bj,19) = 0.0
                0219 # endif
                0220 # ifdef ALLOW_CLIMSST_RELAXATION
                0221           StoreEXF1(I,J,bi,bj,20) = climsst0(I,J,bi,bj)
                0222           StoreEXF1(I,J,bi,bj,21) = climsst1(I,J,bi,bj)
                0223 # else
                0224           StoreEXF1(I,J,bi,bj,20) = 0.0
                0225           StoreEXF1(I,J,bi,bj,21) = 0.0
                0226 # endif
d217f7c14d Gael*0227 # ifdef ALLOW_SALTFLX
                0228           StoreEXF1(I,J,bi,bj,22) = saltflx0(I,J,bi,bj)
                0229           StoreEXF1(I,J,bi,bj,23) = saltflx1(I,J,bi,bj)
                0230 # else
                0231           StoreEXF1(I,J,bi,bj,22) = 0.0
                0232           StoreEXF1(I,J,bi,bj,23) = 0.0
                0233 # endif
634ecb5dc5 Jean*0234          ENDDO
                0235         ENDDO
                0236        ENDDO
                0237       ENDDO
0d7eb15592 Jean*0238 
5728d4a98b Patr*0239 C--   Over all tiles
                0240       DO bj = myByLo(myThid), myByHi(myThid)
                0241        DO bi = myBxLo(myThid), myBxHi(myThid)
                0242 C-      2D arrays
e4f1c09db9 Jean*0243         DO J=1-OLy,sNy+OLy
                0244          DO I=1-OLx,sNx+OLx
6fe4379e6f Jean*0245 # ifdef ALLOW_ATM_TEMP
5728d4a98b Patr*0246           StoreEXF2(I,J,bi,bj,1) = aqh0(I,J,bi,bj)
                0247           StoreEXF2(I,J,bi,bj,2) = aqh1(I,J,bi,bj)
                0248           StoreEXF2(I,J,bi,bj,3) = atemp0(I,J,bi,bj)
                0249           StoreEXF2(I,J,bi,bj,4) = atemp1(I,J,bi,bj)
                0250           StoreEXF2(I,J,bi,bj,5) = precip0(I,J,bi,bj)
                0251           StoreEXF2(I,J,bi,bj,6) = precip1(I,J,bi,bj)
                0252           StoreEXF2(I,J,bi,bj,7) = lwflux0(I,J,bi,bj)
                0253           StoreEXF2(I,J,bi,bj,8) = lwflux1(I,J,bi,bj)
fead278c20 Patr*0254           StoreEXF2(I,J,bi,bj,9)  = snowprecip0(I,J,bi,bj)
                0255           StoreEXF2(I,J,bi,bj,10) = snowprecip1(I,J,bi,bj)
0e8df33a35 Jean*0256 #  ifdef ALLOW_READ_TURBFLUXES
                0257           StoreEXF2(I,J,bi,bj,11) = hs0(I,J,bi,bj)
                0258           StoreEXF2(I,J,bi,bj,12) = hs1(I,J,bi,bj)
                0259           StoreEXF2(I,J,bi,bj,13) = hl0(I,J,bi,bj)
                0260           StoreEXF2(I,J,bi,bj,14) = hl1(I,J,bi,bj)
6fe4379e6f Jean*0261 #  else
0e8df33a35 Jean*0262           StoreEXF2(I,J,bi,bj,11) = 0.0
fead278c20 Patr*0263           StoreEXF2(I,J,bi,bj,12) = 0.0
5728d4a98b Patr*0264           StoreEXF2(I,J,bi,bj,13) = 0.0
                0265           StoreEXF2(I,J,bi,bj,14) = 0.0
0e8df33a35 Jean*0266 #  endif
                0267 #  ifdef EXF_READ_EVAP
                0268           StoreEXF2(I,J,bi,bj,15) = evap0(I,J,bi,bj)
                0269           StoreEXF2(I,J,bi,bj,16) = evap1(I,J,bi,bj)
                0270 #  else
                0271           StoreEXF2(I,J,bi,bj,15) = evap(I,J,bi,bj)
fead278c20 Patr*0272           StoreEXF2(I,J,bi,bj,16) = 0.0
0e8df33a35 Jean*0273 #  endif /* EXF_READ_EVAP */
                0274 #  ifdef ALLOW_DOWNWARD_RADIATION
                0275           StoreEXF2(I,J,bi,bj,17) = swdown0(I,J,bi,bj)
                0276           StoreEXF2(I,J,bi,bj,18) = swdown1(I,J,bi,bj)
                0277           StoreEXF2(I,J,bi,bj,19) = lwdown0(I,J,bi,bj)
                0278           StoreEXF2(I,J,bi,bj,20) = lwdown1(I,J,bi,bj)
                0279 #  else
                0280           StoreEXF2(I,J,bi,bj,17) = 0.0
                0281           StoreEXF2(I,J,bi,bj,18) = 0.0
                0282           StoreEXF2(I,J,bi,bj,19) = 0.0
                0283           StoreEXF2(I,J,bi,bj,20) = 0.0
6fe4379e6f Jean*0284 #  endif
                0285 # endif /* ALLOW_ATM_TEMP */
0e8df33a35 Jean*0286           StoreEXF2(I,J,bi,bj,21) = uwind0(I,J,bi,bj)
                0287           StoreEXF2(I,J,bi,bj,22) = uwind1(I,J,bi,bj)
                0288           StoreEXF2(I,J,bi,bj,23) = vwind0(I,J,bi,bj)
                0289           StoreEXF2(I,J,bi,bj,24) = vwind1(I,J,bi,bj)
634ecb5dc5 Jean*0290          ENDDO
                0291         ENDDO
                0292        ENDDO
                0293       ENDDO
5728d4a98b Patr*0294 #endif /* ALLOW_EXF */
                0295 
3c775cbf98 Mart*0296 #ifdef ALLOW_SEAICE
                0297 C--   Over all tiles
                0298       DO bj = myByLo(myThid), myByHi(myThid)
                0299        DO bi = myBxLo(myThid), myBxHi(myThid)
                0300 C-      2D arrays
                0301         DO J=1-OLy,sNy+OLy
                0302          DO I=1-OLx,sNx+OLx
                0303           StoreSEAICE(I,J,bi,bj, 1) = AREA(I,J,bi,bj)
                0304           StoreSEAICE(I,J,bi,bj, 2) = HEFF(I,J,bi,bj)
                0305           StoreSEAICE(I,J,bi,bj, 3) = HSNOW(I,J,bi,bj)
                0306           StoreSEAICE(I,J,bi,bj, 4) = RUNOFF(I,J,bi,bj)
                0307           StoreSEAICE(I,J,bi,bj, 5) = UICE(I,J,bi,bj)
                0308           StoreSEAICE(I,J,bi,bj, 6) = VICE(I,J,bi,bj)
                0309           StoreSEAICE(I,J,bi,bj, 7) = ZETA(I,J,bi,bj)
                0310           StoreSEAICE(I,J,bi,bj, 8) = ETA(I,J,bi,bj)
                0311 # ifdef SEAICE_CGRID
                0312           StoreSEAICE(I,J,bi,bj, 9) = dwatn(I,J,bi,bj)
                0313 #  ifdef SEAICE_ALLOW_BOTTOMDRAG
                0314           StoreSEAICE(I,J,bi,bj,10) = cbotc(I,J,bi,bj)
                0315 #  else
                0316           StoreSEAICE(I,J,bi,bj,10) = 0.0
                0317 #  endif /* SEAICE_ALLOW_BOTTOMDRAG */
                0318           StoreSEAICE(I,J,bi,bj,11) = stressDivergenceX(I,J,bi,bj)
                0319           StoreSEAICE(I,J,bi,bj,12) = stressDivergenceY(I,J,bi,bj)
                0320 # else
                0321           StoreSEAICE(I,J,bi,bj, 9) = 0.0
                0322           StoreSEAICE(I,J,bi,bj,10) = 0.0
                0323           StoreSEAICE(I,J,bi,bj,11) = 0.0
                0324           StoreSEAICE(I,J,bi,bj,12) = 0.0
                0325 # endif /* SEAICE_CGRID */
                0326 # ifdef SEAICE_ALLOW_EVP
                0327           StoreSEAICE(I,J,bi,bj,13) = seaice_sigma1(I,J,bi,bj)
                0328           StoreSEAICE(I,J,bi,bj,14) = seaice_sigma2(I,J,bi,bj)
                0329           StoreSEAICE(I,J,bi,bj,15) = seaice_sigma12(I,J,bi,bj)
                0330 # else
                0331           StoreSEAICE(I,J,bi,bj,13) = 0.0
                0332           StoreSEAICE(I,J,bi,bj,14) = 0.0
                0333           StoreSEAICE(I,J,bi,bj,15) = 0.0
                0334 # endif /* SEAICE_ALLOW_EVP */
                0335 # ifdef SEAICE_VARIABLE_SALINITY
                0336           StoreSEAICE(I,J,bi,bj,16) = HSALT(I,J,bi,bj)
                0337 # else
                0338           StoreSEAICE(I,J,bi,bj,16) = 0.0
                0339 # endif
                0340          ENDDO
                0341         ENDDO
                0342 C--   this 3D array comes last because it has a variable size nITD
cda1c18f72 Jean*0343         DO K=1,nITD
3c775cbf98 Mart*0344          DO J=1-OLy,sNy+OLy
                0345           DO I=1-OLx,sNx+OLx
cda1c18f72 Jean*0346            StoreSEAICE(I,J,bi,bj,16+K) = TICES(I,J,K,bi,bj)
3c775cbf98 Mart*0347           ENDDO
                0348          ENDDO
                0349         ENDDO
                0350 C
                0351        ENDDO
                0352       ENDDO
                0353 #endif /* ALLOW_SEAICE */
                0354 
                0355 #endif /* AUTODIFF_USE_STORE_RESTORE */
                0356 
                0357 #if ( defined ALLOW_OBCS && defined AUTODIFF_USE_STORE_RESTORE_OBCS )
5728d4a98b Patr*0358 # ifdef ALLOW_OBCS_NORTH
                0359 C--   Over all tiles
                0360       DO bj = myByLo(myThid), myByHi(myThid)
                0361        DO bi = myBxLo(myThid), myBxHi(myThid)
                0362 C-      2D arrays
                0363         DO K=1,Nr
e4f1c09db9 Jean*0364          DO I=1-OLx,sNx+OLx
634ecb5dc5 Jean*0365           StoreOBCSN(I,K,bi,bj,1)  = OBNu(I,K,bi,bj)
                0366           StoreOBCSN(I,K,bi,bj,2)  = OBNv(I,K,bi,bj)
                0367           StoreOBCSN(I,K,bi,bj,3)  = OBNt(I,K,bi,bj)
                0368           StoreOBCSN(I,K,bi,bj,4)  = OBNs(I,K,bi,bj)
7b94249161 Jean*0369 #  ifdef ALLOW_OBCS_PRESCRIBE
634ecb5dc5 Jean*0370           StoreOBCSN(I,K,bi,bj,5)  = OBNu0(I,K,bi,bj)
                0371           StoreOBCSN(I,K,bi,bj,6)  = OBNv0(I,K,bi,bj)
                0372           StoreOBCSN(I,K,bi,bj,7)  = OBNt0(I,K,bi,bj)
                0373           StoreOBCSN(I,K,bi,bj,8)  = OBNs0(I,K,bi,bj)
                0374           StoreOBCSN(I,K,bi,bj,9)  = OBNu1(I,K,bi,bj)
                0375           StoreOBCSN(I,K,bi,bj,10) = OBNv1(I,K,bi,bj)
                0376           StoreOBCSN(I,K,bi,bj,11) = OBNt1(I,K,bi,bj)
                0377           StoreOBCSN(I,K,bi,bj,12) = OBNs1(I,K,bi,bj)
7b94249161 Jean*0378 #  endif
5728d4a98b Patr*0379 #  ifdef ALLOW_OBCSN_CONTROL
634ecb5dc5 Jean*0380           StoreOBCSN(I,K,bi,bj,13) = xx_obcsn0(I,K,bi,bj,1)
                0381           StoreOBCSN(I,K,bi,bj,14) = xx_obcsn0(I,K,bi,bj,2)
                0382           StoreOBCSN(I,K,bi,bj,15) = xx_obcsn0(I,K,bi,bj,3)
                0383           StoreOBCSN(I,K,bi,bj,16) = xx_obcsn0(I,K,bi,bj,4)
                0384           StoreOBCSN(I,K,bi,bj,17) = xx_obcsn1(I,K,bi,bj,1)
                0385           StoreOBCSN(I,K,bi,bj,18) = xx_obcsn1(I,K,bi,bj,2)
                0386           StoreOBCSN(I,K,bi,bj,19) = xx_obcsn1(I,K,bi,bj,3)
                0387           StoreOBCSN(I,K,bi,bj,20) = xx_obcsn1(I,K,bi,bj,4)
6fe4379e6f Jean*0388 #  else
60bf15049b Patr*0389           StoreOBCSN(I,K,bi,bj,13) = 0.0
                0390           StoreOBCSN(I,K,bi,bj,14) = 0.0
                0391           StoreOBCSN(I,K,bi,bj,15) = 0.0
                0392           StoreOBCSN(I,K,bi,bj,16) = 0.0
                0393           StoreOBCSN(I,K,bi,bj,17) = 0.0
                0394           StoreOBCSN(I,K,bi,bj,18) = 0.0
634ecb5dc5 Jean*0395           StoreOBCSN(I,K,bi,bj,19) = 0.0
                0396           StoreOBCSN(I,K,bi,bj,20) = 0.0
5728d4a98b Patr*0397 #  endif
634ecb5dc5 Jean*0398          ENDDO
                0399         ENDDO
                0400        ENDDO
                0401       ENDDO
0d7eb15592 Jean*0402 # endif /* ALLOW_OBCS_NORTH */
5728d4a98b Patr*0403 
                0404 # ifdef ALLOW_OBCS_SOUTH
                0405 C--   Over all tiles
                0406       DO bj = myByLo(myThid), myByHi(myThid)
                0407        DO bi = myBxLo(myThid), myBxHi(myThid)
                0408 C-      2D arrays
                0409         DO K=1,Nr
e4f1c09db9 Jean*0410          DO I=1-OLx,sNx+OLx
634ecb5dc5 Jean*0411           StoreOBCSS(I,K,bi,bj,1)  = OBSu(I,K,bi,bj)
                0412           StoreOBCSS(I,K,bi,bj,2)  = OBSv(I,K,bi,bj)
                0413           StoreOBCSS(I,K,bi,bj,3)  = OBSt(I,K,bi,bj)
                0414           StoreOBCSS(I,K,bi,bj,4)  = OBSs(I,K,bi,bj)
7b94249161 Jean*0415 #  ifdef ALLOW_OBCS_PRESCRIBE
634ecb5dc5 Jean*0416           StoreOBCSS(I,K,bi,bj,5)  = OBSu0(I,K,bi,bj)
                0417           StoreOBCSS(I,K,bi,bj,6)  = OBSv0(I,K,bi,bj)
                0418           StoreOBCSS(I,K,bi,bj,7)  = OBSt0(I,K,bi,bj)
                0419           StoreOBCSS(I,K,bi,bj,8)  = OBSs0(I,K,bi,bj)
                0420           StoreOBCSS(I,K,bi,bj,9)  = OBSu1(I,K,bi,bj)
                0421           StoreOBCSS(I,K,bi,bj,10) = OBSv1(I,K,bi,bj)
                0422           StoreOBCSS(I,K,bi,bj,11) = OBSt1(I,K,bi,bj)
                0423           StoreOBCSS(I,K,bi,bj,12) = OBSs1(I,K,bi,bj)
7b94249161 Jean*0424 #  endif
5728d4a98b Patr*0425 #  ifdef ALLOW_OBCSS_CONTROL
634ecb5dc5 Jean*0426           StoreOBCSS(I,K,bi,bj,13) = xx_obcss0(I,K,bi,bj,1)
                0427           StoreOBCSS(I,K,bi,bj,14) = xx_obcss0(I,K,bi,bj,2)
                0428           StoreOBCSS(I,K,bi,bj,15) = xx_obcss0(I,K,bi,bj,3)
                0429           StoreOBCSS(I,K,bi,bj,16) = xx_obcss0(I,K,bi,bj,4)
                0430           StoreOBCSS(I,K,bi,bj,17) = xx_obcss1(I,K,bi,bj,1)
                0431           StoreOBCSS(I,K,bi,bj,18) = xx_obcss1(I,K,bi,bj,2)
                0432           StoreOBCSS(I,K,bi,bj,19) = xx_obcss1(I,K,bi,bj,3)
                0433           StoreOBCSS(I,K,bi,bj,20) = xx_obcss1(I,K,bi,bj,4)
6fe4379e6f Jean*0434 #  else
60bf15049b Patr*0435           StoreOBCSS(I,K,bi,bj,13) = 0.0
                0436           StoreOBCSS(I,K,bi,bj,14) = 0.0
                0437           StoreOBCSS(I,K,bi,bj,15) = 0.0
                0438           StoreOBCSS(I,K,bi,bj,16) = 0.0
                0439           StoreOBCSS(I,K,bi,bj,17) = 0.0
                0440           StoreOBCSS(I,K,bi,bj,18) = 0.0
634ecb5dc5 Jean*0441           StoreOBCSS(I,K,bi,bj,19) = 0.0
                0442           StoreOBCSS(I,K,bi,bj,20) = 0.0
5728d4a98b Patr*0443 #  endif
634ecb5dc5 Jean*0444          ENDDO
                0445         ENDDO
                0446        ENDDO
                0447       ENDDO
0d7eb15592 Jean*0448 # endif /* ALLOW_OBCS_SOUTH */
5728d4a98b Patr*0449 
                0450 # ifdef ALLOW_OBCS_EAST
                0451 C--   Over all tiles
                0452       DO bj = myByLo(myThid), myByHi(myThid)
                0453        DO bi = myBxLo(myThid), myBxHi(myThid)
                0454 C-      2D arrays
                0455         DO K=1,Nr
e4f1c09db9 Jean*0456          DO J=1-OLy,sNy+OLy
634ecb5dc5 Jean*0457           StoreOBCSE(J,K,bi,bj,1)  = OBEu(J,K,bi,bj)
                0458           StoreOBCSE(J,K,bi,bj,2)  = OBEv(J,K,bi,bj)
                0459           StoreOBCSE(J,K,bi,bj,3)  = OBEt(J,K,bi,bj)
                0460           StoreOBCSE(J,K,bi,bj,4)  = OBEs(J,K,bi,bj)
7b94249161 Jean*0461 #  ifdef ALLOW_OBCS_PRESCRIBE
634ecb5dc5 Jean*0462           StoreOBCSE(J,K,bi,bj,5)  = OBEu0(J,K,bi,bj)
                0463           StoreOBCSE(J,K,bi,bj,6)  = OBEv0(J,K,bi,bj)
                0464           StoreOBCSE(J,K,bi,bj,7)  = OBEt0(J,K,bi,bj)
                0465           StoreOBCSE(J,K,bi,bj,8)  = OBEs0(J,K,bi,bj)
                0466           StoreOBCSE(J,K,bi,bj,9)  = OBEu1(J,K,bi,bj)
                0467           StoreOBCSE(J,K,bi,bj,10) = OBEv1(J,K,bi,bj)
                0468           StoreOBCSE(J,K,bi,bj,11) = OBEt1(J,K,bi,bj)
                0469           StoreOBCSE(J,K,bi,bj,12) = OBEs1(J,K,bi,bj)
7b94249161 Jean*0470 #  endif
5728d4a98b Patr*0471 #  ifdef ALLOW_OBCSE_CONTROL
634ecb5dc5 Jean*0472           StoreOBCSE(J,K,bi,bj,13) = xx_obcse0(J,K,bi,bj,1)
                0473           StoreOBCSE(J,K,bi,bj,14) = xx_obcse0(J,K,bi,bj,2)
                0474           StoreOBCSE(J,K,bi,bj,15) = xx_obcse0(J,K,bi,bj,3)
                0475           StoreOBCSE(J,K,bi,bj,16) = xx_obcse0(J,K,bi,bj,4)
                0476           StoreOBCSE(J,K,bi,bj,17) = xx_obcse1(J,K,bi,bj,1)
                0477           StoreOBCSE(J,K,bi,bj,18) = xx_obcse1(J,K,bi,bj,2)
                0478           StoreOBCSE(J,K,bi,bj,19) = xx_obcse1(J,K,bi,bj,3)
                0479           StoreOBCSE(J,K,bi,bj,20) = xx_obcse1(J,K,bi,bj,4)
6fe4379e6f Jean*0480 #  else
60bf15049b Patr*0481           StoreOBCSE(J,K,bi,bj,13) = 0.0
                0482           StoreOBCSE(J,K,bi,bj,14) = 0.0
                0483           StoreOBCSE(J,K,bi,bj,15) = 0.0
                0484           StoreOBCSE(J,K,bi,bj,16) = 0.0
                0485           StoreOBCSE(J,K,bi,bj,17) = 0.0
                0486           StoreOBCSE(J,K,bi,bj,18) = 0.0
634ecb5dc5 Jean*0487           StoreOBCSE(J,K,bi,bj,19) = 0.0
                0488           StoreOBCSE(J,K,bi,bj,20) = 0.0
5728d4a98b Patr*0489 #  endif
634ecb5dc5 Jean*0490          ENDDO
                0491         ENDDO
                0492        ENDDO
                0493       ENDDO
0d7eb15592 Jean*0494 # endif /* ALLOW_OBCS_EAST */
5728d4a98b Patr*0495 
                0496 # ifdef ALLOW_OBCS_WEST
                0497 C--   Over all tiles
                0498       DO bj = myByLo(myThid), myByHi(myThid)
                0499        DO bi = myBxLo(myThid), myBxHi(myThid)
                0500 C-      2D arrays
                0501         DO K=1,Nr
e4f1c09db9 Jean*0502          DO J=1-OLy,sNy+OLy
634ecb5dc5 Jean*0503           StoreOBCSW(J,K,bi,bj,1)  = OBWu(J,K,bi,bj)
                0504           StoreOBCSW(J,K,bi,bj,2)  = OBWv(J,K,bi,bj)
                0505           StoreOBCSW(J,K,bi,bj,3)  = OBWt(J,K,bi,bj)
                0506           StoreOBCSW(J,K,bi,bj,4)  = OBWs(J,K,bi,bj)
7b94249161 Jean*0507 #  ifdef ALLOW_OBCS_PRESCRIBE
634ecb5dc5 Jean*0508           StoreOBCSW(J,K,bi,bj,5)  = OBWu0(J,K,bi,bj)
                0509           StoreOBCSW(J,K,bi,bj,6)  = OBWv0(J,K,bi,bj)
                0510           StoreOBCSW(J,K,bi,bj,7)  = OBWt0(J,K,bi,bj)
                0511           StoreOBCSW(J,K,bi,bj,8)  = OBWs0(J,K,bi,bj)
                0512           StoreOBCSW(J,K,bi,bj,9)  = OBWu1(J,K,bi,bj)
                0513           StoreOBCSW(J,K,bi,bj,10) = OBWv1(J,K,bi,bj)
                0514           StoreOBCSW(J,K,bi,bj,11) = OBWt1(J,K,bi,bj)
                0515           StoreOBCSW(J,K,bi,bj,12) = OBWs1(J,K,bi,bj)
7b94249161 Jean*0516 #  endif
5728d4a98b Patr*0517 #  ifdef ALLOW_OBCSW_CONTROL
634ecb5dc5 Jean*0518           StoreOBCSW(J,K,bi,bj,13) = xx_obcsw0(J,K,bi,bj,1)
                0519           StoreOBCSW(J,K,bi,bj,14) = xx_obcsw0(J,K,bi,bj,2)
                0520           StoreOBCSW(J,K,bi,bj,15) = xx_obcsw0(J,K,bi,bj,3)
                0521           StoreOBCSW(J,K,bi,bj,16) = xx_obcsw0(J,K,bi,bj,4)
                0522           StoreOBCSW(J,K,bi,bj,17) = xx_obcsw1(J,K,bi,bj,1)
                0523           StoreOBCSW(J,K,bi,bj,18) = xx_obcsw1(J,K,bi,bj,2)
                0524           StoreOBCSW(J,K,bi,bj,19) = xx_obcsw1(J,K,bi,bj,3)
                0525           StoreOBCSW(J,K,bi,bj,20) = xx_obcsw1(J,K,bi,bj,4)
6fe4379e6f Jean*0526 #  else
60bf15049b Patr*0527           StoreOBCSW(J,K,bi,bj,13) = 0.0
                0528           StoreOBCSW(J,K,bi,bj,14) = 0.0
                0529           StoreOBCSW(J,K,bi,bj,15) = 0.0
                0530           StoreOBCSW(J,K,bi,bj,16) = 0.0
                0531           StoreOBCSW(J,K,bi,bj,17) = 0.0
                0532           StoreOBCSW(J,K,bi,bj,18) = 0.0
634ecb5dc5 Jean*0533           StoreOBCSW(J,K,bi,bj,19) = 0.0
                0534           StoreOBCSW(J,K,bi,bj,20) = 0.0
5728d4a98b Patr*0535 #  endif
634ecb5dc5 Jean*0536          ENDDO
                0537         ENDDO
                0538        ENDDO
                0539       ENDDO
5728d4a98b Patr*0540 # endif /* ALLOW_OBCS_WEST */
cda1c18f72 Jean*0541 #endif /* ALLOW_OBCS & AUTODIFF_USE_STORE_RESTORE_OBCS */
5728d4a98b Patr*0542 
b167b0379c Patr*0543 #ifdef ALLOW_DEBUG
862d160a2f Jean*0544       IF ( debugMode ) CALL DEBUG_LEAVE('AUTODIFF_STORE',myThid)
5728d4a98b Patr*0545 #endif
                0546 
                0547 #endif /* ALLOW_AUTODIFF_TAMC */
cda1c18f72 Jean*0548 C**************************************
5728d4a98b Patr*0549 
6fe4379e6f Jean*0550       RETURN
                0551       END