Back to home page

MITgcm

 
 

    


File indexing completed on 2024-06-06 05:11:01 UTC

view on githubraw file Latest commit af61e5eb on 2024-06-06 03:30:35 UTC
42c525bfb4 Alis*0001 #include "OBCS_OPTIONS.h"
af61e5eb16 Mart*0002 #ifdef ALLOW_AUTODIFF
                0003 # include "AUTODIFF_OPTIONS.h"
                0004 #endif
42c525bfb4 Alis*0005 
c8754365e9 Jean*0006 CBOP
                0007 C     !ROUTINE: OBCS_INIT_VARIABLES
                0008 C     !INTERFACE:
42c525bfb4 Alis*0009       SUBROUTINE OBCS_INIT_VARIABLES( myThid )
c8754365e9 Jean*0010 
                0011 C     !DESCRIPTION:
2d12bccb16 Jean*0012 C     *==========================================================*
                0013 C     | SUBROUTINE OBCS_INIT_VARIABLES
                0014 C     | o Initialise OBCs variable data
                0015 C     *==========================================================*
                0016 C     *==========================================================*
42c525bfb4 Alis*0017 
c8754365e9 Jean*0018 C     !USES:
                0019       IMPLICIT NONE
42c525bfb4 Alis*0020 C     === Global variables ===
                0021 #include "SIZE.h"
                0022 #include "EEPARAMS.h"
                0023 #include "PARAMS.h"
                0024 #include "DYNVARS.h"
9b4f2a04e2 Jean*0025 #include "OBCS_PARAMS.h"
                0026 c#include "OBCS_GRID.h"
                0027 #include "OBCS_FIELDS.h"
                0028 #include "OBCS_SEAICE.h"
d38a1b9bc4 Jean*0029 #ifdef ALLOW_PTRACERS
ee1c912a22 Mart*0030 #include "PTRACERS_SIZE.h"
a5787b36f8 Jean*0031 #include "PTRACERS_PARAMS.h"
                0032 #include "PTRACERS_FIELDS.h"
ee1c912a22 Mart*0033 #include "OBCS_PTRACERS.h"
                0034 #endif /* ALLOW_PTRACERS */
42c525bfb4 Alis*0035 
c8754365e9 Jean*0036 C     !INPUT/OUTPUT PARAMETERS:
42c525bfb4 Alis*0037 C     == Routine arguments ==
c8754365e9 Jean*0038 C     myThid :: my Thread Id Number
42c525bfb4 Alis*0039       INTEGER myThid
c8754365e9 Jean*0040 CEOP
42c525bfb4 Alis*0041 
                0042 #ifdef ALLOW_OBCS
                0043 
c8754365e9 Jean*0044 C     !LOCAL VARIABLES:
42c525bfb4 Alis*0045 C     == Local variables ==
                0046       INTEGER bi, bj
6960d36165 Jean*0047       INTEGER i, j, k
ee1c912a22 Mart*0048 #ifdef ALLOW_PTRACERS
                0049       INTEGER iTracer
                0050 #endif /* ALLOW_PTRACERS */
42c525bfb4 Alis*0051 
abb214f17f Alis*0052 #ifdef ALLOW_DEBUG
                0053       IF (debugMode) CALL DEBUG_ENTER('OBCS_INIT_VARIABLES',myThid)
                0054 #endif
                0055 
42c525bfb4 Alis*0056       DO bj = myByLo(myThid), myByHi(myThid)
                0057        DO bi = myBxLo(myThid), myBxHi(myThid)
                0058 
8b081ca9eb Jean*0059 #ifdef ALLOW_OBCS_PRESCRIBE
                0060         OBCS_ldRec(bi,bj) = 0
                0061 #endif
6960d36165 Jean*0062         DO k=1,Nr
672b822630 Jean*0063          DO i=1-OLx,sNx+OLx
96bbd4e2a5 Patr*0064 #ifdef ALLOW_OBCS_NORTH
6960d36165 Jean*0065           OBNu(i,k,bi,bj)=0. _d 0
                0066           OBNv(i,k,bi,bj)=0. _d 0
                0067           OBNt(i,k,bi,bj)=0. _d 0
                0068           OBNs(i,k,bi,bj)=0. _d 0
