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

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

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


Revision 1.14 - (show annotations) (download)
Mon Oct 10 05:53:48 2005 UTC (18 years, 8 months ago) by mlosch
Branch: MAIN
CVS Tags: checkpoint57y_post, checkpoint57v_post, checkpoint57y_pre, checkpint57u_post, checkpoint57w_post, checkpoint57x_post
Changes since 1.13: +60 -1 lines
o OBCS and PTRACERS: add open boundary support for passive tracers
  - either use homogenous (pseudo) v.Neumann conditions or prescribe
    OB-values from file; this is not different from the way theta and salinity
    are treated
  - however, Orlanski-radiation conditions are not supported, and the model
    will stop if you use pTracers and Orlanski at the same time.
  - beefed up the rountine obcs_external_fields_load: now only those open
    boundary values are overwritten with values from files for which there
    are really files, otherwise the OB-fields remain untouched. This makes
    it possible to use different OBs at different ends of the domain (as
    with EXF)
  - TODO: add support for OB?w and OB?eta, which can currently not be read
    from a file.

1 C $Header: /u/gcmpack/MITgcm/pkg/obcs/obcs_init_variables.F,v 1.13 2004/10/20 14:16:23 edhill Exp $
2 C $Name: $
3
4 #include "OBCS_OPTIONS.h"
5
6 SUBROUTINE OBCS_INIT_VARIABLES( myThid )
7 C /==========================================================\
8 C | SUBROUTINE OBCS_INIT_VARIABLES |
9 C | o Initialise OBCs variable data |
10 C |==========================================================|
11 C | |
12 C \==========================================================/
13 IMPLICIT NONE
14
15 C === Global variables ===
16 #include "SIZE.h"
17 #include "EEPARAMS.h"
18 #include "PARAMS.h"
19 #include "DYNVARS.h"
20 #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 ==
28 C myThid - Number of this instance of INI_DEPTHS
29 INTEGER myThid
30
31 #ifdef ALLOW_OBCS
32
33 C == Local variables ==
34 INTEGER bi, bj
35 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)
48 DO bi = myBxLo(myThid), myBxHi(myThid)
49
50 DO K=1,Nr
51 DO I=1-Olx,sNx+Olx
52 #ifdef ALLOW_OBCS_NORTH
53 OBNu(I,K,bi,bj)=0. _d 0
54 OBNv(I,K,bi,bj)=0. _d 0
55 OBNt(I,K,bi,bj)=0. _d 0
56 OBNs(I,K,bi,bj)=0. _d 0
57 # ifdef ALLOW_NONHYDROSTATIC
58 OBNw(I,K,bi,bj)=0. _d 0
59 # endif
60 # ifdef ALLOW_OBCS_PRESCRIBE
61 OBNu0(I,K,bi,bj)=0. _d 0
62 OBNv0(I,K,bi,bj)=0. _d 0
63 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
92
93 DO J=1-Oly,sNy+Oly
94 #ifdef ALLOW_OBCS_EAST
95 OBEu(J,K,bi,bj)=0. _d 0
96 OBEv(J,K,bi,bj)=0. _d 0
97 OBEt(J,K,bi,bj)=0. _d 0
98 OBEs(J,K,bi,bj)=0. _d 0
99 # ifdef ALLOW_NONHYDROSTATIC
100 OBEw(J,K,bi,bj)=0. _d 0
101 # endif
102 # ifdef ALLOW_OBCS_PRESCRIBE
103 OBEu0(J,K,bi,bj)=0. _d 0
104 OBEv0(J,K,bi,bj)=0. _d 0
105 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
175 ENDDO
176 #endif /* ALLOW_PTRACERS */
177
178 #ifdef NONLIN_FRSURF
179 DO I=1-Olx,sNx+Olx
180 OBNeta(I,bi,bj)=0.
181 OBSeta(I,bi,bj)=0.
182 ENDDO
183 DO J=1-Oly,sNy+Oly
184 OBEeta(J,bi,bj)=0.
185 OBWeta(J,bi,bj)=0.
186 ENDDO
187 #endif /* NONLIN_FRSURF */
188
189 #ifdef ALLOW_ORLANSKI
190 IF (useOrlanskiNorth.OR.useOrlanskiSouth.OR.
191 & 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)
196 ENDIF
197 #endif /* ALLOW_ORLANSKI */
198
199 ENDDO
200 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
218 #ifdef ALLOW_DEBUG
219 IF (debugMode) CALL DEBUG_CALL('OBCS_CALC',myThid)
220 #endif
221 DO bj = myByLo(myThid), myByHi(myThid)
222 DO bi = myBxLo(myThid), myBxHi(myThid)
223 CALL OBCS_CALC( bi, bj, startTime, nIter0,
224 & uVel, vVel, wVel, theta, salt, myThid )
225 ENDDO
226 ENDDO
227
228 #ifdef ALLOW_DEBUG
229 IF (debugMode)
230 & CALL DEBUG_CALL('OBCS_APPLY_UV + OBCS_APPLY_TS',myThid)
231 #endif
232 DO bj = myByLo(myThid), myByHi(myThid)
233 DO bi = myBxLo(myThid), myBxHi(myThid)
234 DO K=1,Nr
235 CALL OBCS_APPLY_UV( bi, bj, k, uVel, vVel, myThid )
236 CALL OBCS_APPLY_TS( bi, bj, k, theta, salt, myThid )
237 #ifdef ALLOW_PTRACERS
238 DO iTracer=1,PTRACERS_numInUse
239 CALL OBCS_APPLY_PTRACER(
240 I bi, bj, K, iTracer,
241 U ptracer(1-Olx,1-Oly,K,bi,bj,iTracer),
242 I myThid )
243 ENDDO
244 #endif /* ALLOW_PTRACERS */
245 ENDDO
246 ENDDO
247 ENDDO
248
249 IF (useOBCSprescribe) THEN
250 C After applying the boundary conditions exchange the 3D-fields.
251 C This is only necessary of the boudnary values have been read
252 C from a file.
253 #ifdef ALLOW_DEBUG
254 IF (debugMode)
255 & CALL DEBUG_CALL('EXCHANGES in OBCS_INIT_VARIABLES',myThid)
256 #endif
257 CALL EXCH_UV_XYZ_RL(uVel,vVel,.TRUE.,myThid)
258 _EXCH_XYZ_R8( theta, myThid )
259 _EXCH_XYZ_R8( salt , myThid )
260 ENDIF
261
262 #endif /* ALLOW_OBCS */
263
264 #ifdef ALLOW_DEBUG
265 IF (debugMode) CALL DEBUG_LEAVE('OBCS_INIT_VARIABLES',myThid)
266 #endif
267 RETURN
268 END

  ViewVC Help
Powered by ViewVC 1.1.22