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"
                0002 
b4626a356d Jean*0003 CBOP
                0004 C     !ROUTINE: OBCS_READPARMS
                0005 C     !INTERFACE:
42c525bfb4 Alis*0006       SUBROUTINE OBCS_READPARMS( myThid )
b4626a356d Jean*0007 
                0008 C     !DESCRIPTION: \bv
2d12bccb16 Jean*0009 C     *==========================================================*
                0010 C     | SUBROUTINE OBCS_READPARMS
                0011 C     | o Routine to initialize OBCS variables and constants.
                0012 C     *==========================================================*
b4626a356d Jean*0013 C     \ev
42c525bfb4 Alis*0014 
b4626a356d Jean*0015 C     !USES:
                0016       IMPLICIT NONE
42c525bfb4 Alis*0017 C     === Global variables ===
                0018 #include "SIZE.h"
                0019 #include "EEPARAMS.h"
                0020 #include "PARAMS.h"
9b4f2a04e2 Jean*0021 #include "OBCS_PARAMS.h"
                0022 #include "OBCS_GRID.h"
                0023 #include "OBCS_SEAICE.h"
42c525bfb4 Alis*0024 #ifdef ALLOW_ORLANSKI
                0025 #include "ORLANSKI.h"
                0026 #endif
0d9be7eb22 Jean*0027 #ifdef ALLOW_PTRACERS
ee1c912a22 Mart*0028 #include "PTRACERS_SIZE.h"
                0029 #include "OBCS_PTRACERS.h"
                0030 #endif /* ALLOW_PTRACERS */
9a428ff231 Oliv*0031 #ifdef ALLOW_EXCH2
                0032 #include "W2_EXCH2_SIZE.h"
                0033 #include "W2_EXCH2_TOPOLOGY.h"
                0034 #include "W2_EXCH2_PARAMS.h"
                0035 #endif /* ALLOW_EXCH2 */
42c525bfb4 Alis*0036 
b4626a356d Jean*0037 C     !INPUT/OUTPUT PARAMETERS:
42c525bfb4 Alis*0038       INTEGER myThid
                0039 
                0040 #ifdef ALLOW_OBCS
672b822630 Jean*0041 C     !FUNCTIONS:
                0042       INTEGER  ILNBLNK
                0043       EXTERNAL ILNBLNK
42c525bfb4 Alis*0044 
b4626a356d Jean*0045 C     !LOCAL VARIABLES:
45bc474d14 Jean*0046 C     msgBuf       :: Informational/error message buffer
                0047 C     iUnit        :: Work variable for IO unit number
                0048 C  OB_indexUnset   :: OB index value for places where no OB is defined
                0049 C  OB_singleJnorth :: global/uniform Northern OB position index
                0050 C  OB_singleJsouth :: global/uniform Southern OB position index
                0051 C  OB_singleIeast  :: global/uniform Eastern  OB position index
                0052 C  OB_singleIwest  :: global/uniform Western  OB position index
9b8b001637 Jean*0053       CHARACTER*(MAX_LEN_MBUF) msgBuf
                0054       INTEGER iUnit
45bc474d14 Jean*0055       INTEGER errCount
6646af77e1 Jean*0056       INTEGER i, j
d222604fe0 Mart*0057       INTEGER bi, bj, iG, jG, iGm, jGm
c816a80284 Jean*0058       INTEGER OB_indexUnset
8d129534f3 Jean*0059 #ifdef ALLOW_PTRACERS
                0060       INTEGER iTracer
                0061 #endif
9a428ff231 Oliv*0062 #ifdef ALLOW_EXCH2
                0063       INTEGER tN
                0064 #endif /* ALLOW_EXCH2 */
                0065 
                0066 C These are input arrays (of integers) that contain the *absolute*
                0067 C computational index of an open-boundary (OB) point.
                0068 C A zero (0) element means there is no corresponding OB in that column/row.
                0069 C The computational coordinate refers to "tracer" cells.
                0070 C For a northern/southern OB, the OB V point is to the south/north.
                0071 C For an eastern/western OB, the OB U point is to the west/east.
                0072 C eg.
                0073 C     OB_Jnorth(3)=34  means that:
                0074 C          T( 3 ,34) is a an OB point
                0075 C          U(3:4,34) is a an OB point
                0076 C          V( 4 ,34) is a an OB point
                0077 C while
                0078 C     OB_Jsouth(3)=1  means that:
                0079 C          T( 3 ,1) is a an OB point
                0080 C          U(3:4,1) is a an OB point
                0081 C          V( 4 ,2) is a an OB point
                0082 C
                0083 C For convenience, negative values for Jnorth/Ieast refer to
                0084 C points relative to the Northern/Eastern edges of the model
                0085 C eg. OB_Jnorth(3)=-1  means that the point (3,Ny) is a northern O-B.
                0086 C
45bc474d14 Jean*0087 C When the OB index value is uniform across the full domain, one can set
                0088 C a unique OB index value using local parameter OB_singleJnorth/south,
                0089 C  OB_singleIeast/west, (same index convention) instead of multiple/repeating
                0090 C index setting
                0091 C
9a428ff231 Oliv*0092 C With exch2, the global domain used for specifying the boundary (and
                0093 C boundary value files) is different for N,S and E,W boundaries:
                0094 C - for N,S, the facets are stacked in x (like W2_mapIO=-1)
                0095 C - for E,W, the facets are stacked in y, so that E,W boundaries in
                0096 C   different facets cannot have the same I
                0097 C
                0098 C OB_Jnorth(W2_maxXStackNx) :: global index array of northern open-boundary point
                0099 C OB_Jsouth(W2_maxXStackNx) :: global index array of southern open-boundary point
                0100 C OB_Ieast(W2_maxYStackNy)  :: global index array of eastern  open-boundary point
                0101 C OB_Iwest(W2_maxYStackNy)  :: global index array of western  open-boundary point
                0102 
                0103 #ifdef ALLOW_EXCH2
                0104       INTEGER OB_Jnorth(W2_maxXStackNx)
                0105       INTEGER OB_Jsouth(W2_maxXStackNx)
                0106       INTEGER OB_Ieast(W2_maxYStackNy)
                0107       INTEGER OB_Iwest(W2_maxYStackNy)
                0108 #else
                0109       INTEGER OB_Jnorth(Nx)
                0110       INTEGER OB_Jsouth(Nx)
                0111       INTEGER OB_Ieast(Ny)
                0112       INTEGER OB_Iwest(Ny)
                0113 #endif
