/[MITgcm]/MITgcm/pkg/autodiff/active_file_loc_control_slice.F
ViewVC logotype

Contents of /MITgcm/pkg/autodiff/active_file_loc_control_slice.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download)
Thu Oct 9 04:19:18 2003 UTC (20 years, 7 months ago) by edhill
Branch: MAIN
CVS Tags: checkpoint51k_post, checkpoint53f_post, checkpoint54a_pre, checkpoint55c_post, checkpoint57b_post, checkpoint53b_pre, checkpoint51l_post, checkpoint55e_post, checkpoint52d_pre, checkpoint52l_pre, checkpoint52e_pre, hrcube4, checkpoint52n_post, checkpoint52j_post, checkpoint53d_post, checkpoint51o_pre, checkpoint57f_post, checkpoint52e_post, checkpoint51n_pre, checkpoint53c_post, checkpoint55d_pre, checkpoint57d_post, checkpoint57g_post, checkpoint57c_pre, checkpoint55j_post, checkpoint56b_post, checkpoint57i_post, checkpoint51q_post, checkpoint52j_pre, checkpoint54a_post, branch-netcdf, checkpoint52l_post, checkpoint55h_post, checkpoint51r_post, checkpoint52k_post, checkpoint52b_pre, checkpoint57g_pre, checkpoint54b_post, checkpoint51i_post, checkpoint57e_post, checkpoint54d_post, checkpoint56c_post, checkpoint54e_post, checkpoint55b_post, checkpoint57h_post, checkpoint51l_pre, checkpoint52m_post, checkpoint55, checkpoint53a_post, checkpoint57f_pre, checkpoint57a_post, checkpoint54, checkpoint54f_post, checkpoint53b_post, checkpoint55g_post, checkpoint51o_post, checkpoint51p_post, checkpoint55f_post, checkpoint57a_pre, checkpoint55i_post, checkpoint57, checkpoint56, checkpoint53, checkpoint52, checkpoint52d_post, eckpoint57e_pre, checkpoint52a_post, checkpoint57h_done, checkpoint52b_post, checkpoint53g_post, checkpoint52f_post, checkpoint52c_post, ecco_c52_e35, hrcube5, checkpoint57c_post, checkpoint52a_pre, checkpoint52i_post, checkpoint55a_post, checkpoint51t_post, checkpoint53d_pre, checkpoint54c_post, checkpoint51n_post, checkpoint57h_pre, checkpoint52i_pre, checkpoint51u_post, checkpoint52h_pre, checkpoint52f_pre, hrcube_1, hrcube_2, hrcube_3, checkpoint56a_post, checkpoint51m_post, checkpoint51s_post, checkpoint55d_post
Branch point for: netcdf-sm0, branch-nonh, tg2-branch, checkpoint51n_branch
Changes since 1.2: +1 -1 lines
 o first check-in for the "branch-genmake2" merge
 o verification suite as run on shelley (gcc 3.2.2):

Wed Oct  8 23:42:29 EDT 2003
                T           S           U           V
G D M    c        m  s        m  s        m  s        m  s
E p a R  g  m  m  e  .  m  m  e  .  m  m  e  .  m  m  e  .
N n k u  2  i  a  a  d  i  a  a  d  i  a  a  d  i  a  a  d
2 d e n  d  n  x  n  .  n  x  n  .  n  x  n  .  n  x  n  .

OPTFILE=NONE

