/[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.15 by mlosch, Wed Dec 14 16:43:19 2005 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.h
22    #include "PTRACERS_SIZE.h"
23    #include "PTRACERS.h"
24    #include "OBCS_PTRACERS.h"
25    #endif /* ALLOW_PTRACERS */
26    
27  C     == Routine arguments ==  C     == Routine arguments ==
28  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 33  C     myThid -  Number of this instance
33  C     == Local variables ==  C     == Local variables ==
34        INTEGER bi, bj        INTEGER bi, bj
35        INTEGER I, J, K        INTEGER I, J, K
36          CHARACTER*(10) suff
37          INTEGER prec
38    #ifdef ALLOW_PTRACERS
39          INTEGER iTracer
40    CML      _RL ptracerLoc(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
41    #endif /* ALLOW_PTRACERS */
42    
43    #ifdef ALLOW_DEBUG
44          IF (debugMode) CALL DEBUG_ENTER('OBCS_INIT_VARIABLES',myThid)
45    #endif
46    
47        DO bj = myByLo(myThid), myByHi(myThid)        DO bj = myByLo(myThid), myByHi(myThid)
48         DO bi = myBxLo(myThid), myBxHi(myThid)         DO bi = myBxLo(myThid), myBxHi(myThid)
49    
50          DO K=1,Nr          DO K=1,Nr
51           DO I=1-Olx,sNx+Olx           DO I=1-Olx,sNx+Olx
52            OBNu(I,K,bi,bj)=0.  #ifdef ALLOW_OBCS_NORTH
53            OBNv(I,K,bi,bj)=0.            OBNu(I,K,bi,bj)=0. _d 0
54            OBNt(I,K,bi,bj)=0.            OBNv(I,K,bi,bj)=0. _d 0
55            OBNs(I,K,bi,bj)=0.            OBNt(I,K,bi,bj)=0. _d 0
56            OBSu(I,K,bi,bj)=0.            OBNs(I,K,bi,bj)=0. _d 0
57            OBSv(I,K,bi,bj)=0.  # ifdef ALLOW_NONHYDROSTATIC
58            OBSt(I,K,bi,bj)=0.            OBNw(I,K,bi,bj)=0. _d 0
59            OBSs(I,K,bi,bj)=0.  # endif
60  #ifdef ALLOW_NONHYDROSTATIC  # ifdef ALLOW_OBCS_PRESCRIBE
61            OBNw(I,K,bi,bj)=0.            OBNu0(I,K,bi,bj)=0. _d 0
62            OBSw(I,K,bi,bj)=0.            OBNv0(I,K,bi,bj)=0. _d 0
63  #endif            OBNt0(I,K,bi,bj)=0. _d 0
64              OBNs0(I,K,bi,bj)=0. _d 0
65              OBNu1(I,K,bi,bj)=0. _d 0
66              OBNv1(I,K,bi,bj)=0. _d 0
67              OBNt1(I,K,bi,bj)=0. _d 0
68              OBNs1(I,K,bi,bj)=0. _d 0
69    # endif
70    #endif /* ALLOW_OBCS_NORTH */
71    
72    #ifdef ALLOW_OBCS_SOUTH
73              OBSu(I,K,bi,bj)=0. _d 0
74              OBSv(I,K,bi,bj)=0. _d 0
75              OBSt(I,K,bi,bj)=0. _d 0
76              OBSs(I,K,bi,bj)=0. _d 0
77    # ifdef ALLOW_NONHYDROSTATIC
78              OBSw(I,K,bi,bj)=0. _d 0
79    # endif
80    # ifdef ALLOW_OBCS_PRESCRIBE
81              OBSu0(I,K,bi,bj)=0. _d 0
82              OBSv0(I,K,bi,bj)=0. _d 0
83              OBSt0(I,K,bi,bj)=0. _d 0
84              OBSs0(I,K,bi,bj)=0. _d 0
85              OBSu1(I,K,bi,bj)=0. _d 0
86              OBSv1(I,K,bi,bj)=0. _d 0
87              OBSt1(I,K,bi,bj)=0. _d 0
88              OBSs1(I,K,bi,bj)=0. _d 0
89    # endif
90    #endif /* ALLOW_OBCS_SOUTH */
91           ENDDO           ENDDO
92    
93           DO J=1-Oly,sNy+Oly           DO J=1-Oly,sNy+Oly
94            OBEu(J,K,bi,bj)=0.  #ifdef ALLOW_OBCS_EAST
95            OBEv(J,K,bi,bj)=0.            OBEu(J,K,bi,bj)=0. _d 0
96            OBEt(J,K,bi,bj)=0.            OBEv(J,K,bi,bj)=0. _d 0
97            OBEs(J,K,bi,bj)=0.            OBEt(J,K,bi,bj)=0. _d 0
98            OBWu(J,K,bi,bj)=0.            OBEs(J,K,bi,bj)=0. _d 0
99            OBWv(J,K,bi,bj)=0.  # ifdef ALLOW_NONHYDROSTATIC
100            OBWt(J,K,bi,bj)=0.            OBEw(J,K,bi,bj)=0. _d 0
101            OBWs(J,K,bi,bj)=0.  # endif
102  #ifdef ALLOW_NONHYDROSTATIC  # ifdef ALLOW_OBCS_PRESCRIBE
103            OBEw(J,K,bi,bj)=0.            OBEu0(J,K,bi,bj)=0. _d 0
104            OBWw(J,K,bi,bj)=0.            OBEv0(J,K,bi,bj)=0. _d 0
105  #endif            OBEt0(J,K,bi,bj)=0. _d 0
106              OBEs0(J,K,bi,bj)=0. _d 0
107              OBEu1(J,K,bi,bj)=0. _d 0
108              OBEv1(J,K,bi,bj)=0. _d 0
109              OBEt1(J,K,bi,bj)=0. _d 0
110              OBEs1(J,K,bi,bj)=0. _d 0
111    # endif
112    #endif /* ALLOW_OBCS_EAST */
113    
114    #ifdef ALLOW_OBCS_WEST
115              OBWu(J,K,bi,bj)=0. _d 0
116              OBWv(J,K,bi,bj)=0. _d 0
117              OBWt(J,K,bi,bj)=0. _d 0
118              OBWs(J,K,bi,bj)=0. _d 0
119    # ifdef ALLOW_NONHYDROSTATIC
120              OBWw(J,K,bi,bj)=0. _d 0
121    # endif
122    # ifdef ALLOW_OBCS_PRESCRIBE
123              OBWu0(J,K,bi,bj)=0. _d 0
124              OBWv0(J,K,bi,bj)=0. _d 0
125              OBWt0(J,K,bi,bj)=0. _d 0
126              OBWs0(J,K,bi,bj)=0. _d 0
127              OBWu1(J,K,bi,bj)=0. _d 0
128              OBWv1(J,K,bi,bj)=0. _d 0
129              OBWt1(J,K,bi,bj)=0. _d 0
130              OBWs1(J,K,bi,bj)=0. _d 0
131    # endif
132    #endif /* ALLOW_OBCS_WEST */
133             ENDDO
134            ENDDO
135    
136    #ifdef ALLOW_PTRACERS
137            DO iTracer=1,PTRACERS_numInUse
138             DO K=1,Nr
139              DO I=1-Olx,sNx+Olx
140    #ifdef ALLOW_OBCS_NORTH
141               OBNptr (I,K,bi,bj,iTracer)=0. _d 0
142    # ifdef ALLOW_OBCS_PRESCRIBE
143               OBNptr0(I,K,bi,bj,iTracer)=0. _d 0
144               OBNptr1(I,K,bi,bj,iTracer)=0. _d 0
145    # endif
146    #endif /* ALLOW_OBCS_NORTH */
147    
148    #ifdef ALLOW_OBCS_SOUTH
149               OBSptr (I,K,bi,bj,iTracer)=0. _d 0
150    # ifdef ALLOW_OBCS_PRESCRIBE
151               OBSptr0(I,K,bi,bj,iTracer)=0. _d 0
152               OBSptr1(I,K,bi,bj,iTracer)=0. _d 0
153    # endif
154    #endif /* ALLOW_OBCS_SOUTH */
155              ENDDO
156    
157              DO J=1-Oly,sNy+Oly
158    #ifdef ALLOW_OBCS_EAST
159               OBEptr (J,K,bi,bj,iTracer)=0. _d 0
160    # ifdef ALLOW_OBCS_PRESCRIBE
161               OBEptr0(J,K,bi,bj,iTracer)=0. _d 0
162               OBEptr1(J,K,bi,bj,iTracer)=0. _d 0
163    # endif
164    #endif /* ALLOW_OBCS_EAST */
165    
166    #ifdef ALLOW_OBCS_WEST
167               OBWptr (J,K,bi,bj,iTracer)=0. _d 0
168    # ifdef ALLOW_OBCS_PRESCRIBE
169               OBWptr0(J,K,bi,bj,iTracer)=0. _d 0
170               OBWptr1(J,K,bi,bj,iTracer)=0. _d 0
171    # endif
172    #endif /* ALLOW_OBCS_WEST */
173              ENDDO
174           ENDDO           ENDDO
175          ENDDO          ENDDO
176    #endif /* ALLOW_PTRACERS */
177    
178  #ifdef NONLIN_FRSURF  #ifdef NONLIN_FRSURF
179          DO I=1-Olx,sNx+Olx          DO I=1-Olx,sNx+Olx
# Line 77  C     == Local variables == Line 189  C     == Local variables ==
189  #ifdef ALLOW_ORLANSKI  #ifdef ALLOW_ORLANSKI
190          IF (useOrlanskiNorth.OR.useOrlanskiSouth.OR.          IF (useOrlanskiNorth.OR.useOrlanskiSouth.OR.
191       &      useOrlanskiEast.OR.useOrlanskiWest) THEN       &      useOrlanskiEast.OR.useOrlanskiWest) THEN
192    #ifdef ALLOW_DEBUG
193          IF (debugMode) CALL DEBUG_CALL('ORLANSKI_INIT',myThid)
194    #endif
195            CALL ORLANSKI_INIT(bi, bj, myThid)            CALL ORLANSKI_INIT(bi, bj, myThid)
196          ENDIF          ENDIF
197  #endif /* ALLOW_ORLANSKI */  #endif /* ALLOW_ORLANSKI */
# Line 84  C     == Local variables == Line 199  C     == Local variables ==
199         ENDDO         ENDDO
200        ENDDO            ENDDO    
201    
202    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
203    C jmc: here is the logical place to read OBCS-pickup files
204    C      but a) without Orlanski: pass the test 1+1=2 without reading pickup.
205    C          b) with Orlanski: 1+1=2 fail even with this bit of code
206          IF ( nIter0.NE.0 ) THEN
207            prec = precFloat64
208            IF (pickupSuff.EQ.' ') THEN
209             WRITE(suff,'(I10.10)') nIter0
210            ELSE
211             WRITE(suff,'(A10)') pickupSuff
212            ENDIF
213    c       CALL OBCS_READ_CHECKPOINT(prec, nIter0, suff, myThid)
214          ENDIF
215    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
216    
217  C--   Apply OBCS values to initial conditions for consistancy  C--   Apply OBCS values to initial conditions for consistancy
218    #ifdef ALLOW_DEBUG
219          IF (debugMode) CALL DEBUG_CALL('OBCS_CALC',myThid)
220    #endif
221        DO bj = myByLo(myThid), myByHi(myThid)        DO bj = myByLo(myThid), myByHi(myThid)
222         DO bi = myBxLo(myThid), myBxHi(myThid)         DO bi = myBxLo(myThid), myBxHi(myThid)
223          CALL OBCS_CALC( bi, bj, startTime, nIter0,          CALL OBCS_CALC( bi, bj, startTime, nIter0,
224       &        uVel, vVel, wVel, theta, salt, myThid )       &        uVel, vVel, wVel, theta, salt, myThid )
         DO K=1,Nr  
          CALL OBCS_APPLY_UV( bi, bj, k, uVel, vVel, myThid )  
          CALL OBCS_APPLY_TS( bi, bj, k, theta, salt, myThid )  
         ENDDO  
