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

Diff of /MITgcm/pkg/obcs/obcs_init_variables.F

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

revision 1.6 by jmc, Fri Feb 8 22:16:09 2002 UTC revision 1.29 by jmc, Thu Oct 1 21:46:25 2009 UTC
# Line 18  C     === Global variables === Line 18  C     === Global variables ===
18  #include "PARAMS.h"  #include "PARAMS.h"
19  #include "DYNVARS.h"  #include "DYNVARS.h"
20  #include "OBCS.h"  #include "OBCS.h"
21    #ifdef ALLOW_PTRACERS
22    #include "PTRACERS_SIZE.h"
23    #include "PTRACERS_PARAMS.h"
24    #include "PTRACERS_FIELDS.h"
25    #include "OBCS_PTRACERS.h"
26    #endif /* ALLOW_PTRACERS */
27    
28  C     == Routine arguments ==  C     == Routine arguments ==
29  C     myThid -  Number of this instance of INI_DEPTHS  C     myThid -  Number of this instance of INI_DEPTHS
# Line 28  C     myThid -  Number of this instance Line 34  C     myThid -  Number of this instance
34  C     == Local variables ==  C     == Local variables ==
35        INTEGER bi, bj        INTEGER bi, bj
36        INTEGER I, J, K        INTEGER I, J, K
37    #ifdef ALLOW_PTRACERS
38          INTEGER iTracer
39    #endif /* ALLOW_PTRACERS */
40    
41    #ifdef ALLOW_DEBUG
42          IF (debugMode) CALL DEBUG_ENTER('OBCS_INIT_VARIABLES',myThid)
43    #endif
44    
45        DO bj = myByLo(myThid), myByHi(myThid)        DO bj = myByLo(myThid), myByHi(myThid)
46         DO bi = myBxLo(myThid), myBxHi(myThid)         DO bi = myBxLo(myThid), myBxHi(myThid)
47    
48          DO K=1,Nr          DO K=1,Nr
49           DO I=1-Olx,sNx+Olx           DO I=1-Olx,sNx+Olx
50            OBNu(I,K,bi,bj)=0.  #ifdef ALLOW_OBCS_NORTH
51            OBNv(I,K,bi,bj)=0.            OBNu(I,K,bi,bj)=0. _d 0
52            OBNt(I,K,bi,bj)=0.            OBNv(I,K,bi,bj)=0. _d 0
53            OBNs(I,K,bi,bj)=0.            OBNt(I,K,bi,bj)=0. _d 0
54            OBSu(I,K,bi,bj)=0.            OBNs(I,K,bi,bj)=0. _d 0
55            OBSv(I,K,bi,bj)=0.  # ifdef ALLOW_NONHYDROSTATIC
56            OBSt(I,K,bi,bj)=0.            OBNw(I,K,bi,bj)=0. _d 0
57            OBSs(I,K,bi,bj)=0.  # endif
58  #ifdef ALLOW_NONHYDROSTATIC  # ifdef ALLOW_OBCS_PRESCRIBE
59            OBNw(I,K,bi,bj)=0.            OBNu0(I,K,bi,bj)=0. _d 0
60            OBSw(I,K,bi,bj)=0.            OBNv0(I,K,bi,bj)=0. _d 0
61  #endif            OBNt0(I,K,bi,bj)=0. _d 0
62              OBNs0(I,K,bi,bj)=0. _d 0
63              OBNu1(I,K,bi,bj)=0. _d 0
64              OBNv1(I,K,bi,bj)=0. _d 0
65              OBNt1(I,K,bi,bj)=0. _d 0
66              OBNs1(I,K,bi,bj)=0. _d 0
67    # endif
68    #endif /* ALLOW_OBCS_NORTH */
69    
70    #ifdef ALLOW_OBCS_SOUTH
71              OBSu(I,K,bi,bj)=0. _d 0
72              OBSv(I,K,bi,bj)=0. _d 0
73              OBSt(I,K,bi,bj)=0. _d 0
74              OBSs(I,K,bi,bj)=0. _d 0
75    # ifdef ALLOW_NONHYDROSTATIC
76              OBSw(I,K,bi,bj)=0. _d 0
77    # endif
78    # ifdef ALLOW_OBCS_PRESCRIBE
79              OBSu0(I,K,bi,bj)=0. _d 0
80              OBSv0(I,K,bi,bj)=0. _d 0
81              OBSt0(I,K,bi,bj)=0. _d 0
82              OBSs0(I,K,bi,bj)=0. _d 0
83              OBSu1(I,K,bi,bj)=0. _d 0
84              OBSv1(I,K,bi,bj)=0. _d 0
85              OBSt1(I,K,bi,bj)=0. _d 0
86              OBSs1(I,K,bi,bj)=0. _d 0
87    # endif
88    #endif /* ALLOW_OBCS_SOUTH */
89           ENDDO           ENDDO
90    
91           DO J=1-Oly,sNy+Oly           DO J=1-Oly,sNy+Oly
92            OBEu(J,K,bi,bj)=0.  #ifdef ALLOW_OBCS_EAST
93            OBEv(J,K,bi,bj)=0.            OBEu(J,K,bi,bj)=0. _d 0
94            OBEt(J,K,bi,bj)=0.            OBEv(J,K,bi,bj)=0. _d 0
95            OBEs(J,K,bi,bj)=0.            OBEt(J,K,bi,bj)=0. _d 0
96            OBWu(J,K,bi,bj)=0.            OBEs(J,K,bi,bj)=0. _d 0
97            OBWv(J,K,bi,bj)=0.  # ifdef ALLOW_NONHYDROSTATIC
98            OBWt(J,K,bi,bj)=0.            OBEw(J,K,bi,bj)=0. _d 0
99            OBWs(J,K,bi,bj)=0.  # endif
100  #ifdef ALLOW_NONHYDROSTATIC  # ifdef ALLOW_OBCS_PRESCRIBE
101            OBEw(J,K,bi,bj)=0.            OBEu0(J,K,bi,bj)=0. _d 0
102            OBWw(J,K,bi,bj)=0.            OBEv0(J,K,bi,bj)=0. _d 0
103  #endif            OBEt0(J,K,bi,bj)=0. _d 0
104              OBEs0(J,K,bi,bj)=0. _d 0
105              OBEu1(J,K,bi,bj)=0. _d 0
106              OBEv1(J,K,bi,bj)=0. _d 0
107              OBEt1(J,K,bi,bj)=0. _d 0
108              OBEs1(J,K,bi,bj)=0. _d 0
109    # endif
110    #endif /* ALLOW_OBCS_EAST */
111    
112    #ifdef ALLOW_OBCS_WEST
113              OBWu(J,K,bi,bj)=0. _d 0
114              OBWv(J,K,bi,bj)=0. _d 0
115              OBWt(J,K,bi,bj)=0. _d 0
116              OBWs(J,K,bi,bj)=0. _d 0
117    # ifdef ALLOW_NONHYDROSTATIC
118              OBWw(J,K,bi,bj)=0. _d 0
119    # endif
120    # ifdef ALLOW_OBCS_PRESCRIBE
121              OBWu0(J,K,bi,bj)=0. _d 0
122              OBWv0(J,K,bi,bj)=0. _d 0
123              OBWt0(J,K,bi,bj)=0. _d 0
124              OBWs0(J,K,bi,bj)=0. _d 0
125              OBWu1(J,K,bi,bj)=0. _d 0
126              OBWv1(J,K,bi,bj)=0. _d 0
127              OBWt1(J,K,bi,bj)=0. _d 0
128              OBWs1(J,K,bi,bj)=0. _d 0
129    # endif
130    #endif /* ALLOW_OBCS_WEST */
131           ENDDO           ENDDO
132          ENDDO          ENDDO
133    
134    #ifdef ALLOW_SEAICE
135            DO I=1-Olx,sNx+Olx
136    #ifdef ALLOW_OBCS_NORTH
137             OBNa (I,bi,bj)=0. _d 0
138             OBNh (I,bi,bj)=0. _d 0
139             OBNa0(I,bi,bj)=0. _d 0
140             OBNh0(I,bi,bj)=0. _d 0
141             OBNa1(I,bi,bj)=0. _d 0
142             OBNh1(I,bi,bj)=0. _d 0
143             OBNsl (I,bi,bj)=0. _d 0
144             OBNsn (I,bi,bj)=0. _d 0
145             OBNsl0(I,bi,bj)=0. _d 0
146             OBNsn0(I,bi,bj)=0. _d 0
147             OBNsl1(I,bi,bj)=0. _d 0
148             OBNsn1(I,bi,bj)=0. _d 0
149             OBNuice (I,bi,bj)=0. _d 0
150             OBNvice (I,bi,bj)=0. _d 0
151             OBNuice0(I,bi,bj)=0. _d 0
152             OBNvice0(I,bi,bj)=0. _d 0
153             OBNuice1(I,bi,bj)=0. _d 0
154             OBNvice1(I,bi,bj)=0. _d 0
155    #endif /* ALLOW_OBCS_NORTH */
156    #ifdef ALLOW_OBCS_SOUTH
157             OBSa (I,bi,bj)=0. _d 0
158             OBSh (I,bi,bj)=0. _d 0
159             OBSa0(I,bi,bj)=0. _d 0
160             OBSh0(I,bi,bj)=0. _d 0
161             OBSa1(I,bi,bj)=0. _d 0
162             OBSh1(I,bi,bj)=0. _d 0
163             OBSsl (I,bi,bj)=0. _d 0
164             OBSsn (I,bi,bj)=0. _d 0
165             OBSsl0(I,bi,bj)=0. _d 0
166             OBSsn0(I,bi,bj)=0. _d 0
167             OBSsl1(I,bi,bj)=0. _d 0
168             OBSsn1(I,bi,bj)=0. _d 0
169             OBSuice (I,bi,bj)=0. _d 0
170             OBSvice (I,bi,bj)=0. _d 0
171             OBSuice0(I,bi,bj)=0. _d 0
172             OBSvice0(I,bi,bj)=0. _d 0
173             OBSuice1(I,bi,bj)=0. _d 0
174             OBSvice1(I,bi,bj)=0. _d 0
175    #endif /* ALLOW_OBCS_SOUTH */
176            ENDDO
177            DO J=1-Oly,sNy+Oly
178    #ifdef ALLOW_OBCS_EAST
179             OBEa (J,bi,bj)=0. _d 0
180             OBEh (J,bi,bj)=0. _d 0
181             OBEa0(J,bi,bj)=0. _d 0
182             OBEh0(J,bi,bj)=0. _d 0
183             OBEa1(J,bi,bj)=0. _d 0
184             OBEh1(J,bi,bj)=0. _d 0
185             OBEsl (J,bi,bj)=0. _d 0
186             OBEsn (J,bi,bj)=0. _d 0
187             OBEsl0(J,bi,bj)=0. _d 0
188             OBEsn0(J,bi,bj)=0. _d 0
189             OBEsl1(J,bi,bj)=0. _d 0
190             OBEsn1(J,bi,bj)=0. _d 0
191             OBEuice (J,bi,bj)=0. _d 0
192             OBEvice (J,bi,bj)=0. _d 0
193             OBEuice0(J,bi,bj)=0. _d 0
194             OBEvice0(J,bi,bj)=0. _d 0
195             OBEuice1(J,bi,bj)=0. _d 0
196             OBEvice1(J,bi,bj)=0. _d 0
197    #endif /* ALLOW_OBCS_EAST */
198    #ifdef ALLOW_OBCS_WEST
199             OBWa (J,bi,bj)=0. _d 0
200             OBWh (J,bi,bj)=0. _d 0
201             OBWa0(J,bi,bj)=0. _d 0
202             OBWh0(J,bi,bj)=0. _d 0
203             OBWa1(J,bi,bj)=0. _d 0
204             OBWh1(J,bi,bj)=0. _d 0
205             OBWsl (J,bi,bj)=0. _d 0
206             OBWsn (J,bi,bj)=0. _d 0
207             OBWsl0(J,bi,bj)=0. _d 0
208             OBWsn0(J,bi,bj)=0. _d 0
209             OBWsl1(J,bi,bj)=0. _d 0
210             OBWsn1(J,bi,bj)=0. _d 0
211             OBWuice (J,bi,bj)=0. _d 0
212             OBWvice (J,bi,bj)=0. _d 0
213             OBWuice0(J,bi,bj)=0. _d 0
214             OBWvice0(J,bi,bj)=0. _d 0
215             OBWuice1(J,bi,bj)=0. _d 0
216             OBWvice1(J,bi,bj)=0. _d 0
217    #endif /* ALLOW_OBCS_WEST */
218            ENDDO
219    #endif /* ALLOW_SEAICE */
220    
221    #ifdef ALLOW_PTRACERS
222    #ifndef ALLOW_AUTODIFF_TAMC
223            IF ( usePTRACERS ) THEN
224    #endif
225             DO iTracer=1,PTRACERS_numInUse
226              DO K=1,Nr
227               DO I=1-Olx,sNx+Olx
228    #ifdef ALLOW_OBCS_NORTH
229                OBNptr (I,K,bi,bj,iTracer)=0. _d 0
230    # ifdef ALLOW_OBCS_PRESCRIBE
231                OBNptr0(I,K,bi,bj,iTracer)=0. _d 0
232                OBNptr1(I,K,bi,bj,iTracer)=0. _d 0
233    # endif
234    #endif /* ALLOW_OBCS_NORTH */
235    
236    #ifdef ALLOW_OBCS_SOUTH
237                OBSptr (I,K,bi,bj,iTracer)=0. _d 0
238    # ifdef ALLOW_OBCS_PRESCRIBE
239                OBSptr0(I,K,bi,bj,iTracer)=0. _d 0
240                OBSptr1(I,K,bi,bj,iTracer)=0. _d 0
241    # endif
242    #endif /* ALLOW_OBCS_SOUTH */
243               ENDDO
244    
245               DO J=1-Oly,sNy+Oly
246    #ifdef ALLOW_OBCS_EAST
247                OBEptr (J,K,bi,bj,iTracer)=0. _d 0
248    # ifdef ALLOW_OBCS_PRESCRIBE
249                OBEptr0(J,K,bi,bj,iTracer)=0. _d 0
250                OBEptr1(J,K,bi,bj,iTracer)=0. _d 0
251    # endif
252    #endif /* ALLOW_OBCS_EAST */
253    
254    #ifdef ALLOW_OBCS_WEST
255                OBWptr (J,K,bi,bj,iTracer)=0. _d 0
256    # ifdef ALLOW_OBCS_PRESCRIBE
257                OBWptr0(J,K,bi,bj,iTracer)=0. _d 0
258                OBWptr1(J,K,bi,bj,iTracer)=0. _d 0
259    # endif
260    #endif /* ALLOW_OBCS_WEST */
261               ENDDO
262              ENDDO
263             ENDDO
264    #ifndef ALLOW_AUTODIFF_TAMC
265            ENDIF
266    #endif
267    #endif /* ALLOW_PTRACERS */
268    
269  #ifdef NONLIN_FRSURF  #ifdef NONLIN_FRSURF
270          DO I=1-Olx,sNx+Olx          DO I=1-Olx,sNx+Olx
271            OBNeta(I,bi,bj)=0.            OBNeta(I,bi,bj)=0.
# Line 77  C     == Local variables == Line 280  C     == Local variables ==
280  #ifdef ALLOW_ORLANSKI  #ifdef ALLOW_ORLANSKI
281          IF (useOrlanskiNorth.OR.useOrlanskiSouth.OR.          IF (useOrlanskiNorth.OR.useOrlanskiSouth.OR.
282       &      useOrlanskiEast.OR.useOrlanskiWest) THEN       &      useOrlanskiEast.OR.useOrlanskiWest) THEN
283    #ifdef ALLOW_DEBUG
284          IF (debugMode) CALL DEBUG_CALL('ORLANSKI_INIT',myThid)
285    #endif
286            CALL ORLANSKI_INIT(bi, bj, myThid)            CALL ORLANSKI_INIT(bi, bj, myThid)
287          ENDIF          ENDIF
288  #endif /* ALLOW_ORLANSKI */  #endif /* ALLOW_ORLANSKI */
289    
290         ENDDO         ENDDO
291        ENDDO            ENDDO
292    
293  C--   Apply OBCS values to initial conditions for consistancy  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
294        DO bj = myByLo(myThid), myByHi(myThid)  C     Only needed for Orlanski:
295         DO bi = myBxLo(myThid), myBxHi(myThid)        IF ( nIter0.NE.0 .OR. pickupSuff.NE.' ' ) THEN
296          CALL OBCS_CALC( bi, bj, startTime, nIter0,          CALL OBCS_READ_PICKUP( nIter0, myThid )
297       &        uVel, vVel, wVel, theta, salt, myThid )        ENDIF
298          DO K=1,Nr  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
299           CALL OBCS_APPLY_UV( bi, bj, k, uVel, vVel, myThid )  
300           CALL OBCS_APPLY_TS( bi, bj, k, theta, salt, myThid )  C--   Load/compute OBCS values (initial conditions only)
301          IF ( startTime .EQ. baseTime .AND.  nIter0 .EQ. 0
302         &     .AND. pickupSuff .EQ. ' ' ) THEN
303    #ifdef ALLOW_DEBUG
304           IF (debugMode) CALL DEBUG_CALL('OBCS_CALC',myThid)
305    #endif
306           DO bj = myByLo(myThid), myByHi(myThid)
307            DO bi = myBxLo(myThid), myBxHi(myThid)
308              CALL OBCS_CALC( bi, bj, startTime, nIter0,
309         &              uVel, vVel, wVel, theta, salt, myThid )
310          ENDDO          ENDDO
311         ENDDO         ENDDO
312        ENDDO  
313    C--   Apply OBCS values to initial conditions for consistency
314    C      (but initial conditions only)
315    #ifdef ALLOW_DEBUG
316           IF (debugMode)
317         &      CALL DEBUG_CALL('OBCS_APPLY_UV + OBCS_APPLY_TS',myThid)
318    #endif
319           DO bj = myByLo(myThid), myByHi(myThid)
320            DO bi = myBxLo(myThid), myBxHi(myThid)
321             DO K=1,Nr
322              CALL OBCS_APPLY_UV( bi, bj, k, uVel, vVel, myThid )
323              CALL OBCS_APPLY_TS( bi, bj, k, theta, salt, myThid )
324             ENDDO
325            ENDDO
326           ENDDO
327           IF (useOBCSprescribe) THEN
328    C     After applying the boundary conditions exchange the 3D-fields.
329    C     This is only necessary of the boudnary values have been read
330    C     from a file.
331    #ifdef ALLOW_DEBUG
332            IF (debugMode)
333         &       CALL DEBUG_CALL('EXCHANGES in OBCS_INIT_VARIABLES',myThid)
334    #endif
335            CALL EXCH_UV_XYZ_RL(uVel,vVel,.TRUE.,myThid)
336            _EXCH_XYZ_RL( theta, myThid )
337            _EXCH_XYZ_RL( salt , myThid )
338           ENDIF
339    C     endif start from rest
340          ENDIF
341    #ifdef ALLOW_PTRACERS
342    C     repeat everything for passive tracers
343          IF ( usePTRACERS ) THEN
344    C     catch the case when we do start from a pickup for dynamics variables
345    C     but initialise ptracers differently
346           IF ( nIter0 .EQ. PTRACERS_Iter0 ) THEN
347    #ifdef ALLOW_DEBUG
348            IF (debugMode)
349         &       CALL DEBUG_CALL('OBCS_APPLY_PTRACER',myThid)
350    #endif
351            DO iTracer=1,PTRACERS_numInUse
352             DO bj = myByLo(myThid), myByHi(myThid)
353              DO bi = myBxLo(myThid), myBxHi(myThid)
354               DO K=1,Nr
355                CALL OBCS_APPLY_PTRACER(
356         I           bi, bj, K, iTracer,
357         U           ptracer(1-Olx,1-Oly,K,bi,bj,iTracer),
358         I           myThid )
359               ENDDO
360              ENDDO
361             ENDDO
362            ENDDO
363            IF (useOBCSprescribe) THEN
364    C     After applying the boundary conditions exchange the 3D-fields.
365    C     This is only necessary of the boudnary values have been read
366    C     from a file.
367    #ifdef ALLOW_DEBUG
368             IF (debugMode) CALL DEBUG_CALL(
369         &        'PTRACERS EXCHANGES in OBCS_INIT_VARIABLES',myThid)
370    #endif
371             CALL PTRACERS_FIELDS_BLOCKING_EXCH( myThid )
372            ENDIF
373    C     endif start from rest
374           ENDIF
375    C     endif usePTRACERS
376          ENDIF
377    #endif /* ALLOW_PTRACERS */
378    
379  #endif /* ALLOW_OBCS */  #endif /* ALLOW_OBCS */
380    
381    #ifdef ALLOW_DEBUG
382          IF (debugMode) CALL DEBUG_LEAVE('OBCS_INIT_VARIABLES',myThid)
383    #endif
384        RETURN        RETURN
385        END        END

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.29

  ViewVC Help
Powered by ViewVC 1.1.22