Y Y Y Y 13 16 16 16  0 16 16 16 16 16 16 16 16 13 12  0  0 pass  adjustment.128x64x1
Y Y Y Y 16 16 16 16  0 16 16 16 16 16 16  0  0 16 16  0  0 pass  adjustment.cs-32x32x1
Y Y Y Y 16 16 16 16  0 16 16 16 16 16 16 22  0 16 16 22  0 pass  adjust_nlfs.cs-32x32x1
Y Y Y Y -- 13 13 16 16 13 13 13 13 16 16 16 16 16 16 16 16 N/O   advect_cs
Y Y Y Y -- 22 16 16 16 16 16 16 13 16 16 16 16 16 16 16 16 N/O   advect_xy
Y Y Y Y -- 13 16 13 16 16 16 16 16 16 16 22 16 16 16 16 16 N/O   advect_xz
Y Y Y Y 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 pass  aim.5l_cs
Y Y Y Y 14 16 16 16 16 16 16 16 16 13 16 16 16 16 16 13 16 pass  aim.5l_Equatorial_Channel
Y Y Y Y 16 16 16 16 16 16 16 16 16 16 16 13 16 16 13 13 16 pass  aim.5l_LatLon
Y Y Y Y 13 16 16 16 16 16 16 16 16 16 13 12 13 13 16 13 16 pass  exp0
Y Y Y Y 14 16 16 16 16 16 16 16 22 16 16 16 13 16 16 22 16 pass  exp1
Y Y Y Y 13 13 16 13 16 16 16 16 16 13 13 16 16 13 13 13 13 pass  exp2
Y Y Y Y 16 16 16 16 16 16 16 16 22 16 16 16 16 16 16 16 16 pass  exp4
Y Y Y Y 16 16 16 16 16 16 16 16 16 16 16 22 16 16 16 22 16 pass  exp5
Y Y Y Y 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 pass  front_relax
Y Y Y Y 14 16 16 13 13 16 16 13 13 16 13 13 16 12 13 13 16 pass  global_ocean.90x40x15
Y Y Y Y 10 16 16 13 13 16 13 16 16 13 13 13 13 16 16 13 16 FAIL  global_ocean.cs32x15
Y Y Y Y  6 11 12 13 13 12 13 16 13  9  9  9  9 10  9  9 11 FAIL  global_ocean_pressure
Y Y Y Y 14 16 16 13 16 16 16 13 13 13 13 13 16 12 16 13 16 pass  global_with_exf
Y Y Y Y 14 16 16 16 16 16 16 16 16 11 13 22 13 16 16  9 16 pass  hs94.128x64x5
Y Y Y Y 13 16 16 16 16 16 16 16 16 11 16 16 16 13 16 22 13 pass  hs94.1x64x5
Y Y Y Y 14 16 16 16 16 16 16 16 16 13 16 13 13 16 16 22 13 pass  hs94.cs-32x32x5
Y Y Y Y 10 10 16 13 13 16 16 16 22 16 13 13 13 13 13 22 13 FAIL  ideal_2D_oce
Y Y Y Y  8 16 16 16 16 16 16 16 16 13 13  8 16 16 16 16 16 FAIL  internal_wave
Y Y Y Y 14 16 16 16 16 16 16 16 16 13 13 22 13 13 13 22 16 pass  inverted_barometer
Y Y Y Y 12 16 16 16 16 16 16 16 16 16 13 12 13 13 13 13 13 FAIL  lab_sea
Y Y Y Y 11 16 16 16 16 16 16 16 13 13 13 12 13 16 13 12 13 FAIL  natl_box
Y Y Y Y 16 16 16 16 16 16 16 16 22 16 16 16 16 16 16 16 16 pass  plume_on_slope
Y Y Y Y 13 16 16 16 16 13 16 16 16 16 16 16 16 13 16 16 16 pass  solid-body.cs-32x32x1

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
56 c == routine arguments ==
57
58 character*(*) active_var_file
59
60 logical globalfile
61 logical lAdInit
62 integer irec
63 integer mynr
64 integer theSimulationMode
65 integer myOptimIter
66 integer mythid
67 _RL active_var(1-olx:snx+olx,mynr,nsx,nsy)
68
69 c == local variables ==
70
71 character*(2) adpref
72 character*(80) adfname
73
74 integer bi,bj
75 integer i,j,k
76 integer oldprec
77 integer prec
78 integer il
79 integer ilnblnk
80
81 logical writeglobalfile
82
83 _RL active_data_t(1-olx:snx+olx,nsx,nsy)
84
85 c == functions ==
86
87 external ilnblnk
88
89 c == end of interface ==
90
91 c force 64-bit io
92 oldPrec = readBinaryPrec
93 readBinaryPrec = precFloat64
94 prec = precFloat64
95
96 write(adfname(1:80),'(80a)') ' '
97 adpref = 'ad'
98 il = ilnblnk( active_var_file )
99
100 write(adfname(1:2),'(a)') adpref
101 write(adfname(3:il+2),'(a)') active_var_file(1:il)
102
103 c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
104 c >>>>>>>>>>>>>>>>>>> FORWARD RUN <<<<<<<<<<<<<<<<<<<
105 c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
106
107 if (theSimulationMode .eq. FORWARD_SIMULATION) then
108
109 _BEGIN_MASTER( mythid )
110
111 c Read the active variable from file.
112
113 call mdsreadfieldxz_loc(
114 & active_var_file,
115 & prec,
116 & 'RL',
117 & mynr,
118 & active_var,
119 & irec,
120 & mythid )
121
122 if (lAdInit) then
123 c Initialise the corresponding adjoint variable on the
124 c adjoint variable's file. These files are tiled.
125
126 writeglobalfile = .false.
127 do bj = 1,nsy
128 do bi = 1,nsx
129 do i = 1,snx
130 active_data_t(i,bi,bj)= 0. _d 0
131 enddo
132 enddo
133 enddo
134
135 do k = 1,mynr
136 call mdswritefieldxz_loc(
137 & adfname,
138 & prec,
139 & globalfile,
140 & 'RL',
141 & 1,
142 & active_data_t,
143 & (irec-1)*mynr+k,
144 & myOptimIter,
145 & mythid )
146 enddo
147 endif
148
149 _END_MASTER( mythid )
150
151 endif
152
153 c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
154 c >>>>>>>>>>>>>>>>>>> ADJOINT RUN <<<<<<<<<<<<<<<<<<<
155 c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
156
157 if (theSimulationMode .eq. REVERSE_SIMULATION) then
158
159 _BEGIN_MASTER( mythid )
160
161 writeglobalfile = .false.
162 do k=1,mynr
163 c Read data from file layer by layer.
164 call mdsreadfieldxz_loc(
165 & active_var_file,
166 & prec,
167 & 'RL',
168 & 1,
169 & active_data_t,
170 & (irec-1)*mynr+k,
171 & mythid )
172
173 c Add active_var from appropriate location to data.
174 do bj = 1,nsy
175 do bi = 1,nsx
176 do i = 1,snx
177 active_data_t(i,bi,bj) = active_data_t(i,bi,bj) +
178 & active_var(i,k,bi,bj)
179 enddo
180 enddo
181 enddo
182
183 c Store the result on disk.
184 call mdswritefieldxz_loc(
185 & active_var_file,
186 & prec,
187 & writeglobalfile,
188 & 'RL',
189 & 1,
190 & active_data_t,
191 & (irec-1)*mynr+k,
192 & myOptimIter,
193 & mythid )
194 enddo
195
196
197 c Set active_var to zero.
198 do k=1,mynr
199 do bj = 1,nsy
200 do bi = 1,nsx
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
271 c == routine arguments ==
272
273 character*(*) active_var_file
274
275 integer mynr
276 logical globalfile
277 integer irec
278 integer theSimulationMode
279 integer myOptimIter
280 integer mythid
281 _RL active_var(1-olx:snx+olx,mynr,nsx,nsy)
282
283 c == local variables ==
284
285 integer i,j,k
286 integer bi,bj
287 _RL active_data_t(1-olx:snx+olx,nsx,nsy)
288 integer oldprec
289 integer prec
290
291 c == end of interface ==
292
293 c force 64-bit io
294 oldPrec = readBinaryPrec
295 readBinaryPrec = precFloat64
296 prec = precFloat64
297
298 c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
299 c >>>>>>>>>>>>>>>>>>> FORWARD RUN <<<<<<<<<<<<<<<<<<<
300 c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
301
302 if (theSimulationMode .eq. FORWARD_SIMULATION) then
303
304 _BEGIN_MASTER( mythid )
305
306 call mdswritefieldxz_loc(
307 & active_var_file,
308 & prec,
309 & globalfile,
310 & 'RL',
311 & mynr,
312 & active_var,
313 & irec,
314 & myOptimIter,
315 & mythid )
316
317 _END_MASTER( mythid )
318
319 endif
320
321 c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
322 c >>>>>>>>>>>>>>>>>>> ADJOINT RUN <<<<<<<<<<<<<<<<<<<
323 c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
324
325 if (theSimulationMode .eq. REVERSE_SIMULATION) then
326
327 _BEGIN_MASTER( mythid )
328
329 do k=1,mynr
330 c Read data from file layer by layer.
331 call mdsreadfieldxz_loc(
332 & active_var_file,
333 & prec,
334 & 'RL',
335 & 1,
336 & active_data_t,
337 & (irec-1)*mynr+k,
338 & mythid )
339
340 c Add active_var from appropriate location to data.
341 do bj = 1,nsy
342 do bi = 1,nsx
343 do i = 1,snx
344 active_var(i,k,bi,bj) =
345 & active_var(i,k,bi,bj) +
346 & active_data_t(i,bi,bj)
347 active_data_t(i,bi,bj) = 0. _d 0
348 enddo
349 enddo
350 enddo
351 call mdswritefieldxz_loc(
352 & active_var_file,
353 & prec,
354 & globalfile,
355 & 'RL',
356 & 1,
357 & active_data_t,
358 & (irec-1)*mynr+k,
359 & myOptimIter,
360 & mythid )
361 enddo
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
432 c == routine arguments ==
433
434 character*(*) active_var_file
435
436 logical globalfile
437 logical lAdInit
438 integer irec
439 integer mynr
440 integer theSimulationMode
441 integer myOptimIter
442 integer mythid
443 _RL active_var(1-oly:sny+oly,mynr,nsx,nsy)
444
445 c == local variables ==
446
447 character*(2) adpref
448 character*(80) adfname
449
450 integer bi,bj
451 integer i,j,k
452 integer oldprec
453 integer prec
454 integer il
455 integer ilnblnk
456
457 logical writeglobalfile
458
459 _RL active_data_t(1-oly:sny+oly,nsx,nsy)
460
461 c == functions ==
462
463 external ilnblnk
464
465 c == end of interface ==
466
467 c force 64-bit io
468 oldPrec = readBinaryPrec
469 readBinaryPrec = precFloat64
470 prec = precFloat64
471
472 write(adfname(1:80),'(80a)') ' '
473 adpref = 'ad'
474 il = ilnblnk( active_var_file )
475
476 write(adfname(1:2),'(a)') adpref
477 write(adfname(3:il+2),'(a)') active_var_file(1:il)
478
479 c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
480 c >>>>>>>>>>>>>>>>>>> FORWARD RUN <<<<<<<<<<<<<<<<<<<
481 c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
482
483 if (theSimulationMode .eq. FORWARD_SIMULATION) then
484
485 _BEGIN_MASTER( mythid )
486
487 c Read the active variable from file.
488
489 call mdsreadfieldyz_loc(
490 & active_var_file,
491 & prec,
492 & 'RL',
493 & mynr,
494 & active_var,
495 & irec,
496 & mythid )
497
498 if (lAdInit) then
499 c Initialise the corresponding adjoint variable on the
500 c adjoint variable's file. These files are tiled.
501
502 writeglobalfile = .false.
503 do bj = 1,nsy
504 do bi = 1,nsx
505 do j = 1,sny
506 active_data_t(j,bi,bj)= 0. _d 0
507 enddo
508 enddo
509 enddo
510
511 do k = 1,mynr
512 call mdswritefieldyz_loc(
513 & adfname,
514 & prec,
515 & globalfile,
516 & 'RL',
517 & 1,
518 & active_data_t,
519 & (irec-1)*mynr+k,
520 & myOptimIter,
521 & mythid )
522 enddo
523 endif
524
525 _END_MASTER( mythid )
526
527 endif
528
529 c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
530 c >>>>>>>>>>>>>>>>>>> ADJOINT RUN <<<<<<<<<<<<<<<<<<<
531 c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
532
533 if (theSimulationMode .eq. REVERSE_SIMULATION) then
534
535 _BEGIN_MASTER( mythid )
536
537 writeglobalfile = .false.
538 do k=1,mynr
539 c Read data from file layer by layer.
540 call mdsreadfieldyz_loc(
541 & active_var_file,
542 & prec,
543 & 'RL',
544 & 1,
545 & active_data_t,
546 & (irec-1)*mynr+k,
547 & mythid )
548
549 c Add active_var from appropriate location to data.
550 do bj = 1,nsy
551 do bi = 1,nsx
552 do j = 1,sny
553 active_data_t(j,bi,bj) = active_data_t(j,bi,bj) +
554 & active_var(j,k,bi,bj)
555 enddo
556 enddo
557 enddo
558
559 c Store the result on disk.
560 call mdswritefieldyz_loc(
561 & active_var_file,
562 & prec,
563 & writeglobalfile,
564 & 'RL',
565 & 1,
566 & active_data_t,
567 & (irec-1)*mynr+k,
568 & myOptimIter,
569 & mythid )
570 enddo
571
572
573 c Set active_var to zero.
574 do k=1,mynr
575 do bj = 1,nsy
576 do bi = 1,nsx
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
647 c == routine arguments ==
648
649 character*(*) active_var_file
650
651 integer mynr
652 logical globalfile
653 integer irec
654 integer theSimulationMode
655 integer myOptimIter
656 integer mythid
657 _RL active_var(1-oly:sny+oly,mynr,nsx,nsy)
658
659 c == local variables ==
660
661 integer i,j,k
662 integer bi,bj
663 _RL active_data_t(1-oly:sny+oly,nsx,nsy)
664 integer oldprec
665 integer prec
666
667 c == end of interface ==
668
669 c force 64-bit io
670 oldPrec = readBinaryPrec
671 readBinaryPrec = precFloat64
672 prec = precFloat64
673
674 c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
675 c >>>>>>>>>>>>>>>>>>> FORWARD RUN <<<<<<<<<<<<<<<<<<<
676 c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
677
678 if (theSimulationMode .eq. FORWARD_SIMULATION) then
679
680 _BEGIN_MASTER( mythid )
681
682 call mdswritefieldyz_loc(
683 & active_var_file,
684 & prec,
685 & globalfile,
686 & 'RL',
687 & mynr,
688 & active_var,
689 & irec,
690 & myOptimIter,
691 & mythid )
692
693 _END_MASTER( mythid )
694
695 endif
696
697 c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
698 c >>>>>>>>>>>>>>>>>>> ADJOINT RUN <<<<<<<<<<<<<<<<<<<
699 c >>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<
700
701 if (theSimulationMode .eq. REVERSE_SIMULATION) then
702
703 _BEGIN_MASTER( mythid )
704
705 do k=1,mynr
706 c Read data from file layer by layer.
707 call mdsreadfieldyz_loc(
708 & active_var_file,
709 & prec,
710 & 'RL',
711 & 1,
712 & active_data_t,
713 & (irec-1)*mynr+k,
714 & mythid )
715
716 c Add active_var from appropriate location to data.
717 do bj = 1,nsy
718 do bi = 1,nsx
719 do j = 1,sny
720 active_var(j,k,bi,bj) =
721 & active_var(j,k,bi,bj) +
722 & active_data_t(j,bi,bj)
723 active_data_t(j,bi,bj) = 0. _d 0
724 enddo
725 enddo
726 enddo
727 call mdswritefieldyz_loc(
728 & active_var_file,
729 & prec,
730 & globalfile,
731 & 'RL',
732 & 1,
733 & active_data_t,
734 & (irec-1)*mynr+k,
735 & myOptimIter,
736 & mythid )
737 enddo
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

  ViewVC Help
Powered by ViewVC 1.1.22