45bc474d14 Jean*0114       INTEGER OB_singleJnorth
                0115       INTEGER OB_singleJsouth
                0116       INTEGER OB_singleIeast
                0117       INTEGER OB_singleIwest
9a428ff231 Oliv*0118 
                0119 C With exch2, we use different global domains for specifying
                0120 C N,S resp. E,W boundaries (and for reading in the corresponding data):
                0121 C
                0122 C     OBNS_Nx ::  width of global domain for OB_Jnorth, OB_Jsouth
                0123 C     OBNS_Ny :: height of global domain for OB_Jnorth, OB_Jsouth
                0124 C     OBEW_Nx ::  width of global domain for OB_Ieast, OB_Iwest
                0125 C     OBEW_Ny :: height of global domain for OB_Ieast, OB_Iwest
                0126 
                0127       INTEGER OBNS_Nx, OBNS_Ny
                0128       INTEGER OBEW_Nx, OBEW_Ny
b4626a356d Jean*0129 CEOP
9b8b001637 Jean*0130 
672b822630 Jean*0131 C     Retired parameters:
05b5fb3079 Jean*0132       INTEGER nRetired
                0133       LOGICAL useOBCSYearlyFields
672b822630 Jean*0134       _RL tidalPeriod(OBCS_tideCompSize)
                0135       CHARACTER*(MAX_LEN_FNAM)
                0136      &      OBNamFile, OBSamFile, OBEamFile, OBWamFile,
                0137      &      OBNphFile, OBSphFile, OBEphFile, OBWphFile
05b5fb3079 Jean*0138 
42c525bfb4 Alis*0139       NAMELIST /OBCS_PARM01/
ef03bf2dde Jean*0140      &          insideOBmaskFile,
e4a300ec91 Jean*0141      &          OBNconnectFile, OBSconnectFile,
                0142      &          OBEconnectFile, OBWconnectFile,
672b822630 Jean*0143      &          OB_Jnorth, OB_Jsouth, OB_Ieast, OB_Iwest,
45bc474d14 Jean*0144      &          OB_singleJnorth, OB_singleJsouth,
672b822630 Jean*0145      &          OB_singleIeast,  OB_singleIwest,
                0146      &          useOrlanskiNorth, useOrlanskiSouth,
                0147      &          useOrlanskiEast,  useOrlanskiWest,
                0148      &          useStevensNorth, useStevensSouth,
                0149      &          useStevensEast,  useStevensWest,
                0150      &          useOBCSprescribe, useOBCStides, OBCS_tidalPeriod,
4fb81a5efb Jean*0151      &          OBCS_u1_adv_T, OBCS_u1_adv_S,
672b822630 Jean*0152      &          OBNuFile, OBNvFile, OBNtFile, OBNsFile, OBNetaFile,
                0153      &          OBSuFile, OBSvFile, OBStFile, OBSsFile, OBSetaFile,
                0154      &          OBEuFile, OBEvFile, OBEtFile, OBEsFile, OBEetaFile,
                0155      &          OBWuFile, OBWvFile, OBWtFile, OBWsFile, OBWetaFile,
                0156      &          OBNwFile,  OBSwFile,  OBEwFile,  OBWwFile,
                0157      &  OBN_uTidAmFile, OBS_uTidAmFile, OBE_uTidAmFile, OBW_uTidAmFile,
                0158      &  OBN_vTidAmFile, OBS_vTidAmFile, OBE_vTidAmFile, OBW_vTidAmFile,
                0159      &  OBN_uTidPhFile, OBS_uTidPhFile, OBE_uTidPhFile, OBW_uTidPhFile,
                0160      &  OBN_vTidPhFile, OBS_vTidPhFile, OBE_vTidPhFile, OBW_vTidPhFile,
                0161      &          OBNaFile,  OBSaFile,  OBEaFile,  OBWaFile,
                0162      &          OBNhFile,  OBShFile,  OBEhFile,  OBWhFile,
                0163      &          OBNslFile, OBSslFile, OBEslFile, OBWslFile,
                0164      &          OBNsnFile, OBSsnFile, OBEsnFile, OBWsnFile,
                0165      &          OBNuiceFile, OBSuiceFile, OBEuiceFile, OBWuiceFile,
                0166      &          OBNviceFile, OBSviceFile, OBEviceFile, OBWviceFile,
ee1c912a22 Mart*0167 #ifdef ALLOW_PTRACERS
4fb81a5efb Jean*0168      &          OBCS_u1_adv_Tr,
672b822630 Jean*0169      &          OBNptrFile, OBSptrFile, OBEptrFile, OBWptrFile,
ee1c912a22 Mart*0170 #endif
af61e5eb16 Mart*0171      &          useOBCSsponge, useSeaiceSponge, useSeaiceNeumann,
432b2a4585 Dimi*0172      &          OBCSsponge_N , OBCSsponge_S,
                0173      &          OBCSsponge_E, OBCSsponge_W,
                0174      &          OBCSsponge_UatNS, OBCSsponge_UatEW,
                0175      &          OBCSsponge_VatNS, OBCSsponge_VatEW,
                0176      &          OBCSsponge_Theta, OBCSsponge_Salt, useLinearSponge,
abfe198bce Mart*0177      &          useOBCSbalance, OBCSbalanceSurf,
f4098ccf3f Jean*0178      &          OBCS_balanceFacN, OBCS_balanceFacS,
                0179      &          OBCS_balanceFacE, OBCS_balanceFacW,
672b822630 Jean*0180      &          OBCSfixTopo, OBCS_uvApplyFac,
6f4cf52d27 Dimi*0181      &          OBCS_monitorFreq, OBCS_monSelect, OBCSprintDiags,
672b822630 Jean*0182      &          useOBCSYearlyFields,
                0183      &          OBNAmFile, OBSAmFile, OBEAmFile, OBWAmFile,
                0184      &          OBNPhFile, OBSPhFile, OBEPhFile, OBWPhFile,
6f4cf52d27 Dimi*0185      &          tidalPeriod
174cf6d3c0 Alis*0186 
                0187 #ifdef ALLOW_ORLANSKI
                0188       NAMELIST /OBCS_PARM02/
f2f2d1c632 Alis*0189      & CMAX, cvelTimeScale, CFIX, useFixedCEast, useFixedCWest
174cf6d3c0 Alis*0190 #endif
42c525bfb4 Alis*0191 
96bbd4e2a5 Patr*0192 #ifdef ALLOW_OBCS_SPONGE
                0193       NAMELIST /OBCS_PARM03/
                0194      &          Urelaxobcsinner,Urelaxobcsbound,
                0195      &          Vrelaxobcsinner,Vrelaxobcsbound,
                0196      &          spongeThickness
                0197 #endif
