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