1 |
C $Header: /u/gcmpack/MITgcm/pkg/autodiff/active_file_loc.F,v 1.4 2007/10/08 23:50:53 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "AUTODIFF_OPTIONS.h" |
5 |
|
6 |
c ================================================================== |
7 |
c |
8 |
c active_file.F: Routines to handle the I/O of the active file for |
9 |
c the adjoint calculations. All files are direct |
10 |
c access files. |
11 |
c |
12 |
c Routines |
13 |
c |
14 |
c o active_read_xy - Read an active 2D variable from file. |
15 |
c o active_read_xyz - Read an active 3D variable from file. |
16 |
c o active_read_xz - Read an active 2D xz-slice from file. |
17 |
c o active_read_yz - Read an active 2D yz-slice from file. |
18 |
c |
19 |
c o active_write_xy - Write an active 2D variable to a file. |
20 |
c o active_write_xyz - Write an active 3D variable to a file. |
21 |
c o active_write_xz - Write an active 2D xz-slice to a file. |
22 |
c o active_write_yz - Write an active 2D yz-slice to a file. |
23 |
c |
24 |
c changed: Christian Eckert eckert@mit.edu 24-Apr-2000 |
25 |
c - Added routines that do active writes on tiles |
26 |
c instead of a whole thread. |
27 |
c changed: heimbach@mit.edu 05-Mar-2001 |
28 |
c - added active file handling of xz-/yz-arrays |
29 |
c |
30 |
c ================================================================== |
31 |
|
32 |
|
33 |
CBOP |
34 |
C !ROUTINE: active_read_xy_loc |
35 |
C !INTERFACE: |
36 |
subroutine active_read_xy_loc( |
37 |
I active_var_file, |
38 |
O active_var, |
39 |
I irec, |
40 |
I doglobalread, |
41 |
I lAdInit, |
42 |
I myOptimIter, |
43 |
I mythid |
44 |
I , dummy |
45 |
& ) |
46 |
|
47 |
C !DESCRIPTION: \bv |
48 |
c ================================================================== |
49 |
c SUBROUTINE active_read_xy_loc |
50 |
c ================================================================== |
51 |
c o Read an active 2D (XY) variable from file. |
52 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
53 |
c ================================================================== |
54 |
C \ev |
55 |
|
56 |
C !USES: |
57 |
implicit none |
58 |
|
59 |
c == global variables == |
60 |
#include "EEPARAMS.h" |
61 |
#include "SIZE.h" |
62 |
|
63 |
C !INPUT/OUTPUT PARAMETERS: |
64 |
c == routine arguments == |
65 |
c active_var_file: filename |
66 |
c active_var: array |
67 |
c irec: record number |
68 |
c myOptimIter: number of optimization iteration (default: 0) |
69 |
c mythid: thread number for this instance |
70 |
c doglobalread: flag for global or local read/write |
71 |
c (default: .false.) |
72 |
c lAdInit: initialisation of corresponding adjoint |
73 |
c variable and write to active file |
74 |
character*(*) active_var_file |
75 |
_RL active_var(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
76 |
integer irec |
77 |
integer myOptimIter |
78 |
integer mythid |
79 |
logical doglobalread |
80 |
logical lAdInit |
81 |
_RL dummy |
82 |
|
83 |
C !LOCAL VARIABLES: |
84 |
c == local variables == |
85 |
integer mynr |
86 |
|
87 |
c == end of interface == |
88 |
CEOP |
89 |
|
90 |
mynr = 1 |
91 |
call active_read_rl_loc( active_var_file, active_var, |
92 |
& doglobalread, lAdInit, irec, mynr, |
93 |
& FORWARD_SIMULATION, myOptimIter, mythid) |
94 |
|
95 |
return |
96 |
end |
97 |
|
98 |
c ================================================================== |
99 |
|
100 |
CBOP |
101 |
C !ROUTINE: active_read_xyz_loc |
102 |
C !INTERFACE: |
103 |
subroutine active_read_xyz_loc( |
104 |
I active_var_file, |
105 |
O active_var, |
106 |
I irec, |
107 |
I doglobalread, |
108 |
I lAdInit, |
109 |
I myOptimIter, |
110 |
I mythid |
111 |
I , dummy |
112 |
& ) |
113 |
|
114 |
C !DESCRIPTION: \bv |
115 |
c ================================================================== |
116 |
c SUBROUTINE active_read_xyz_loc |
117 |
c ================================================================== |
118 |
c o Read an active 3D variable from file. |
119 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
120 |
c ================================================================== |
121 |
C \ev |
122 |
|
123 |
C !USES: |
124 |
implicit none |
125 |
|
126 |
c == global variables == |
127 |
#include "EEPARAMS.h" |
128 |
#include "SIZE.h" |
129 |
|
130 |
C !INPUT/OUTPUT PARAMETERS: |
131 |
c == routine arguments == |
132 |
c active_var_file: filename |
133 |
c active_var: array |
134 |
c irec: record number |
135 |
c myOptimIter: number of optimization iteration (default: 0) |
136 |
c mythid: thread number for this instance |
137 |
c doglobalread: flag for global or local read/write |
138 |
c (default: .false.) |
139 |
c lAdInit: initialisation of corresponding adjoint |
140 |
c variable and write to active file |
141 |
character*(*) active_var_file |
142 |
_RL active_var(1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy) |
143 |
integer irec |
144 |
integer myOptimIter |
145 |
integer mythid |
146 |
logical doglobalread |
147 |
logical lAdInit |
148 |
_RL dummy |
149 |
|
150 |
C !LOCAL VARIABLES: |
151 |
c == local variables == |
152 |
integer mynr |
153 |
|
154 |
c == end of interface == |
155 |
CEOP |
156 |
|
157 |
mynr = nr |
158 |
call active_read_rl_loc( active_var_file, active_var, |
159 |
& doglobalread, lAdInit, irec, mynr, |
160 |
& FORWARD_SIMULATION, myOptimIter, mythid) |
161 |
|
162 |
return |
163 |
end |
164 |
|
165 |
c ================================================================== |
166 |
|
167 |
|
168 |
CBOP |
169 |
C !ROUTINE: active_read_xz_loc |
170 |
C !INTERFACE: |
171 |
subroutine active_read_xz_loc( |
172 |
I active_var_file, |
173 |
O active_var, |
174 |
I irec, |
175 |
I doglobalread, |
176 |
I lAdInit, |
177 |
I myOptimIter, |
178 |
I mythid |
179 |
I , dummy |
180 |
& ) |
181 |
|
182 |
C !DESCRIPTION: \bv |
183 |
c ================================================================== |
184 |
c SUBROUTINE active_read_xz_loc |
185 |
c ================================================================== |
186 |
c o Read an active 2D xz-slice from file. |
187 |
c started: heimbach@mit.edu 05-Mar-2001 |
188 |
c ================================================================== |
189 |
C \ev |
190 |
|
191 |
C !USES: |
192 |
implicit none |
193 |
|
194 |
c == global variables == |
195 |
#include "EEPARAMS.h" |
196 |
#include "SIZE.h" |
197 |
|
198 |
C !INPUT/OUTPUT PARAMETERS: |
199 |
c == routine arguments == |
200 |
c active_var_file: filename |
201 |
c active_var: array |
202 |
c irec: record number |
203 |
c myOptimIter: number of optimization iteration (default: 0) |
204 |
c mythid: thread number for this instance |
205 |
c doglobalread: flag for global or local read/write |
206 |
c (default: .false.) |
207 |
c lAdInit: initialisation of corresponding adjoint |
208 |
c variable and write to active file |
209 |
character*(*) active_var_file |
210 |
_RL active_var(1-olx:snx+olx,nsx,nsy) |
211 |
integer irec |
212 |
integer myOptimIter |
213 |
integer mythid |
214 |
logical doglobalread |
215 |
logical lAdInit |
216 |
_RL dummy |
217 |
|
218 |
C !LOCAL VARIABLES: |
219 |
c == local variables == |
220 |
integer mynr |
221 |
|
222 |
c == end of interface == |
223 |
CEOP |
224 |
|
225 |
mynr = nr |
226 |
call active_read_xz_rl_loc( active_var_file, active_var, |
227 |
& doglobalread, lAdInit, irec, mynr, |
228 |
& FORWARD_SIMULATION, myOptimIter, mythid) |
229 |
|
230 |
return |
231 |
end |
232 |
|
233 |
c ================================================================== |
234 |
|
235 |
|
236 |
CBOP |
237 |
C !ROUTINE: active_read_yz_loc |
238 |
C !INTERFACE: |
239 |
subroutine active_read_yz_loc( |
240 |
I active_var_file, |
241 |
O active_var, |
242 |
I irec, |
243 |
I doglobalread, |
244 |
I lAdInit, |
245 |
I myOptimIter, |
246 |
I mythid |
247 |
I , dummy |
248 |
& ) |
249 |
|
250 |
C !DESCRIPTION: \bv |
251 |
c ================================================================== |
252 |
c SUBROUTINE active_read_yz_loc |
253 |
c ================================================================== |
254 |
c o Read an active 2D yz-slice from file. |
255 |
c started: heimbach@mit.edu 05-Mar-2001 |
256 |
c ================================================================== |
257 |
C \ev |
258 |
|
259 |
C !USES: |
260 |
implicit none |
261 |
|
262 |
c == global variables == |
263 |
#include "EEPARAMS.h" |
264 |
#include "SIZE.h" |
265 |
|
266 |
C !INPUT/OUTPUT PARAMETERS: |
267 |
c == routine arguments == |
268 |
c active_var_file: filename |
269 |
c active_var: array |
270 |
c irec: record number |
271 |
c myOptimIter: number of optimization iteration (default: 0) |
272 |
c mythid: thread number for this instance |
273 |
c doglobalread: flag for global or local read/write |
274 |
c (default: .false.) |
275 |
c lAdInit: initialisation of corresponding adjoint |
276 |
c variable and write to active file |
277 |
character*(*) active_var_file |
278 |
_RL active_var(1-oly:sny+oly,nsx,nsy) |
279 |
integer irec |
280 |
integer myOptimIter |
281 |
integer mythid |
282 |
logical doglobalread |
283 |
logical lAdInit |
284 |
_RL dummy |
285 |
|
286 |
C !LOCAL VARIABLES: |
287 |
c == local variables == |
288 |
integer mynr |
289 |
|
290 |
c == end of interface == |
291 |
CEOP |
292 |
|
293 |
mynr = nr |
294 |
call active_read_yz_rl_loc( active_var_file, active_var, |
295 |
& doglobalread, lAdInit, irec, mynr, |
296 |
& FORWARD_SIMULATION, myOptimIter, mythid) |
297 |
|
298 |
return |
299 |
end |
300 |
|
301 |
c ================================================================== |
302 |
|
303 |
CBOP |
304 |
C !ROUTINE: active_write_xy_loc |
305 |
C !INTERFACE: |
306 |
subroutine active_write_xy_loc( |
307 |
I active_var_file, |
308 |
I active_var, |
309 |
I irec, |
310 |
I myOptimIter, |
311 |
I mythid |
312 |
I , dummy |
313 |
& ) |
314 |
|
315 |
C !DESCRIPTION: \bv |
316 |
c ================================================================== |
317 |
c SUBROUTINE active_write_xy_loc |
318 |
c ================================================================== |
319 |
c o Write an active 2D variable to a file. |
320 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
321 |
c ================================================================== |
322 |
C \ev |
323 |
|
324 |
C !USES: |
325 |
implicit none |
326 |
|
327 |
c == global variables == |
328 |
#include "EEPARAMS.h" |
329 |
#include "SIZE.h" |
330 |
|
331 |
c == routine arguments == |
332 |
c active_var_file: filename |
333 |
c active_var: array |
334 |
c irec: record number |
335 |
c myOptimIter: number of optimization iteration (default: 0) |
336 |
c mythid: thread number for this instance |
337 |
character*(*) active_var_file |
338 |
_RL active_var(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
339 |
integer irec |
340 |
integer myOptimIter |
341 |
integer mythid |
342 |
_RL dummy |
343 |
|
344 |
C !LOCAL VARIABLES: |
345 |
c == local variables == |
346 |
integer mynr |
347 |
logical globalfile |
348 |
|
349 |
c == end of interface == |
350 |
CEOP |
351 |
|
352 |
mynr = 1 |
353 |
globalfile = .false. |
354 |
|
355 |
call active_write_rl_loc( active_var_file, active_var, |
356 |
& globalfile, irec, mynr, |
357 |
& FORWARD_SIMULATION, myOptimIter, mythid ) |
358 |
|
359 |
return |
360 |
end |
361 |
|
362 |
c ================================================================== |
363 |
|
364 |
CBOP |
365 |
C !ROUTINE: active_write_xyz_loc |
366 |
C !INTERFACE: |
367 |
subroutine active_write_xyz_loc( |
368 |
I active_var_file, |
369 |
I active_var, |
370 |
I irec, |
371 |
I myOptimIter, |
372 |
I mythid |
373 |
I , dummy |
374 |
& ) |
375 |
|
376 |
C !DESCRIPTION: \bv |
377 |
c ================================================================== |
378 |
c SUBROUTINE active_write_xyz_loc |
379 |
c ================================================================== |
380 |
c o Write an active 3D variable to a file. |
381 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
382 |
c ================================================================== |
383 |
C \ev |
384 |
|
385 |
C !USES: |
386 |
implicit none |
387 |
|
388 |
c == global variables == |
389 |
#include "EEPARAMS.h" |
390 |
#include "SIZE.h" |
391 |
|
392 |
c == routine arguments == |
393 |
c active_var_file: filename |
394 |
c active_var: array |
395 |
c irec: record number |
396 |
c myOptimIter: number of optimization iteration (default: 0) |
397 |
c mythid: thread number for this instance |
398 |
character*(*) active_var_file |
399 |
_RL active_var(1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy) |
400 |
integer irec |
401 |
integer myOptimIter |
402 |
integer mythid |
403 |
_RL dummy |
404 |
|
405 |
C !LOCAL VARIABLES: |
406 |
c == local variables == |
407 |
integer mynr |
408 |
logical globalfile |
409 |
|
410 |
c == end of interface == |
411 |
CEOP |
412 |
|
413 |
mynr = nr |
414 |
globalfile = .false. |
415 |
call active_write_rl_loc(active_var_file, active_var, |
416 |
& globalfile, irec, mynr, |
417 |
& FORWARD_SIMULATION, myOptimIter, mythid) |
418 |
|
419 |
return |
420 |
end |
421 |
|
422 |
c ================================================================== |
423 |
|
424 |
CBOP |
425 |
C !ROUTINE: active_write_xz_loc |
426 |
C !INTERFACE: |
427 |
subroutine active_write_xz_loc( |
428 |
I active_var_file, |
429 |
I active_var, |
430 |
I irec, |
431 |
I myOptimIter, |
432 |
I mythid |
433 |
I , dummy |
434 |
& ) |
435 |
|
436 |
C !DESCRIPTION: \bv |
437 |
c ================================================================== |
438 |
c SUBROUTINE active_write_xz_loc |
439 |
c ================================================================== |
440 |
c o Write an active 2D xz-slice to a file. |
441 |
c started: heimbach@mit.edu 05-Mar-2001 |
442 |
c ================================================================== |
443 |
C \ev |
444 |
|
445 |
C !USES: |
446 |
implicit none |
447 |
|
448 |
c == global variables == |
449 |
#include "EEPARAMS.h" |
450 |
#include "SIZE.h" |
451 |
|
452 |
c == routine arguments == |
453 |
c active_var_file: filename |
454 |
c active_var: array |
455 |
c irec: record number |
456 |
c myOptimIter: number of optimization iteration (default: 0) |
457 |
c mythid: thread number for this instance |
458 |
character*(*) active_var_file |
459 |
_RL active_var(1-olx:snx+olx,nsx,nsy) |
460 |
integer irec |
461 |
integer myOptimIter |
462 |
integer mythid |
463 |
_RL dummy |
464 |
|
465 |
C !LOCAL VARIABLES: |
466 |
c == local variables == |
467 |
integer mynr |
468 |
logical globalfile |
469 |
|
470 |
c == end of interface == |
471 |
CEOP |
472 |
|
473 |
mynr = nr |
474 |
globalfile = .false. |
475 |
|
476 |
call active_write_xz_rl_loc( active_var_file, active_var, |
477 |
& globalfile, irec, mynr, |
478 |
& FORWARD_SIMULATION, myOptimIter, mythid ) |
479 |
|
480 |
return |
481 |
end |
482 |
|
483 |
c ================================================================== |
484 |
|
485 |
CBOP |
486 |
C !ROUTINE: active_write_yz_loc |
487 |
C !INTERFACE: |
488 |
subroutine active_write_yz_loc( |
489 |
I active_var_file, |
490 |
I active_var, |
491 |
I irec, |
492 |
I myOptimIter, |
493 |
I mythid |
494 |
I , dummy |
495 |
& ) |
496 |
|
497 |
C !DESCRIPTION: \bv |
498 |
c ================================================================== |
499 |
c SUBROUTINE active_write_yz_loc |
500 |
c ================================================================== |
501 |
c o Write an active 2D variable to a file. |
502 |
c started: heimbach@mit.edu 05-Mar-2001 |
503 |
c ================================================================== |
504 |
C \ev |
505 |
|
506 |
C !USES: |
507 |
implicit none |
508 |
|
509 |
c == global variables == |
510 |
#include "EEPARAMS.h" |
511 |
#include "SIZE.h" |
512 |
|
513 |
c == routine arguments == |
514 |
c active_var_file: filename |
515 |
c active_var: array |
516 |
c irec: record number |
517 |
c myOptimIter: number of optimization iteration (default: 0) |
518 |
c mythid: thread number for this instance |
519 |
character*(*) active_var_file |
520 |
_RL active_var(1-oly:sny+oly,nsx,nsy) |
521 |
integer irec |
522 |
integer myOptimIter |
523 |
integer mythid |
524 |
_RL dummy |
525 |
|
526 |
C !LOCAL VARIABLES: |
527 |
c == local variables == |
528 |
integer mynr |
529 |
logical globalfile |
530 |
|
531 |
c == end of interface == |
532 |
CEOP |
533 |
|
534 |
mynr = nr |
535 |
globalfile = .false. |
536 |
|
537 |
call active_write_yz_rl_loc( active_var_file, active_var, |
538 |
& globalfile, irec, mynr, |
539 |
& FORWARD_SIMULATION, myOptimIter, mythid ) |
540 |
|
541 |
return |
542 |
end |