b2cb1ccb9a Mart*0198 #ifdef ALLOW_OBCS_STEVENS
                0199       NAMELIST /OBCS_PARM04/
                0200      &          TrelaxStevens,SrelaxStevens,
                0201      &          useStevensPhaseVel,useStevensAdvection
b4626a356d Jean*0202 #endif /* ALLOW_OBCS_STEVENS */
c7c4b57180 Dimi*0203 #ifdef ALLOW_OBCS_SEAICE_SPONGE
                0204       NAMELIST /OBCS_PARM05/
5e26aed318 Dimi*0205      &           Arelaxobcsinner, Arelaxobcsbound,
                0206      &           Hrelaxobcsinner, Hrelaxobcsbound,
                0207      &          SLrelaxobcsinner,SLrelaxobcsbound,
                0208      &          SNrelaxobcsinner,SNrelaxobcsbound,
c7c4b57180 Dimi*0209      &          seaiceSpongeThickness
ae4c29e0db Jean*0210 #endif
                0211 
                0212       IF ( .NOT.useOBCS ) THEN
                0213 C-    pkg OBCS is not used
                0214         _BEGIN_MASTER(myThid)
                0215 C-    Track pkg activation status:
                0216 C     print a (weak) warning if data.obcs is found
                0217          CALL PACKAGES_UNUSED_MSG( 'useOBCS', ' ', ' ' )
                0218         _END_MASTER(myThid)
                0219         RETURN
                0220       ENDIF
96bbd4e2a5 Patr*0221 
9b8b001637 Jean*0222       _BEGIN_MASTER(myThid)
42c525bfb4 Alis*0223 
9a428ff231 Oliv*0224 #ifdef ALLOW_EXCH2
                0225       OBNS_Nx = exch2_xStack_Nx
                0226       OBNS_Ny = exch2_xStack_Ny
                0227       OBEW_Nx = exch2_yStack_Nx
                0228       OBEW_Ny = exch2_yStack_Ny
                0229 #else
                0230       OBNS_Nx = Nx
                0231       OBNS_Ny = Ny
                0232       OBEW_Nx = Nx
                0233       OBEW_Ny = Ny
                0234 #endif
                0235 
42c525bfb4 Alis*0236 C--   Default flags and values for OBCS
da08c1c2cb Jean*0237       OB_indexNone  = -99
c816a80284 Jean*0238       OB_indexUnset = 0
ef03bf2dde Jean*0239       insideOBmaskFile = ' '
e4a300ec91 Jean*0240       OBNconnectFile   = ' '
                0241       OBSconnectFile   = ' '
                0242       OBEconnectFile   = ' '
                0243       OBWconnectFile   = ' '
6646af77e1 Jean*0244       DO i=1,OBNS_Nx
c816a80284 Jean*0245        OB_Jnorth(i) = OB_indexUnset
                0246        OB_Jsouth(i) = OB_indexUnset
42c525bfb4 Alis*0247       ENDDO
6646af77e1 Jean*0248       DO j=1,OBEW_Ny
c816a80284 Jean*0249        OB_Ieast(j) = OB_indexUnset
                0250        OB_Iwest(j) = OB_indexUnset
42c525bfb4 Alis*0251       ENDDO
45bc474d14 Jean*0252       OB_singleJnorth = OB_indexUnset
                0253       OB_singleJsouth = OB_indexUnset
                0254       OB_singleIeast = OB_indexUnset
                0255       OB_singleIwest = OB_indexUnset
6646af77e1 Jean*0256       OBCS_indexStatus = 0
7c7f4c7f71 Mart*0257       useOrlanskiNorth   =.FALSE.
                0258       useOrlanskiSouth   =.FALSE.
                0259       useOrlanskiEast    =.FALSE.
                0260       useOrlanskiWest    =.FALSE.
b2cb1ccb9a Mart*0261       useStevensNorth    =.FALSE.
                0262       useStevensSouth    =.FALSE.
                0263       useStevensEast     =.FALSE.
                0264       useStevensWest     =.FALSE.
                0265       useStevensPhaseVel =.TRUE.
                0266       useStevensAdvection=.TRUE.
672b822630 Jean*0267       useOBCSprescribe   =.FALSE.
                0268       useOBCStides       =.FALSE.
7c7f4c7f71 Mart*0269       useOBCSsponge      =.FALSE.
c7c4b57180 Dimi*0270       useSeaiceSponge    =.FALSE.
af61e5eb16 Mart*0271       useSeaiceNeumann   =.FALSE.
432b2a4585 Dimi*0272       OBCSsponge_N       =.TRUE.
                0273       OBCSsponge_S       =.TRUE.
                0274       OBCSsponge_E       =.TRUE.
                0275       OBCSsponge_W       =.TRUE.
                0276       OBCSsponge_UatNS   =.TRUE.
                0277       OBCSsponge_UatEW   =.TRUE.
                0278       OBCSsponge_VatNS   =.TRUE.
                0279       OBCSsponge_VatEW   =.TRUE.
                0280       OBCSsponge_Theta   =.TRUE.
                0281       OBCSsponge_Salt    =.TRUE.
                0282       useLinearSponge    =.FALSE.
7c7f4c7f71 Mart*0283       useOBCSbalance     =.FALSE.
abfe198bce Mart*0284       OBCSbalanceSurf    =.FALSE.
f4098ccf3f Jean*0285       OBCS_balanceFacN   = 1. _d 0
                0286       OBCS_balanceFacS   = 1. _d 0
                0287       OBCS_balanceFacE   = 1. _d 0
                0288       OBCS_balanceFacW   = 1. _d 0
4fb81a5efb Jean*0289       OBCS_u1_adv_T      = 0
                0290       OBCS_u1_adv_S      = 0
fb5ad257ea Jean*0291       OBCSfixTopo        =.FALSE.
52fba54157 Jean*0292       OBCS_uvApplyFac    = 1. _d 0
f4098ccf3f Jean*0293       OBCS_monitorFreq   = monitorFreq
                0294       OBCS_monSelect     = 0
8830b8f970 Jean*0295       OBCSprintDiags     = debugLevel.GE.debLevC
42c525bfb4 Alis*0296 
b48d3feefc Patr*0297       OBNuFile = ' '
                0298       OBNvFile = ' '
                0299       OBNtFile = ' '
                0300       OBNsFile = ' '