96bbd4e2a5 Patr*0069 # ifdef ALLOW_OBCS_PRESCRIBE
6960d36165 Jean*0070           OBNu0(i,k,bi,bj)=0. _d 0
                0071           OBNv0(i,k,bi,bj)=0. _d 0
                0072           OBNt0(i,k,bi,bj)=0. _d 0
                0073           OBNs0(i,k,bi,bj)=0. _d 0
                0074           OBNu1(i,k,bi,bj)=0. _d 0
                0075           OBNv1(i,k,bi,bj)=0. _d 0
                0076           OBNt1(i,k,bi,bj)=0. _d 0
                0077           OBNs1(i,k,bi,bj)=0. _d 0
96bbd4e2a5 Patr*0078 # endif
824ab1e2dd Mart*0079 # ifdef ALLOW_OBCS_STEVENS
                0080           OBNvStevens(i,k,bi,bj)=0. _d 0
b1353a35da Mart*0081           OBNtStevens(i,k,bi,bj)=0. _d 0
                0082           OBNsStevens(i,k,bi,bj)=0. _d 0
824ab1e2dd Mart*0083 # endif /* ALLOW_OBCS_STEVENS */
96bbd4e2a5 Patr*0084 #endif /* ALLOW_OBCS_NORTH */
                0085 
                0086 #ifdef ALLOW_OBCS_SOUTH
6960d36165 Jean*0087           OBSu(i,k,bi,bj)=0. _d 0
                0088           OBSv(i,k,bi,bj)=0. _d 0
                0089           OBSt(i,k,bi,bj)=0. _d 0
                0090           OBSs(i,k,bi,bj)=0. _d 0
96bbd4e2a5 Patr*0091 # ifdef ALLOW_OBCS_PRESCRIBE
6960d36165 Jean*0092           OBSu0(i,k,bi,bj)=0. _d 0
                0093           OBSv0(i,k,bi,bj)=0. _d 0
                0094           OBSt0(i,k,bi,bj)=0. _d 0
                0095           OBSs0(i,k,bi,bj)=0. _d 0
                0096           OBSu1(i,k,bi,bj)=0. _d 0
                0097           OBSv1(i,k,bi,bj)=0. _d 0
                0098           OBSt1(i,k,bi,bj)=0. _d 0
                0099           OBSs1(i,k,bi,bj)=0. _d 0
96bbd4e2a5 Patr*0100 # endif
824ab1e2dd Mart*0101 # ifdef ALLOW_OBCS_STEVENS
                0102           OBSvStevens(i,k,bi,bj)=0. _d 0
b1353a35da Mart*0103           OBStStevens(i,k,bi,bj)=0. _d 0
                0104           OBSsStevens(i,k,bi,bj)=0. _d 0
824ab1e2dd Mart*0105 # endif /* ALLOW_OBCS_STEVENS */
96bbd4e2a5 Patr*0106 #endif /* ALLOW_OBCS_SOUTH */
42c525bfb4 Alis*0107          ENDDO
96bbd4e2a5 Patr*0108 
672b822630 Jean*0109          DO j=1-OLy,sNy+OLy
96bbd4e2a5 Patr*0110 #ifdef ALLOW_OBCS_EAST
6960d36165 Jean*0111           OBEu(j,k,bi,bj)=0. _d 0
                0112           OBEv(j,k,bi,bj)=0. _d 0
                0113           OBEt(j,k,bi,bj)=0. _d 0
                0114           OBEs(j,k,bi,bj)=0. _d 0
96bbd4e2a5 Patr*0115 # ifdef ALLOW_OBCS_PRESCRIBE
6960d36165 Jean*0116           OBEu0(j,k,bi,bj)=0. _d 0
                0117           OBEv0(j,k,bi,bj)=0. _d 0
                0118           OBEt0(j,k,bi,bj)=0. _d 0
                0119           OBEs0(j,k,bi,bj)=0. _d 0
                0120           OBEu1(j,k,bi,bj)=0. _d 0
                0121           OBEv1(j,k,bi,bj)=0. _d 0
                0122           OBEt1(j,k,bi,bj)=0. _d 0
                0123           OBEs1(j,k,bi,bj)=0. _d 0
