/[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.3 by adcroft, Wed Feb 28 14:45:21 2001 UTC revision 1.19 by jmc, Thu Dec 15 17:15:36 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
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    #endif /* ALLOW_PTRACERS */
41    
42    #ifdef ALLOW_DEBUG
43          IF (debugMode) CALL DEBUG_ENTER('OBCS_INIT_VARIABLES',myThid)
44    #endif
45    
46        DO bj = myByLo(myThid), myByHi(myThid)        DO bj = myByLo(myThid), myByHi(myThid)
47         DO bi = myBxLo(myThid), myBxHi(myThid)         DO bi = myBxLo(myThid), myBxHi(myThid)
48    
49          DO K=1,Nr          DO K=1,Nr
50           DO I=1-Olx,sNx+Olx           DO I=1-Olx,sNx+Olx
51            OBNu(I,K,bi,bj)=0.  #ifdef ALLOW_OBCS_NORTH
52            OBNv(I,K,bi,bj)=0.            OBNu(I,K,bi,bj)=0. _d 0
53            OBNt(I,K,bi,bj)=0.            OBNv(I,K,bi,bj)=0. _d 0
54            OBSu(I,K,bi,bj)=0.            OBNt(I,K,bi,bj)=0. _d 0
55            OBSv(I,K,bi,bj)=0.            OBNs(I,K,bi,bj)=0. _d 0
56            OBSt(I,K,bi,bj)=0.  # ifdef ALLOW_NONHYDROSTATIC
57  #ifdef ALLOW_NONHYDROSTATIC            OBNw(I,K,bi,bj)=0. _d 0
58            OBNw(I,K,bi,bj)=0.  # endif
59            OBSw(I,K,bi,bj)=0.  # ifdef ALLOW_OBCS_PRESCRIBE
60  #endif            OBNu0(I,K,bi,bj)=0. _d 0
61              OBNv0(I,K,bi,bj)=0. _d 0
62              OBNt0(I,K,bi,bj)=0. _d 0
63              OBNs0(I,K,bi,bj)=0. _d 0
64              OBNu1(I,K,bi,bj)=0. _d 0
65              OBNv1(I,K,bi,bj)=0. _d 0
66              OBNt1(I,K,bi,bj)=0. _d 0
67              OBNs1(I,K,bi,bj)=0. _d 0
68    # endif
69    #endif /* ALLOW_OBCS_NORTH */
70    
71    #ifdef ALLOW_OBCS_SOUTH
72              OBSu(I,K,bi,bj)=0. _d 0
73              OBSv(I,K,bi,bj)=0. _d 0
74              OBSt(I,K,bi,bj)=0. _d 0
75              OBSs(I,K,bi,bj)=0. _d 0
76    # ifdef ALLOW_NONHYDROSTATIC
77              OBSw(I,K,bi,bj)=0. _d 0
78    # endif
79    # ifdef ALLOW_OBCS_PRESCRIBE
80              OBSu0(I,K,bi,bj)=0. _d 0
81              OBSv0(I,K,bi,bj)=0. _d 0
82              OBSt0(I,K,bi,bj)=0. _d 0
83              OBSs0(I,K,bi,bj)=0. _d 0
84              OBSu1(I,K,bi,bj)=0. _d 0
85              OBSv1(I,K,bi,bj)=0. _d 0
86              OBSt1(I,K,bi,bj)=0. _d 0
87              OBSs1(I,K,bi,bj)=0. _d 0
88    # endif
89    #endif /* ALLOW_OBCS_SOUTH */
90           ENDDO           ENDDO
91    
92           DO J=1-Oly,sNy+Oly           DO J=1-Oly,sNy+Oly
93            OBEu(J,K,bi,bj)=0.  #ifdef ALLOW_OBCS_EAST
94            OBEv(J,K,bi,bj)=0.            OBEu(J,K,bi,bj)=0. _d 0
95            OBEt(J,K,bi,bj)=0.            OBEv(J,K,bi,bj)=0. _d 0
96            OBWu(J,K,bi,bj)=0.            OBEt(J,K,bi,bj)=0. _d 0
97            OBWv(J,K,bi,bj)=0.            OBEs(J,K,bi,bj)=0. _d 0
98            OBWt(J,K,bi,bj)=0.  # ifdef ALLOW_NONHYDROSTATIC
99  #ifdef ALLOW_NONHYDROSTATIC            OBEw(J,K,bi,bj)=0. _d 0
100            OBEw(J,K,bi,bj)=0.  # endif
101            OBWw(J,K,bi,bj)=0.  # ifdef ALLOW_OBCS_PRESCRIBE
102  #endif            OBEu0(J,K,bi,bj)=0. _d 0
103              OBEv0(J,K,bi,bj)=0. _d 0
104              OBEt0(J,K,bi,bj)=0. _d 0
105              OBEs0(J,K,bi,bj)=0. _d 0
106              OBEu1(J,K,bi,bj)=0. _d 0
107              OBEv1(J,K,bi,bj)=0. _d 0
108              OBEt1(J,K,bi,bj)=0. _d 0
109              OBEs1(J,K,bi,bj)=0. _d 0
110    # endif
111    #endif /* ALLOW_OBCS_EAST */
112    
113    #ifdef ALLOW_OBCS_WEST
114              OBWu(J,K,bi,bj)=0. _d 0
115              OBWv(J,K,bi,bj)=0. _d 0
116              OBWt(J,K,bi,bj)=0. _d 0
117              OBWs(J,K,bi,bj)=0. _d 0
118    # ifdef ALLOW_NONHYDROSTATIC
119              OBWw(J,K,bi,bj)=0. _d 0
120    # endif
121    # ifdef ALLOW_OBCS_PRESCRIBE
122              OBWu0(J,K,bi,bj)=0. _d 0
123              OBWv0(J,K,bi,bj)=0. _d 0
124              OBWt0(J,K,bi,bj)=0. _d 0
125              OBWs0(J,K,bi,bj)=0. _d 0
126              OBWu1(J,K,bi,bj)=0. _d 0
127              OBWv1(J,K,bi,bj)=0. _d 0
128              OBWt1(J,K,bi,bj)=0. _d 0
129              OBWs1(J,K,bi,bj)=0. _d 0
130    # endif
131    #endif /* ALLOW_OBCS_WEST */
132             ENDDO
133            ENDDO
134    
135    #ifdef ALLOW_PTRACERS
136            IF ( usePTRACERS ) THEN
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
175           ENDDO           ENDDO
176            ENDIF
177    #endif /* ALLOW_PTRACERS */
178    
179    #ifdef NONLIN_FRSURF
180            DO I=1-Olx,sNx+Olx
181              OBNeta(I,bi,bj)=0.
182              OBSeta(I,bi,bj)=0.
183          ENDDO          ENDDO
184            DO J=1-Oly,sNy+Oly
185              OBEeta(J,bi,bj)=0.
186              OBWeta(J,bi,bj)=0.
187            ENDDO
188    #endif /* NONLIN_FRSURF */
189    
190  #ifdef ALLOW_ORLANSKI  #ifdef ALLOW_ORLANSKI
191          IF (useOrlanskiNorth.OR.useOrlanskiSouth.OR.          IF (useOrlanskiNorth.OR.useOrlanskiSouth.OR.
192       &      useOrlanskiEast.OR.useOrlanskiWest) THEN       &      useOrlanskiEast.OR.useOrlanskiWest) THEN
193    #ifdef ALLOW_DEBUG
194          IF (debugMode) CALL DEBUG_CALL('ORLANSKI_INIT',myThid)
195    #endif
196            CALL ORLANSKI_INIT(bi, bj, myThid)            CALL ORLANSKI_INIT(bi, bj, myThid)
197          ENDIF          ENDIF
198  #endif /* ALLOW_ORLANSKI */  #endif /* ALLOW_ORLANSKI */
# Line 69  C     == Local variables == Line 200  C     == Local variables ==
200         ENDDO         ENDDO
201        ENDDO            ENDDO    
202    
203  C--   Apply OBCS values to initial conditions for consistancy  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
204    C jmc: here is the logical place to read OBCS-pickup files
205    C      but a) without Orlanski: pass the test 1+1=2 without reading pickup.
206    C          b) with Orlanski: 1+1=2 fail even with this bit of code
207          IF ( nIter0.NE.0 ) THEN
208            prec = precFloat64
209            IF (pickupSuff.EQ.' ') THEN
210             WRITE(suff,'(I10.10)') nIter0
211            ELSE
212             WRITE(suff,'(A10)') pickupSuff
213            ENDIF
214    c       CALL OBCS_READ_CHECKPOINT(prec, nIter0, suff, myThid)
215          ENDIF
216    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
217    
218    C--   Load/compute OBCS values in all cases, although these values are
219    C--   only used for initialisation and never for restart:
220    #ifdef ALLOW_DEBUG
221          IF (debugMode) CALL DEBUG_CALL('OBCS_CALC',myThid)
222    #endif
223        DO bj = myByLo(myThid), myByHi(myThid)        DO bj = myByLo(myThid), myByHi(myThid)
224         DO bi = myBxLo(myThid), myBxHi(myThid)         DO bi = myBxLo(myThid), myBxHi(myThid)
225          CALL OBCS_CALC( bi, bj, startTime,          CALL OBCS_CALC( bi, bj, startTime, nIter0,
226       &        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  
227         ENDDO         ENDDO
228        ENDDO        ENDDO
229    
230          IF ( startTime .EQ. baseTime .AND.  nIter0 .EQ. 0
231         &     .AND. pickupSuff .EQ. ' ' ) THEN
232    C--   Apply OBCS values to initial conditions for consistency
233    C      (but initial conditions only)
234    #ifdef ALLOW_DEBUG
235           IF (debugMode)
236         &      CALL DEBUG_CALL('OBCS_APPLY_UV + OBCS_APPLY_TS',myThid)
237    #endif
238           DO bj = myByLo(myThid), myByHi(myThid)
239            DO bi = myBxLo(myThid), myBxHi(myThid)
240             DO K=1,Nr
241              CALL OBCS_APPLY_UV( bi, bj, k, uVel, vVel, myThid )
242              CALL OBCS_APPLY_TS( bi, bj, k, theta, salt, myThid )
243             ENDDO
244            ENDDO
245           ENDDO
246           IF (useOBCSprescribe) THEN
247    C     After applying the boundary conditions exchange the 3D-fields.
248    C     This is only necessary of the boudnary values have been read
249    C     from a file.
250    #ifdef ALLOW_DEBUG
251            IF (debugMode)
252         &       CALL DEBUG_CALL('EXCHANGES in OBCS_INIT_VARIABLES',myThid)
253    #endif
254            CALL EXCH_UV_XYZ_RL(uVel,vVel,.TRUE.,myThid)
255            _EXCH_XYZ_R8( theta, myThid )
256            _EXCH_XYZ_R8( salt , myThid )
257           ENDIF
258    C     endif start from rest
259          ENDIF
260    #ifdef ALLOW_PTRACERS
261    C     repeat everything for passive tracers
262          IF ( usePTRACERS ) THEN
263    C     catch the case when we do start from a pickup for dynamics variables
264    C     but initialise ptracers differently
265           IF ( nIter0 .EQ. PTRACERS_Iter0 ) THEN
266    #ifdef ALLOW_DEBUG
267            IF (debugMode)
268         &       CALL DEBUG_CALL('OBCS_APPLY_PTRACER',myThid)
269    #endif
270            DO iTracer=1,PTRACERS_numInUse
271             DO bj = myByLo(myThid), myByHi(myThid)
272              DO bi = myBxLo(myThid), myBxHi(myThid)
273               DO K=1,Nr
274                CALL OBCS_APPLY_PTRACER(
275         I           bi, bj, K, iTracer,
276         U           ptracer(1-Olx,1-Oly,K,bi,bj,iTracer),
277         I           myThid )
278               ENDDO
279              ENDDO
280             ENDDO
281            ENDDO
282            IF (useOBCSprescribe) THEN
283    C     After applying the boundary conditions exchange the 3D-fields.
284    C     This is only necessary of the boudnary values have been read
285    C     from a file.
286    #ifdef ALLOW_DEBUG
287             IF (debugMode) CALL DEBUG_CALL(
288         &        'PTRACERS EXCHANGES in OBCS_INIT_VARIABLES',myThid)
289    #endif
290             CALL PTRACERS_FIELDS_BLOCKING_EXCH( myThid )
291            ENDIF
292    C     endif start from rest
293           ENDIF
294    C     endif usePTRACERS
295          ENDIF
296    #endif /* ALLOW_PTRACERS */
297    
298  #endif /* ALLOW_OBCS */  #endif /* ALLOW_OBCS */
299    
300    #ifdef ALLOW_DEBUG
301          IF (debugMode) CALL DEBUG_LEAVE('OBCS_INIT_VARIABLES',myThid)
302    #endif
303        RETURN        RETURN
304        END        END

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.22