fe50289ca9 Dimi*0301       OBNaFile = ' '
6f4cf52d27 Dimi*0302       OBNhFile = ' '
fa757486b0 Dimi*0303       OBNslFile = ' '
                0304       OBNsnFile = ' '
5459643feb Dimi*0305       OBNuiceFile = ' '
                0306       OBNviceFile = ' '
b48d3feefc Patr*0307       OBSuFile = ' '
                0308       OBSvFile = ' '
                0309       OBStFile = ' '
                0310       OBSsFile = ' '
fe50289ca9 Dimi*0311       OBSaFile = ' '
                0312       OBShFile = ' '
fa757486b0 Dimi*0313       OBSslFile = ' '
                0314       OBSsnFile = ' '
5459643feb Dimi*0315       OBSuiceFile = ' '
                0316       OBSviceFile = ' '
b48d3feefc Patr*0317       OBEuFile = ' '
                0318       OBEvFile = ' '
                0319       OBEtFile = ' '
                0320       OBEsFile = ' '
fe50289ca9 Dimi*0321       OBEaFile = ' '
                0322       OBEhFile = ' '
fa757486b0 Dimi*0323       OBEslFile = ' '
                0324       OBEsnFile = ' '
5459643feb Dimi*0325       OBEuiceFile = ' '
                0326       OBEviceFile = ' '
b48d3feefc Patr*0327       OBWuFile = ' '
                0328       OBWvFile = ' '
                0329       OBWtFile = ' '
                0330       OBWsFile = ' '
fe50289ca9 Dimi*0331       OBWaFile = ' '
                0332       OBWhFile = ' '
fa757486b0 Dimi*0333       OBWslFile = ' '
                0334       OBWsnFile = ' '
5459643feb Dimi*0335       OBWuiceFile = ' '
                0336       OBWviceFile = ' '
d260176b41 Mart*0337       OBNetaFile = ' '
                0338       OBSetaFile = ' '
                0339       OBEetaFile = ' '
                0340       OBWetaFile = ' '
2d12bccb16 Jean*0341       OBNwFile = ' '
                0342       OBSwFile = ' '
                0343       OBEwFile = ' '
                0344       OBWwFile = ' '
672b822630 Jean*0345       OBN_uTidAmFile = ' '
                0346       OBN_uTidPhFile = ' '
                0347       OBN_vTidAmFile = ' '
                0348       OBN_vTidPhFile = ' '
                0349       OBS_uTidAmFile = ' '
                0350       OBS_uTidPhFile = ' '
                0351       OBS_vTidAmFile = ' '
                0352       OBS_vTidPhFile = ' '
                0353       OBE_uTidAmFile = ' '
                0354       OBE_uTidPhFile = ' '
                0355       OBE_vTidAmFile = ' '
                0356       OBE_vTidPhFile = ' '
                0357       OBW_uTidAmFile = ' '
                0358       OBW_uTidPhFile = ' '
                0359       OBW_vTidAmFile = ' '
                0360       OBW_vTidPhFile = ' '
ee1c912a22 Mart*0361 #ifdef ALLOW_PTRACERS
                0362       DO iTracer = 1, PTRACERS_num
4fb81a5efb Jean*0363        OBCS_u1_adv_Tr(iTracer) = 0
ee1c912a22 Mart*0364        OBNptrFile(iTracer) = ' '
                0365        OBSptrFile(iTracer) = ' '
                0366        OBEptrFile(iTracer) = ' '
                0367        OBWptrFile(iTracer) = ' '
                0368       ENDDO
                0369 #endif
672b822630 Jean*0370 c#ifdef ALLOW_OBCS_TIDES
                0371       OBCS_nTidalComp = 0
                0372       DO i = 1, OBCS_tideCompSize
                0373        OBCS_tidalPeriod(i) = 0. _d 0
6f4cf52d27 Dimi*0374       ENDDO
672b822630 Jean*0375 c#endif
05b5fb3079 Jean*0376 C-    retired parameters
                0377       nRetired = 0
                0378       useOBCSYearlyFields = .FALSE.
672b822630 Jean*0379       OBNamFile = 'retired-and-unset'
                0380       OBSamFile = 'retired-and-unset'
                0381       OBEamFile = 'retired-and-unset'
                0382       OBWamFile = 'retired-and-unset'
                0383       OBNphFile = 'retired-and-unset'
                0384       OBSphFile = 'retired-and-unset'
                0385       OBEphFile = 'retired-and-unset'
                0386       OBWphFile = 'retired-and-unset'
                0387       DO i = 1, OBCS_tideCompSize
                0388        tidalPeriod(i) = -1. _d 0
                0389       ENDDO
b48d3feefc Patr*0390 
b4626a356d Jean*0391 C     Open and read the data.obcs file
                0392       WRITE(msgBuf,'(A)') ' OBCS_READPARMS: opening data.obcs'
                0393       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0394      &                    SQUEEZE_RIGHT , myThid )
                0395       CALL OPEN_COPY_DATA_FILE(
                0396      I                          'data.obcs', 'OBCS_READPARMS',
                0397      O                          iUnit,
                0398      I                          myThid )
                0399 
42c525bfb4 Alis*0400 C--   Read parameters from open data file
                0401       READ(UNIT=iUnit,NML=OBCS_PARM01)
                0402 
05b5fb3079 Jean*0403 C-    retired parameter
                0404       IF ( useOBCSYearlyFields ) THEN
                0405        nRetired = nRetired + 1
672b822630 Jean*0406        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0407      &  '"useOBCSYearlyFields" no longer allowed in file "data.obcs"'
05b5fb3079 Jean*0408        CALL PRINT_ERROR( msgBuf, myThid )
                0409        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0410      &  ' was moved to "data.exf", namelist: "EXF_NML_OBCS"'
                0411        CALL PRINT_ERROR( msgBuf, myThid )
                0412       ENDIF