96bbd4e2a5 Patr*0124 # endif
824ab1e2dd Mart*0125 # ifdef ALLOW_OBCS_STEVENS
                0126           OBEuStevens(j,k,bi,bj)=0. _d 0
b1353a35da Mart*0127           OBEtStevens(j,k,bi,bj)=0. _d 0
                0128           OBEsStevens(j,k,bi,bj)=0. _d 0
824ab1e2dd Mart*0129 # endif /* ALLOW_OBCS_STEVENS */
96bbd4e2a5 Patr*0130 #endif /* ALLOW_OBCS_EAST */
                0131 
                0132 #ifdef ALLOW_OBCS_WEST
6960d36165 Jean*0133           OBWu(j,k,bi,bj)=0. _d 0
                0134           OBWv(j,k,bi,bj)=0. _d 0
                0135           OBWt(j,k,bi,bj)=0. _d 0
                0136           OBWs(j,k,bi,bj)=0. _d 0
96bbd4e2a5 Patr*0137 # ifdef ALLOW_OBCS_PRESCRIBE
6960d36165 Jean*0138           OBWu0(j,k,bi,bj)=0. _d 0
                0139           OBWv0(j,k,bi,bj)=0. _d 0
                0140           OBWt0(j,k,bi,bj)=0. _d 0
                0141           OBWs0(j,k,bi,bj)=0. _d 0
                0142           OBWu1(j,k,bi,bj)=0. _d 0
                0143           OBWv1(j,k,bi,bj)=0. _d 0
                0144           OBWt1(j,k,bi,bj)=0. _d 0
                0145           OBWs1(j,k,bi,bj)=0. _d 0
96bbd4e2a5 Patr*0146 # endif
824ab1e2dd Mart*0147 # ifdef ALLOW_OBCS_STEVENS
                0148           OBWuStevens(j,k,bi,bj)=0. _d 0
b1353a35da Mart*0149           OBWtStevens(j,k,bi,bj)=0. _d 0
                0150           OBWsStevens(j,k,bi,bj)=0. _d 0
824ab1e2dd Mart*0151 # endif /* ALLOW_OBCS_STEVENS */
96bbd4e2a5 Patr*0152 #endif /* ALLOW_OBCS_WEST */
42c525bfb4 Alis*0153          ENDDO
                0154         ENDDO
                0155 
2d12bccb16 Jean*0156 #ifdef ALLOW_NONHYDROSTATIC
6960d36165 Jean*0157         DO k=1,Nr
672b822630 Jean*0158          DO i=1-OLx,sNx+OLx
6960d36165 Jean*0159           OBNw (i,k,bi,bj) = 0. _d 0
                0160           OBSw (i,k,bi,bj) = 0. _d 0
2d12bccb16 Jean*0161 # ifdef ALLOW_OBCS_PRESCRIBE
6960d36165 Jean*0162           OBNw0(i,k,bi,bj) = 0. _d 0
                0163           OBSw0(i,k,bi,bj) = 0. _d 0
                0164           OBNw1(i,k,bi,bj) = 0. _d 0
                0165           OBSw1(i,k,bi,bj) = 0. _d 0
2d12bccb16 Jean*0166 # endif
                0167          ENDDO
672b822630 Jean*0168          DO j=1-OLy,sNy+OLy
6960d36165 Jean*0169           OBEw (j,k,bi,bj) = 0. _d 0
                0170           OBWw (j,k,bi,bj) = 0. _d 0
2d12bccb16 Jean*0171 # ifdef ALLOW_OBCS_PRESCRIBE
6960d36165 Jean*0172           OBEw0(j,k,bi,bj) = 0. _d 0
                0173           OBWw0(j,k,bi,bj) = 0. _d 0
                0174           OBEw1(j,k,bi,bj) = 0. _d 0
                0175           OBWw1(j,k,bi,bj) = 0. _d 0
2d12bccb16 Jean*0176 # endif
                0177          ENDDO
                0178         ENDDO
                0179 #endif /* ALLOW_NONHYDROSTATIC */
                0180 
                0181 #ifdef NONLIN_FRSURF
