1 |
|
2 |
#include "AUTODIFF_OPTIONS.h" |
3 |
|
4 |
c ================================================================== |
5 |
c |
6 |
c active_file_control.F: Routines to handle the i/o of active vari- |
7 |
c ables for the adjoint calculations. All |
8 |
c files are direct access files. |
9 |
c |
10 |
c Routines: |
11 |
c |
12 |
c o active_read_xz_rl_loc - Basic routine to handle active read |
13 |
c operations. |
14 |
c o active_write_xz_rl_loc - Basic routine to handle active write |
15 |
c operations. |
16 |
c o active_read_yz_rl_loc - Basic routine to handle active read |
17 |
c operations. |
18 |
c o active_write_yz_rl_loc - Basic routine to handle active write |
19 |
c operations. |
20 |
c |
21 |
c ================================================================== |
22 |
|
23 |
|
24 |
subroutine active_read_xz_rl_loc( |
25 |
I active_var_file, |
26 |
O active_var, |
27 |
I globalfile, |
28 |
I lAdInit, |
29 |
I irec, |
30 |
I mynr, |
31 |
I theSimulationMode, |
32 |
I myOptimIter, |
33 |
I mythid |
34 |
& ) |
35 |
|
36 |
c ================================================================== |
37 |
c |
38 |
c o Read an active variable from file. |
39 |
c |
40 |
c The variable *globalfile* can be used as a switch, which allows |
41 |
c to read from a global file. The adjoint files are, however, always |
42 |
c treated as tiled files. |
43 |
c |
44 |
c started: heimbach@mit.edu 05-Mar-2001 |
45 |
c |
46 |
c ================================================================== |
47 |
|
48 |
implicit none |
49 |
|
50 |
c == global variables == |
51 |
|
52 |
#include "EEPARAMS.h" |
53 |
#include "SIZE.h" |
54 |
#include "PARAMS.h" |
55 |
#include "ctrl.h" |
56 |
|
57 |
c == routine arguments == |
58 |
|
59 |
character*(*) active_var_file |
60 |
|
61 |
logical globalfile |
62 |
logical lAdInit |
63 |
integer irec |
64 |
integer mynr |
65 |
integer theSimulationMode |
66 |
integer myOptimIter |
67 |
integer mythid |
68 |
_RL active_var(1-olx:snx+olx,mynr,nsx,nsy) |
69 |
|
70 |
c == local variables == |
71 |
|
72 |
character*(2) adpref |
73 |
character*(80) adfname |
74 |
|
75 |
integer bi,bj |
76 |
integer i,j,k |
77 |
integer oldprec |
78 |
integer prec |
79 |
integer il |
80 |
integer ilnblnk |
81 |
|
82 |
logical writeglobalfile |
83 |
|
84 |
_RL active_data_t(1-olx:snx+olx,mynr,nsx,nsy) |
85 |
|
86 |
c == functions == |
87 |
|
88 |
external ilnblnk |
89 |
|
90 |
c == end of interface == |
91 |
|
92 |
c force 64-bit io |
93 |
oldPrec = readBinaryPrec |
94 |
readBinaryPrec = ctrlprec |
95 |
prec = ctrlprec |
96 |
|
97 |
write(adfname(1:80),'(80a)') ' ' |
98 |
adpref = 'ad' |
99 |
il = ilnblnk( active_var_file ) |
100 |
|
101 |
write(adfname(1:2),'(a)') adpref |
102 |
write(adfname(3:il+2),'(a)') active_var_file(1:il) |
103 |
|
104 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
105 |
c >>>>>>>>>>>>>>>>>>> FORWARD RUN <<<<<<<<<<<<<<<<<<< |
106 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
107 |
|
108 |
if (theSimulationMode .eq. FORWARD_SIMULATION) then |
109 |
|
110 |
_BEGIN_MASTER( mythid ) |
111 |
|
112 |
c Read the active variable from file. |
113 |
|
114 |
call mdsreadfieldxz_loc( |
115 |
& active_var_file, |
116 |
& prec, |
117 |
& 'RL', |
118 |
& mynr, |
119 |
& active_var, |
120 |
& irec, |
121 |
& mythid ) |
122 |
|
123 |
if (lAdInit) then |
124 |
c Initialise the corresponding adjoint variable on the |
125 |
c adjoint variable's file. These files are tiled. |
126 |
|
127 |
writeglobalfile = .false. |
128 |
do bj = 1,nsy |
129 |
do bi = 1,nsx |
130 |
do k = 1,mynr |
131 |
do i = 1,snx |
132 |
active_data_t(i,k,bi,bj)= 0. _d 0 |
133 |
enddo |
134 |
enddo |
135 |
enddo |
136 |
enddo |
137 |
|
138 |
call mdswritefieldxz_loc( |
139 |
& adfname, |
140 |
& prec, |
141 |
& globalfile, |
142 |
& 'RL', |
143 |
& mynr, |
144 |
& active_data_t, |
145 |
& irec, |
146 |
& myOptimIter, |
147 |
& mythid ) |
148 |
endif |
149 |
|
150 |
_END_MASTER( mythid ) |
151 |
|
152 |
endif |
153 |
|
154 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
155 |
c >>>>>>>>>>>>>>>>>>> ADJOINT RUN <<<<<<<<<<<<<<<<<<< |
156 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
157 |
|
158 |
if (theSimulationMode .eq. REVERSE_SIMULATION) then |
159 |
|
160 |
_BEGIN_MASTER( mythid ) |
161 |
|
162 |
writeglobalfile = .false. |
163 |
call mdsreadfieldxz_loc( |
164 |
& active_var_file, |
165 |
& prec, |
166 |
& 'RL', |
167 |
& mynr, |
168 |
& active_data_t, |
169 |
& irec, |
170 |
& mythid ) |
171 |
|
172 |
c Add active_var from appropriate location to data. |
173 |
do bj = 1,nsy |
174 |
do bi = 1,nsx |
175 |
do k = 1,mynr |
176 |
do i = 1,snx |
177 |
active_data_t(i,k,bi,bj) = |
178 |
& active_data_t(i,k,bi,bj) + |
179 |
& active_var(i,k,bi,bj) |
180 |
enddo |
181 |
enddo |
182 |
enddo |
183 |
enddo |
184 |
|
185 |
c Store the result on disk. |
186 |
call mdswritefieldxz_loc( |
187 |
& active_var_file, |
188 |
& prec, |
189 |
& writeglobalfile, |
190 |
& 'RL', |
191 |
& mynr, |
192 |
& active_data_t, |
193 |
& irec, |
194 |
& myOptimIter, |
195 |
& mythid ) |
196 |
|
197 |
c Set active_var to zero. |
198 |
do bj = 1,nsy |
199 |
do bi = 1,nsx |
200 |
do k=1,mynr |
201 |
do i = 1,snx |
202 |
active_var(i,k,bi,bj) = 0. _d 0 |
203 |
enddo |
204 |
enddo |
205 |
enddo |
206 |
enddo |
207 |
|
208 |
_END_MASTER( mythid ) |
209 |
endif |
210 |
|
211 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
212 |
c >>>>>>>>>>>>>>>>>>> TANGENT RUN <<<<<<<<<<<<<<<<<<< |
213 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
214 |
|
215 |
if (theSimulationMode .eq. TANGENT_SIMULATION) then |
216 |
|
217 |
_BEGIN_MASTER( mythid ) |
218 |
|
219 |
c Read the active variable from file. |
220 |
|
221 |
call mdsreadfieldxz_loc( |
222 |
& active_var_file, |
223 |
& prec, |
224 |
& 'RL', |
225 |
& mynr, |
226 |
& active_var, |
227 |
& irec, |
228 |
& mythid ) |
229 |
|
230 |
_END_MASTER( mythid ) |
231 |
|
232 |
endif |
233 |
|
234 |
c Reset default io precision. |
235 |
readBinaryPrec = oldPrec |
236 |
|
237 |
_BARRIER |
238 |
|
239 |
return |
240 |
end |
241 |
|
242 |
c ================================================================== |
243 |
|
244 |
subroutine active_write_xz_rl_loc( |
245 |
I active_var_file, |
246 |
I active_var, |
247 |
I globalfile, |
248 |
I irec, |
249 |
I mynr, |
250 |
I theSimulationMode, |
251 |
I myOptimIter, |
252 |
I mythid |
253 |
& ) |
254 |
|
255 |
c ================================================================== |
256 |
c |
257 |
c o Write an active variable to a file. |
258 |
c |
259 |
c started: heimbach@mit.edu 05-Mar-2001 |
260 |
c |
261 |
c ================================================================== |
262 |
|
263 |
implicit none |
264 |
|
265 |
c == global variables == |
266 |
|
267 |
#include "EEPARAMS.h" |
268 |
#include "SIZE.h" |
269 |
#include "PARAMS.h" |
270 |
#include "ctrl.h" |
271 |
|
272 |
c == routine arguments == |
273 |
|
274 |
character*(*) active_var_file |
275 |
|
276 |
integer mynr |
277 |
logical globalfile |
278 |
integer irec |
279 |
integer theSimulationMode |
280 |
integer myOptimIter |
281 |
integer mythid |
282 |
_RL active_var(1-olx:snx+olx,mynr,nsx,nsy) |
283 |
|
284 |
c == local variables == |
285 |
|
286 |
integer i,j,k |
287 |
integer bi,bj |
288 |
_RL active_data_t(1-olx:snx+olx,mynr,nsx,nsy) |
289 |
integer oldprec |
290 |
integer prec |
291 |
|
292 |
c == end of interface == |
293 |
|
294 |
c force 64-bit io |
295 |
oldPrec = readBinaryPrec |
296 |
readBinaryPrec = ctrlprec |
297 |
prec = ctrlprec |
298 |
|
299 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
300 |
c >>>>>>>>>>>>>>>>>>> FORWARD RUN <<<<<<<<<<<<<<<<<<< |
301 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
302 |
|
303 |
if (theSimulationMode .eq. FORWARD_SIMULATION) then |
304 |
|
305 |
_BEGIN_MASTER( mythid ) |
306 |
|
307 |
call mdswritefieldxz_loc( |
308 |
& active_var_file, |
309 |
& prec, |
310 |
& globalfile, |
311 |
& 'RL', |
312 |
& mynr, |
313 |
& active_var, |
314 |
& irec, |
315 |
& myOptimIter, |
316 |
& mythid ) |
317 |
|
318 |
_END_MASTER( mythid ) |
319 |
|
320 |
endif |
321 |
|
322 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
323 |
c >>>>>>>>>>>>>>>>>>> ADJOINT RUN <<<<<<<<<<<<<<<<<<< |
324 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
325 |
|
326 |
if (theSimulationMode .eq. REVERSE_SIMULATION) then |
327 |
|
328 |
_BEGIN_MASTER( mythid ) |
329 |
|
330 |
call mdsreadfieldxz_loc( |
331 |
& active_var_file, |
332 |
& prec, |
333 |
& 'RL', |
334 |
& mynr, |
335 |
& active_data_t, |
336 |
& irec, |
337 |
& mythid ) |
338 |
|
339 |
c Add active_var from appropriate location to data. |
340 |
do bj = 1,nsy |
341 |
do bi = 1,nsx |
342 |
do k = 1,mynr |
343 |
do i = 1,snx |
344 |
active_var(i,k,bi,bj) = |
345 |
& active_var(i,k,bi,bj) + |
346 |
& active_data_t(i,k,bi,bj) |
347 |
active_data_t(i,k,bi,bj) = 0. _d 0 |
348 |
enddo |
349 |
enddo |
350 |
enddo |
351 |
enddo |
352 |
call mdswritefieldxz_loc( |
353 |
& active_var_file, |
354 |
& prec, |
355 |
& globalfile, |
356 |
& 'RL', |
357 |
& mynr, |
358 |
& active_data_t, |
359 |
& irec, |
360 |
& myOptimIter, |
361 |
& mythid ) |
362 |
|
363 |
_END_MASTER( mythid ) |
364 |
|
365 |
endif |
366 |
|
367 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
368 |
c >>>>>>>>>>>>>>>>>>> TANGENT RUN <<<<<<<<<<<<<<<<<<< |
369 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
370 |
|
371 |
if (theSimulationMode .eq. TANGENT_SIMULATION) then |
372 |
|
373 |
_BEGIN_MASTER( mythid ) |
374 |
|
375 |
call mdswritefieldxz_loc( |
376 |
& active_var_file, |
377 |
& prec, |
378 |
& globalfile, |
379 |
& 'RL', |
380 |
& mynr, |
381 |
& active_var, |
382 |
& irec, |
383 |
& myOptimIter, |
384 |
& mythid ) |
385 |
|
386 |
_END_MASTER( mythid ) |
387 |
|
388 |
endif |
389 |
|
390 |
c Reset default io precision. |
391 |
readBinaryPrec = oldPrec |
392 |
|
393 |
_BARRIER |
394 |
|
395 |
return |
396 |
end |
397 |
|
398 |
c ================================================================== |
399 |
|
400 |
subroutine active_read_yz_rl_loc( |
401 |
I active_var_file, |
402 |
O active_var, |
403 |
I globalfile, |
404 |
I lAdInit, |
405 |
I irec, |
406 |
I mynr, |
407 |
I theSimulationMode, |
408 |
I myOptimIter, |
409 |
I mythid |
410 |
& ) |
411 |
|
412 |
c ================================================================== |
413 |
c |
414 |
c o Read an active variable from file. |
415 |
c |
416 |
c The variable *globalfile* can be used as a switch, which allows |
417 |
c to read from a global file. The adjoint files are, however, always |
418 |
c treated as tiled files. |
419 |
c |
420 |
c started: heimbach@mit.edu 05-Mar-2001 |
421 |
c |
422 |
c ================================================================== |
423 |
|
424 |
implicit none |
425 |
|
426 |
c == global variables == |
427 |
|
428 |
#include "EEPARAMS.h" |
429 |
#include "SIZE.h" |
430 |
#include "PARAMS.h" |
431 |
#include "ctrl.h" |
432 |
|
433 |
c == routine arguments == |
434 |
|
435 |
character*(*) active_var_file |
436 |
|
437 |
logical globalfile |
438 |
logical lAdInit |
439 |
integer irec |
440 |
integer mynr |
441 |
integer theSimulationMode |
442 |
integer myOptimIter |
443 |
integer mythid |
444 |
_RL active_var(1-oly:sny+oly,mynr,nsx,nsy) |
445 |
|
446 |
c == local variables == |
447 |
|
448 |
character*(2) adpref |
449 |
character*(80) adfname |
450 |
|
451 |
integer bi,bj |
452 |
integer i,j,k |
453 |
integer oldprec |
454 |
integer prec |
455 |
integer il |
456 |
integer ilnblnk |
457 |
|
458 |
logical writeglobalfile |
459 |
|
460 |
_RL active_data_t(1-oly:sny+oly,mynr,nsx,nsy) |
461 |
|
462 |
c == functions == |
463 |
|
464 |
external ilnblnk |
465 |
|
466 |
c == end of interface == |
467 |
|
468 |
c force 64-bit io |
469 |
oldPrec = readBinaryPrec |
470 |
readBinaryPrec = ctrlprec |
471 |
prec = ctrlprec |
472 |
|
473 |
write(adfname(1:80),'(80a)') ' ' |
474 |
adpref = 'ad' |
475 |
il = ilnblnk( active_var_file ) |
476 |
|
477 |
write(adfname(1:2),'(a)') adpref |
478 |
write(adfname(3:il+2),'(a)') active_var_file(1:il) |
479 |
|
480 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
481 |
c >>>>>>>>>>>>>>>>>>> FORWARD RUN <<<<<<<<<<<<<<<<<<< |
482 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
483 |
|
484 |
if (theSimulationMode .eq. FORWARD_SIMULATION) then |
485 |
|
486 |
_BEGIN_MASTER( mythid ) |
487 |
|
488 |
c Read the active variable from file. |
489 |
|
490 |
call mdsreadfieldyz_loc( |
491 |
& active_var_file, |
492 |
& prec, |
493 |
& 'RL', |
494 |
& mynr, |
495 |
& active_var, |
496 |
& irec, |
497 |
& mythid ) |
498 |
|
499 |
if (lAdInit) then |
500 |
c Initialise the corresponding adjoint variable on the |
501 |
c adjoint variable's file. These files are tiled. |
502 |
|
503 |
writeglobalfile = .false. |
504 |
do bj = 1,nsy |
505 |
do bi = 1,nsx |
506 |
do k = 1,mynr |
507 |
do j = 1,sny |
508 |
active_data_t(j,k,bi,bj)= 0. _d 0 |
509 |
enddo |
510 |
enddo |
511 |
enddo |
512 |
enddo |
513 |
|
514 |
call mdswritefieldyz_loc( |
515 |
& adfname, |
516 |
& prec, |
517 |
& globalfile, |
518 |
& 'RL', |
519 |
& mynr, |
520 |
& active_data_t, |
521 |
& irec, |
522 |
& myOptimIter, |
523 |
& mythid ) |
524 |
endif |
525 |
|
526 |
_END_MASTER( mythid ) |
527 |
|
528 |
endif |
529 |
|
530 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
531 |
c >>>>>>>>>>>>>>>>>>> ADJOINT RUN <<<<<<<<<<<<<<<<<<< |
532 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
533 |
|
534 |
if (theSimulationMode .eq. REVERSE_SIMULATION) then |
535 |
|
536 |
_BEGIN_MASTER( mythid ) |
537 |
|
538 |
writeglobalfile = .false. |
539 |
call mdsreadfieldyz_loc( |
540 |
& active_var_file, |
541 |
& prec, |
542 |
& 'RL', |
543 |
& mynr, |
544 |
& active_data_t, |
545 |
& irec, |
546 |
& mythid ) |
547 |
|
548 |
c Add active_var from appropriate location to data. |
549 |
do bj = 1,nsy |
550 |
do bi = 1,nsx |
551 |
do k = 1,mynr |
552 |
do j = 1,sny |
553 |
active_data_t(j,k,bi,bj) = |
554 |
& active_data_t(j,k,bi,bj) + |
555 |
& active_var(j,k,bi,bj) |
556 |
enddo |
557 |
enddo |
558 |
enddo |
559 |
enddo |
560 |
|
561 |
c Store the result on disk. |
562 |
call mdswritefieldyz_loc( |
563 |
& active_var_file, |
564 |
& prec, |
565 |
& writeglobalfile, |
566 |
& 'RL', |
567 |
& mynr, |
568 |
& active_data_t, |
569 |
& irec, |
570 |
& myOptimIter, |
571 |
& mythid ) |
572 |
|
573 |
c Set active_var to zero. |
574 |
do bj = 1,nsy |
575 |
do bi = 1,nsx |
576 |
do k = 1,mynr |
577 |
do j = 1,sny |
578 |
active_var(j,k,bi,bj) = 0. _d 0 |
579 |
enddo |
580 |
enddo |
581 |
enddo |
582 |
enddo |
583 |
|
584 |
_END_MASTER( mythid ) |
585 |
endif |
586 |
|
587 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
588 |
c >>>>>>>>>>>>>>>>>>> TANGENT RUN <<<<<<<<<<<<<<<<<<< |
589 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
590 |
|
591 |
if (theSimulationMode .eq. TANGENT_SIMULATION) then |
592 |
|
593 |
_BEGIN_MASTER( mythid ) |
594 |
|
595 |
c Read the active variable from file. |
596 |
|
597 |
call mdsreadfieldyz_loc( |
598 |
& active_var_file, |
599 |
& prec, |
600 |
& 'RL', |
601 |
& mynr, |
602 |
& active_var, |
603 |
& irec, |
604 |
& mythid ) |
605 |
|
606 |
_END_MASTER( mythid ) |
607 |
|
608 |
endif |
609 |
|
610 |
c Reset default io precision. |
611 |
readBinaryPrec = oldPrec |
612 |
|
613 |
_BARRIER |
614 |
|
615 |
return |
616 |
end |
617 |
|
618 |
c ================================================================== |
619 |
|
620 |
subroutine active_write_yz_rl_loc( |
621 |
I active_var_file, |
622 |
I active_var, |
623 |
I globalfile, |
624 |
I irec, |
625 |
I mynr, |
626 |
I theSimulationMode, |
627 |
I myOptimIter, |
628 |
I mythid |
629 |
& ) |
630 |
|
631 |
c ================================================================== |
632 |
c |
633 |
c o Write an active variable to a file. |
634 |
c |
635 |
c started: heimbach@mit.edu 05-Mar-2001 |
636 |
c |
637 |
c ================================================================== |
638 |
|
639 |
implicit none |
640 |
|
641 |
c == global variables == |
642 |
|
643 |
#include "EEPARAMS.h" |
644 |
#include "SIZE.h" |
645 |
#include "PARAMS.h" |
646 |
#include "ctrl.h" |
647 |
|
648 |
c == routine arguments == |
649 |
|
650 |
character*(*) active_var_file |
651 |
|
652 |
integer mynr |
653 |
logical globalfile |
654 |
integer irec |
655 |
integer theSimulationMode |
656 |
integer myOptimIter |
657 |
integer mythid |
658 |
_RL active_var(1-oly:sny+oly,mynr,nsx,nsy) |
659 |
|
660 |
c == local variables == |
661 |
|
662 |
integer i,j,k |
663 |
integer bi,bj |
664 |
_RL active_data_t(1-oly:sny+oly,mynr,nsx,nsy) |
665 |
integer oldprec |
666 |
integer prec |
667 |
|
668 |
c == end of interface == |
669 |
|
670 |
c force 64-bit io |
671 |
oldPrec = readBinaryPrec |
672 |
readBinaryPrec = ctrlprec |
673 |
prec = ctrlprec |
674 |
|
675 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
676 |
c >>>>>>>>>>>>>>>>>>> FORWARD RUN <<<<<<<<<<<<<<<<<<< |
677 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
678 |
|
679 |
if (theSimulationMode .eq. FORWARD_SIMULATION) then |
680 |
|
681 |
_BEGIN_MASTER( mythid ) |
682 |
|
683 |
call mdswritefieldyz_loc( |
684 |
& active_var_file, |
685 |
& prec, |
686 |
& globalfile, |
687 |
& 'RL', |
688 |
& mynr, |
689 |
& active_var, |
690 |
& irec, |
691 |
& myOptimIter, |
692 |
& mythid ) |
693 |
|
694 |
_END_MASTER( mythid ) |
695 |
|
696 |
endif |
697 |
|
698 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
699 |
c >>>>>>>>>>>>>>>>>>> ADJOINT RUN <<<<<<<<<<<<<<<<<<< |
700 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
701 |
|
702 |
if (theSimulationMode .eq. REVERSE_SIMULATION) then |
703 |
|
704 |
_BEGIN_MASTER( mythid ) |
705 |
|
706 |
call mdsreadfieldyz_loc( |
707 |
& active_var_file, |
708 |
& prec, |
709 |
& 'RL', |
710 |
& mynr, |
711 |
& active_data_t, |
712 |
& irec, |
713 |
& mythid ) |
714 |
|
715 |
c Add active_var from appropriate location to data. |
716 |
do bj = 1,nsy |
717 |
do bi = 1,nsx |
718 |
do k = 1,mynr |
719 |
do j = 1,sny |
720 |
active_var(j,k,bi,bj) = |
721 |
& active_var(j,k,bi,bj) + |
722 |
& active_data_t(j,k,bi,bj) |
723 |
active_data_t(j,k,bi,bj) = 0. _d 0 |
724 |
enddo |
725 |
enddo |
726 |
enddo |
727 |
enddo |
728 |
call mdswritefieldyz_loc( |
729 |
& active_var_file, |
730 |
& prec, |
731 |
& globalfile, |
732 |
& 'RL', |
733 |
& mynr, |
734 |
& active_data_t, |
735 |
& irec, |
736 |
& myOptimIter, |
737 |
& mythid ) |
738 |
|
739 |
_END_MASTER( mythid ) |
740 |
|
741 |
endif |
742 |
|
743 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
744 |
c >>>>>>>>>>>>>>>>>>> TANGENTY RUN <<<<<<<<<<<<<<<<<<< |
745 |
c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<< |
746 |
|
747 |
if (theSimulationMode .eq. TANGENT_SIMULATION) then |
748 |
|
749 |
_BEGIN_MASTER( mythid ) |
750 |
|
751 |
call mdswritefieldyz_loc( |
752 |
& active_var_file, |
753 |
& prec, |
754 |
& globalfile, |
755 |
& 'RL', |
756 |
& mynr, |
757 |
& active_var, |
758 |
& irec, |
759 |
& myOptimIter, |
760 |
& mythid ) |
761 |
|
762 |
_END_MASTER( mythid ) |
763 |
|
764 |
endif |
765 |
|
766 |
c Reset default io precision. |
767 |
readBinaryPrec = oldPrec |
768 |
|
769 |
_BARRIER |
770 |
|
771 |
return |
772 |
end |
773 |
|