672b822630 Jean*0413       errCount = 0
                0414       DO i = 1, OBCS_tideCompSize
                0415        IF ( tidalPeriod(i) .NE. -1. _d 0 ) errCount = errCount + 1
                0416       ENDDO
                0417       IF ( errCount.NE.0 ) THEN
                0418        nRetired = nRetired + 1
                0419        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0420      &  '"tidalPeriod" no longer allowed in file "data.obcs"'
                0421        CALL PRINT_ERROR( msgBuf, myThid )
                0422        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0423      &  ' was replaced by "OBCS_tidalPeriod" in same namelist'
                0424        CALL PRINT_ERROR( msgBuf, myThid )
                0425       ENDIF
                0426       i = ILNBLNK(OBNamFile)
                0427       IF ( i.NE.17 .OR. OBNamFile(1:17).NE.'retired-and-unset' ) THEN
                0428        nRetired = nRetired + 1
                0429        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0430      &  '"OBNamFile" no longer allowed in file "data.obcs"'
                0431        CALL PRINT_ERROR( msgBuf, myThid )
                0432        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0433      &  ' was replaced by "OBN_vTidAmFile" in same namelist'
                0434        CALL PRINT_ERROR( msgBuf, myThid )
                0435       ENDIF
                0436       i = ILNBLNK(OBSamFile)
                0437       IF ( i.NE.17 .OR. OBSamFile(1:17).NE.'retired-and-unset' ) THEN
                0438        nRetired = nRetired + 1
                0439        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0440      &  '"OBSamFile" no longer allowed in file "data.obcs"'
                0441        CALL PRINT_ERROR( msgBuf, myThid )
                0442        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0443      &  ' was replaced by "OBS_vTidAmFile" in same namelist'
                0444        CALL PRINT_ERROR( msgBuf, myThid )
                0445       ENDIF
                0446       i = ILNBLNK(OBEamFile)
                0447       IF ( i.NE.17 .OR. OBEamFile(1:17).NE.'retired-and-unset' ) THEN
                0448        nRetired = nRetired + 1
                0449        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0450      &  '"OBEamFile" no longer allowed in file "data.obcs"'
                0451        CALL PRINT_ERROR( msgBuf, myThid )
                0452        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0453      &  ' was replaced by "OBE_uTidAmFile" in same namelist'
                0454        CALL PRINT_ERROR( msgBuf, myThid )
                0455       ENDIF
                0456       i = ILNBLNK(OBWamFile)
                0457       IF ( i.NE.17 .OR. OBWamFile(1:17).NE.'retired-and-unset' ) THEN
                0458        nRetired = nRetired + 1
                0459        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0460      &  '"OBWamFile" no longer allowed in file "data.obcs"'
                0461        CALL PRINT_ERROR( msgBuf, myThid )
                0462        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0463      &  ' was replaced by "OBW_uTidAmFile" in same namelist'
                0464        CALL PRINT_ERROR( msgBuf, myThid )
                0465       ENDIF
                0466       i = ILNBLNK(OBNphFile)
                0467       IF ( i.NE.17 .OR. OBNphFile(1:17).NE.'retired-and-unset' ) THEN
                0468        nRetired = nRetired + 1
                0469        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0470      &  '"OBNphFile" no longer allowed in file "data.obcs"'
                0471        CALL PRINT_ERROR( msgBuf, myThid )
                0472        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0473      &  ' was replaced by "OBN_vTidPhFile" in same namelist'
                0474        CALL PRINT_ERROR( msgBuf, myThid )
                0475       ENDIF
                0476       i = ILNBLNK(OBSphFile)
                0477       IF ( i.NE.17 .OR. OBSphFile(1:17).NE.'retired-and-unset' ) THEN
                0478        nRetired = nRetired + 1
                0479        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0480      &  '"OBSphFile" no longer allowed in file "data.obcs"'
                0481        CALL PRINT_ERROR( msgBuf, myThid )
                0482        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0483      &  ' was replaced by "OBS_vTidPhFile" in same namelist'
                0484        CALL PRINT_ERROR( msgBuf, myThid )
                0485       ENDIF
                0486       i = ILNBLNK(OBEphFile)
                0487       IF ( i.NE.17 .OR. OBEphFile(1:17).NE.'retired-and-unset' ) THEN
                0488        nRetired = nRetired + 1
                0489        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0490      &  '"OBEphFile" no longer allowed in file "data.obcs"'
                0491        CALL PRINT_ERROR( msgBuf, myThid )
                0492        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0493      &  ' was replaced by "OBE_uTidPhFile" in same namelist'
                0494        CALL PRINT_ERROR( msgBuf, myThid )
                0495       ENDIF
                0496       i = ILNBLNK(OBWphFile)
                0497       IF ( i.NE.17 .OR. OBWphFile(1:17).NE.'retired-and-unset' ) THEN
                0498        nRetired = nRetired + 1
                0499        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0500      &  '"OBWphFile" no longer allowed in file "data.obcs"'
                0501        CALL PRINT_ERROR( msgBuf, myThid )
                0502        WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
                0503      &  ' was replaced by "OBW_uTidPhFile" in same namelist'
                0504        CALL PRINT_ERROR( msgBuf, myThid )
                0505       ENDIF
05b5fb3079 Jean*0506 
174cf6d3c0 Alis*0507 #ifdef ALLOW_ORLANSKI
                0508 C     Default Orlanski radiation parameters
                0509       CMAX = 0.45 _d 0 /* maximum allowable phase speed-CFL for AB-II */
4fb81a5efb Jean*0510       cvelTimeScale = 2000.0 _d 0 /* Averaging period for phase speed (s) */
f2f2d1c632 Alis*0511       CFIX = 0.8 _d 0 /* Fixed boundary phase speed in m/s */
                0512       useFixedCEast=.FALSE.
                0513       useFixedCWest=.FALSE.
174cf6d3c0 Alis*0514       IF (useOrlanskiNorth.OR.
                0515      &    useOrlanskiSouth.OR.
                0516      &    useOrlanskiEast.OR.
9b8b001637 Jean*0517      &    useOrlanskiWest)
174cf6d3c0 Alis*0518      & READ(UNIT=iUnit,NML=OBCS_PARM02)
42c525bfb4 Alis*0519 #endif
9b8b001637 Jean*0520 
96bbd4e2a5 Patr*0521 #ifdef ALLOW_OBCS_SPONGE
689200863e Mart*0522 C     Default sponge layer parameters:
                0523 C     sponge layer is turned off by default
                0524       spongeThickness = 0
                0525       Urelaxobcsinner = 0. _d 0
                0526       Urelaxobcsbound = 0. _d 0
                0527       Vrelaxobcsinner = 0. _d 0
                0528       Vrelaxobcsbound = 0. _d 0
                0529 CML this was the previous default in units of days
                0530 CML      spongeThickness = 2
                0531 CML      Urelaxobcsinner = 5. _d 0
                0532 CML      Urelaxobcsbound = 1. _d 0
                0533 CML      Vrelaxobcsinner = 5. _d 0
                0534 CML      Vrelaxobcsbound = 1. _d 0
96bbd4e2a5 Patr*0535       IF (useOBCSsponge)
                0536      & READ(UNIT=iUnit,NML=OBCS_PARM03)
                0537 #endif