672b822630 Jean*0182         DO i=1-OLx,sNx+OLx
6960d36165 Jean*0183           OBNeta (i,bi,bj) = 0. _d 0
                0184           OBSeta (i,bi,bj) = 0. _d 0
2d12bccb16 Jean*0185 # ifdef ALLOW_OBCS_PRESCRIBE
6960d36165 Jean*0186           OBNeta0(i,bi,bj) = 0. _d 0
                0187           OBSeta0(i,bi,bj) = 0. _d 0
                0188           OBNeta1(i,bi,bj) = 0. _d 0
                0189           OBSeta1(i,bi,bj) = 0. _d 0
2d12bccb16 Jean*0190 # endif
                0191         ENDDO
672b822630 Jean*0192         DO j=1-OLy,sNy+OLy
6960d36165 Jean*0193           OBEeta (j,bi,bj) = 0. _d 0
                0194           OBWeta (j,bi,bj) = 0. _d 0
2d12bccb16 Jean*0195 # ifdef ALLOW_OBCS_PRESCRIBE
6960d36165 Jean*0196           OBEeta0(j,bi,bj) = 0. _d 0
                0197           OBWeta0(j,bi,bj) = 0. _d 0
                0198           OBEeta1(j,bi,bj) = 0. _d 0
                0199           OBWeta1(j,bi,bj) = 0. _d 0
2d12bccb16 Jean*0200 # endif
                0201         ENDDO
                0202 #endif /* NONLIN_FRSURF */
                0203 
                0204 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0205 
b48f786726 Dimi*0206 #ifdef ALLOW_SEAICE
672b822630 Jean*0207         DO i=1-OLx,sNx+OLx
b48f786726 Dimi*0208 #ifdef ALLOW_OBCS_NORTH
6960d36165 Jean*0209          OBNa (i,bi,bj)=0. _d 0
                0210          OBNh (i,bi,bj)=0. _d 0
                0211          OBNa0(i,bi,bj)=0. _d 0
                0212          OBNh0(i,bi,bj)=0. _d 0
                0213          OBNa1(i,bi,bj)=0. _d 0
                0214          OBNh1(i,bi,bj)=0. _d 0
                0215          OBNsl (i,bi,bj)=0. _d 0
                0216          OBNsn (i,bi,bj)=0. _d 0
                0217          OBNsl0(i,bi,bj)=0. _d 0
                0218          OBNsn0(i,bi,bj)=0. _d 0
                0219          OBNsl1(i,bi,bj)=0. _d 0
                0220          OBNsn1(i,bi,bj)=0. _d 0
                0221          OBNuice (i,bi,bj)=0. _d 0
                0222          OBNvice (i,bi,bj)=0. _d 0
                0223          OBNuice0(i,bi,bj)=0. _d 0
                0224          OBNvice0(i,bi,bj)=0. _d 0
                0225          OBNuice1(i,bi,bj)=0. _d 0
                0226          OBNvice1(i,bi,bj)=0. _d 0
b48f786726 Dimi*0227 #endif /* ALLOW_OBCS_NORTH */
                0228 #ifdef ALLOW_OBCS_SOUTH
6960d36165 Jean*0229          OBSa (i,bi,bj)=0. _d 0
                0230          OBSh (i,bi,bj)=0. _d 0
                0231          OBSa0(i,bi,bj)=0. _d 0
                0232          OBSh0(i,bi,bj)=0. _d 0
                0233          OBSa1(i,bi,bj)=0. _d 0
                0234          OBSh1(i,bi,bj)=0. _d 0
                0235          OBSsl (i,bi,bj)=0. _d 0
                0236          OBSsn (i,bi,bj)=0. _d 0
                0237          OBSsl0(i,bi,bj)=0. _d 0
                0238          OBSsn0(i,bi,bj)=0. _d 0
                0239          OBSsl1(i,bi,bj)=0. _d 0
                0240          OBSsn1(i,bi,bj)=0. _d 0
                0241          OBSuice (i,bi,bj)=0. _d 0
                0242          OBSvice (i,bi,bj)=0. _d 0
                0243          OBSuice0(i,bi,bj)=0. _d 0
                0244          OBSvice0(i,bi,bj)=0. _d 0
                0245          OBSuice1(i,bi,bj)=0. _d 0
                0246          OBSvice1(i,bi,bj)=0. _d 0