225         ENDDO         ENDDO
226        ENDDO        ENDDO
227    
228          IF ( startTime .EQ. baseTime .AND.  nIter0 .EQ. 0
229         &     .AND. pickupSuff .EQ. ' ' ) THEN
230    #ifdef ALLOW_DEBUG
231           IF (debugMode)
232         &      CALL DEBUG_CALL('OBCS_APPLY_UV + OBCS_APPLY_TS',myThid)
233    #endif
234           DO bj = myByLo(myThid), myByHi(myThid)
235            DO bi = myBxLo(myThid), myBxHi(myThid)
236             DO K=1,Nr
237              CALL OBCS_APPLY_UV( bi, bj, k, uVel, vVel, myThid )
238              CALL OBCS_APPLY_TS( bi, bj, k, theta, salt, myThid )
239             ENDDO
240            ENDDO
241           ENDDO
242    #ifdef ALLOW_PTRACERS
243    C     repeat everything for passive tracers
244           IF ( usePTRACERS ) THEN
245    #ifdef ALLOW_DEBUG
246            IF (debugMode)
247         &       CALL DEBUG_CALL('OBCS_APPLY_PTRACER',myThid)
248    #endif
249            DO iTracer=1,PTRACERS_numInUse
250             DO bj = myByLo(myThid), myByHi(myThid)
251              DO bi = myBxLo(myThid), myBxHi(myThid)
252               DO K=1,Nr
253                CALL OBCS_APPLY_PTRACER(
254         I           bi, bj, K, iTracer,
255         U           ptracer(1-Olx,1-Oly,K,bi,bj,iTracer),
256         I           myThid )
257               ENDDO
258              ENDDO
259             ENDDO
260            ENDDO
261           ENDIF
262    #endif /* ALLOW_PTRACERS */
263           IF (useOBCSprescribe) THEN
264    C     After applying the boundary conditions exchange the 3D-fields.
265    C     This is only necessary of the boudnary values have been read
266    C     from a file.
267    #ifdef ALLOW_DEBUG
268            IF (debugMode)
269         &       CALL DEBUG_CALL('EXCHANGES in OBCS_INIT_VARIABLES',myThid)
270    #endif
271            CALL EXCH_UV_XYZ_RL(uVel,vVel,.TRUE.,myThid)
272            _EXCH_XYZ_R8( theta, myThid )
273            _EXCH_XYZ_R8( salt , myThid )
274           ENDIF
275    #ifdef ALLOW_PTRACERS
276           IF (usePTRACERS) THEN
277    C     Loop over passive tracers
278            DO iTracer=1,PTRACERS_numInUse
279             _EXCH_XYZ_R8( pTracer(1-Olx,1-Oly,1,1,1,iTracer),
280         &        myThid )
281            ENDDO
282           ENDIF
283    #endif /* ALLOW_PTRACERS */
284    C     endif start from rest
285          ENDIF
286    
287  #endif /* ALLOW_OBCS */  #endif /* ALLOW_OBCS */
288    
289    #ifdef ALLOW_DEBUG
290          IF (debugMode) CALL DEBUG_LEAVE('OBCS_INIT_VARIABLES',myThid)
291    #endif
292        RETURN        RETURN
293        END        END

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

  ViewVC Help
Powered by ViewVC 1.1.22