b2cb1ccb9a Mart*0538 #ifdef ALLOW_OBCS_STEVENS
                0539       TrelaxStevens   = 0. _d 0
                0540       SrelaxStevens   = 0. _d 0
b4626a356d Jean*0541       IF (      useStevensNorth .OR. useStevensSouth
b2cb1ccb9a Mart*0542      &     .OR. useStevensEast  .OR. useStevensWest  )
                0543      & READ(UNIT=iUnit,NML=OBCS_PARM04)
                0544 #endif
c7c4b57180 Dimi*0545 #ifdef ALLOW_OBCS_SEAICE_SPONGE
                0546 C     Default seaice sponge layer parameters:
                0547 C     seaice sponge layer is turned off by default
                0548       seaiceSpongeThickness = 0
5e26aed318 Dimi*0549       Arelaxobcsinner  = 0. _d 0
                0550       Arelaxobcsbound  = 0. _d 0
                0551       Hrelaxobcsinner  = 0. _d 0
                0552       Hrelaxobcsbound  = 0. _d 0
                0553       SLrelaxobcsinner = 0. _d 0
                0554       SLrelaxobcsbound = 0. _d 0
                0555       SNrelaxobcsinner = 0. _d 0
                0556       SNrelaxobcsbound = 0. _d 0
                0557       IF (useSeaiceSponge) READ(UNIT=iUnit,NML=OBCS_PARM05)
c7c4b57180 Dimi*0558 #endif
96bbd4e2a5 Patr*0559 
b4626a356d Jean*0560       WRITE(msgBuf,'(A)') ' OBCS_READPARMS: finished reading data.obcs'
                0561       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0562      &                    SQUEEZE_RIGHT , myThid )
42c525bfb4 Alis*0563 
                0564 C--   Close the open data file
7a77863887 Mart*0565 #ifdef SINGLE_DISK_IO
42c525bfb4 Alis*0566       CLOSE(iUnit)
7a77863887 Mart*0567 #else
                0568       CLOSE(iUnit,STATUS='DELETE')
                0569 #endif /* SINGLE_DISK_IO */
42c525bfb4 Alis*0570 
05b5fb3079 Jean*0571 C-    retired parameter
                0572       IF ( nRetired .GT. 0 ) THEN
                0573        WRITE(msgBuf,'(A)')
                0574      &  'OBCS_READPARMS: reading parameter file "data.obcs"'
                0575        CALL PRINT_ERROR( msgBuf, myThid )
672b822630 Jean*0576        WRITE(msgBuf,'(I4,A)') nRetired,
                0577      &  ' out of date parameters were found in namelist'
05b5fb3079 Jean*0578        CALL PRINT_ERROR( msgBuf, myThid )
                0579        STOP 'ABNORMAL END: S/R OBCS_READPARMS'
                0580       ENDIF
                0581 
672b822630 Jean*0582 #ifdef ALLOW_OBCS_TIDES
                0583       IF ( useOBCStides ) THEN
                0584 C--   Set OBCS_nTidalComp (= the number of tidal components to use)
                0585 C     as the last non-zero tidalPeriod:
                0586        OBCS_nTidalComp = 0
                0587        DO i = 1, OBCS_tideCompSize
                0588         IF ( OBCS_tidalPeriod(i).NE.zeroRL ) OBCS_nTidalComp = i
                0589        ENDDO
                0590        WRITE(msgBuf,'(2A,I6)') '  Set number of tidal Components ',
                0591      &   'in use: OBCS_nTidalComp =', OBCS_nTidalComp
                0592        CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0593      &                     SQUEEZE_RIGHT, myThid )
                0594        IF ( OBCS_nTidalComp .EQ. 0 ) THEN
                0595         WRITE(msgBuf,'(2A)') 'OBCS_READPARMS: ',
                0596      &   'useOBCStides=T without any OBCS_tidalPeriod > 0'
                0597         CALL PRINT_ERROR( msgBuf, myThid )
                0598         STOP 'ABNORMAL END: S/R OBCS_READPARMS'
                0599        ENDIF
                0600       ENDIF
                0601 #endif /* ALLOW_OBCS_TIDES */
                0602 
45bc474d14 Jean*0603 C-    Acount for single/uniform position OB setting:
                0604       errCount = 0
                0605       IF ( OB_singleIeast.NE.OB_indexUnset ) THEN
                0606         DO j=1,OBEW_Ny
                0607           IF ( OB_Ieast(j).EQ.OB_indexUnset ) THEN
                0608             OB_Ieast(j) = OB_singleIeast
                0609           ELSEIF ( OB_Ieast(j).NE.OB_singleIeast ) THEN
                0610             errCount = errCount + 1
                0611           ENDIF
                0612         ENDDO
                0613       ENDIF
                0614       IF ( errCount .NE. 0 ) THEN
                0615         WRITE(msgBuf,'(2A)') 'OBCS_READPARMS: ',
                0616      &  'Inconsistent setting of OB_Ieast/OB_singleIeast'
                0617         CALL PRINT_ERROR( msgBuf, myThid )
                0618         STOP 'ABNORMAL END: S/R OBCS_READPARMS'
                0619       ENDIF
                0620 
                0621       IF ( OB_singleIwest.NE.OB_indexUnset ) THEN
                0622         DO j=1,OBEW_Ny
                0623           IF ( OB_Iwest(j).EQ.OB_indexUnset ) THEN
                0624             OB_Iwest(j) = OB_singleIwest
                0625           ELSEIF ( OB_Iwest(j).NE.OB_singleIwest ) THEN
                0626             errCount = errCount + 1
                0627           ENDIF
                0628         ENDDO
                0629       ENDIF
                0630       IF ( errCount .NE. 0 ) THEN
                0631         WRITE(msgBuf,'(2A)') 'OBCS_READPARMS: ',
                0632      &  'Inconsistent setting of OB_Iwest/OB_singleIwest'
                0633         CALL PRINT_ERROR( msgBuf, myThid )
                0634         STOP 'ABNORMAL END: S/R OBCS_READPARMS'
                0635       ENDIF
                0636 
                0637       IF ( OB_singleJnorth.NE.OB_indexUnset ) THEN
                0638         DO i=1,OBNS_Nx
                0639           IF ( OB_Jnorth(i).EQ.OB_indexUnset ) THEN
                0640             OB_Jnorth(i) = OB_singleJnorth
                0641           ELSEIF ( OB_Jnorth(i).NE.OB_singleJnorth ) THEN
                0642             errCount = errCount + 1
                0643           ENDIF
                0644         ENDDO
                0645       ENDIF
                0646       IF ( errCount .NE. 0 ) THEN
                0647         WRITE(msgBuf,'(2A)') 'OBCS_READPARMS: ',
                0648      &  'Inconsistent setting of OB_Jnorth/OB_singleJnorth'
                0649         CALL PRINT_ERROR( msgBuf, myThid )
                0650         STOP 'ABNORMAL END: S/R OBCS_READPARMS'
                0651       ENDIF
                0652 
                0653       IF ( OB_singleJsouth.NE.OB_indexUnset ) THEN
                0654         DO i=1,OBNS_Nx
                0655           IF ( OB_Jsouth(i).EQ.OB_indexUnset ) THEN
                0656             OB_Jsouth(i) = OB_singleJsouth
                0657           ELSEIF ( OB_Jsouth(i).NE.OB_singleJsouth ) THEN
                0658             errCount = errCount + 1
                0659           ENDIF
                0660         ENDDO
                0661       ENDIF
                0662       IF ( errCount .NE. 0 ) THEN
                0663         WRITE(msgBuf,'(2A)') 'OBCS_READPARMS: ',
                0664      &  'Inconsistent setting of OB_Jsouth/OB_singleJsouth'
                0665         CALL PRINT_ERROR( msgBuf, myThid )
                0666         STOP 'ABNORMAL END: S/R OBCS_READPARMS'
                0667       ENDIF
                0668 