b48f786726 Dimi*0247 #endif /* ALLOW_OBCS_SOUTH */
                0248         ENDDO
672b822630 Jean*0249         DO j=1-OLy,sNy+OLy
b48f786726 Dimi*0250 #ifdef ALLOW_OBCS_EAST
6960d36165 Jean*0251          OBEa (j,bi,bj)=0. _d 0
                0252          OBEh (j,bi,bj)=0. _d 0
                0253          OBEa0(j,bi,bj)=0. _d 0
                0254          OBEh0(j,bi,bj)=0. _d 0
                0255          OBEa1(j,bi,bj)=0. _d 0
                0256          OBEh1(j,bi,bj)=0. _d 0
                0257          OBEsl (j,bi,bj)=0. _d 0
                0258          OBEsn (j,bi,bj)=0. _d 0
                0259          OBEsl0(j,bi,bj)=0. _d 0
                0260          OBEsn0(j,bi,bj)=0. _d 0
                0261          OBEsl1(j,bi,bj)=0. _d 0
                0262          OBEsn1(j,bi,bj)=0. _d 0
                0263          OBEuice (j,bi,bj)=0. _d 0
                0264          OBEvice (j,bi,bj)=0. _d 0
                0265          OBEuice0(j,bi,bj)=0. _d 0
                0266          OBEvice0(j,bi,bj)=0. _d 0
                0267          OBEuice1(j,bi,bj)=0. _d 0
                0268          OBEvice1(j,bi,bj)=0. _d 0
b48f786726 Dimi*0269 #endif /* ALLOW_OBCS_EAST */
                0270 #ifdef ALLOW_OBCS_WEST
6960d36165 Jean*0271          OBWa (j,bi,bj)=0. _d 0
                0272          OBWh (j,bi,bj)=0. _d 0
                0273          OBWa0(j,bi,bj)=0. _d 0
                0274          OBWh0(j,bi,bj)=0. _d 0
                0275          OBWa1(j,bi,bj)=0. _d 0
                0276          OBWh1(j,bi,bj)=0. _d 0
                0277          OBWsl (j,bi,bj)=0. _d 0
                0278          OBWsn (j,bi,bj)=0. _d 0
                0279          OBWsl0(j,bi,bj)=0. _d 0
                0280          OBWsn0(j,bi,bj)=0. _d 0
                0281          OBWsl1(j,bi,bj)=0. _d 0
                0282          OBWsn1(j,bi,bj)=0. _d 0
                0283          OBWuice (j,bi,bj)=0. _d 0
                0284          OBWvice (j,bi,bj)=0. _d 0
                0285          OBWuice0(j,bi,bj)=0. _d 0
                0286          OBWvice0(j,bi,bj)=0. _d 0
                0287          OBWuice1(j,bi,bj)=0. _d 0
                0288          OBWvice1(j,bi,bj)=0. _d 0
b48f786726 Dimi*0289 #endif /* ALLOW_OBCS_WEST */
                0290         ENDDO
                0291 #endif /* ALLOW_SEAICE */
                0292 
ee1c912a22 Mart*0293 #ifdef ALLOW_PTRACERS
517be4a08a Mart*0294 #ifndef ALLOW_AUTODIFF_TAMC
ab41fb7174 Mart*0295         IF ( usePTRACERS ) THEN
517be4a08a Mart*0296 #endif
ab41fb7174 Mart*0297          DO iTracer=1,PTRACERS_numInUse
6960d36165 Jean*0298           DO k=1,Nr
672b822630 Jean*0299            DO i=1-OLx,sNx+OLx
ee1c912a22 Mart*0300 #ifdef ALLOW_OBCS_NORTH
6960d36165 Jean*0301             OBNptr (i,k,bi,bj,iTracer)=0. _d 0
ee1c912a22 Mart*0302 # ifdef ALLOW_OBCS_PRESCRIBE
6960d36165 Jean*0303             OBNptr0(i,k,bi,bj,iTracer)=0. _d 0
                0304             OBNptr1(i,k,bi,bj,iTracer)=0. _d 0
