Back to home page

MITgcm

 
 

    


File indexing completed on 2019-08-24 05:11:02 UTC

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