1 |
C $Header: /u/gcmpack/MITgcm/pkg/obcs/obcs_external_fields_load.F,v 1.12 2009/08/11 15:46:27 mlosch Exp $ |
2 |
C $Name: $ |
3 |
#include "OBCS_OPTIONS.h" |
4 |
|
5 |
CBOP |
6 |
C !ROUTINE: OBCS_EXTERNAL_FIELDS_LOAD |
7 |
C !INTERFACE: |
8 |
SUBROUTINE OBCS_EXTERNAL_FIELDS_LOAD( myTime, myIter, myThid ) |
9 |
C !DESCRIPTION: \bv |
10 |
C *==========================================================* |
11 |
C | SUBROUTINE OBCS_EXTERNAL_FIELDS_LOAD |
12 |
C | o Control reading of fields from external source. |
13 |
C *==========================================================* |
14 |
C | External source field loading routine for open boundaries. |
15 |
C | This routine is called every time we want to |
16 |
C | load a a set of external open boundary fields. |
17 |
C | Only if there are fields available (file names are not empty) |
18 |
C | the open boundary fields are overwritten. |
19 |
C | The routine decides which fields to load and then reads them in. |
20 |
C | This routine needs to be customised for particular |
21 |
C | experiments. |
22 |
C | Notes |
23 |
C | ===== |
24 |
C | Two-dimensional and three-dimensional I/O are handled in |
25 |
C | the following way under MITgcmUV. A master thread |
26 |
C | performs I/O using system calls. This threads reads data |
27 |
C | into a temporary buffer. At present the buffer is loaded |
28 |
C | with the entire model domain. This is probably OK for now |
29 |
C | Each thread then copies data from the buffer to the |
30 |
C | region of the proper array it is responsible for. |
31 |
C | ===== |
32 |
C | This routine is the complete analogue to external_fields_load, |
33 |
C | except for exchanges of forcing fields. These are done in |
34 |
C | obcs_precribe_exchanges, which is called from dynamics. |
35 |
C | - Forcing period and cycle are the same as for other fields |
36 |
C | in external forcing. |
37 |
C | - constant boundary values are also read here and not |
38 |
C | directly in obcs_init_variables (which calls obcs_calc |
39 |
C | which in turn calls this routine) |
40 |
C *==========================================================* |
41 |
C \ev |
42 |
|
43 |
C !USES: |
44 |
IMPLICIT NONE |
45 |
C === Global variables === |
46 |
#include "SIZE.h" |
47 |
#include "EEPARAMS.h" |
48 |
#include "PARAMS.h" |
49 |
#include "GRID.h" |
50 |
|
51 |
C !INPUT/OUTPUT PARAMETERS: |
52 |
C === Routine arguments === |
53 |
C myTime :: Simulation time |
54 |
C myIter :: Simulation timestep number |
55 |
C myThid :: Thread no. that called this routine. |
56 |
_RL myTime |
57 |
INTEGER myIter |
58 |
INTEGER myThid |
59 |
|
60 |
C if external forcing (exf) package is enabled, all loading of external |
61 |
C fields is done by exf |
62 |
#if (defined ALLOW_OBCS && defined ALLOW_OBCS_PRESCRIBE && !defined ALLOW_EXF) |
63 |
C |
64 |
#include "OBCS.h" |
65 |
#ifdef ALLOW_PTRACERS |
66 |
#include "PTRACERS_SIZE.h" |
67 |
#include "OBCS_PTRACERS.h" |
68 |
#include "PTRACERS_PARAMS.h" |
69 |
c#include "PTRACERS_FIELDS.h" |
70 |
#endif /* ALLOW_PTRACERS */ |
71 |
|
72 |
C !LOCAL VARIABLES: |
73 |
C === Local arrays === |
74 |
C aWght, bWght :: Interpolation weights |
75 |
C msgBuf :: Informational/error meesage buffer |
76 |
#ifdef NONLIN_FRSURF |
77 |
INTEGER i,j,bi,bj |
78 |
#endif /* NONLIN_FRSURF */ |
79 |
INTEGER fp |
80 |
INTEGER iRec0, iRec1, iTr |
81 |
_RL aWght,bWght,rdt |
82 |
INTEGER nForcingPeriods,Imytm,Ifprd,Ifcyc,Iftm |
83 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
84 |
CEOP |
85 |
|
86 |
fp = readBinaryPrec |
87 |
|
88 |
IF ( periodicExternalForcing ) THEN |
89 |
|
90 |
C Now calculate whether it is time to update the forcing arrays |
91 |
rdt = 1. _d 0 / deltaTclock |
92 |
nForcingPeriods = NINT(externForcingCycle/externForcingPeriod) |
93 |
Imytm = NINT(myTime*rdt) |
94 |
Ifprd = NINT(externForcingPeriod*rdt) |
95 |
Ifcyc = NINT(externForcingCycle*rdt) |
96 |
Iftm = MOD( Imytm+Ifcyc-Ifprd/2, Ifcyc) |
97 |
|
98 |
iRec0 = 1 + INT(Iftm/Ifprd) |
99 |
iRec1 = 1 + MOD(iRec0,nForcingPeriods) |
100 |
c aWght = DFLOAT( Iftm-Ifprd*(iRec0 - 1) ) / DFLOAT( Ifprd ) |
101 |
aWght = FLOAT( Iftm-Ifprd*(iRec0 - 1) ) |
102 |
bWght = FLOAT( Ifprd ) |
103 |
aWght = aWght / bWght |
104 |
bWght = 1. _d 0 - aWght |
105 |
|
106 |
IF ( |
107 |
& Iftm-Ifprd*(iRec0-1) .EQ. 0 |
108 |
& .OR. myIter .EQ. nIter0 |
109 |
& ) THEN |
110 |
|
111 |
#ifndef ALLOW_MDSIO |
112 |
STOP 'ABNORMAL END: OBCS_EXTERNAL_FIELDS_LOAD: NEEDS MSDIO PKG' |
113 |
#endif /* ALLOW_MDSIO */ |
114 |
|
115 |
_BARRIER |
116 |
|
117 |
C If the above condition is met then we need to read in |
118 |
C data for the period ahead and the period behind myTime. |
119 |
WRITE(msgBuf,'(1X,A,2I5,I10,1P1E20.12)') |
120 |
& 'OBCS_EXTERNAL_FIELDS_LOAD: Reading new data:', |
121 |
& iRec0, iRec1, myIter, myTime |
122 |
CALL PRINT_MESSAGE(msgBuf,standardMessageUnit, |
123 |
& SQUEEZE_RIGHT,myThid) |
124 |
|
125 |
#ifdef ALLOW_OBCS_EAST |
126 |
C Eastern boundary |
127 |
IF ( OBEuFile .NE. ' ' ) THEN |
128 |
CALL READ_REC_YZ_RL( OBEuFile, fp,Nr,OBEu0,iRec0,myIter,myThid ) |
129 |
CALL READ_REC_YZ_RL( OBEuFile, fp,Nr,OBEu1,iRec1,myIter,myThid ) |
130 |
ENDIF |
131 |
IF ( OBEvFile .NE. ' ' ) THEN |
132 |
CALL READ_REC_YZ_RL( OBEvFile, fp,Nr,OBEv0,iRec0,myIter,myThid ) |
133 |
CALL READ_REC_YZ_RL( OBEvFile, fp,Nr,OBEv1,iRec1,myIter,myThid ) |
134 |
ENDIF |
135 |
IF ( OBEtFile .NE. ' ' ) THEN |
136 |
CALL READ_REC_YZ_RL( OBEtFile, fp,Nr,OBEt0,iRec0,myIter,myThid ) |
137 |
CALL READ_REC_YZ_RL( OBEtFile, fp,Nr,OBEt1,iRec1,myIter,myThid ) |
138 |
ENDIF |
139 |
IF ( OBEsFile .NE. ' ' ) THEN |
140 |
CALL READ_REC_YZ_RL( OBEsFile, fp,Nr,OBEs0,iRec0,myIter,myThid ) |
141 |
CALL READ_REC_YZ_RL( OBEsFile, fp,Nr,OBEs1,iRec1,myIter,myThid ) |
142 |
ENDIF |
143 |
# ifdef NONLIN_FRSURF |
144 |
IF ( OBEetaFile .NE. ' ' ) THEN |
145 |
CALL READ_REC_YZ_RL(OBEetaFile,fp,1,OBEeta0,iRec0,myIter,myThid) |
146 |
CALL READ_REC_YZ_RL(OBEetaFile,fp,1,OBEeta1,iRec1,myIter,myThid) |
147 |
ENDIF |
148 |
# endif /* NONLIN_FRSURF */ |
149 |
#endif /* ALLOW_OBCS_EAST */ |
150 |
#ifdef ALLOW_OBCS_WEST |
151 |
C Western boundary |
152 |
IF ( OBWuFile .NE. ' ' ) THEN |
153 |
CALL READ_REC_YZ_RL( OBWuFile, fp,Nr,OBWu0,iRec0,myIter,myThid ) |
154 |
CALL READ_REC_YZ_RL( OBWuFile, fp,Nr,OBWu1,iRec1,myIter,myThid ) |
155 |
ENDIF |
156 |
IF ( OBWvFile .NE. ' ' ) THEN |
157 |
CALL READ_REC_YZ_RL( OBWvFile, fp,Nr,OBWv0,iRec0,myIter,myThid ) |
158 |
CALL READ_REC_YZ_RL( OBWvFile, fp,Nr,OBWv1,iRec1,myIter,myThid ) |
159 |
ENDIF |
160 |
IF ( OBWtFile .NE. ' ' ) THEN |
161 |
CALL READ_REC_YZ_RL( OBWtFile, fp,Nr,OBWt0,iRec0,myIter,myThid ) |
162 |
CALL READ_REC_YZ_RL( OBWtFile, fp,Nr,OBWt1,iRec1,myIter,myThid ) |
163 |
ENDIF |
164 |
IF ( OBWsFile .NE. ' ' ) THEN |
165 |
CALL READ_REC_YZ_RL( OBWsFile, fp,Nr,OBWs0,iRec0,myIter,myThid ) |
166 |
CALL READ_REC_YZ_RL( OBWsFile, fp,Nr,OBWs1,iRec1,myIter,myThid ) |
167 |
ENDIF |
168 |
# ifdef NONLIN_FRSURF |
169 |
IF ( OBWetaFile .NE. ' ' ) THEN |
170 |
CALL READ_REC_YZ_RL(OBWetaFile,fp,1,OBWeta0,iRec0,myIter,myThid) |
171 |
CALL READ_REC_YZ_RL(OBWetaFile,fp,1,OBWeta1,iRec1,myIter,myThid) |
172 |
ENDIF |
173 |
# endif /* NONLIN_FRSURF */ |
174 |
#endif /* ALLOW_OBCS_WEST */ |
175 |
#ifdef ALLOW_OBCS_NORTH |
176 |
C Northern boundary |
177 |
IF ( OBNuFile .NE. ' ' ) THEN |
178 |
CALL READ_REC_XZ_RL( OBNuFile, fp,Nr,OBNu0,iRec0,myIter,myThid ) |
179 |
CALL READ_REC_XZ_RL( OBNuFile, fp,Nr,OBNu1,iRec1,myIter,myThid ) |
180 |
ENDIF |
181 |
IF ( OBNvFile .NE. ' ' ) THEN |
182 |
CALL READ_REC_XZ_RL( OBNvFile, fp,Nr,OBNv0,iRec0,myIter,myThid ) |
183 |
CALL READ_REC_XZ_RL( OBNvFile, fp,Nr,OBNv1,iRec1,myIter,myThid ) |
184 |
ENDIF |
185 |
IF ( OBNtFile .NE. ' ' ) THEN |
186 |
CALL READ_REC_XZ_RL( OBNtFile, fp,Nr,OBNt0,iRec0,myIter,myThid ) |
187 |
CALL READ_REC_XZ_RL( OBNtFile, fp,Nr,OBNt1,iRec1,myIter,myThid ) |
188 |
ENDIF |
189 |
IF ( OBNsFile .NE. ' ' ) THEN |
190 |
CALL READ_REC_XZ_RL( OBNsFile, fp,Nr,OBNs0,iRec0,myIter,myThid ) |
191 |
CALL READ_REC_XZ_RL( OBNsFile, fp,Nr,OBNs1,iRec1,myIter,myThid ) |
192 |
ENDIF |
193 |
# ifdef NONLIN_FRSURF |
194 |
IF ( OBNetaFile .NE. ' ' ) THEN |
195 |
CALL READ_REC_XZ_RL(OBNetaFile,fp,1,OBNeta0,iRec0,myIter,myThid) |
196 |
CALL READ_REC_XZ_RL(OBNetaFile,fp,1,OBNeta1,iRec1,myIter,myThid) |
197 |
ENDIF |
198 |
# endif /* NONLIN_FRSURF */ |
199 |
#endif /* ALLOW_OBCS_NORTH */ |
200 |
#ifdef ALLOW_OBCS_SOUTH |
201 |
C Southern boundary |
202 |
IF ( OBSuFile .NE. ' ' ) THEN |
203 |
CALL READ_REC_XZ_RL( OBSuFile, fp,Nr,OBSu0,iRec0,myIter,myThid ) |
204 |
CALL READ_REC_XZ_RL( OBSuFile, fp,Nr,OBSu1,iRec1,myIter,myThid ) |
205 |
ENDIF |
206 |
IF ( OBSvFile .NE. ' ' ) THEN |
207 |
CALL READ_REC_XZ_RL( OBSvFile, fp,Nr,OBSv0,iRec0,myIter,myThid ) |
208 |
CALL READ_REC_XZ_RL( OBSvFile, fp,Nr,OBSv1,iRec1,myIter,myThid ) |
209 |
ENDIF |
210 |
IF ( OBStFile .NE. ' ' ) THEN |
211 |
CALL READ_REC_XZ_RL( OBStFile, fp,Nr,OBSt0,iRec0,myIter,myThid ) |
212 |
CALL READ_REC_XZ_RL( OBStFile, fp,Nr,OBSt1,iRec1,myIter,myThid ) |
213 |
ENDIF |
214 |
IF ( OBSsFile .NE. ' ' ) THEN |
215 |
CALL READ_REC_XZ_RL( OBSsFile, fp,Nr,OBSs0,iRec0,myIter,myThid ) |
216 |
CALL READ_REC_XZ_RL( OBSsFile, fp,Nr,OBSs1,iRec1,myIter,myThid ) |
217 |
ENDIF |
218 |
# ifdef NONLIN_FRSURF |
219 |
IF ( OBSetaFile .NE. ' ' ) THEN |
220 |
CALL READ_REC_XZ_RL(OBSetaFile,fp,1,OBSeta0,iRec0,myIter,myThid) |
221 |
CALL READ_REC_XZ_RL(OBSetaFile,fp,1,OBSeta1,iRec1,myIter,myThid) |
222 |
ENDIF |
223 |
# endif /* NONLIN_FRSURF */ |
224 |
#endif /* ALLOW_OBCS_SOUTH */ |
225 |
#ifdef ALLOW_PTRACERS |
226 |
IF (usePTRACERS) THEN |
227 |
C read boundary values for passive tracers |
228 |
DO iTr = 1, PTRACERS_numInUse |
229 |
# ifdef ALLOW_OBCS_EAST |
230 |
C Eastern boundary |
231 |
IF ( OBEptrFile(iTr) .NE. ' ' ) THEN |
232 |
CALL READ_REC_YZ_RL( OBEptrFile(iTr), fp, Nr, |
233 |
& OBEptr0(1-Oly,1,1,1,iTr), iRec0, myIter, myThid ) |
234 |
CALL READ_REC_YZ_RL( OBEptrFile(iTr), fp, Nr, |
235 |
& OBEptr1(1-Oly,1,1,1,iTr), iRec1, myIter, myThid ) |
236 |
ENDIF |
237 |
# endif /* ALLOW_OBCS_WEST */ |
238 |
# ifdef ALLOW_OBCS_WEST |
239 |
C Western boundary |
240 |
IF ( OBWptrFile(iTr) .NE. ' ' ) THEN |
241 |
CALL READ_REC_YZ_RL( OBWptrFile(iTr), fp, Nr, |
242 |
& OBWptr0(1-Oly,1,1,1,iTr), iRec0, myIter, myThid ) |
243 |
CALL READ_REC_YZ_RL( OBWptrFile(iTr), fp, Nr, |
244 |
& OBWptr1(1-Oly,1,1,1,iTr), iRec1, myIter, myThid ) |
245 |
ENDIF |
246 |
# endif /* ALLOW_OBCS_WEST */ |
247 |
# ifdef ALLOW_OBCS_NORTH |
248 |
C Northern boundary |
249 |
IF ( OBNptrFile(iTr) .NE. ' ' ) THEN |
250 |
CALL READ_REC_XZ_RL( OBNptrFile(iTr), fp, Nr, |
251 |
& OBNptr0(1-Oly,1,1,1,iTr), iRec0, myIter, myThid ) |
252 |
CALL READ_REC_XZ_RL( OBNptrFile(iTr), fp, Nr, |
253 |
& OBNptr1(1-Oly,1,1,1,iTr), iRec1, myIter, myThid ) |
254 |
ENDIF |
255 |
# endif /* ALLOW_OBCS_NORTH */ |
256 |
# ifdef ALLOW_OBCS_SOUTH |
257 |
C Southern boundary |
258 |
IF ( OBSptrFile(iTr) .NE. ' ' ) THEN |
259 |
CALL READ_REC_XZ_RL( OBSptrFile(iTr), fp, Nr, |
260 |
& OBSptr0(1-Oly,1,1,1,iTr), iRec0, myIter, myThid ) |
261 |
CALL READ_REC_XZ_RL( OBSptrFile(iTr), fp, Nr, |
262 |
& OBSptr1(1-Oly,1,1,1,iTr), iRec1, myIter, myThid ) |
263 |
ENDIF |
264 |
# endif /* ALLOW_OBCS_SOUTH */ |
265 |
C end do iTr |
266 |
ENDDO |
267 |
C end if (usePTRACERS) |
268 |
ENDIF |
269 |
#endif /* ALLOW_PTRACERS */ |
270 |
|
271 |
C |
272 |
C At this point in external_fields_load the input fields are exchanged. |
273 |
C However, we do not have exchange routines for vertical |
274 |
C slices and they are not planned, either, so the approriate fields |
275 |
C are exchanged after the open boundary conditions have been |
276 |
C applied. (in DYNAMICS and DO_FIELDS_BLOCKING_EXCHANGES) |
277 |
_BARRIER |
278 |
|
279 |
C end if time to read new data |
280 |
ENDIF |
281 |
|
282 |
C if not periodicForcing |
283 |
ELSE |
284 |
aWght = 0. _d 0 |
285 |
bWght = 1. _d 0 |
286 |
C read boundary values once and for all |
287 |
IF ( myIter .EQ. nIter0 ) THEN |
288 |
#ifndef ALLOW_MDSIO |
289 |
STOP 'ABNORMAL END: OBCS_EXTERNAL_FIELDS_LOAD: NEEDS MSDIO PKG' |
290 |
#endif /* ALLOW_MDSIO */ |
291 |
_BARRIER |
292 |
C Read constant boundary conditions only for myIter = nIter0 |
293 |
WRITE(msgBuf,'(1X,A,I10,1P1E20.12)') |
294 |
& 'OBCS_EXTERNAL_FIELDS_LOAD: Reading initial data:', |
295 |
& myIter, myTime |
296 |
CALL PRINT_MESSAGE(msgBuf,standardMessageUnit, |
297 |
& SQUEEZE_RIGHT,myThid) |
298 |
iRec0 = 1 |
299 |
|
300 |
#ifdef ALLOW_OBCS_EAST |
301 |
C Eastern boundary |
302 |
IF ( OBEuFile .NE. ' ' ) THEN |
303 |
CALL READ_REC_YZ_RL( OBEuFile,fp,Nr,OBEu0,iRec0,myIter,myThid ) |
304 |
ENDIF |
305 |
IF ( OBEvFile .NE. ' ' ) THEN |
306 |
CALL READ_REC_YZ_RL( OBEvFile,fp,Nr,OBEv0,iRec0,myIter,myThid ) |
307 |
ENDIF |
308 |
IF ( OBEtFile .NE. ' ' ) THEN |
309 |
CALL READ_REC_YZ_RL( OBEtFile,fp,Nr,OBEt0,iRec0,myIter,myThid ) |
310 |
ENDIF |
311 |
IF ( OBEsFile .NE. ' ' ) THEN |
312 |
CALL READ_REC_YZ_RL( OBEsFile,fp,Nr,OBEs0,iRec0,myIter,myThid ) |
313 |
ENDIF |
314 |
# ifdef NONLIN_FRSURF |
315 |
IF ( OBEetaFile .NE. ' ' ) THEN |
316 |
CALL READ_REC_YZ_RL( OBEetaFile, fp, 1, OBEeta0, iRec0, |
317 |
& myIter, myThid ) |
318 |
ENDIF |
319 |
# endif /* NONLIN_FRSURF */ |
320 |
#endif /* ALLOW_OBCS_WEST */ |
321 |
#ifdef ALLOW_OBCS_WEST |
322 |
C Western boundary |
323 |
IF ( OBWuFile .NE. ' ' ) THEN |
324 |
CALL READ_REC_YZ_RL( OBWuFile,fp,Nr,OBWu0,iRec0,myIter,myThid ) |
325 |
ENDIF |
326 |
IF ( OBWvFile .NE. ' ' ) THEN |
327 |
CALL READ_REC_YZ_RL( OBWvFile,fp,Nr,OBWv0,iRec0,myIter,myThid ) |
328 |
ENDIF |
329 |
IF ( OBWtFile .NE. ' ' ) THEN |
330 |
CALL READ_REC_YZ_RL( OBWtFile,fp,Nr,OBWt0,iRec0,myIter,myThid ) |
331 |
ENDIF |
332 |
IF ( OBWsFile .NE. ' ' ) THEN |
333 |
CALL READ_REC_YZ_RL( OBWsFile,fp,Nr,OBWs0,iRec0,myIter,myThid ) |
334 |
ENDIF |
335 |
# ifdef NONLIN_FRSURF |
336 |
IF ( OBWetaFile .NE. ' ' ) THEN |
337 |
CALL READ_REC_YZ_RL( OBWetaFile, fp, 1, OBWeta0, iRec0, |
338 |
& myIter, myThid ) |
339 |
ENDIF |
340 |
# endif /* NONLIN_FRSURF */ |
341 |
#endif /* ALLOW_OBCS_WEST */ |
342 |
#ifdef ALLOW_OBCS_NORTH |
343 |
C Northern boundary |
344 |
IF ( OBNuFile .NE. ' ' ) THEN |
345 |
CALL READ_REC_XZ_RL( OBNuFile,fp,Nr,OBNu0,iRec0,myIter,myThid ) |
346 |
ENDIF |
347 |
IF ( OBNvFile .NE. ' ' ) THEN |
348 |
CALL READ_REC_XZ_RL( OBNvFile,fp,Nr,OBNv0,iRec0,myIter,myThid ) |
349 |
ENDIF |
350 |
IF ( OBNtFile .NE. ' ' ) THEN |
351 |
CALL READ_REC_XZ_RL( OBNtFile,fp,Nr,OBNt0,iRec0,myIter,myThid ) |
352 |
ENDIF |
353 |
IF ( OBNsFile .NE. ' ' ) THEN |
354 |
CALL READ_REC_XZ_RL( OBNsFile,fp,Nr,OBNs0,iRec0,myIter,myThid ) |
355 |
ENDIF |
356 |
# ifdef NONLIN_FRSURF |
357 |
IF ( OBNetaFile .NE. ' ' ) THEN |
358 |
CALL READ_REC_XZ_RL( OBNetaFile, fp, 1, OBNeta0, iRec0, |
359 |
& myIter, myThid ) |
360 |
ENDIF |
361 |
# endif /* NONLIN_FRSURF */ |
362 |
#endif /* ALLOW_OBCS_NORTH */ |
363 |
#ifdef ALLOW_OBCS_SOUTH |
364 |
C Southern boundary |
365 |
IF ( OBSuFile .NE. ' ' ) THEN |
366 |
CALL READ_REC_XZ_RL( OBSuFile,fp,Nr,OBSu0,iRec0,myIter,myThid ) |
367 |
ENDIF |
368 |
IF ( OBSvFile .NE. ' ' ) THEN |
369 |
CALL READ_REC_XZ_RL( OBSvFile,fp,Nr,OBSv0,iRec0,myIter,myThid ) |
370 |
ENDIF |
371 |
IF ( OBStFile .NE. ' ' ) THEN |
372 |
CALL READ_REC_XZ_RL( OBStFile,fp,Nr,OBSt0,iRec0,myIter,myThid ) |
373 |
ENDIF |
374 |
IF ( OBSsFile .NE. ' ' ) THEN |
375 |
CALL READ_REC_XZ_RL( OBSsFile,fp,Nr,OBSs0,iRec0,myIter,myThid ) |
376 |
ENDIF |
377 |
# ifdef NONLIN_FRSURF |
378 |
IF ( OBSetaFile .NE. ' ' ) THEN |
379 |
CALL READ_REC_XZ_RL( OBSetaFile, fp, 1, OBSeta0, iRec0, |
380 |
& myIter, myThid ) |
381 |
ENDIF |
382 |
# endif /* NONLIN_FRSURF */ |
383 |
#endif /* ALLOW_OBCS_SOUTH */ |
384 |
#ifdef ALLOW_PTRACERS |
385 |
IF (usePTRACERS) THEN |
386 |
C read passive tracer boundary values |
387 |
DO iTr = 1, PTRACERS_numInUse |
388 |
# ifdef ALLOW_OBCS_EAST |
389 |
C Eastern boundary |
390 |
IF ( OBEptrFile(iTr) .NE. ' ' ) THEN |
391 |
CALL READ_REC_YZ_RL( OBEptrFile(iTr), fp, Nr, |
392 |
& OBEptr0(1-Oly,1,1,1,iTr), iRec0,myIter, myThid ) |
393 |
ENDIF |
394 |
# endif /* ALLOW_OBCS_WEST */ |
395 |
# ifdef ALLOW_OBCS_WEST |
396 |
C Western boundary |
397 |
IF ( OBWptrFile(iTr) .NE. ' ' ) THEN |
398 |
CALL READ_REC_YZ_RL( OBWptrFile(iTr), fp, Nr, |
399 |
& OBWptr0(1-Oly,1,1,1,iTr), iRec0, myIter, myThid ) |
400 |
ENDIF |
401 |
# endif /* ALLOW_OBCS_WEST */ |
402 |
# ifdef ALLOW_OBCS_NORTH |
403 |
C Northern boundary |
404 |
IF ( OBNptrFile(iTr) .NE. ' ' ) THEN |
405 |
CALL READ_REC_XZ_RL( OBNptrFile(iTr), fp, Nr, |
406 |
& OBNptr0(1-Oly,1,1,1,iTr), iRec0, myIter, myThid ) |
407 |
ENDIF |
408 |
# endif /* ALLOW_OBCS_NORTH */ |
409 |
# ifdef ALLOW_OBCS_SOUTH |
410 |
C Southern boundary |
411 |
IF ( OBSptrFile(iTr) .NE. ' ' ) THEN |
412 |
CALL READ_REC_XZ_RL( OBSptrFile(iTr), fp, Nr, |
413 |
& OBSptr0(1-Oly,1,1,1,iTr), iRec0, myIter, myThid ) |
414 |
ENDIF |
415 |
# endif /* ALLOW_OBCS_SOUTH */ |
416 |
C end do iTr |
417 |
ENDDO |
418 |
C end if (usePTRACERS) |
419 |
ENDIF |
420 |
#endif /* ALLOW_PTRACERS */ |
421 |
_BARRIER |
422 |
C endif myIter .EQ. nIter0 |
423 |
ENDIF |
424 |
C endif for periodicForcing |
425 |
ENDIF |
426 |
|
427 |
C-- Now interpolate OBSu, OBSv, OBSt, OBSs, OBSptr, etc. |
428 |
C-- For periodicForcing, aWght = 0. and bWght = 1. so that the |
429 |
C-- interpolation boilds down to copying the time-independent |
430 |
C-- forcing field OBSu0 to OBSu |
431 |
#ifdef ALLOW_OBCS_EAST |
432 |
IF ( OBEuFile .NE. ' ' ) CALL OBCS_EXTERNAL_FIELDS_INTERP_YZ( |
433 |
& OBEu, OBEu0, OBEu1, aWght, bWght, myThid ) |
434 |
IF ( OBEvFile .NE. ' ' ) CALL OBCS_EXTERNAL_FIELDS_INTERP_YZ( |
435 |
& OBEv, OBEv0, OBEv1, aWght, bWght, myThid ) |
436 |
IF ( OBEtFile .NE. ' ' ) CALL OBCS_EXTERNAL_FIELDS_INTERP_YZ( |
437 |
& OBEt, OBEt0, OBEt1, aWght, bWght, myThid ) |
438 |
IF ( OBEsFile .NE. ' ' ) CALL OBCS_EXTERNAL_FIELDS_INTERP_YZ( |
439 |
& OBEs, OBEs0, OBEs1, aWght, bWght, myThid ) |
440 |
# ifdef NONLIN_FRSURF |
441 |
IF ( OBEetaFile .NE. ' ' ) THEN |
442 |
DO bj = myByLo(myThid), myByHi(myThid) |
443 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
444 |
DO j=1-Oly,sNy+Oly |
445 |
OBEeta(j,bi,bj) = bWght*OBEeta0(j,bi,bj) |
446 |
& +aWght*OBEeta1(j,bi,bj) |
447 |
ENDDO |
448 |
ENDDO |
449 |
ENDDO |
450 |
ENDIF |
451 |
# endif /* NONLIN_FRSURF */ |
452 |
#endif /* ALLOW_OBCS_EAST */ |
453 |
#ifdef ALLOW_OBCS_WEST |
454 |
IF ( OBWuFile .NE. ' ' ) CALL OBCS_EXTERNAL_FIELDS_INTERP_YZ( |
455 |
& OBWu, OBWu0, OBWu1, aWght, bWght, myThid ) |
456 |
IF ( OBWvFile .NE. ' ' ) CALL OBCS_EXTERNAL_FIELDS_INTERP_YZ( |
457 |
& OBWv, OBWv0, OBWv1, aWght, bWght, myThid ) |
458 |
IF ( OBWtFile .NE. ' ' ) CALL OBCS_EXTERNAL_FIELDS_INTERP_YZ( |
459 |
& OBWt, OBWt0, OBWt1, aWght, bWght, myThid ) |
460 |
IF ( OBWsFile .NE. ' ' ) CALL OBCS_EXTERNAL_FIELDS_INTERP_YZ( |
461 |
& OBWs, OBWs0, OBWs1, aWght, bWght, myThid ) |
462 |
# ifdef NONLIN_FRSURF |
463 |
IF ( OBWetaFile .NE. ' ' ) THEN |
464 |
DO bj = myByLo(myThid), myByHi(myThid) |
465 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
466 |
DO j=1-Oly,sNy+Oly |
467 |
OBWeta(j,bi,bj) = bWght*OBWeta0(j,bi,bj) |
468 |
& +aWght*OBWeta1(j,bi,bj) |
469 |
ENDDO |
470 |
ENDDO |
471 |
ENDDO |
472 |
ENDIF |
473 |
# endif /* NONLIN_FRSURF */ |
474 |
#endif /* ALLOW_OBCS_WEST */ |
475 |
#ifdef ALLOW_OBCS_NORTH |
476 |
IF ( OBNuFile .NE. ' ' ) CALL OBCS_EXTERNAL_FIELDS_INTERP_XZ( |
477 |
& OBNu, OBNu0, OBNu1, aWght, bWght, myThid ) |
478 |
IF ( OBNvFile .NE. ' ' ) CALL OBCS_EXTERNAL_FIELDS_INTERP_XZ( |
479 |
& OBNv, OBNv0, OBNv1, aWght, bWght, myThid ) |
480 |
IF ( OBNtFile .NE. ' ' ) CALL OBCS_EXTERNAL_FIELDS_INTERP_XZ( |
481 |
& OBNt, OBNt0, OBNt1, aWght, bWght, myThid ) |
482 |
IF ( OBNsFile .NE. ' ' ) CALL OBCS_EXTERNAL_FIELDS_INTERP_XZ( |
483 |
& OBNs, OBNs0, OBNs1, aWght, bWght, myThid ) |
484 |
# ifdef NONLIN_FRSURF |
485 |
IF ( OBNetaFile .NE. ' ' ) THEN |
486 |
DO bj = myByLo(myThid), myByHi(myThid) |
487 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
488 |
DO i=1-Olx,sNx+Olx |
489 |
OBNeta(i,bi,bj) = bWght*OBNeta0(i,bi,bj) |
490 |
& +aWght*OBNeta1(i,bi,bj) |
491 |
ENDDO |
492 |
ENDDO |
493 |
ENDDO |
494 |
ENDIF |
495 |
# endif /* NONLIN_FRSURF */ |
496 |
#endif /* ALLOW_OBCS_NORTH */ |
497 |
#ifdef ALLOW_OBCS_SOUTH |
498 |
IF ( OBSuFile .NE. ' ' ) CALL OBCS_EXTERNAL_FIELDS_INTERP_XZ( |
499 |
& OBSu, OBSu0, OBSu1, aWght, bWght, myThid ) |
500 |
IF ( OBSvFile .NE. ' ' ) CALL OBCS_EXTERNAL_FIELDS_INTERP_XZ( |
501 |
& OBSv, OBSv0, OBSv1, aWght, bWght, myThid ) |
502 |
IF ( OBStFile .NE. ' ' ) CALL OBCS_EXTERNAL_FIELDS_INTERP_XZ( |
503 |
& OBSt, OBSt0, OBSt1, aWght, bWght, myThid ) |
504 |
IF ( OBSsFile .NE. ' ' ) CALL OBCS_EXTERNAL_FIELDS_INTERP_XZ( |
505 |
& OBSs, OBSs0, OBSs1, aWght, bWght, myThid ) |
506 |
# ifdef NONLIN_FRSURF |
507 |
IF ( OBSetaFile .NE. ' ' ) THEN |
508 |
DO bj = myByLo(myThid), myByHi(myThid) |
509 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
510 |
DO i=1-Olx,sNx+Olx |
511 |
OBSeta(i,bi,bj) = bWght*OBSeta0(i,bi,bj) |
512 |
& +aWght*OBSeta1(i,bi,bj) |
513 |
ENDDO |
514 |
ENDDO |
515 |
ENDDO |
516 |
ENDIF |
517 |
# endif /* NONLIN_FRSURF */ |
518 |
#endif /* ALLOW_OBCS_SOUTH */ |
519 |
#ifdef ALLOW_PTRACERS |
520 |
IF (usePTRACERS) THEN |
521 |
C "interpolate" passive tracer boundary values |
522 |
DO iTr = 1, PTRACERS_numInUse |
523 |
# ifdef ALLOW_OBCS_EAST |
524 |
IF ( OBEptrFile(iTr) .NE. ' ' ) |
525 |
& CALL OBCS_EXTERNAL_FIELDS_INTERP_YZ( |
526 |
O OBEptr (1-Oly,1,1,1,iTr), |
527 |
I OBEptr0(1-Oly,1,1,1,iTr), |
528 |
I OBEptr1(1-Oly,1,1,1,iTr), aWght, bWght, myThid ) |
529 |
# endif /* ALLOW_OBCS_EAST */ |
530 |
# ifdef ALLOW_OBCS_WEST |
531 |
IF ( OBWptrFile(iTr) .NE. ' ' ) |
532 |
& CALL OBCS_EXTERNAL_FIELDS_INTERP_YZ( |
533 |
O OBWptr (1-Oly,1,1,1,iTr), |
534 |
I OBWptr0(1-Oly,1,1,1,iTr), |
535 |
I OBWptr1(1-Oly,1,1,1,iTr), aWght, bWght, myThid ) |
536 |
# endif /* ALLOW_OBCS_WEST */ |
537 |
# ifdef ALLOW_OBCS_NORTH |
538 |
IF ( OBNptrFile(iTr) .NE. ' ' ) |
539 |
& CALL OBCS_EXTERNAL_FIELDS_INTERP_XZ( |
540 |
O OBNptr (1-Olx,1,1,1,iTr), |
541 |
I OBNptr0(1-Olx,1,1,1,iTr), |
542 |
I OBNptr1(1-Olx,1,1,1,iTr), aWght, bWght, myThid ) |
543 |
# endif /* ALLOW_OBCS_NORTH */ |
544 |
# ifdef ALLOW_OBCS_SOUTH |
545 |
IF ( OBSptrFile(iTr) .NE. ' ' ) |
546 |
& CALL OBCS_EXTERNAL_FIELDS_INTERP_XZ( |
547 |
O OBSptr (1-Olx,1,1,1,iTr), |
548 |
I OBSptr0(1-Olx,1,1,1,iTr), |
549 |
I OBSptr1(1-Olx,1,1,1,iTr), aWght, bWght, myThid ) |
550 |
# endif /* ALLOW_OBCS_SOUTH */ |
551 |
C end do iTr |
552 |
ENDDO |
553 |
C end if (usePTRACERS) |
554 |
ENDIF |
555 |
#endif /* ALLOW_PTRACERS */ |
556 |
|
557 |
RETURN |
558 |
END |
559 |
|
560 |
CBOP |
561 |
C !ROUTINE: OBCS_EXTERNAL_FIELDS_INTERP_XZ |
562 |
C !INTERFACE: |
563 |
SUBROUTINE OBCS_EXTERNAL_FIELDS_INTERP_XZ( |
564 |
O fld, |
565 |
I fld0, fld1, aWght, bWght, myThid ) |
566 |
C !DESCRIPTION: \bv |
567 |
C *==========================================================* |
568 |
C | SUBROUTINE OBCS_EXTERNAL_FIELDS_INTERP_XZ |
569 |
C | o Interpolate between to records |
570 |
C *==========================================================* |
571 |
C \ev |
572 |
|
573 |
C !USES: |
574 |
IMPLICIT NONE |
575 |
C === Global variables === |
576 |
#include "SIZE.h" |
577 |
#include "EEPARAMS.h" |
578 |
#include "PARAMS.h" |
579 |
|
580 |
C !INPUT/OUTPUT PARAMETERS: |
581 |
C === Routine arguments === |
582 |
C myThid - Thread no. that called this routine. |
583 |
C aWght, bWght :: Interpolation weights |
584 |
INTEGER myThid |
585 |
_RL aWght,bWght |
586 |
_RL fld (1-Olx:sNx+Olx,Nr,nSx,nSy) |
587 |
_RL fld0(1-Olx:sNx+Olx,Nr,nSx,nSy) |
588 |
_RL fld1(1-Olx:sNx+Olx,Nr,nSx,nSy) |
589 |
|
590 |
C !LOCAL VARIABLES: |
591 |
C === Local arrays === |
592 |
C bi,bj,i,j :: loop counters |
593 |
INTEGER bi,bj,i,k |
594 |
CEOP |
595 |
DO bj = myByLo(myThid), myByHi(myThid) |
596 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
597 |
DO K = 1, Nr |
598 |
DO i=1-Olx,sNx+Olx |
599 |
fld(i,k,bi,bj) = bWght*fld0(i,k,bi,bj) |
600 |
& +aWght*fld1(i,k,bi,bj) |
601 |
ENDDO |
602 |
ENDDO |
603 |
ENDDO |
604 |
ENDDO |
605 |
|
606 |
RETURN |
607 |
END |
608 |
CBOP |
609 |
C !ROUTINE: OBCS_EXTERNAL_FIELDS_INTERP_YZ |
610 |
C !INTERFACE: |
611 |
SUBROUTINE OBCS_EXTERNAL_FIELDS_INTERP_YZ( |
612 |
O fld, |
613 |
I fld0, fld1, aWght, bWght, myThid ) |
614 |
C !DESCRIPTION: \bv |
615 |
C *==========================================================* |
616 |
C | SUBROUTINE OBCS_EXTERNAL_FIELDS_INTERP_YZ |
617 |
C | o Interpolate between to records |
618 |
C *==========================================================* |
619 |
C \ev |
620 |
|
621 |
C !USES: |
622 |
IMPLICIT NONE |
623 |
C === Global variables === |
624 |
#include "SIZE.h" |
625 |
#include "EEPARAMS.h" |
626 |
#include "PARAMS.h" |
627 |
|
628 |
C !INPUT/OUTPUT PARAMETERS: |
629 |
C === Routine arguments === |
630 |
C myThid - Thread no. that called this routine. |
631 |
C aWght, bWght :: Interpolation weights |
632 |
INTEGER myThid |
633 |
_RL aWght,bWght |
634 |
_RL fld (1-Oly:sNy+Oly,Nr,nSx,nSy) |
635 |
_RL fld0(1-Oly:sNy+Oly,Nr,nSx,nSy) |
636 |
_RL fld1(1-Oly:sNy+Oly,Nr,nSx,nSy) |
637 |
|
638 |
C !LOCAL VARIABLES: |
639 |
C === Local arrays === |
640 |
C bi,bj,i,j :: loop counters |
641 |
INTEGER bi,bj,j,k |
642 |
CEOP |
643 |
DO bj = myByLo(myThid), myByHi(myThid) |
644 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
645 |
DO K = 1, Nr |
646 |
DO j=1-Oly,sNy+Oly |
647 |
fld(j,k,bi,bj) = bWght*fld0(j,k,bi,bj) |
648 |
& +aWght*fld1(j,k,bi,bj) |
649 |
ENDDO |
650 |
ENDDO |
651 |
ENDDO |
652 |
ENDDO |
653 |
|
654 |
#endif /* ALLOW_OBCS AND ALLOW_OBCS_PRESCRIBE AND .NOT. ALLOW_EXF */ |
655 |
|
656 |
RETURN |
657 |
END |