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