b4626a356d Jean*0669 C-    Account for periodicity if negative indices were supplied
6646af77e1 Jean*0670       DO j=1,OBEW_Ny
c816a80284 Jean*0671        IF ( OB_Ieast(j) .NE.OB_indexUnset .AND.
                0672      &      OB_Ieast(j) .LT.0 ) OB_Ieast(j) = OB_Ieast(j)+OBEW_Nx+1
b4626a356d Jean*0673       ENDDO
6646af77e1 Jean*0674       DO i=1,OBNS_Nx
c816a80284 Jean*0675        IF ( OB_Jnorth(i).NE.OB_indexUnset .AND.
                0676      &      OB_Jnorth(i).LT.0 ) OB_Jnorth(i)=OB_Jnorth(i)+OBNS_Ny+1
b4626a356d Jean*0677       ENDDO
45bc474d14 Jean*0678 
b4626a356d Jean*0679       IF ( debugLevel.GE.debLevA ) THEN
c816a80284 Jean*0680         CALL WRITE_0D_I( OB_indexUnset, INDEX_NONE,' OB_indexUnset =',
                0681      &                   ' /* unset OB index value (i.e. no OB) */')
b4626a356d Jean*0682 c       write(*,*) 'OB Jn =',OB_Jnorth
                0683 c       write(*,*) 'OB Js =',OB_Jsouth
                0684 c       write(*,*) 'OB Ie =',OB_Ieast
                0685 c       write(*,*) 'OB Iw =',OB_Iwest
                0686         WRITE(msgBuf,'(A)') ' Northern OB global indices : OB_Jnorth ='
                0687         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0688      &                      SQUEEZE_RIGHT, myThid )
                0689         CALL PRINT_LIST_I( OB_Jnorth, 1, OBNS_Nx, INDEX_I,
                0690      &                    .FALSE., .TRUE., standardMessageUnit )
                0691         WRITE(msgBuf,'(A)') ' Southern OB global indices : OB_Jsouth ='
                0692         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0693      &                      SQUEEZE_RIGHT, myThid )
                0694         CALL PRINT_LIST_I( OB_Jsouth, 1, OBNS_Nx, INDEX_I,
                0695      &                    .FALSE., .TRUE., standardMessageUnit )
                0696         WRITE(msgBuf,'(A)') ' Eastern  OB global indices : OB_Ieast ='
                0697         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0698      &                      SQUEEZE_RIGHT, myThid )
                0699         CALL PRINT_LIST_I( OB_Ieast, 1, OBEW_Ny, INDEX_J,
                0700      &                    .FALSE., .TRUE., standardMessageUnit )
                0701         WRITE(msgBuf,'(A)') ' Western  OB global indices : OB_Iwest ='
                0702         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0703      &                      SQUEEZE_RIGHT, myThid )
                0704         CALL PRINT_LIST_I( OB_Iwest, 1, OBEW_Ny, INDEX_J,
                0705      &                    .FALSE., .TRUE., standardMessageUnit )
                0706         WRITE(msgBuf,'(A)') ' '
                0707         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0708      &                      SQUEEZE_RIGHT, myThid )
                0709       ENDIF
abfe198bce Mart*0710       OBCSbalanceSurf = OBCSbalanceSurf .AND. useOBCSbalance
b4626a356d Jean*0711 
8eca246483 Jean*0712 C--   Continue master-thread only since global OB indices (+ OB_indexUnset)
                0713 C     are not shared (not in common block).
42c525bfb4 Alis*0714 
8eca246483 Jean*0715 C--   Calculate the tiled OB index arrays OB_Jn/Js/Ie/Iw here from the
                0716 C     global indices OB_Jnorth/Jsouth/Ieast/Iwest.
c816a80284 Jean*0717 C     Note: This part of the code has been moved from obcs_init_fixed
                0718 C     to this routine because the OB_Jn/Js/Ie/Iw index arrays are
6646af77e1 Jean*0719 C     required by INI_DEPTH (calling OBCS_CHECK_DEPTHS, but only needs
                0720 C     valid interior indices) which is called before OBCS_INIT_FIXED.
8eca246483 Jean*0721       DO bj = 1, nSy
                0722        DO bi = 1, nSx
d222604fe0 Mart*0723 
6646af77e1 Jean*0724         DO i=1-OLx,sNx+OLx
c816a80284 Jean*0725          OB_Jn(i,bi,bj) = OB_indexNone
                0726          OB_Js(i,bi,bj) = OB_indexNone
d222604fe0 Mart*0727         ENDDO
                0728 
6646af77e1 Jean*0729         DO j=1-OLy,sNy+OLy
c816a80284 Jean*0730          OB_Ie(j,bi,bj) = OB_indexNone
672b822630 Jean*0731          OB_Iw(j,bi,bj) = OB_indexNone
d222604fe0 Mart*0732         ENDDO
                0733 
9a428ff231 Oliv*0734 #ifdef ALLOW_EXCH2
c816a80284 Jean*0735 
                0736 C--   We apply OBCS only inside tile and exchange overlaps later
9a428ff231 Oliv*0737         tN = W2_myTileList(bi,bj)
                0738 C 1. N/S boundaries
