1 |
heimbach |
1.1 |
|
2 |
edhill |
1.4 |
#include "AUTODIFF_OPTIONS.h" |
3 |
heimbach |
1.1 |
|
4 |
|
|
c ================================================================== |
5 |
|
|
c |
6 |
|
|
c active_file.F: Routines to handle the I/O of the active file for |
7 |
|
|
c the adjoint calculations. All files are direct |
8 |
|
|
c access files. |
9 |
|
|
c |
10 |
|
|
c Routines |
11 |
|
|
c |
12 |
|
|
c o active_read_xy - Read an active 2D variable from file. |
13 |
|
|
c o active_read_xyz - Read an active 3D variable from file. |
14 |
|
|
c o active_read_xz - Read an active 2D xz-slice from file. |
15 |
|
|
c o active_read_yz - Read an active 2D yz-slice from file. |
16 |
|
|
c |
17 |
|
|
c o active_write_xy - Write an active 2D variable to a file. |
18 |
|
|
c o active_write_xyz - Write an active 3D variable to a file. |
19 |
|
|
c o active_write_xz - Write an active 2D xz-slice to a file. |
20 |
|
|
c o active_write_yz - Write an active 2D yz-slice to a file. |
21 |
|
|
c |
22 |
|
|
c o active_read_tile_xy - Read an active 2D variable from file. |
23 |
|
|
c o active_read_tile_xyz - Read an active 3D variable from file. |
24 |
|
|
c |
25 |
|
|
c o active_write_tile_xy - Write an active 2D variable to a file. |
26 |
|
|
c o active_write_tile_xyz - Write an active 3D variable to a file. |
27 |
|
|
c |
28 |
heimbach |
1.5 |
c o active_read_profile - Read an active 1D record. |
29 |
|
|
c o active_write_profile - Write an active 1D record. |
30 |
|
|
c |
31 |
heimbach |
1.1 |
c |
32 |
|
|
c changed: Christian Eckert eckert@mit.edu 24-Apr-2000 |
33 |
|
|
c - Added routines that do active writes on tiles |
34 |
|
|
c instead of a whole thread. |
35 |
heimbach |
1.2 |
c changed: heimbach@mit.edu 05-Mar-2001 |
36 |
|
|
c - added active file handling of xz-/yz-arrays |
37 |
heimbach |
1.1 |
c |
38 |
|
|
c ================================================================== |
39 |
|
|
|
40 |
|
|
|
41 |
heimbach |
1.2 |
CBOP |
42 |
|
|
C !ROUTINE: active_read_xy |
43 |
|
|
C !INTERFACE: |
44 |
heimbach |
1.1 |
subroutine active_read_xy( |
45 |
|
|
I active_var_file, |
46 |
|
|
O active_var, |
47 |
|
|
I irec, |
48 |
|
|
I doglobalread, |
49 |
|
|
I lAdInit, |
50 |
|
|
I myOptimIter, |
51 |
|
|
I mythid |
52 |
|
|
I , dummy |
53 |
|
|
& ) |
54 |
|
|
|
55 |
heimbach |
1.2 |
C !DESCRIPTION: \bv |
56 |
heimbach |
1.1 |
c ================================================================== |
57 |
|
|
c SUBROUTINE active_read_xy |
58 |
|
|
c ================================================================== |
59 |
heimbach |
1.2 |
c o Read an active 2D (XY) variable from file. |
60 |
heimbach |
1.1 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
61 |
|
|
c ================================================================== |
62 |
|
|
c SUBROUTINE active_read_xy |
63 |
|
|
c ================================================================== |
64 |
heimbach |
1.2 |
C \ev |
65 |
heimbach |
1.1 |
|
66 |
heimbach |
1.2 |
C !USES: |
67 |
heimbach |
1.1 |
implicit none |
68 |
|
|
|
69 |
|
|
c == global variables == |
70 |
|
|
#include "EEPARAMS.h" |
71 |
|
|
#include "SIZE.h" |
72 |
|
|
|
73 |
heimbach |
1.2 |
C !INPUT/OUTPUT PARAMETERS: |
74 |
heimbach |
1.1 |
c == routine arguments == |
75 |
heimbach |
1.2 |
c active_var_file: filename |
76 |
|
|
c active_var: array |
77 |
|
|
c irec: record number |
78 |
|
|
c myOptimIter: number of optimization iteration (default: 0) |
79 |
|
|
c mythid: thread number for this instance |
80 |
|
|
c doglobalread: flag for global or local read/write |
81 |
|
|
c (default: .false.) |
82 |
|
|
c lAdInit: initialisation of corresponding adjoint |
83 |
|
|
c variable and write to active file |
84 |
heimbach |
1.1 |
character*(*) active_var_file |
85 |
|
|
_RL active_var(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
86 |
|
|
integer irec |
87 |
|
|
integer myOptimIter |
88 |
|
|
integer mythid |
89 |
|
|
logical doglobalread |
90 |
|
|
logical lAdInit |
91 |
|
|
_RL dummy |
92 |
|
|
|
93 |
heimbach |
1.2 |
C !LOCAL VARIABLES: |
94 |
heimbach |
1.1 |
c == local variables == |
95 |
|
|
integer mynr |
96 |
|
|
|
97 |
|
|
c == end of interface == |
98 |
heimbach |
1.2 |
CEOP |
99 |
heimbach |
1.1 |
|
100 |
|
|
mynr = 1 |
101 |
|
|
call active_read_rl( active_var_file, active_var, doglobalread, |
102 |
|
|
& lAdInit, irec, mynr, |
103 |
|
|
& FORWARD_SIMULATION, myOptimIter, mythid) |
104 |
|
|
|
105 |
|
|
return |
106 |
|
|
end |
107 |
|
|
|
108 |
|
|
c ================================================================== |
109 |
|
|
|
110 |
heimbach |
1.2 |
CBOP |
111 |
|
|
C !ROUTINE: active_read_xyz |
112 |
|
|
C !INTERFACE: |
113 |
heimbach |
1.1 |
subroutine active_read_xyz( |
114 |
|
|
I active_var_file, |
115 |
|
|
O active_var, |
116 |
|
|
I irec, |
117 |
|
|
I doglobalread, |
118 |
|
|
I lAdInit, |
119 |
|
|
I myOptimIter, |
120 |
|
|
I mythid |
121 |
|
|
I , dummy |
122 |
|
|
& ) |
123 |
|
|
|
124 |
heimbach |
1.2 |
C !DESCRIPTION: \bv |
125 |
heimbach |
1.1 |
c ================================================================== |
126 |
|
|
c SUBROUTINE active_read_xyz |
127 |
|
|
c ================================================================== |
128 |
|
|
c o Read an active 3D variable from file. |
129 |
|
|
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
130 |
|
|
c ================================================================== |
131 |
|
|
c SUBROUTINE active_read_xyz |
132 |
|
|
c ================================================================== |
133 |
heimbach |
1.2 |
C \ev |
134 |
heimbach |
1.1 |
|
135 |
heimbach |
1.2 |
C !USES: |
136 |
heimbach |
1.1 |
implicit none |
137 |
|
|
|
138 |
|
|
c == global variables == |
139 |
|
|
#include "EEPARAMS.h" |
140 |
|
|
#include "SIZE.h" |
141 |
|
|
|
142 |
heimbach |
1.2 |
C !INPUT/OUTPUT PARAMETERS: |
143 |
heimbach |
1.1 |
c == routine arguments == |
144 |
heimbach |
1.2 |
c active_var_file: filename |
145 |
|
|
c active_var: array |
146 |
|
|
c irec: record number |
147 |
|
|
c myOptimIter: number of optimization iteration (default: 0) |
148 |
|
|
c mythid: thread number for this instance |
149 |
|
|
c doglobalread: flag for global or local read/write |
150 |
|
|
c (default: .false.) |
151 |
|
|
c lAdInit: initialisation of corresponding adjoint |
152 |
|
|
c variable and write to active file |
153 |
heimbach |
1.1 |
character*(*) active_var_file |
154 |
|
|
_RL active_var(1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy) |
155 |
|
|
integer irec |
156 |
|
|
integer myOptimIter |
157 |
|
|
integer mythid |
158 |
|
|
logical doglobalread |
159 |
|
|
logical lAdInit |
160 |
|
|
_RL dummy |
161 |
|
|
|
162 |
heimbach |
1.2 |
C !LOCAL VARIABLES: |
163 |
heimbach |
1.1 |
c == local variables == |
164 |
|
|
integer mynr |
165 |
|
|
|
166 |
|
|
c == end of interface == |
167 |
heimbach |
1.2 |
CEOP |
168 |
heimbach |
1.1 |
|
169 |
|
|
mynr = nr |
170 |
|
|
call active_read_rl( active_var_file, active_var, doglobalread, |
171 |
|
|
& lAdInit, irec, mynr, |
172 |
|
|
& FORWARD_SIMULATION, myOptimIter, mythid) |
173 |
|
|
|
174 |
|
|
return |
175 |
|
|
end |
176 |
|
|
|
177 |
|
|
c ================================================================== |
178 |
|
|
|
179 |
|
|
|
180 |
heimbach |
1.2 |
CBOP |
181 |
|
|
C !ROUTINE: active_read_xz |
182 |
|
|
C !INTERFACE: |
183 |
heimbach |
1.1 |
subroutine active_read_xz( |
184 |
|
|
I active_var_file, |
185 |
|
|
O active_var, |
186 |
|
|
I irec, |
187 |
|
|
I doglobalread, |
188 |
|
|
I lAdInit, |
189 |
|
|
I myOptimIter, |
190 |
|
|
I mythid |
191 |
|
|
I , dummy |
192 |
|
|
& ) |
193 |
|
|
|
194 |
heimbach |
1.2 |
C !DESCRIPTION: \bv |
195 |
heimbach |
1.1 |
c ================================================================== |
196 |
|
|
c SUBROUTINE active_read_xz |
197 |
|
|
c ================================================================== |
198 |
|
|
c o Read an active 2D xz-slice from file. |
199 |
|
|
c started: heimbach@mit.edu 05-Mar-2001 |
200 |
|
|
c ================================================================== |
201 |
|
|
c SUBROUTINE active_read_xz |
202 |
|
|
c ================================================================== |
203 |
heimbach |
1.2 |
C \ev |
204 |
heimbach |
1.1 |
|
205 |
heimbach |
1.2 |
C !USES: |
206 |
heimbach |
1.1 |
implicit none |
207 |
|
|
|
208 |
|
|
c == global variables == |
209 |
|
|
#include "EEPARAMS.h" |
210 |
|
|
#include "SIZE.h" |
211 |
|
|
|
212 |
heimbach |
1.2 |
C !INPUT/OUTPUT PARAMETERS: |
213 |
heimbach |
1.1 |
c == routine arguments == |
214 |
heimbach |
1.2 |
c active_var_file: filename |
215 |
|
|
c active_var: array |
216 |
|
|
c irec: record number |
217 |
|
|
c myOptimIter: number of optimization iteration (default: 0) |
218 |
|
|
c mythid: thread number for this instance |
219 |
|
|
c doglobalread: flag for global or local read/write |
220 |
|
|
c (default: .false.) |
221 |
|
|
c lAdInit: initialisation of corresponding adjoint |
222 |
|
|
c variable and write to active file |
223 |
heimbach |
1.1 |
character*(*) active_var_file |
224 |
|
|
_RL active_var(1-olx:snx+olx,nsx,nsy) |
225 |
|
|
integer irec |
226 |
|
|
integer myOptimIter |
227 |
|
|
integer mythid |
228 |
|
|
logical doglobalread |
229 |
|
|
logical lAdInit |
230 |
|
|
_RL dummy |
231 |
|
|
|
232 |
heimbach |
1.2 |
C !LOCAL VARIABLES: |
233 |
heimbach |
1.1 |
c == local variables == |
234 |
|
|
integer mynr |
235 |
|
|
|
236 |
|
|
c == end of interface == |
237 |
heimbach |
1.2 |
CEOP |
238 |
heimbach |
1.1 |
|
239 |
heimbach |
1.3 |
mynr = nr |
240 |
heimbach |
1.1 |
call active_read_xz_rl( active_var_file, active_var, doglobalread, |
241 |
|
|
& lAdInit, irec, mynr, |
242 |
|
|
& FORWARD_SIMULATION, myOptimIter, mythid) |
243 |
|
|
|
244 |
|
|
return |
245 |
|
|
end |
246 |
|
|
|
247 |
|
|
c ================================================================== |
248 |
|
|
|
249 |
|
|
|
250 |
heimbach |
1.2 |
CBOP |
251 |
|
|
C !ROUTINE: active_read_yz |
252 |
|
|
C !INTERFACE: |
253 |
|
|
subroutine active_read_yz( |
254 |
heimbach |
1.1 |
I active_var_file, |
255 |
|
|
O active_var, |
256 |
|
|
I irec, |
257 |
|
|
I doglobalread, |
258 |
|
|
I lAdInit, |
259 |
|
|
I myOptimIter, |
260 |
|
|
I mythid |
261 |
|
|
I , dummy |
262 |
|
|
& ) |
263 |
|
|
|
264 |
heimbach |
1.2 |
C !DESCRIPTION: \bv |
265 |
heimbach |
1.1 |
c ================================================================== |
266 |
|
|
c SUBROUTINE active_read_yz |
267 |
|
|
c ================================================================== |
268 |
|
|
c o Read an active 2D yz-slice from file. |
269 |
|
|
c started: heimbach@mit.edu 05-Mar-2001 |
270 |
|
|
c ================================================================== |
271 |
|
|
c SUBROUTINE active_read_yz |
272 |
|
|
c ================================================================== |
273 |
heimbach |
1.2 |
C \ev |
274 |
heimbach |
1.1 |
|
275 |
heimbach |
1.2 |
C !USES: |
276 |
heimbach |
1.1 |
implicit none |
277 |
|
|
|
278 |
|
|
c == global variables == |
279 |
|
|
#include "EEPARAMS.h" |
280 |
|
|
#include "SIZE.h" |
281 |
|
|
|
282 |
heimbach |
1.2 |
C !INPUT/OUTPUT PARAMETERS: |
283 |
heimbach |
1.1 |
c == routine arguments == |
284 |
heimbach |
1.2 |
c active_var_file: filename |
285 |
|
|
c active_var: array |
286 |
|
|
c irec: record number |
287 |
|
|
c myOptimIter: number of optimization iteration (default: 0) |
288 |
|
|
c mythid: thread number for this instance |
289 |
|
|
c doglobalread: flag for global or local read/write |
290 |
|
|
c (default: .false.) |
291 |
|
|
c lAdInit: initialisation of corresponding adjoint |
292 |
|
|
c variable and write to active file |
293 |
heimbach |
1.1 |
character*(*) active_var_file |
294 |
|
|
_RL active_var(1-oly:sny+oly,nsx,nsy) |
295 |
|
|
integer irec |
296 |
|
|
integer myOptimIter |
297 |
|
|
integer mythid |
298 |
|
|
logical doglobalread |
299 |
|
|
logical lAdInit |
300 |
|
|
_RL dummy |
301 |
|
|
|
302 |
heimbach |
1.2 |
C !LOCAL VARIABLES: |
303 |
heimbach |
1.1 |
c == local variables == |
304 |
|
|
integer mynr |
305 |
|
|
|
306 |
|
|
c == end of interface == |
307 |
heimbach |
1.2 |
CEOP |
308 |
heimbach |
1.1 |
|
309 |
heimbach |
1.3 |
mynr = nr |
310 |
heimbach |
1.1 |
call active_read_yz_rl( active_var_file, active_var, doglobalread, |
311 |
|
|
& lAdInit, irec, mynr, |
312 |
|
|
& FORWARD_SIMULATION, myOptimIter, mythid) |
313 |
|
|
|
314 |
|
|
return |
315 |
|
|
end |
316 |
|
|
|
317 |
|
|
c ================================================================== |
318 |
|
|
|
319 |
heimbach |
1.2 |
CBOP |
320 |
|
|
C !ROUTINE: active_write_xy |
321 |
|
|
C !INTERFACE: |
322 |
heimbach |
1.1 |
subroutine active_write_xy( |
323 |
|
|
I active_var_file, |
324 |
|
|
I active_var, |
325 |
|
|
I irec, |
326 |
|
|
I myOptimIter, |
327 |
|
|
I mythid |
328 |
|
|
I , dummy |
329 |
|
|
& ) |
330 |
|
|
|
331 |
heimbach |
1.2 |
C !DESCRIPTION: \bv |
332 |
heimbach |
1.1 |
c ================================================================== |
333 |
|
|
c SUBROUTINE active_write_xy |
334 |
|
|
c ================================================================== |
335 |
|
|
c o Write an active 2D variable to a file. |
336 |
|
|
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
337 |
|
|
c ================================================================== |
338 |
|
|
c SUBROUTINE active_write_xy |
339 |
|
|
c ================================================================== |
340 |
heimbach |
1.2 |
C \ev |
341 |
heimbach |
1.1 |
|
342 |
heimbach |
1.2 |
C !USES: |
343 |
heimbach |
1.1 |
implicit none |
344 |
|
|
|
345 |
|
|
c == global variables == |
346 |
|
|
#include "EEPARAMS.h" |
347 |
|
|
#include "SIZE.h" |
348 |
|
|
|
349 |
|
|
c == routine arguments == |
350 |
heimbach |
1.2 |
c active_var_file: filename |
351 |
|
|
c active_var: array |
352 |
|
|
c irec: record number |
353 |
|
|
c myOptimIter: number of optimization iteration (default: 0) |
354 |
|
|
c mythid: thread number for this instance |
355 |
heimbach |
1.1 |
character*(*) active_var_file |
356 |
|
|
_RL active_var(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
357 |
|
|
integer irec |
358 |
|
|
integer myOptimIter |
359 |
|
|
integer mythid |
360 |
|
|
_RL dummy |
361 |
|
|
|
362 |
heimbach |
1.2 |
C !LOCAL VARIABLES: |
363 |
heimbach |
1.1 |
c == local variables == |
364 |
|
|
integer mynr |
365 |
|
|
logical globalfile |
366 |
|
|
|
367 |
|
|
c == end of interface == |
368 |
heimbach |
1.2 |
CEOP |
369 |
heimbach |
1.1 |
|
370 |
|
|
mynr = 1 |
371 |
|
|
globalfile = .false. |
372 |
|
|
|
373 |
|
|
call active_write_rl( active_var_file, active_var, globalfile, |
374 |
|
|
& irec, mynr, |
375 |
|
|
& FORWARD_SIMULATION, myOptimIter, mythid ) |
376 |
|
|
|
377 |
|
|
return |
378 |
|
|
end |
379 |
|
|
|
380 |
|
|
c ================================================================== |
381 |
|
|
|
382 |
heimbach |
1.2 |
CBOP |
383 |
|
|
C !ROUTINE: active_write_xyz |
384 |
|
|
C !INTERFACE: |
385 |
heimbach |
1.1 |
subroutine active_write_xyz( |
386 |
|
|
I active_var_file, |
387 |
|
|
I active_var, |
388 |
|
|
I irec, |
389 |
|
|
I myOptimIter, |
390 |
|
|
I mythid |
391 |
|
|
I , dummy |
392 |
|
|
& ) |
393 |
|
|
|
394 |
heimbach |
1.2 |
C !DESCRIPTION: \bv |
395 |
heimbach |
1.1 |
c ================================================================== |
396 |
|
|
c SUBROUTINE active_write_xyz |
397 |
|
|
c ================================================================== |
398 |
|
|
c o Write an active 3D variable to a file. |
399 |
|
|
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
400 |
|
|
c ================================================================== |
401 |
|
|
c SUBROUTINE active_write_xyz |
402 |
|
|
c ================================================================== |
403 |
heimbach |
1.2 |
C \ev |
404 |
heimbach |
1.1 |
|
405 |
heimbach |
1.2 |
C !USES: |
406 |
heimbach |
1.1 |
implicit none |
407 |
|
|
|
408 |
|
|
c == global variables == |
409 |
|
|
#include "EEPARAMS.h" |
410 |
|
|
#include "SIZE.h" |
411 |
|
|
|
412 |
|
|
c == routine arguments == |
413 |
heimbach |
1.2 |
c active_var_file: filename |
414 |
|
|
c active_var: array |
415 |
|
|
c irec: record number |
416 |
|
|
c myOptimIter: number of optimization iteration (default: 0) |
417 |
|
|
c mythid: thread number for this instance |
418 |
heimbach |
1.1 |
character*(*) active_var_file |
419 |
|
|
_RL active_var(1-olx:snx+olx,1-oly:sny+oly,nr,nsx,nsy) |
420 |
|
|
integer irec |
421 |
|
|
integer myOptimIter |
422 |
|
|
integer mythid |
423 |
|
|
_RL dummy |
424 |
|
|
|
425 |
heimbach |
1.2 |
C !LOCAL VARIABLES: |
426 |
heimbach |
1.1 |
c == local variables == |
427 |
|
|
integer mynr |
428 |
|
|
logical globalfile |
429 |
|
|
|
430 |
|
|
c == end of interface == |
431 |
heimbach |
1.2 |
CEOP |
432 |
heimbach |
1.1 |
|
433 |
|
|
mynr = nr |
434 |
|
|
globalfile = .false. |
435 |
|
|
call active_write_rl(active_var_file, active_var, globalfile, |
436 |
|
|
& irec, mynr, |
437 |
|
|
& FORWARD_SIMULATION, myOptimIter, mythid) |
438 |
|
|
|
439 |
|
|
return |
440 |
|
|
end |
441 |
|
|
|
442 |
|
|
c ================================================================== |
443 |
|
|
|
444 |
heimbach |
1.2 |
CBOP |
445 |
|
|
C !ROUTINE: active_write_xz |
446 |
|
|
C !INTERFACE: |
447 |
heimbach |
1.1 |
subroutine active_write_xz( |
448 |
|
|
I active_var_file, |
449 |
|
|
I active_var, |
450 |
|
|
I irec, |
451 |
|
|
I myOptimIter, |
452 |
|
|
I mythid |
453 |
|
|
I , dummy |
454 |
|
|
& ) |
455 |
|
|
|
456 |
heimbach |
1.2 |
C !DESCRIPTION: \bv |
457 |
heimbach |
1.1 |
c ================================================================== |
458 |
|
|
c SUBROUTINE active_write_xz |
459 |
|
|
c ================================================================== |
460 |
|
|
c o Write an active 2D xz-slice to a file. |
461 |
|
|
c started: heimbach@mit.edu 05-Mar-2001 |
462 |
|
|
c ================================================================== |
463 |
|
|
c SUBROUTINE active_write_xz |
464 |
|
|
c ================================================================== |
465 |
heimbach |
1.2 |
C \ev |
466 |
heimbach |
1.1 |
|
467 |
heimbach |
1.2 |
C !USES: |
468 |
heimbach |
1.1 |
implicit none |
469 |
|
|
|
470 |
|
|
c == global variables == |
471 |
|
|
#include "EEPARAMS.h" |
472 |
|
|
#include "SIZE.h" |
473 |
|
|
|
474 |
|
|
c == routine arguments == |
475 |
heimbach |
1.2 |
c active_var_file: filename |
476 |
|
|
c active_var: array |
477 |
|
|
c irec: record number |
478 |
|
|
c myOptimIter: number of optimization iteration (default: 0) |
479 |
|
|
c mythid: thread number for this instance |
480 |
heimbach |
1.1 |
character*(*) active_var_file |
481 |
|
|
_RL active_var(1-olx:snx+olx,nsx,nsy) |
482 |
|
|
integer irec |
483 |
|
|
integer myOptimIter |
484 |
|
|
integer mythid |
485 |
|
|
_RL dummy |
486 |
|
|
|
487 |
heimbach |
1.2 |
C !LOCAL VARIABLES: |
488 |
heimbach |
1.1 |
c == local variables == |
489 |
|
|
integer mynr |
490 |
|
|
logical globalfile |
491 |
|
|
|
492 |
|
|
c == end of interface == |
493 |
heimbach |
1.2 |
CEOP |
494 |
heimbach |
1.1 |
|
495 |
heimbach |
1.3 |
mynr = nr |
496 |
heimbach |
1.1 |
globalfile = .false. |
497 |
|
|
|
498 |
|
|
call active_write_xz_rl( active_var_file, active_var, globalfile, |
499 |
|
|
& irec, mynr, |
500 |
|
|
& FORWARD_SIMULATION, myOptimIter, mythid ) |
501 |
|
|
|
502 |
|
|
return |
503 |
|
|
end |
504 |
|
|
|
505 |
|
|
c ================================================================== |
506 |
|
|
|
507 |
heimbach |
1.2 |
CBOP |
508 |
|
|
C !ROUTINE: active_write_yz |
509 |
|
|
C !INTERFACE: |
510 |
heimbach |
1.1 |
subroutine active_write_yz( |
511 |
|
|
I active_var_file, |
512 |
|
|
I active_var, |
513 |
|
|
I irec, |
514 |
|
|
I myOptimIter, |
515 |
|
|
I mythid |
516 |
|
|
I , dummy |
517 |
|
|
& ) |
518 |
|
|
|
519 |
heimbach |
1.2 |
C !DESCRIPTION: \bv |
520 |
heimbach |
1.1 |
c ================================================================== |
521 |
|
|
c SUBROUTINE active_write_yz |
522 |
|
|
c ================================================================== |
523 |
|
|
c o Write an active 2D variable to a file. |
524 |
|
|
c started: heimbach@mit.edu 05-Mar-2001 |
525 |
|
|
c ================================================================== |
526 |
|
|
c SUBROUTINE active_write_yz |
527 |
|
|
c ================================================================== |
528 |
heimbach |
1.2 |
C \ev |
529 |
heimbach |
1.1 |
|
530 |
heimbach |
1.2 |
C !USES: |
531 |
heimbach |
1.1 |
implicit none |
532 |
|
|
|
533 |
|
|
c == global variables == |
534 |
|
|
#include "EEPARAMS.h" |
535 |
|
|
#include "SIZE.h" |
536 |
|
|
|
537 |
|
|
c == routine arguments == |
538 |
heimbach |
1.2 |
c active_var_file: filename |
539 |
|
|
c active_var: array |
540 |
|
|
c irec: record number |
541 |
|
|
c myOptimIter: number of optimization iteration (default: 0) |
542 |
|
|
c mythid: thread number for this instance |
543 |
heimbach |
1.1 |
character*(*) active_var_file |
544 |
|
|
_RL active_var(1-oly:sny+oly,nsx,nsy) |
545 |
|
|
integer irec |
546 |
|
|
integer myOptimIter |
547 |
|
|
integer mythid |
548 |
|
|
_RL dummy |
549 |
|
|
|
550 |
heimbach |
1.2 |
C !LOCAL VARIABLES: |
551 |
heimbach |
1.1 |
c == local variables == |
552 |
|
|
integer mynr |
553 |
|
|
logical globalfile |
554 |
|
|
|
555 |
|
|
c == end of interface == |
556 |
heimbach |
1.2 |
CEOP |
557 |
heimbach |
1.1 |
|
558 |
heimbach |
1.3 |
mynr = nr |
559 |
heimbach |
1.1 |
globalfile = .false. |
560 |
|
|
|
561 |
|
|
call active_write_yz_rl( active_var_file, active_var, globalfile, |
562 |
|
|
& irec, mynr, |
563 |
|
|
& FORWARD_SIMULATION, myOptimIter, mythid ) |
564 |
|
|
|
565 |
|
|
return |
566 |
|
|
end |
567 |
|
|
|
568 |
|
|
c ================================================================== |
569 |
|
|
|
570 |
|
|
subroutine active_read_tile_xy( |
571 |
|
|
I active_var_file, |
572 |
|
|
O active_var, |
573 |
|
|
I irec, |
574 |
|
|
I doglobalread, |
575 |
|
|
I bi, |
576 |
|
|
I bj, |
577 |
|
|
I lAdInit, |
578 |
|
|
I myOptimIter, |
579 |
|
|
I mythid |
580 |
|
|
& ) |
581 |
|
|
|
582 |
|
|
c ================================================================== |
583 |
|
|
c SUBROUTINE active_read_tile_xy |
584 |
|
|
c ================================================================== |
585 |
|
|
c |
586 |
|
|
c o Read an active 2D variable from file. |
587 |
|
|
c |
588 |
|
|
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
589 |
|
|
c |
590 |
|
|
c changed: Christian Eckert eckert@mit.edu 11-Feb-2000 |
591 |
|
|
c |
592 |
|
|
c - Restructured the code in order to create a package |
593 |
|
|
c for the MITgcmUV.c |
594 |
|
|
c |
595 |
|
|
c changed: Christian Eckert eckert@mit.edu 24-Apr-2000 |
596 |
|
|
c |
597 |
|
|
c - Added routines that do active writes on tiles |
598 |
|
|
c instead of a whole thread. |
599 |
|
|
c |
600 |
|
|
c ================================================================== |
601 |
|
|
c SUBROUTINE active_read_tile_xy |
602 |
|
|
c ================================================================== |
603 |
|
|
|
604 |
|
|
implicit none |
605 |
|
|
|
606 |
|
|
c == global variables == |
607 |
|
|
|
608 |
|
|
#include "EEPARAMS.h" |
609 |
|
|
#include "SIZE.h" |
610 |
|
|
|
611 |
|
|
c == routine arguments == |
612 |
|
|
|
613 |
|
|
character*(*) active_var_file |
614 |
|
|
_RL active_var(1-olx:snx+olx,1-oly:sny+oly) |
615 |
|
|
integer irec |
616 |
|
|
integer myOptimIter |
617 |
|
|
integer mythid |
618 |
|
|
integer bi |
619 |
|
|
integer bj |
620 |
|
|
logical doglobalread |
621 |
|
|
logical lAdInit |
622 |
|
|
|
623 |
|
|
c == local variables == |
624 |
|
|
|
625 |
|
|
integer mynr |
626 |
|
|
|
627 |
|
|
c == end of interface == |
628 |
|
|
|
629 |
|
|
mynr = 1 |
630 |
|
|
call active_read_tile_rl( |
631 |
|
|
I active_var_file, |
632 |
|
|
I active_var, |
633 |
|
|
I doglobalread, |
634 |
|
|
I lAdInit, |
635 |
|
|
I irec, |
636 |
|
|
I mynr, |
637 |
|
|
I bi, |
638 |
|
|
I bj, |
639 |
|
|
I FORWARD_SIMULATION, |
640 |
|
|
I myOptimIter, |
641 |
|
|
I mythid |
642 |
|
|
& ) |
643 |
|
|
|
644 |
|
|
return |
645 |
|
|
end |
646 |
|
|
|
647 |
|
|
|
648 |
|
|
subroutine active_read_tile_xyz( |
649 |
|
|
I active_var_file, |
650 |
|
|
O active_var, |
651 |
|
|
I irec, |
652 |
|
|
I doglobalread, |
653 |
|
|
I bi, |
654 |
|
|
I bj, |
655 |
|
|
I lAdInit, |
656 |
|
|
I myOptimIter, |
657 |
|
|
I mythid |
658 |
|
|
& ) |
659 |
|
|
|
660 |
|
|
c ================================================================== |
661 |
|
|
c SUBROUTINE active_read_tile_xyz |
662 |
|
|
c ================================================================== |
663 |
|
|
c |
664 |
|
|
c o Read an active 3D variable from file. |
665 |
|
|
c |
666 |
|
|
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
667 |
|
|
c |
668 |
|
|
c changed: Christian Eckert eckert@mit.edu 11-Feb-2000 |
669 |
|
|
c |
670 |
|
|
c - Restructured the code in order to create a package |
671 |
|
|
c for the MITgcmUV.c |
672 |
|
|
c |
673 |
|
|
c changed: Christian Eckert eckert@mit.edu 24-Apr-2000 |
674 |
|
|
c |
675 |
|
|
c - Added routines that do active writes on tiles |
676 |
|
|
c instead of a whole thread. |
677 |
|
|
c |
678 |
|
|
c ================================================================== |
679 |
|
|
c SUBROUTINE active_read_tile_xyz |
680 |
|
|
c ================================================================== |
681 |
|
|
|
682 |
|
|
implicit none |
683 |
|
|
|
684 |
|
|
c == global variables == |
685 |
|
|
|
686 |
|
|
#include "EEPARAMS.h" |
687 |
|
|
#include "SIZE.h" |
688 |
|
|
|
689 |
|
|
c == routine arguments == |
690 |
|
|
|
691 |
|
|
character*(*) active_var_file |
692 |
|
|
_RL active_var(1-olx:snx+olx,1-oly:sny+oly,nr) |
693 |
|
|
integer irec |
694 |
|
|
integer myOptimIter |
695 |
|
|
integer mythid |
696 |
|
|
logical doglobalread |
697 |
|
|
integer bi |
698 |
|
|
integer bj |
699 |
|
|
logical lAdInit |
700 |
|
|
|
701 |
|
|
c == local variables == |
702 |
|
|
|
703 |
|
|
integer mynr |
704 |
|
|
|
705 |
|
|
c == end of interface == |
706 |
|
|
|
707 |
|
|
mynr = nr |
708 |
|
|
|
709 |
|
|
call active_read_tile_rl( |
710 |
|
|
I active_var_file, |
711 |
|
|
I active_var, |
712 |
|
|
I doglobalread, |
713 |
|
|
I lAdInit, |
714 |
|
|
I irec, |
715 |
|
|
I mynr, |
716 |
|
|
I bi, |
717 |
|
|
I bj, |
718 |
|
|
I FORWARD_SIMULATION, |
719 |
|
|
I myOptimIter, |
720 |
|
|
I mythid |
721 |
|
|
& ) |
722 |
|
|
|
723 |
|
|
return |
724 |
|
|
end |
725 |
|
|
|
726 |
|
|
|
727 |
|
|
subroutine active_write_tile_xy( |
728 |
|
|
I active_var_file, |
729 |
|
|
I active_var, |
730 |
|
|
I irec, |
731 |
|
|
I bi, |
732 |
|
|
I bj, |
733 |
|
|
I myOptimIter, |
734 |
|
|
I mythid |
735 |
|
|
& ) |
736 |
|
|
|
737 |
|
|
c ================================================================== |
738 |
|
|
c SUBROUTINE active_write_tile_xy |
739 |
|
|
c ================================================================== |
740 |
|
|
c |
741 |
|
|
c o Write an active 2D variable to a file. |
742 |
|
|
c |
743 |
|
|
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
744 |
|
|
c |
745 |
|
|
c changed: Christian Eckert eckert@mit.edu 11-Feb-2000 |
746 |
|
|
c |
747 |
|
|
c - Restructured the code in order to create a package |
748 |
|
|
c for the MITgcmUV.c |
749 |
|
|
c |
750 |
|
|
c changed: Christian Eckert eckert@mit.edu 24-Apr-2000 |
751 |
|
|
c |
752 |
|
|
c - Added routines that do active writes on tiles |
753 |
|
|
c instead of a whole thread. |
754 |
|
|
c |
755 |
|
|
c ================================================================== |
756 |
|
|
c SUBROUTINE active_write_tile_xy |
757 |
|
|
c ================================================================== |
758 |
|
|
|
759 |
|
|
implicit none |
760 |
|
|
|
761 |
|
|
c == global variables == |
762 |
|
|
|
763 |
|
|
#include "EEPARAMS.h" |
764 |
|
|
#include "SIZE.h" |
765 |
|
|
|
766 |
|
|
c == routine arguments == |
767 |
|
|
|
768 |
|
|
character*(*) active_var_file |
769 |
|
|
_RL active_var(1-olx:snx+olx,1-oly:sny+oly) |
770 |
|
|
integer irec |
771 |
|
|
integer bi |
772 |
|
|
integer bj |
773 |
|
|
integer myOptimIter |
774 |
|
|
integer mythid |
775 |
|
|
|
776 |
|
|
c == local variables == |
777 |
|
|
|
778 |
|
|
integer mynr |
779 |
|
|
logical globalfile |
780 |
|
|
|
781 |
|
|
c == end of interface == |
782 |
|
|
|
783 |
|
|
mynr = 1 |
784 |
|
|
globalfile = .false. |
785 |
|
|
|
786 |
|
|
call active_write_tile_rl( |
787 |
|
|
I active_var_file, |
788 |
|
|
I active_var, |
789 |
|
|
I globalfile, |
790 |
|
|
I irec, |
791 |
|
|
I mynr, |
792 |
|
|
I bi, |
793 |
|
|
I bj, |
794 |
|
|
I FORWARD_SIMULATION, |
795 |
|
|
I myOptimIter, |
796 |
|
|
I mythid |
797 |
|
|
& ) |
798 |
|
|
|
799 |
|
|
return |
800 |
|
|
end |
801 |
|
|
|
802 |
|
|
|
803 |
|
|
subroutine active_write_tile_xyz( |
804 |
|
|
I active_var_file, |
805 |
|
|
I active_var, |
806 |
|
|
I irec, |
807 |
|
|
I bi, |
808 |
|
|
I bj, |
809 |
|
|
I myOptimIter, |
810 |
|
|
I mythid |
811 |
|
|
& ) |
812 |
|
|
|
813 |
|
|
c ================================================================== |
814 |
|
|
c SUBROUTINE active_write_tile_xyz |
815 |
|
|
c ================================================================== |
816 |
|
|
c |
817 |
|
|
c o Write an active 3D variable to a file. |
818 |
|
|
c |
819 |
|
|
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
820 |
|
|
c |
821 |
|
|
c changed: Christian Eckert eckert@mit.edu 11-Feb-2000 |
822 |
|
|
c |
823 |
|
|
c - Restructured the code in order to create a package |
824 |
|
|
c for the MITgcmUV.c |
825 |
|
|
c |
826 |
|
|
c changed: Christian Eckert eckert@mit.edu 24-Apr-2000 |
827 |
|
|
c |
828 |
|
|
c - Added routines that do active writes on tiles |
829 |
|
|
c instead of a whole thread. |
830 |
|
|
c |
831 |
|
|
c ================================================================== |
832 |
|
|
c SUBROUTINE active_write_tile_xyz |
833 |
|
|
c ================================================================== |
834 |
|
|
|
835 |
|
|
implicit none |
836 |
|
|
|
837 |
|
|
c == global variables == |
838 |
|
|
|
839 |
|
|
#include "EEPARAMS.h" |
840 |
|
|
#include "SIZE.h" |
841 |
|
|
|
842 |
|
|
c == routine arguments == |
843 |
|
|
|
844 |
|
|
character*(*) active_var_file |
845 |
|
|
_RL active_var(1-olx:snx+olx,1-oly:sny+oly,nr) |
846 |
|
|
integer irec |
847 |
|
|
integer bi |
848 |
|
|
integer bj |
849 |
|
|
integer myOptimIter |
850 |
|
|
integer mythid |
851 |
|
|
|
852 |
|
|
c == local variables == |
853 |
|
|
|
854 |
|
|
integer mynr |
855 |
|
|
logical globalfile |
856 |
|
|
|
857 |
|
|
c == end of interface == |
858 |
|
|
|
859 |
|
|
mynr = nr |
860 |
|
|
globalfile = .false. |
861 |
|
|
call active_write_tile_rl( |
862 |
|
|
I active_var_file, |
863 |
|
|
I active_var, |
864 |
|
|
I globalfile, |
865 |
|
|
I irec, |
866 |
|
|
I mynr, |
867 |
|
|
I bi, |
868 |
|
|
I bj, |
869 |
|
|
I FORWARD_SIMULATION, |
870 |
|
|
I myOptimIter, |
871 |
|
|
I mythid |
872 |
|
|
& ) |
873 |
|
|
|
874 |
|
|
return |
875 |
|
|
end |
876 |
heimbach |
1.5 |
|
877 |
|
|
C !ROUTINE: active_read_profile |
878 |
|
|
C !INTERFACE: |
879 |
|
|
subroutine active_read_profile( |
880 |
|
|
I active_num_file, |
881 |
|
|
I nactive_var, |
882 |
|
|
O active_var, |
883 |
|
|
I active_varnum, |
884 |
|
|
I irec, |
885 |
|
|
I lAdInit, |
886 |
|
|
I myOptimIter, |
887 |
|
|
I mythid, |
888 |
|
|
I dummy |
889 |
|
|
& ) |
890 |
|
|
|
891 |
|
|
c ================================================================== |
892 |
|
|
c SUBROUTINE active_read_profile |
893 |
|
|
c ================================================================== |
894 |
|
|
c o Read an active 1D record from an profile data file. |
895 |
|
|
c ================================================================== |
896 |
|
|
|
897 |
|
|
implicit none |
898 |
|
|
c == global variables == |
899 |
|
|
#include "EEPARAMS.h" |
900 |
|
|
#include "SIZE.h" |
901 |
|
|
#include "profiles.h" |
902 |
|
|
|
903 |
|
|
c == routine arguments == |
904 |
|
|
c active_var_file: filename |
905 |
|
|
c nactive_var: integer size of active_var |
906 |
|
|
c active_var: array |
907 |
|
|
c active_varname: name fo the quantity to save |
908 |
|
|
c irec: record number |
909 |
|
|
c myOptimIter: number of optimization iteration (default: 0) |
910 |
|
|
c mythid: thread number for this instance |
911 |
|
|
c lAdInit: initialisation of corresponding adjoint |
912 |
|
|
c variable and write to active file |
913 |
|
|
integer nactive_var,active_num_file |
914 |
|
|
_RL active_var(nactive_var) |
915 |
|
|
integer irec,active_varnum |
916 |
|
|
integer myOptimIter |
917 |
|
|
integer mythid |
918 |
|
|
logical lAdInit |
919 |
|
|
_RL dummy |
920 |
|
|
|
921 |
|
|
|
922 |
|
|
call active_read_profile_rl( fidforward(active_num_file), |
923 |
|
|
& active_num_file, |
924 |
|
|
& nactive_var, active_var, active_varnum, lAdInit, |
925 |
|
|
& irec, prof_ind_glob(active_num_file,irec), |
926 |
|
|
& FORWARD_SIMULATION, myOptimIter, mythid) |
927 |
|
|
|
928 |
|
|
return |
929 |
|
|
end |
930 |
|
|
|
931 |
|
|
c ================================================================== |
932 |
|
|
c ================================================================== |
933 |
|
|
c ================================================================== |
934 |
|
|
|
935 |
|
|
C !ROUTINE: active_write_profile |
936 |
|
|
C !INTERFACE: |
937 |
|
|
subroutine active_write_profile( |
938 |
|
|
I active_num_file, |
939 |
|
|
I nactive_var, |
940 |
|
|
I active_var, |
941 |
|
|
I active_varnum, |
942 |
|
|
I irec, |
943 |
|
|
I myOptimIter, |
944 |
|
|
I mythid, |
945 |
|
|
I dummy |
946 |
|
|
& ) |
947 |
|
|
|
948 |
|
|
C !DESCRIPTION: \bv |
949 |
|
|
c ================================================================== |
950 |
|
|
c SUBROUTINE active_write_profile |
951 |
|
|
c ================================================================== |
952 |
|
|
c o Write an active 1D record from file. |
953 |
|
|
c ================================================================== |
954 |
|
|
|
955 |
|
|
C !USES: |
956 |
|
|
implicit none |
957 |
|
|
|
958 |
|
|
c == global variables == |
959 |
|
|
#include "EEPARAMS.h" |
960 |
|
|
#include "SIZE.h" |
961 |
|
|
#include "profiles.h" |
962 |
|
|
|
963 |
|
|
c == routine arguments == |
964 |
|
|
c active_var_file: filename |
965 |
|
|
c nactive_var: integer size of active_var |
966 |
|
|
c active_var: array |
967 |
|
|
c active_varname: name fo the quantity to save |
968 |
|
|
c irec: record number |
969 |
|
|
c myOptimIter: number of optimization iteration (default: 0) |
970 |
|
|
c mythid: thread number for this instance |
971 |
|
|
integer nactive_var,active_num_file, active_varnum |
972 |
|
|
_RL active_var(nactive_var) |
973 |
|
|
integer irec |
974 |
|
|
integer myOptimIter |
975 |
|
|
integer mythid |
976 |
|
|
_RL dummy |
977 |
|
|
|
978 |
|
|
call active_write_profile_rl( fidforward(active_num_file), |
979 |
|
|
& active_num_file, |
980 |
|
|
& nactive_var, active_var, active_varnum, |
981 |
|
|
& irec, prof_ind_glob(active_num_file,irec), |
982 |
|
|
& FORWARD_SIMULATION, myOptimIter, mythid) |
983 |
|
|
|
984 |
|
|
return |
985 |
|
|
end |
986 |
|
|
|
987 |
|
|
c ================================================================== |
988 |
|
|
|
989 |
|
|
|