/[MITgcm]/MITgcm/pkg/obcs/obcs_readparms.F
ViewVC logotype

Contents of /MITgcm/pkg/obcs/obcs_readparms.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.50 - (show annotations) (download)
Fri Dec 1 16:21:44 2017 UTC (6 years, 6 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint66o, checkpoint66n, checkpoint66m, HEAD
Changes since 1.49: +92 -5 lines
- add simpler setting (single value) of OB indices for the case where
  indices are uniform over the full section (Bruno Deremble contribution).

1 C $Header: /u/gcmpack/MITgcm/pkg/obcs/obcs_readparms.F,v 1.49 2017/08/09 15:23:37 mlosch Exp $
2 C $Name: $
3
4 #include "OBCS_OPTIONS.h"
5
6 CBOP
7 C !ROUTINE: OBCS_READPARMS
8 C !INTERFACE:
9 SUBROUTINE OBCS_READPARMS( myThid )
10
11 C !DESCRIPTION: \bv
12 C *==========================================================*
13 C | SUBROUTINE OBCS_READPARMS
14 C | o Routine to initialize OBCS variables and constants.
15 C *==========================================================*
16 C \ev
17
18 C !USES:
19 IMPLICIT NONE
20 C === Global variables ===
21 #include "SIZE.h"
22 #include "EEPARAMS.h"
23 #include "PARAMS.h"
24 #include "OBCS_PARAMS.h"
25 #include "OBCS_GRID.h"
26 #include "OBCS_SEAICE.h"
27 #ifdef ALLOW_ORLANSKI
28 #include "ORLANSKI.h"
29 #endif
30 #ifdef ALLOW_PTRACERS
31 #include "PTRACERS_SIZE.h"
32 #include "OBCS_PTRACERS.h"
33 #endif /* ALLOW_PTRACERS */
34 #ifdef ALLOW_EXCH2
35 #include "W2_EXCH2_SIZE.h"
36 #include "W2_EXCH2_TOPOLOGY.h"
37 #include "W2_EXCH2_PARAMS.h"
38 #endif /* ALLOW_EXCH2 */
39
40 C !INPUT/OUTPUT PARAMETERS:
41 C === Routine arguments ===
42 INTEGER myThid
43
44 #ifdef ALLOW_OBCS
45
46 C !LOCAL VARIABLES:
47 C === Local variables ===
48 C msgBuf :: Informational/error message buffer
49 C iUnit :: Work variable for IO unit number
50 C OB_indexUnset :: OB index value for places where no OB is defined
51 C OB_singleJnorth :: global/uniform Northern OB position index
52 C OB_singleJsouth :: global/uniform Southern OB position index
53 C OB_singleIeast :: global/uniform Eastern OB position index
54 C OB_singleIwest :: global/uniform Western OB position index
55 CHARACTER*(MAX_LEN_MBUF) msgBuf
56 INTEGER iUnit
57 INTEGER errCount
58 INTEGER i, j
59 INTEGER bi, bj, iG, jG, iGm, jGm
60 INTEGER OB_indexUnset
61 #ifdef ALLOW_PTRACERS
62 INTEGER iTracer
63 #endif
64 #ifdef ALLOW_EXCH2
65 INTEGER tN
66 #endif /* ALLOW_EXCH2 */
67
68 C These are input arrays (of integers) that contain the *absolute*
69 C computational index of an open-boundary (OB) point.
70 C A zero (0) element means there is no corresponding OB in that column/row.
71 C The computational coordinate refers to "tracer" cells.
72 C For a northern/southern OB, the OB V point is to the south/north.
73 C For an eastern/western OB, the OB U point is to the west/east.
74 C eg.
75 C OB_Jnorth(3)=34 means that:
76 C T( 3 ,34) is a an OB point
77 C U(3:4,34) is a an OB point
78 C V( 4 ,34) is a an OB point
79 C while
80 C OB_Jsouth(3)=1 means that:
81 C T( 3 ,1) is a an OB point
82 C U(3:4,1) is a an OB point
83 C V( 4 ,2) is a an OB point
84 C
85 C For convenience, negative values for Jnorth/Ieast refer to
86 C points relative to the Northern/Eastern edges of the model
87 C eg. OB_Jnorth(3)=-1 means that the point (3,Ny) is a northern O-B.
88 C
89 C When the OB index value is uniform across the full domain, one can set
90 C a unique OB index value using local parameter OB_singleJnorth/south,
91 C OB_singleIeast/west, (same index convention) instead of multiple/repeating
92 C index setting
93 C
94 C With exch2, the global domain used for specifying the boundary (and
95 C boundary value files) is different for N,S and E,W boundaries:
96 C - for N,S, the facets are stacked in x (like W2_mapIO=-1)
97 C - for E,W, the facets are stacked in y, so that E,W boundaries in
98 C different facets cannot have the same I
99 C
100 C OB_Jnorth(W2_maxXStackNx) :: global index array of northern open-boundary point
101 C OB_Jsouth(W2_maxXStackNx) :: global index array of southern open-boundary point
102 C OB_Ieast(W2_maxYStackNy) :: global index array of eastern open-boundary point
103 C OB_Iwest(W2_maxYStackNy) :: global index array of western open-boundary point
104
105 #ifdef ALLOW_EXCH2
106 INTEGER OB_Jnorth(W2_maxXStackNx)
107 INTEGER OB_Jsouth(W2_maxXStackNx)
108 INTEGER OB_Ieast(W2_maxYStackNy)
109 INTEGER OB_Iwest(W2_maxYStackNy)
110 #else
111 INTEGER OB_Jnorth(Nx)
112 INTEGER OB_Jsouth(Nx)
113 INTEGER OB_Ieast(Ny)
114 INTEGER OB_Iwest(Ny)
115 #endif
116 INTEGER OB_singleJnorth
117 INTEGER OB_singleJsouth
118 INTEGER OB_singleIeast
119 INTEGER OB_singleIwest
120
121 C With exch2, we use different global domains for specifying
122 C N,S resp. E,W boundaries (and for reading in the corresponding data):
123 C
124 C OBNS_Nx :: width of global domain for OB_Jnorth, OB_Jsouth
125 C OBNS_Ny :: height of global domain for OB_Jnorth, OB_Jsouth
126 C OBEW_Nx :: width of global domain for OB_Ieast, OB_Iwest
127 C OBEW_Ny :: height of global domain for OB_Ieast, OB_Iwest
128
129 INTEGER OBNS_Nx, OBNS_Ny
130 INTEGER OBEW_Nx, OBEW_Ny
131 CEOP
132
133 C retired parameters
134 INTEGER nRetired
135 LOGICAL useOBCSYearlyFields
136
137 NAMELIST /OBCS_PARM01/
138 & insideOBmaskFile,
139 & OBNconnectFile, OBSconnectFile,
140 & OBEconnectFile, OBWconnectFile,
141 & OB_Jnorth,OB_Jsouth,OB_Ieast,OB_Iwest,
142 & OB_singleJnorth, OB_singleJsouth,
143 & OB_singleIeast, OB_singleIwest,
144 & useOrlanskiNorth,useOrlanskiSouth,
145 & useOrlanskiEast,useOrlanskiWest,
146 & useStevensNorth,useStevensSouth,
147 & useStevensEast,useStevensWest,
148 & OBCS_u1_adv_T, OBCS_u1_adv_S,
149 & OBNuFile,OBNvFile,OBNtFile,OBNsFile,OBNaFile,OBNhFile,
150 & OBSuFile,OBSvFile,OBStFile,OBSsFile,OBSaFile,OBShFile,
151 & OBEuFile,OBEvFile,OBEtFile,OBEsFile,OBEaFile,OBEhFile,
152 & OBWuFile,OBWvFile,OBWtFile,OBWsFile,OBWaFile,OBWhFile,
153 & OBNslFile,OBSslFile,OBEslFile,OBWslFile,
154 & OBNsnFile,OBSsnFile,OBEsnFile,OBWsnFile,
155 & OBNuiceFile,OBSuiceFile,OBEuiceFile,OBWuiceFile,
156 & OBNviceFile,OBSviceFile,OBEviceFile,OBWviceFile,
157 & OBNetaFile, OBSetaFile, OBEetaFile, OBWetaFile,
158 & OBNwFile, OBSwFile, OBEwFile, OBWwFile,
159 & OBNAmFile, OBSAmFile, OBEAmFile, OBWAmFile,
160 & OBNPhFile, OBSPhFile, OBEPhFile, OBWPhFile,
161 #ifdef ALLOW_PTRACERS
162 & OBCS_u1_adv_Tr,
163 & OBNptrFile,OBSptrFile,OBEptrFile,OBWptrFile,
164 #endif
165 & useOBCSsponge, useSeaiceSponge,
166 & OBCSsponge_N , OBCSsponge_S,
167 & OBCSsponge_E, OBCSsponge_W,
168 & OBCSsponge_UatNS, OBCSsponge_UatEW,
169 & OBCSsponge_VatNS, OBCSsponge_VatEW,
170 & OBCSsponge_Theta, OBCSsponge_Salt, useLinearSponge,
171 & useOBCSbalance, useOBCStides, useOBCSprescribe,
172 & OBCS_balanceFacN, OBCS_balanceFacS,
173 & OBCS_balanceFacE, OBCS_balanceFacW,
174 & useOBCSYearlyFields, OBCSfixTopo,
175 & OBCS_uvApplyFac,
176 & OBCS_monitorFreq, OBCS_monSelect, OBCSprintDiags,
177 & tidalPeriod
178
179 #ifdef ALLOW_ORLANSKI
180 NAMELIST /OBCS_PARM02/
181 & CMAX, cvelTimeScale, CFIX, useFixedCEast, useFixedCWest
182 #endif
183
184 #ifdef ALLOW_OBCS_SPONGE
185 NAMELIST /OBCS_PARM03/
186 & Urelaxobcsinner,Urelaxobcsbound,
187 & Vrelaxobcsinner,Vrelaxobcsbound,
188 & spongeThickness
189 #endif
190 #ifdef ALLOW_OBCS_STEVENS
191 NAMELIST /OBCS_PARM04/
192 & TrelaxStevens,SrelaxStevens,
193 & useStevensPhaseVel,useStevensAdvection
194 #endif /* ALLOW_OBCS_STEVENS */
195 #ifdef ALLOW_OBCS_SEAICE_SPONGE
196 NAMELIST /OBCS_PARM05/
197 & Arelaxobcsinner, Arelaxobcsbound,
198 & Hrelaxobcsinner, Hrelaxobcsbound,
199 & SLrelaxobcsinner,SLrelaxobcsbound,
200 & SNrelaxobcsinner,SNrelaxobcsbound,
201 & seaiceSpongeThickness
202 #endif
203
204 IF ( .NOT.useOBCS ) THEN
205 C- pkg OBCS is not used
206 _BEGIN_MASTER(myThid)
207 C- Track pkg activation status:
208 C print a (weak) warning if data.obcs is found
209 CALL PACKAGES_UNUSED_MSG( 'useOBCS', ' ', ' ' )
210 _END_MASTER(myThid)
211 RETURN
212 ENDIF
213
214 _BEGIN_MASTER(myThid)
215
216 #ifdef ALLOW_EXCH2
217 OBNS_Nx = exch2_xStack_Nx
218 OBNS_Ny = exch2_xStack_Ny
219 OBEW_Nx = exch2_yStack_Nx
220 OBEW_Ny = exch2_yStack_Ny
221 #else
222 OBNS_Nx = Nx
223 OBNS_Ny = Ny
224 OBEW_Nx = Nx
225 OBEW_Ny = Ny
226 #endif
227
228 C-- Default flags and values for OBCS
229 OB_indexNone = -99
230 OB_indexUnset = 0
231 insideOBmaskFile = ' '
232 OBNconnectFile = ' '
233 OBSconnectFile = ' '
234 OBEconnectFile = ' '
235 OBWconnectFile = ' '
236 DO i=1,OBNS_Nx
237 OB_Jnorth(i) = OB_indexUnset
238 OB_Jsouth(i) = OB_indexUnset
239 ENDDO
240 DO j=1,OBEW_Ny
241 OB_Ieast(j) = OB_indexUnset
242 OB_Iwest(j) = OB_indexUnset
243 ENDDO
244 OB_singleJnorth = OB_indexUnset
245 OB_singleJsouth = OB_indexUnset
246 OB_singleIeast = OB_indexUnset
247 OB_singleIwest = OB_indexUnset
248 OBCS_indexStatus = 0
249 useOrlanskiNorth =.FALSE.
250 useOrlanskiSouth =.FALSE.
251 useOrlanskiEast =.FALSE.
252 useOrlanskiWest =.FALSE.
253 useStevensNorth =.FALSE.
254 useStevensSouth =.FALSE.
255 useStevensEast =.FALSE.
256 useStevensWest =.FALSE.
257 useStevensPhaseVel =.TRUE.
258 useStevensAdvection=.TRUE.
259 useOBCSsponge =.FALSE.
260 useSeaiceSponge =.FALSE.
261 OBCSsponge_N =.TRUE.
262 OBCSsponge_S =.TRUE.
263 OBCSsponge_E =.TRUE.
264 OBCSsponge_W =.TRUE.
265 OBCSsponge_UatNS =.TRUE.
266 OBCSsponge_UatEW =.TRUE.
267 OBCSsponge_VatNS =.TRUE.
268 OBCSsponge_VatEW =.TRUE.
269 OBCSsponge_Theta =.TRUE.
270 OBCSsponge_Salt =.TRUE.
271 useLinearSponge =.FALSE.
272 useOBCSbalance =.FALSE.
273 OBCS_balanceFacN = 1. _d 0
274 OBCS_balanceFacS = 1. _d 0
275 OBCS_balanceFacE = 1. _d 0
276 OBCS_balanceFacW = 1. _d 0
277 OBCS_u1_adv_T = 0
278 OBCS_u1_adv_S = 0
279 useOBCSprescribe =.FALSE.
280 OBCSfixTopo =.FALSE.
281 OBCS_uvApplyFac = 1. _d 0
282 OBCS_monitorFreq = monitorFreq
283 OBCS_monSelect = 0
284 OBCSprintDiags = debugLevel.GE.debLevC
285
286 OBNuFile = ' '
287 OBNvFile = ' '
288 OBNtFile = ' '
289 OBNsFile = ' '
290 OBNaFile = ' '
291 OBNhFile = ' '
292 OBNslFile = ' '
293 OBNsnFile = ' '
294 OBNuiceFile = ' '
295 OBNviceFile = ' '
296 OBSuFile = ' '
297 OBSvFile = ' '
298 OBStFile = ' '
299 OBSsFile = ' '
300 OBSaFile = ' '
301 OBShFile = ' '
302 OBSslFile = ' '
303 OBSsnFile = ' '
304 OBSuiceFile = ' '
305 OBSviceFile = ' '
306 OBEuFile = ' '
307 OBEvFile = ' '
308 OBEtFile = ' '
309 OBEsFile = ' '
310 OBEaFile = ' '
311 OBEhFile = ' '
312 OBEslFile = ' '
313 OBEsnFile = ' '
314 OBEuiceFile = ' '
315 OBEviceFile = ' '
316 OBWuFile = ' '
317 OBWvFile = ' '
318 OBWtFile = ' '
319 OBWsFile = ' '
320 OBWaFile = ' '
321 OBWhFile = ' '
322 OBWslFile = ' '
323 OBWsnFile = ' '
324 OBWuiceFile = ' '
325 OBWviceFile = ' '
326 OBNetaFile = ' '
327 OBSetaFile = ' '
328 OBEetaFile = ' '
329 OBWetaFile = ' '
330 OBNwFile = ' '
331 OBSwFile = ' '
332 OBEwFile = ' '
333 OBWwFile = ' '
334 OBNAmFile = ' '
335 OBSAmFile = ' '
336 OBEAmFile = ' '
337 OBWAmFile = ' '
338 OBNPhFile = ' '
339 OBSPhFile = ' '
340 OBEPhFile = ' '
341 OBWPhFile = ' '
342 #ifdef ALLOW_PTRACERS
343 DO iTracer = 1, PTRACERS_num
344 OBCS_u1_adv_Tr(iTracer) = 0
345 OBNptrFile(iTracer) = ' '
346 OBSptrFile(iTracer) = ' '
347 OBEptrFile(iTracer) = ' '
348 OBWptrFile(iTracer) = ' '
349 ENDDO
350 #endif
351 #ifdef ALLOW_OBCS_TIDES
352 DO i = 1, tidalComponents
353 tidalPeriod(i) = 0. _d 0
354 ENDDO
355 #endif
356 C- retired parameters
357 nRetired = 0
358 useOBCSYearlyFields = .FALSE.
359
360 C Open and read the data.obcs file
361 WRITE(msgBuf,'(A)') ' OBCS_READPARMS: opening data.obcs'
362 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
363 & SQUEEZE_RIGHT , myThid )
364 CALL OPEN_COPY_DATA_FILE(
365 I 'data.obcs', 'OBCS_READPARMS',
366 O iUnit,
367 I myThid )
368
369 C-- Read parameters from open data file
370 READ(UNIT=iUnit,NML=OBCS_PARM01)
371
372 C- retired parameter
373 IF ( useOBCSYearlyFields ) THEN
374 nRetired = nRetired + 1
375 WRITE(msgBuf,'(A,A)')
376 & 'OBCS_READPARMS: "useOBCSYearlyFields"',
377 & ' no longer allowed in file "data.obcs"'
378 CALL PRINT_ERROR( msgBuf, myThid )
379 WRITE(msgBuf,'(A,A)') 'OBCS_READPARMS: ',
380 & ' was moved to "data.exf", namelist: "EXF_NML_OBCS"'
381 CALL PRINT_ERROR( msgBuf, myThid )
382 ENDIF
383
384 #ifdef ALLOW_ORLANSKI
385 C Default Orlanski radiation parameters
386 CMAX = 0.45 _d 0 /* maximum allowable phase speed-CFL for AB-II */
387 cvelTimeScale = 2000.0 _d 0 /* Averaging period for phase speed (s) */
388 CFIX = 0.8 _d 0 /* Fixed boundary phase speed in m/s */
389 useFixedCEast=.FALSE.
390 useFixedCWest=.FALSE.
391 IF (useOrlanskiNorth.OR.
392 & useOrlanskiSouth.OR.
393 & useOrlanskiEast.OR.
394 & useOrlanskiWest)
395 & READ(UNIT=iUnit,NML=OBCS_PARM02)
396 #endif
397
398 #ifdef ALLOW_OBCS_SPONGE
399 C Default sponge layer parameters:
400 C sponge layer is turned off by default
401 spongeThickness = 0
402 Urelaxobcsinner = 0. _d 0
403 Urelaxobcsbound = 0. _d 0
404 Vrelaxobcsinner = 0. _d 0
405 Vrelaxobcsbound = 0. _d 0
406 CML this was the previous default in units of days
407 CML spongeThickness = 2
408 CML Urelaxobcsinner = 5. _d 0
409 CML Urelaxobcsbound = 1. _d 0
410 CML Vrelaxobcsinner = 5. _d 0
411 CML Vrelaxobcsbound = 1. _d 0
412 IF (useOBCSsponge)
413 & READ(UNIT=iUnit,NML=OBCS_PARM03)
414 #endif
415 #ifdef ALLOW_OBCS_STEVENS
416 TrelaxStevens = 0. _d 0
417 SrelaxStevens = 0. _d 0
418 IF ( useStevensNorth .OR. useStevensSouth
419 & .OR. useStevensEast .OR. useStevensWest )
420 & READ(UNIT=iUnit,NML=OBCS_PARM04)
421 #endif
422 #ifdef ALLOW_OBCS_SEAICE_SPONGE
423 C Default seaice sponge layer parameters:
424 C seaice sponge layer is turned off by default
425 seaiceSpongeThickness = 0
426 Arelaxobcsinner = 0. _d 0
427 Arelaxobcsbound = 0. _d 0
428 Hrelaxobcsinner = 0. _d 0
429 Hrelaxobcsbound = 0. _d 0
430 SLrelaxobcsinner = 0. _d 0
431 SLrelaxobcsbound = 0. _d 0
432 SNrelaxobcsinner = 0. _d 0
433 SNrelaxobcsbound = 0. _d 0
434 IF (useSeaiceSponge) READ(UNIT=iUnit,NML=OBCS_PARM05)
435 #endif
436
437 WRITE(msgBuf,'(A)') ' OBCS_READPARMS: finished reading data.obcs'
438 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
439 & SQUEEZE_RIGHT , myThid )
440
441 C-- Close the open data file
442 #ifdef SINGLE_DISK_IO
443 CLOSE(iUnit)
444 #else
445 CLOSE(iUnit,STATUS='DELETE')
446 #endif /* SINGLE_DISK_IO */
447
448 C- retired parameter
449 IF ( nRetired .GT. 0 ) THEN
450 WRITE(msgBuf,'(A)')
451 & 'OBCS_READPARMS: reading parameter file "data.obcs"'
452 CALL PRINT_ERROR( msgBuf, myThid )
453 WRITE(msgBuf,'(A)')
454 & 'some out of date parameters were found in namelist'
455 CALL PRINT_ERROR( msgBuf, myThid )
456 STOP 'ABNORMAL END: S/R OBCS_READPARMS'
457 ENDIF
458
459 C- Acount for single/uniform position OB setting:
460 errCount = 0
461 IF ( OB_singleIeast.NE.OB_indexUnset ) THEN
462 DO j=1,OBEW_Ny
463 IF ( OB_Ieast(j).EQ.OB_indexUnset ) THEN
464 OB_Ieast(j) = OB_singleIeast
465 ELSEIF ( OB_Ieast(j).NE.OB_singleIeast ) THEN
466 errCount = errCount + 1
467 ENDIF
468 ENDDO
469 ENDIF
470 IF ( errCount .NE. 0 ) THEN
471 WRITE(msgBuf,'(2A)') 'OBCS_READPARMS: ',
472 & 'Inconsistent setting of OB_Ieast/OB_singleIeast'
473 CALL PRINT_ERROR( msgBuf, myThid )
474 STOP 'ABNORMAL END: S/R OBCS_READPARMS'
475 ENDIF
476
477 IF ( OB_singleIwest.NE.OB_indexUnset ) THEN
478 DO j=1,OBEW_Ny
479 IF ( OB_Iwest(j).EQ.OB_indexUnset ) THEN
480 OB_Iwest(j) = OB_singleIwest
481 ELSEIF ( OB_Iwest(j).NE.OB_singleIwest ) THEN
482 errCount = errCount + 1
483 ENDIF
484 ENDDO
485 ENDIF
486 IF ( errCount .NE. 0 ) THEN
487 WRITE(msgBuf,'(2A)') 'OBCS_READPARMS: ',
488 & 'Inconsistent setting of OB_Iwest/OB_singleIwest'
489 CALL PRINT_ERROR( msgBuf, myThid )
490 STOP 'ABNORMAL END: S/R OBCS_READPARMS'
491 ENDIF
492
493 IF ( OB_singleJnorth.NE.OB_indexUnset ) THEN
494 DO i=1,OBNS_Nx
495 IF ( OB_Jnorth(i).EQ.OB_indexUnset ) THEN
496 OB_Jnorth(i) = OB_singleJnorth
497 ELSEIF ( OB_Jnorth(i).NE.OB_singleJnorth ) THEN
498 errCount = errCount + 1
499 ENDIF
500 ENDDO
501 ENDIF
502 IF ( errCount .NE. 0 ) THEN
503 WRITE(msgBuf,'(2A)') 'OBCS_READPARMS: ',
504 & 'Inconsistent setting of OB_Jnorth/OB_singleJnorth'
505 CALL PRINT_ERROR( msgBuf, myThid )
506 STOP 'ABNORMAL END: S/R OBCS_READPARMS'
507 ENDIF
508
509 IF ( OB_singleJsouth.NE.OB_indexUnset ) THEN
510 DO i=1,OBNS_Nx
511 IF ( OB_Jsouth(i).EQ.OB_indexUnset ) THEN
512 OB_Jsouth(i) = OB_singleJsouth
513 ELSEIF ( OB_Jsouth(i).NE.OB_singleJsouth ) THEN
514 errCount = errCount + 1
515 ENDIF
516 ENDDO
517 ENDIF
518 IF ( errCount .NE. 0 ) THEN
519 WRITE(msgBuf,'(2A)') 'OBCS_READPARMS: ',
520 & 'Inconsistent setting of OB_Jsouth/OB_singleJsouth'
521 CALL PRINT_ERROR( msgBuf, myThid )
522 STOP 'ABNORMAL END: S/R OBCS_READPARMS'
523 ENDIF
524
525 C- Account for periodicity if negative indices were supplied
526 DO j=1,OBEW_Ny
527 IF ( OB_Ieast(j) .NE.OB_indexUnset .AND.
528 & OB_Ieast(j) .LT.0 ) OB_Ieast(j) = OB_Ieast(j)+OBEW_Nx+1
529 ENDDO
530 DO i=1,OBNS_Nx
531 IF ( OB_Jnorth(i).NE.OB_indexUnset .AND.
532 & OB_Jnorth(i).LT.0 ) OB_Jnorth(i)=OB_Jnorth(i)+OBNS_Ny+1
533 ENDDO
534
535 IF ( debugLevel.GE.debLevA ) THEN
536 CALL WRITE_0D_I( OB_indexUnset, INDEX_NONE,' OB_indexUnset =',
537 & ' /* unset OB index value (i.e. no OB) */')
538 c write(*,*) 'OB Jn =',OB_Jnorth
539 c write(*,*) 'OB Js =',OB_Jsouth
540 c write(*,*) 'OB Ie =',OB_Ieast
541 c write(*,*) 'OB Iw =',OB_Iwest
542 WRITE(msgBuf,'(A)') ' Northern OB global indices : OB_Jnorth ='
543 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
544 & SQUEEZE_RIGHT, myThid )
545 CALL PRINT_LIST_I( OB_Jnorth, 1, OBNS_Nx, INDEX_I,
546 & .FALSE., .TRUE., standardMessageUnit )
547 WRITE(msgBuf,'(A)') ' Southern OB global indices : OB_Jsouth ='
548 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
549 & SQUEEZE_RIGHT, myThid )
550 CALL PRINT_LIST_I( OB_Jsouth, 1, OBNS_Nx, INDEX_I,
551 & .FALSE., .TRUE., standardMessageUnit )
552 WRITE(msgBuf,'(A)') ' Eastern OB global indices : OB_Ieast ='
553 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
554 & SQUEEZE_RIGHT, myThid )
555 CALL PRINT_LIST_I( OB_Ieast, 1, OBEW_Ny, INDEX_J,
556 & .FALSE., .TRUE., standardMessageUnit )
557 WRITE(msgBuf,'(A)') ' Western OB global indices : OB_Iwest ='
558 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
559 & SQUEEZE_RIGHT, myThid )
560 CALL PRINT_LIST_I( OB_Iwest, 1, OBEW_Ny, INDEX_J,
561 & .FALSE., .TRUE., standardMessageUnit )
562 WRITE(msgBuf,'(A)') ' '
563 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
564 & SQUEEZE_RIGHT, myThid )
565 ENDIF
566
567 C-- Continue master-thread only since global OB indices (+ OB_indexUnset)
568 C are not shared (not in common block).
569
570 C-- Calculate the tiled OB index arrays OB_Jn/Js/Ie/Iw here from the
571 C global indices OB_Jnorth/Jsouth/Ieast/Iwest.
572 C Note: This part of the code has been moved from obcs_init_fixed
573 C to this routine because the OB_Jn/Js/Ie/Iw index arrays are
574 C required by INI_DEPTH (calling OBCS_CHECK_DEPTHS, but only needs
575 C valid interior indices) which is called before OBCS_INIT_FIXED.
576 DO bj = 1, nSy
577 DO bi = 1, nSx
578
579 DO i=1-OLx,sNx+OLx
580 OB_Jn(i,bi,bj) = OB_indexNone
581 OB_Js(i,bi,bj) = OB_indexNone
582 ENDDO
583
584 DO j=1-OLy,sNy+OLy
585 OB_Ie(j,bi,bj) = OB_indexNone
586 OB_Iw(J,bi,bj) = OB_indexNone
587 ENDDO
588
589 #ifdef ALLOW_EXCH2
590
591 C-- We apply OBCS only inside tile and exchange overlaps later
592 tN = W2_myTileList(bi,bj)
593 C 1. N/S boundaries
594 C convert from local y index J to global y index jG
595 C for N/S boundaries, we use faces stacked in x direction
596 DO i=1,sNx
597 iG = exch2_txXStackLo(tN)+i-1
598 C- Northern boundaries
599 IF ( OB_Jnorth(iG).NE.OB_indexUnset ) THEN
600 C loop over local y index J
601 DO j=1,sNy+1
602 jG = exch2_tyXStackLo(tN)+j-1
603 IF ( jG.EQ.OB_Jnorth(iG) ) OB_Jn(i,bi,bj) = j
604 ENDDO
605 ENDIF
606 C- Southern boundaries
607 IF ( OB_Jsouth(iG).NE.OB_indexUnset ) THEN
608 DO j=0,sNy
609 jG = exch2_tyXStackLo(tN)+j-1
610 IF ( jG.EQ.OB_Jsouth(iG) ) OB_Js(i,bi,bj) = j
611 ENDDO
612 ENDIF
613 ENDDO
614 C 2. E/W boundaries
615 C convert from local y index J to global y index jG
616 c for E/W boundaries, we use faces stacked in y direction
617 DO j=1,sNy
618 jG = exch2_tyYStackLo(tN)+j-1
619 C- Eastern boundaries
620 IF ( OB_Ieast(jG).NE.OB_indexUnset ) THEN
621 C loop over local x index I
622 DO i=1,sNx+1
623 iG = exch2_txYStackLo(tN)+i-1
624 IF ( iG.EQ.OB_Ieast(jG) ) OB_Ie(j,bi,bj) = i
625 ENDDO
626 ENDIF
627 C- Western boundaries
628 IF ( OB_Iwest(jG).NE.OB_indexUnset ) THEN
629 DO i=0,sNx
630 iG = exch2_txYStackLo(tN)+i-1
631 IF ( iG.EQ.OB_Iwest(jG) ) OB_Iw(j,bi,bj) = i
632 ENDDO
633 ENDIF
634 ENDDO
635
636 C- OB-index tiled-arrays are set for tile-interior region
637 OBCS_indexStatus = 1
638
639 #else /* ALLOW_EXCH2 */
640
641 DO j=1-OLy,sNy+OLy
642 C convert from local y index J to global y index jG
643 jG = myYGlobalLo+(bj-1)*sNy+j-1
644 C use periodicity to deal with out of range points caused by the overlaps.
645 C they will be excluded by the mask in any case, but this saves array
646 C out-of-bounds errors here.
647 jGm = 1+MOD( jG-1+Ny , Ny )
648 C- Eastern boundaries
649 C OB_Ieast(jGm) allows to put the eastern boundary at variable x locations
650 IF ( OB_Ieast(jGm).NE.OB_indexUnset ) THEN
651 C loop over local x index I
652 DO i=1,sNx+1
653 iG = myXGlobalLo+(bi-1)*sNx+i-1
654 iGm = 1+MOD( iG-1+Nx , Nx )
655 IF ( iG.EQ.OB_Ieast(jGm) ) OB_Ie(j,bi,bj) = i
656 ENDDO
657 ENDIF
658 C- Western boundaries
659 IF ( OB_Iwest(jGm).NE.OB_indexUnset ) THEN
660 DO i=0,sNx
661 iG = myXGlobalLo+(bi-1)*sNx+i-1
662 iGm = 1+MOD( iG-1+Nx , Nx )
663 IF ( iG.EQ.OB_Iwest(jGm) ) OB_Iw(j,bi,bj) = i
664 ENDDO
665 ENDIF
666 ENDDO
667
668 DO i=1-OLx,sNx+OLx
669 iG = myXGlobalLo+(bi-1)*sNx+i-1
670 iGm = 1+MOD( iG-1+Nx , Nx )
671 C- Northern boundaries
672 C OB_Jnorth(iG) allows to put the northern boundary at variable y locations
673 IF ( OB_Jnorth(iGm).NE.OB_indexUnset ) THEN
674 DO j=1,sNy+1
675 jG = myYGlobalLo+(bj-1)*sNy+j-1
676 jGm = 1+MOD( jG-1+Ny , Ny )
677 IF ( jG.EQ.OB_Jnorth(iGm) ) OB_Jn(i,bi,bj) = j
678 ENDDO
679 ENDIF
680 C- Southern boundaries
681 IF ( OB_Jsouth(iGm).NE.OB_indexUnset ) THEN
682 DO j=0,sNy
683 jG = myYGlobalLo+(bj-1)*sNy+j-1
684 jGm = 1+MOD( jG-1+Ny , Ny )
685 IF ( jG.EQ.OB_Jsouth(iGm) ) OB_Js(i,bi,bj) = j
686 ENDDO
687 ENDIF
688 ENDDO
689
690 C- OB-index tiled-arrays are set for interior and overlap regions
691 OBCS_indexStatus = 2
692
693 #endif /* ALLOW_EXCH2 */
694
695 C bi,bj-loops
696 ENDDO
697 ENDDO
698
699 _END_MASTER(myThid)
700 C-- Everyone else must wait for the parameters to be loaded
701 C and tiled OB indices to be set.
702 _BARRIER
703
704 #endif /* ALLOW_OBCS */
705 RETURN
706 END

  ViewVC Help
Powered by ViewVC 1.1.22