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