ee1c912a22 Mart*0305 # endif
                0306 #endif /* ALLOW_OBCS_NORTH */
5b187c067b Jean*0307 
ee1c912a22 Mart*0308 #ifdef ALLOW_OBCS_SOUTH
6960d36165 Jean*0309             OBSptr (i,k,bi,bj,iTracer)=0. _d 0
ee1c912a22 Mart*0310 # ifdef ALLOW_OBCS_PRESCRIBE
6960d36165 Jean*0311             OBSptr0(i,k,bi,bj,iTracer)=0. _d 0
                0312             OBSptr1(i,k,bi,bj,iTracer)=0. _d 0
ee1c912a22 Mart*0313 # endif
                0314 #endif /* ALLOW_OBCS_SOUTH */
ab41fb7174 Mart*0315            ENDDO
5b187c067b Jean*0316 
672b822630 Jean*0317            DO j=1-OLy,sNy+OLy
ee1c912a22 Mart*0318 #ifdef ALLOW_OBCS_EAST
6960d36165 Jean*0319             OBEptr (j,k,bi,bj,iTracer)=0. _d 0
ee1c912a22 Mart*0320 # ifdef ALLOW_OBCS_PRESCRIBE
6960d36165 Jean*0321             OBEptr0(j,k,bi,bj,iTracer)=0. _d 0
                0322             OBEptr1(j,k,bi,bj,iTracer)=0. _d 0
ee1c912a22 Mart*0323 # endif
                0324 #endif /* ALLOW_OBCS_EAST */
5b187c067b Jean*0325 
ee1c912a22 Mart*0326 #ifdef ALLOW_OBCS_WEST
6960d36165 Jean*0327             OBWptr (j,k,bi,bj,iTracer)=0. _d 0
ee1c912a22 Mart*0328 # ifdef ALLOW_OBCS_PRESCRIBE
6960d36165 Jean*0329             OBWptr0(j,k,bi,bj,iTracer)=0. _d 0
                0330             OBWptr1(j,k,bi,bj,iTracer)=0. _d 0
ee1c912a22 Mart*0331 # endif
                0332 #endif /* ALLOW_OBCS_WEST */
ab41fb7174 Mart*0333            ENDDO
ee1c912a22 Mart*0334           ENDDO
                0335          ENDDO
517be4a08a Mart*0336 #ifndef ALLOW_AUTODIFF_TAMC
ab41fb7174 Mart*0337         ENDIF
517be4a08a Mart*0338 #endif
ee1c912a22 Mart*0339 #endif /* ALLOW_PTRACERS */
                0340 
2d12bccb16 Jean*0341 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
7af3d6f22c Jean*0342 
42c525bfb4 Alis*0343 #ifdef ALLOW_ORLANSKI
                0344         IF (useOrlanskiNorth.OR.useOrlanskiSouth.OR.
                0345      &      useOrlanskiEast.OR.useOrlanskiWest) THEN
abb214f17f Alis*0346 #ifdef ALLOW_DEBUG
6960d36165 Jean*0347           IF (debugMode) CALL DEBUG_CALL('ORLANSKI_INIT',myThid)
abb214f17f Alis*0348 #endif
42c525bfb4 Alis*0349           CALL ORLANSKI_INIT(bi, bj, myThid)
                0350         ENDIF
                0351 #endif /* ALLOW_ORLANSKI */
                0352 