c816a80284 Jean*0739 C     convert from local y index J to global y index jG
                0740 C     for N/S boundaries, we use faces stacked in x direction
                0741         DO i=1,sNx
                0742          iG = exch2_txXStackLo(tN)+i-1
                0743 C-    Northern boundaries
                0744          IF ( OB_Jnorth(iG).NE.OB_indexUnset ) THEN
                0745 C     loop over local y index J
                0746           DO j=1,sNy+1
                0747            jG = exch2_tyXStackLo(tN)+j-1
                0748            IF ( jG.EQ.OB_Jnorth(iG) ) OB_Jn(i,bi,bj) = j
                0749           ENDDO
                0750          ENDIF
                0751 C-    Southern boundaries
                0752          IF ( OB_Jsouth(iG).NE.OB_indexUnset ) THEN
                0753           DO j=0,sNy
                0754            jG = exch2_tyXStackLo(tN)+j-1
                0755            IF ( jG.EQ.OB_Jsouth(iG) ) OB_Js(i,bi,bj) = j
                0756           ENDDO
                0757          ENDIF
9a428ff231 Oliv*0758         ENDDO
                0759 C 2. E/W boundaries
c816a80284 Jean*0760 C     convert from local y index J to global y index jG
                0761 c     for E/W boundaries, we use faces stacked in y direction
6646af77e1 Jean*0762         DO j=1,sNy
                0763          jG = exch2_tyYStackLo(tN)+j-1
c816a80284 Jean*0764 C-    Eastern  boundaries
                0765          IF ( OB_Ieast(jG).NE.OB_indexUnset ) THEN
                0766 C     loop over local x index I
                0767           DO i=1,sNx+1
                0768            iG = exch2_txYStackLo(tN)+i-1
                0769            IF ( iG.EQ.OB_Ieast(jG) )  OB_Ie(j,bi,bj) = i
                0770           ENDDO
                0771          ENDIF
                0772 C-    Western  boundaries
                0773          IF ( OB_Iwest(jG).NE.OB_indexUnset ) THEN
                0774           DO i=0,sNx
                0775            iG = exch2_txYStackLo(tN)+i-1
                0776            IF ( iG.EQ.OB_Iwest(jG) )  OB_Iw(j,bi,bj) = i
                0777           ENDDO
                0778          ENDIF
9a428ff231 Oliv*0779         ENDDO
c816a80284 Jean*0780 
6646af77e1 Jean*0781 C-    OB-index tiled-arrays are set for tile-interior region
                0782          OBCS_indexStatus = 1
9a428ff231 Oliv*0783 
                0784 #else /* ALLOW_EXCH2 */
                0785 
6646af77e1 Jean*0786         DO j=1-OLy,sNy+OLy
c816a80284 Jean*0787 C     convert from local y index J to global y index jG
6646af77e1 Jean*0788          jG = myYGlobalLo+(bj-1)*sNy+j-1
c816a80284 Jean*0789 C     use periodicity to deal with out of range points caused by the overlaps.
                0790 C     they will be excluded by the mask in any case, but this saves array
                0791 C     out-of-bounds errors here.
                0792          jGm = 1+MOD( jG-1+Ny , Ny )
                0793 C-    Eastern  boundaries
                0794 C     OB_Ieast(jGm) allows to put the eastern boundary at variable x locations
                0795          IF ( OB_Ieast(jGm).NE.OB_indexUnset ) THEN
                0796 C     loop over local x index I
                0797           DO i=1,sNx+1
                0798            iG = myXGlobalLo+(bi-1)*sNx+i-1
                0799            iGm = 1+MOD( iG-1+Nx , Nx )
                0800            IF ( iG.EQ.OB_Ieast(jGm) )  OB_Ie(j,bi,bj) = i
                0801           ENDDO
                0802          ENDIF
                0803 C-    Western  boundaries
                0804          IF ( OB_Iwest(jGm).NE.OB_indexUnset ) THEN
                0805           DO i=0,sNx
                0806            iG = myXGlobalLo+(bi-1)*sNx+i-1
                0807            iGm = 1+MOD( iG-1+Nx , Nx )
                0808            IF ( iG.EQ.OB_Iwest(jGm) )  OB_Iw(j,bi,bj) = i
                0809           ENDDO
                0810          ENDIF
d222604fe0 Mart*0811         ENDDO
c816a80284 Jean*0812 
                0813         DO i=1-OLx,sNx+OLx
                0814          iG = myXGlobalLo+(bi-1)*sNx+i-1
                0815          iGm = 1+MOD( iG-1+Nx , Nx )
                0816 C-    Northern boundaries
                0817 C     OB_Jnorth(iG) allows to put the northern boundary at variable y locations
                0818          IF ( OB_Jnorth(iGm).NE.OB_indexUnset ) THEN
                0819           DO j=1,sNy+1
                0820            jG = myYGlobalLo+(bj-1)*sNy+j-1
                0821            jGm = 1+MOD( jG-1+Ny , Ny )
                0822            IF ( jG.EQ.OB_Jnorth(iGm) ) OB_Jn(i,bi,bj) = j
                0823           ENDDO
                0824          ENDIF
                0825 C-    Southern boundaries
                0826          IF ( OB_Jsouth(iGm).NE.OB_indexUnset ) THEN
                0827           DO j=0,sNy
                0828            jG = myYGlobalLo+(bj-1)*sNy+j-1
                0829            jGm = 1+MOD( jG-1+Ny , Ny )
                0830            IF ( jG.EQ.OB_Jsouth(iGm) ) OB_Js(i,bi,bj) = j
                0831           ENDDO
                0832          ENDIF
d222604fe0 Mart*0833         ENDDO
c816a80284 Jean*0834 
6646af77e1 Jean*0835 C-    OB-index tiled-arrays are set for interior and overlap regions
                0836         OBCS_indexStatus = 2
c816a80284 Jean*0837 
9a428ff231 Oliv*0838 #endif /* ALLOW_EXCH2 */
                0839 
d222604fe0 Mart*0840 C     bi,bj-loops
                0841        ENDDO
                0842       ENDDO
                0843 
8eca246483 Jean*0844       _END_MASTER(myThid)
                0845 C--   Everyone else must wait for the parameters to be loaded
                0846 C     and tiled OB indices to be set.
6646af77e1 Jean*0847       _BARRIER
9a428ff231 Oliv*0848 
42c525bfb4 Alis*0849 #endif /* ALLOW_OBCS */
                0850       RETURN
                0851       END