dc4fb63152 Alis*0353        ENDDO
5b187c067b Jean*0354       ENDDO
dc4fb63152 Alis*0355 
0c1665e096 Alis*0356 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
672b822630 Jean*0357 C     Only needed for Orlanski or Stevens OB:
65adb300c0 Jean*0358       IF ( nIter0.NE.0 .OR. pickupSuff.NE.' ' ) THEN
9467978093 Jean*0359         CALL OBCS_READ_PICKUP( nIter0, myThid )
3cd87e8d30 Mart*0360       ENDIF
65adb300c0 Jean*0361 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
0c1665e096 Alis*0362 
9467978093 Jean*0363 C--   Load/compute OBCS values (initial conditions only)
65adb300c0 Jean*0364       IF ( nIter0.EQ.0 .AND. pickupSuff.EQ.' ' ) THEN
abb214f17f Alis*0365 #ifdef ALLOW_DEBUG
9467978093 Jean*0366        IF (debugMode) CALL DEBUG_CALL('OBCS_CALC',myThid)
abb214f17f Alis*0367 #endif
af61e5eb16 Mart*0368 #if ( defined ALLOW_AUTODIFF_TAMC && defined ALLOW_OBCS_STEVENS )
                0369 # ifdef ALLOW_OBCS_EAST
                0370 CADJ STORE OBEsStevens = tapelev_init, key = 1
                0371 CADJ STORE OBEtStevens = tapelev_init, key = 1
                0372 # endif
                0373 # ifdef ALLOW_OBCS_WEST
                0374 CADJ STORE OBWsStevens = tapelev_init, key = 1
                0375 CADJ STORE OBWtStevens = tapelev_init, key = 1
                0376 # endif
                0377 # ifdef ALLOW_OBCS_SOUTH
                0378 CADJ STORE OBSsStevens = tapelev_init, key = 1
                0379 CADJ STORE OBStStevens = tapelev_init, key = 1
                0380 # endif
                0381 # ifdef ALLOW_OBCS_NORTH
                0382 CADJ STORE OBNsStevens = tapelev_init, key = 1
                0383 CADJ STORE OBNtStevens = tapelev_init, key = 1
                0384 # endif
                0385 #endif
3a86c9b47d Oliv*0386        CALL OBCS_CALC( startTime, nIter0,
9467978093 Jean*0387      &              uVel, vVel, wVel, theta, salt, myThid )
abfe198bce Mart*0388 C     S/R OBCS_CALC is split between computing the boundary conditions
                0389 C     and adjusting them to balance the flow (and apply tides)
                0390        CALL OBCS_ADJUST( startTime, nIter0, myThid )
96bbd4e2a5 Patr*0391 
d38a1b9bc4 Jean*0392 C--   Apply OBCS values to initial conditions for consistency
                0393 C      (but initial conditions only)
abb214f17f Alis*0394 #ifdef ALLOW_DEBUG
5b187c067b Jean*0395        IF (debugMode)
c8754365e9 Jean*0396      &    CALL DEBUG_CALL('OBCS_APPLY_UV + OBCS_APPLY_TS',myThid)
abb214f17f Alis*0397 #endif
7914483c99 Mart*0398        DO bj = myByLo(myThid), myByHi(myThid)
                0399         DO bi = myBxLo(myThid), myBxHi(myThid)
c8754365e9 Jean*0400           CALL OBCS_APPLY_UV( bi, bj, 0, uVel, vVel, myThid )
10980378a3 Jean*0401           CALL OBCS_APPLY_TS( bi, bj, 0, theta, salt, myThid )
42c525bfb4 Alis*0402         ENDDO
                0403        ENDDO
0283233458 Mart*0404        IF (useOBCSprescribe) THEN
                0405 C     After applying the boundary conditions exchange the 3D-fields.
e16d78bea8 Jean*0406 C     This is only necessary of the boundary values have been read
0283233458 Mart*0407 C     from a file.
                0408 #ifdef ALLOW_DEBUG
5b187c067b Jean*0409         IF (debugMode)
c8754365e9 Jean*0410      &    CALL DEBUG_CALL('EXCHANGES in OBCS_INIT_VARIABLES',myThid)
0283233458 Mart*0411 #endif
                0412         CALL EXCH_UV_XYZ_RL(uVel,vVel,.TRUE.,myThid)
7163a40534 Jean*0413         _EXCH_XYZ_RL( theta, myThid )
                0414         _EXCH_XYZ_RL( salt , myThid )
0283233458 Mart*0415        ENDIF
                0416 C     endif start from rest
65adb300c0 Jean*0417 #ifdef ALLOW_OBCS_PRESCRIBE
e16d78bea8 Jean*0418       ELSEIF ( useOBCSprescribe ) THEN
6960d36165 Jean*0419 C-- Need this call (although loading U,V,T,S OB values is not really necessary)
                0420 C    a) OB values needed for etaH (NonLinFreeSurf) and for wVel (nonHydrostatic)
                0421 C    b) OB values needed for ptracers (in case nIter0 = PTRACERS_Iter0 <> 0)
                0422 C    c) with present implementation, only do initialisation when called
                0423 C       with myTime=startTime (S/R EXF_GETFFIELDREC, setting "first")
                0424 C       or with myIter=nIter0 (S/R OBCS_FIELDS_LOAD). And this cannot be changed
                0425 C       because of above call to OBCS_CALC(startTime,nIter0).
65adb300c0 Jean*0426         CALL OBCS_PRESCRIBE_READ( startTime, nIter0, myThid )
                0427 #endif
0283233458 Mart*0428       ENDIF
6a11665c9a Jean*0429 C--   calls to S/R OBCS_COPY_TRACER on theta & salt are no longer needed
                0430 C     with maskInC,W,S in pkg/generic_advdiff: removed
65adb300c0 Jean*0431 
7914483c99 Mart*0432 #ifdef ALLOW_PTRACERS
                0433 C     repeat everything for passive tracers
0283233458 Mart*0434       IF ( usePTRACERS ) THEN
                0435 C     catch the case when we do start from a pickup for dynamics variables
                0436 C     but initialise ptracers differently
10980378a3 Jean*0437        IF ( nIter0.EQ.PTRACERS_Iter0 ) THEN
7914483c99 Mart*0438 #ifdef ALLOW_DEBUG
6960d36165 Jean*0439         IF (debugMode) CALL DEBUG_CALL('OBCS_APPLY_PTRACER',myThid)
7914483c99 Mart*0440 #endif
                0441         DO iTracer=1,PTRACERS_numInUse
                0442          DO bj = myByLo(myThid), myByHi(myThid)
                0443           DO bi = myBxLo(myThid), myBxHi(myThid)
5b187c067b Jean*0444             CALL OBCS_APPLY_PTRACER(
6960d36165 Jean*0445      I           bi, bj, 0, iTracer,
672b822630 Jean*0446      U           pTracer(1-OLx,1-OLy,1,bi,bj,iTracer),
7914483c99 Mart*0447      I           myThid )
                0448           ENDDO
                0449          ENDDO
                0450         ENDDO
10980378a3 Jean*0451 C     endif start from rest
                0452        ENDIF
                0453        IF ( nIter0.EQ.PTRACERS_Iter0 .AND. useOBCSprescribe ) THEN
838f3e321e Mart*0454 C     After applying the boundary conditions exchange the 3D-fields.
e16d78bea8 Jean*0455 C     This is only necessary of the boundary values have been read
838f3e321e Mart*0456 C     from a file.
abb214f17f Alis*0457 #ifdef ALLOW_DEBUG
5b187c067b Jean*0458          IF (debugMode) CALL DEBUG_CALL(
0283233458 Mart*0459      &        'PTRACERS EXCHANGES in OBCS_INIT_VARIABLES',myThid)
abb214f17f Alis*0460 #endif
0ea13e5a69 Jean*0461          CALL PTRACERS_FIELDS_BLOCKING_EXCH( myThid )
6a11665c9a Jean*0462 c      ELSE
6960d36165 Jean*0463 C--   Calls to S/R OBCS_COPY_TRACER on pTracers are no longer needed
6a11665c9a Jean*0464 C     with maskInC,W,S in pkg/generic_advdiff: removed
6960d36165 Jean*0465 C-    This call was part of ptracers exchange S/R but was needed in all cases
0283233458 Mart*0466        ENDIF
                0467 C     endif usePTRACERS
838f3e321e Mart*0468       ENDIF
0283233458 Mart*0469 #endif /* ALLOW_PTRACERS */
838f3e321e Mart*0470 
42c525bfb4 Alis*0471 #endif /* ALLOW_OBCS */
96bbd4e2a5 Patr*0472 
abb214f17f Alis*0473 #ifdef ALLOW_DEBUG
                0474       IF (debugMode) CALL DEBUG_LEAVE('OBCS_INIT_VARIABLES',myThid)
                0475 #endif
42c525bfb4 Alis*0476       RETURN
                0477       END