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

Annotation of /MITgcm/pkg/autodiff/active_file_control.F

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


Revision 1.14 - (hide annotations) (download)
Tue Feb 17 14:31:42 2015 UTC (9 years, 4 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65n, checkpoint65l, checkpoint65m, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65o, HEAD
Changes since 1.13: +15 -15 lines
- remove dynamic allocation that is not f77 compliant.
- note : this was leading to segmtation faults, depending on
  compiler; a similar issue remain in active_file_control_slice.F.

1 gforget 1.14 C $Header: /u/gcmpack/MITgcm/pkg/autodiff/active_file_control.F,v 1.13 2014/04/04 23:03:59 jmc Exp $
2 jmc 1.9 C $Name: $
3 heimbach 1.3
4 edhill 1.5 #include "AUTODIFF_OPTIONS.h"
5 jmc 1.13 #ifdef ALLOW_CTRL
6     # include "CTRL_OPTIONS.h"
7     #endif
8 heimbach 1.3
9 jmc 1.12 C ==================================================================
10     C active_file_control.F: Routines to handle the I/O of active
11     C variables for the adjoint calculations.
12     C All files are direct access files.
13     C Routines:
14     C o ACTIVE_READ_3D_RL : Basic routine to handle active 3D read operations
15     C o ACTIVE_READ_3D_RS : Basic routine to handle active 3D read operations
16     C o ACTIVE_WRITE_3D_RL : Basic routine to handle active 3D write operations
17     C o ACTIVE_WRITE_3D_RS : Basic routine to handle active 3D write operations
18     C
19     C changed: Christian Eckert eckert@mit.edu 24-Apr-2000
20     C - Added routines that do active writes on tiles
21     C instead of a whole thread.
22     C ==================================================================
23 heimbach 1.3
24 jmc 1.12 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
25     CBOP
26     C !ROUTINE: ACTIVE_READ_3D_RL
27     C !INTERFACE:
28     SUBROUTINE ACTIVE_READ_3D_RL(
29     I activeVar_file,
30     O active_var,
31     I globalFile,
32     I useCurrentDir,
33     I lAdInit,
34     I iRec,
35     I myNr,
36     I theSimulationMode,
37     I myOptimIter,
38     I myThid )
39     C !DESCRIPTION: \bv
40     C ==================================================================
41     C SUBROUTINE ACTIVE_READ_3D_RL
42     C ==================================================================
43     C o Read an active 3D _RL variable from file.
44     C The variable *globalfile* can be used as a switch, which allows
45     C to read from a global file. The adjoint files are, however, always
46     C treated as tiled files.
47     C started: Christian Eckert eckert@mit.edu Jan-1999
48     C ==================================================================
49     C SUBROUTINE ACTIVE_READ_3D_RL
50     C ==================================================================
51     C \ev
52    
53     C !USES:
54     IMPLICIT NONE
55    
56     C == global variables ==
57     #include "EEPARAMS.h"
58     #include "SIZE.h"
59     #include "PARAMS.h"
60     #include "ctrl.h"
61    
62     C !INPUT/OUTPUT PARAMETERS:
63     C activeVar_file :: filename
64     C active_var :: array
65     C globalFile ::
66     C useCurrentDir :: always read from the current directory
67     C (even if "mdsioLocalDir" is set)
68     C lAdInit :: initialisation of corresponding adjoint variable
69     C and write to active file
70     C iRec :: record number
71     C myNr :: vertical array dimension
72     C theSimulationMode :: forward mode or reverse mode simulation
73     C myOptimIter :: number of optimization iteration (default: 0)
74     C myThid :: thread number for this instance
75     CHARACTER*(*) activeVar_file
76     INTEGER myNr
77     _RL active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
78     LOGICAL globalFile
79     LOGICAL useCurrentDir
80     LOGICAL lAdInit
81     INTEGER iRec
82     INTEGER theSimulationMode
83     INTEGER myOptimIter
84     INTEGER myThid
85    
86     C !FUNCTIONS:
87     INTEGER ILNBLNK
88     EXTERNAL ILNBLNK
89    
90     C !LOCAL VARIABLES:
91     CHARACTER*(2) adpref
92     CHARACTER*(80) adfname
93     INTEGER bi,bj
94     INTEGER i,j,k
95     INTEGER prec
96     INTEGER il
97     LOGICAL w_globFile
98     _RS dummyRS(1)
99 gforget 1.14 _RL active_data_t(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
100 jmc 1.12 CEOP
101    
102     C force 64-bit io
103     prec = ctrlprec
104    
105     adpref = 'ad'
106     il = ILNBLNK( activeVar_file )
107     WRITE(adfname(1:80),'(80a)') ' '
108     WRITE(adfname(1:il+2),'(2A)') adpref, activeVar_file(1:il)
109    
110     C >>>>>>>>>>>>>>>>>>> FORWARD RUN <<<<<<<<<<<<<<<<<<<
111     IF (theSimulationMode .EQ. FORWARD_SIMULATION) THEN
112    
113     C Read the active variable from file.
114     CALL MDS_READ_FIELD(
115     I activeVar_file, prec, useCurrentDir,
116     I 'RL', myNr, 1, myNr,
117     O active_var, dummyRS,
118     I iRec, myThid )
119    
120     IF ( lAdInit ) THEN
121     C Initialise the corresponding adjoint variable on the
122     C adjoint variable file. These files are tiled.
123    
124     DO bj = myByLo(myThid), myByHi(myThid)
125     DO bi = myBxLo(myThid), myBxHi(myThid)
126     DO k = 1, myNr
127     DO j=1,sNy
128     DO i=1,sNx
129     active_data_t(i,j,k,bi,bj) = 0. _d 0
130     ENDDO
131     ENDDO
132     ENDDO
133     ENDDO
134     ENDDO
135    
136     CALL MDS_WRITE_FIELD(
137     I adfname, prec, globalFile, useCurrentDir,
138 gforget 1.14 I 'RL', Nr, 1, myNr,
139 jmc 1.12 I active_data_t, dummyRS,
140     I iRec, myOptimIter, myThid )
141    
142     ENDIF
143    
144     ENDIF
145    
146     C >>>>>>>>>>>>>>>>>>> ADJOINT RUN <<<<<<<<<<<<<<<<<<<
147     IF (theSimulationMode .EQ. REVERSE_SIMULATION) THEN
148    
149     CALL MDS_READ_FIELD(
150     I activeVar_file, prec, useCurrentDir,
151 gforget 1.14 I 'RL', Nr, 1, myNr,
152 jmc 1.12 O active_data_t, dummyRS,
153     I iRec, myThid )
154    
155     C Add active_var from appropriate location to data.
156     DO bj = myByLo(myThid), myByHi(myThid)
157     DO bi = myBxLo(myThid), myBxHi(myThid)
158     DO k = 1, myNr
159     DO j=1,sNy
160     DO i=1,sNx
161     active_data_t(i,j,k,bi,bj) = active_data_t(i,j,k,bi,bj)
162     & + active_var(i,j,k,bi,bj)
163     ENDDO
164     ENDDO
165     ENDDO
166     ENDDO
167     ENDDO
168    
169     C Store the result on disk.
170     w_globFile = .FALSE.
171     CALL MDS_WRITE_FIELD(
172     I activeVar_file, prec, w_globFile, useCurrentDir,
173 gforget 1.14 I 'RL', Nr, 1, myNr,
174 jmc 1.12 I active_data_t, dummyRS,
175     I iRec, myOptimIter, myThid )
176    
177     C Set active_var to zero.
178     DO bj = myByLo(myThid), myByHi(myThid)
179     DO bi = myBxLo(myThid), myBxHi(myThid)
180     DO k = 1, myNr
181     DO j=1,sNy
182     DO i=1,sNx
183     active_var(i,j,k,bi,bj) = 0 _d 0
184     ENDDO
185     ENDDO
186     ENDDO
187     ENDDO
188     ENDDO
189    
190     ENDIF
191    
192     C >>>>>>>>>>>>>>>>>>> TANGENT RUN <<<<<<<<<<<<<<<<<<<
193     IF (theSimulationMode .EQ. TANGENT_SIMULATION) THEN
194     C Read the active variable from file.
195     CALL MDS_READ_FIELD(
196     I activeVar_file, prec, useCurrentDir,
197     I 'RL', myNr, 1, myNr,
198     O active_var, dummyRS,
199     I iRec, myThid )
200     ENDIF
201    
202     RETURN
203     END
204 heimbach 1.3
205 jmc 1.12 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
206 heimbach 1.3 CBOP
207 jmc 1.12 C !ROUTINE: ACTIVE_READ_3D_RS
208 heimbach 1.3 C !INTERFACE:
209 jmc 1.12 SUBROUTINE ACTIVE_READ_3D_RS(
210     I activeVar_file,
211     O active_var,
212     I globalFile,
213     I useCurrentDir,
214     I lAdInit,
215     I iRec,
216     I myNr,
217     I theSimulationMode,
218     I myOptimIter,
219     I myThid )
220 heimbach 1.3
221     C !DESCRIPTION: \bv
222 jmc 1.12 C ==================================================================
223     C SUBROUTINE ACTIVE_READ_3D_RS
224     C ==================================================================
225     C o Read an active 3D _RS variable from file.
226     C The variable *globalfile* can be used as a switch, which allows
227     C to read from a global file. The adjoint files are, however, always
228     C treated as tiled files.
229     C started: Christian Eckert eckert@mit.edu Jan-1999
230     C ==================================================================
231     C SUBROUTINE ACTIVE_READ_3D_RS
232     C ==================================================================
233 heimbach 1.3 C \ev
234    
235     C !USES:
236 jmc 1.12 IMPLICIT NONE
237 heimbach 1.3
238 jmc 1.12 C == global variables ==
239 heimbach 1.3 #include "EEPARAMS.h"
240     #include "SIZE.h"
241     #include "PARAMS.h"
242 heimbach 1.7 #include "ctrl.h"
243 heimbach 1.3
244     C !INPUT/OUTPUT PARAMETERS:
245 jmc 1.12 C activeVar_file :: filename
246     C active_var :: array
247     C globalFile ::
248     C useCurrentDir :: always read from the current directory
249     C (even if "mdsioLocalDir" is set)
250     C lAdInit :: initialisation of corresponding adjoint variable
251     C and write to active file
252     C iRec :: record number
253     C myNr :: vertical array dimension
254     C theSimulationMode :: forward mode or reverse mode simulation
255     C myOptimIter :: number of optimization iteration (default: 0)
256     C myThid :: thread number for this instance
257     CHARACTER*(*) activeVar_file
258     INTEGER myNr
259     _RS active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
260     LOGICAL globalFile
261     LOGICAL useCurrentDir
262     LOGICAL lAdInit
263     INTEGER iRec
264     INTEGER theSimulationMode
265     INTEGER myOptimIter
266     INTEGER myThid
267    
268     C !FUNCTIONS:
269     INTEGER ILNBLNK
270     EXTERNAL ILNBLNK
271 heimbach 1.3
272     C !LOCAL VARIABLES:
273 jmc 1.12 CHARACTER*(2) adpref
274     CHARACTER*(80) adfname
275     INTEGER bi,bj
276     INTEGER i,j,k
277     INTEGER prec
278     INTEGER il
279     LOGICAL w_globFile
280 gforget 1.14 _RS active_data_t(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
281 jmc 1.12 _RL dummyRL(1)
282     CEOP
283    
284     C force 64-bit io
285     prec = ctrlprec
286 heimbach 1.3
287 jmc 1.12 adpref = 'ad'
288     il = ILNBLNK( activeVar_file )
289     WRITE(adfname(1:80),'(80a)') ' '
290     WRITE(adfname(1:il+2),'(2A)') adpref, activeVar_file(1:il)
291    
292     C >>>>>>>>>>>>>>>>>>> FORWARD RUN <<<<<<<<<<<<<<<<<<<
293     IF (theSimulationMode .EQ. FORWARD_SIMULATION) THEN
294    
295     C Read the active variable from file.
296     CALL MDS_READ_FIELD(
297     I activeVar_file, prec, useCurrentDir,
298     I 'RS', myNr, 1, myNr,
299     O dummyRL, active_var,
300     I iRec, myThid )
301    
302     IF ( lAdInit ) THEN
303     C Initialise the corresponding adjoint variable on the
304     C adjoint variable file. These files are tiled.
305    
306     DO bj = myByLo(myThid), myByHi(myThid)
307     DO bi = myBxLo(myThid), myBxHi(myThid)
308     DO k = 1, myNr
309     DO j=1,sNy
310     DO i=1,sNx
311     active_data_t(i,j,k,bi,bj) = 0. _d 0
312     ENDDO
313     ENDDO
314     ENDDO
315     ENDDO
316     ENDDO
317    
318     CALL MDS_WRITE_FIELD(
319     I adfname, prec, globalFile, useCurrentDir,
320 gforget 1.14 I 'RS', Nr, 1, myNr,
321 jmc 1.12 I dummyRL, active_data_t,
322     I iRec, myOptimIter, myThid )
323    
324     ENDIF
325    
326     ENDIF
327    
328     C >>>>>>>>>>>>>>>>>>> ADJOINT RUN <<<<<<<<<<<<<<<<<<<
329     IF (theSimulationMode .EQ. REVERSE_SIMULATION) THEN
330    
331     CALL MDS_READ_FIELD(
332     I activeVar_file, prec, useCurrentDir,
333 gforget 1.14 I 'RS', Nr, 1, myNr,
334 jmc 1.12 O dummyRL, active_data_t,
335     I iRec, myThid )
336    
337     C Add active_var from appropriate location to data.
338     DO bj = myByLo(myThid), myByHi(myThid)
339     DO bi = myBxLo(myThid), myBxHi(myThid)
340     DO k = 1, myNr
341     DO j=1,sNy
342     DO i=1,sNx
343     active_data_t(i,j,k,bi,bj) = active_data_t(i,j,k,bi,bj)
344     & + active_var(i,j,k,bi,bj)
345     ENDDO
346     ENDDO
347     ENDDO
348     ENDDO
349     ENDDO
350    
351     C Store the result on disk.
352     w_globFile = .FALSE.
353     CALL MDS_WRITE_FIELD(
354     I activeVar_file, prec, w_globFile, useCurrentDir,
355 gforget 1.14 I 'RS', Nr, 1, myNr,
356 jmc 1.12 I dummyRL, active_data_t,
357     I iRec, myOptimIter, myThid )
358    
359     C Set active_var to zero.
360     DO bj = myByLo(myThid), myByHi(myThid)
361     DO bi = myBxLo(myThid), myBxHi(myThid)
362     DO k = 1, myNr
363     DO j=1,sNy
364     DO i=1,sNx
365     active_var(i,j,k,bi,bj) = 0 _d 0
366     ENDDO
367     ENDDO
368     ENDDO
369     ENDDO
370     ENDDO
371    
372     ENDIF
373    
374     C >>>>>>>>>>>>>>>>>>> TANGENT RUN <<<<<<<<<<<<<<<<<<<
375     IF (theSimulationMode .EQ. TANGENT_SIMULATION) THEN
376     C Read the active variable from file.
377     CALL MDS_READ_FIELD(
378     I activeVar_file, prec, useCurrentDir,
379     I 'RS', myNr, 1, myNr,
380     O dummyRL, active_var,
381     I iRec, myThid )
382     ENDIF
383 heimbach 1.3
384 jmc 1.12 RETURN
385     END
386    
387     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
388     CBOP
389     C !ROUTINE: ACTIVE_WRITE_3D_RL
390     C !INTERFACE:
391     SUBROUTINE ACTIVE_WRITE_3D_RL(
392     I activeVar_file,
393     I active_var,
394     I globalFile,
395     I useCurrentDir,
396     I iRec,
397     I myNr,
398     I theSimulationMode,
399     I myOptimIter,
400     I myThid )
401 heimbach 1.3
402 jmc 1.12 C !DESCRIPTION: \bv
403     C ==================================================================
404     C SUBROUTINE ACTIVE_WRITE_3D_RL
405     C ==================================================================
406     C o Write an active 3D _RL variable to a file.
407     C started: Christian Eckert eckert@mit.edu Jan-1999
408     C ==================================================================
409     C SUBROUTINE ACTIVE_WRITE_3D_RL
410     C ==================================================================
411     C \ev
412 heimbach 1.3
413 jmc 1.12 C !USES:
414     IMPLICIT NONE
415 heimbach 1.3
416 jmc 1.12 C == global variables ==
417     #include "EEPARAMS.h"
418     #include "SIZE.h"
419     #include "PARAMS.h"
420     #include "ctrl.h"
421 heimbach 1.3
422 jmc 1.12 C !INPUT/OUTPUT PARAMETERS:
423     C activeVar_file :: filename
424     C active_var :: array
425     C globalFile ::
426     C useCurrentDir :: always write to the current directory
427     C (even if "mdsioLocalDir" is set)
428     C iRec :: record number
429     C myNr :: vertical array dimension
430     C theSimulationMode :: forward mode or reverse mode simulation
431     C myOptimIter :: number of optimization iteration (default: 0)
432     C myThid :: thread number for this instance
433     CHARACTER*(*) activeVar_file
434     INTEGER myNr
435     _RL active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
436     LOGICAL globalFile
437     LOGICAL useCurrentDir
438     INTEGER iRec
439     INTEGER theSimulationMode
440     INTEGER myOptimIter
441     INTEGER myThid
442 heimbach 1.4
443 jmc 1.12 C !LOCAL VARIABLES:
444     INTEGER i,j,k
445     INTEGER bi,bj
446     INTEGER prec
447     _RS dummyRS(1)
448 gforget 1.14 _RL active_data_t(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
449 jmc 1.12 CEOP
450 heimbach 1.3
451 jmc 1.12 C force 64-bit io
452     prec = ctrlprec
453 heimbach 1.3
454 jmc 1.12 C >>>>>>>>>>>>>>>>>>> FORWARD RUN <<<<<<<<<<<<<<<<<<<
455     IF (theSimulationMode .EQ. FORWARD_SIMULATION) THEN
456     CALL MDS_WRITE_FIELD(
457     I activeVar_file, prec, globalFile, useCurrentDir,
458     I 'RL', myNr, 1, myNr,
459     I active_var, dummyRS,
460     I iRec, myOptimIter, myThid )
461     ENDIF
462    
463     C >>>>>>>>>>>>>>>>>>> ADJOINT RUN <<<<<<<<<<<<<<<<<<<
464     IF (theSimulationMode .EQ. REVERSE_SIMULATION) THEN
465    
466     CALL MDS_READ_FIELD(
467     I activeVar_file, prec, useCurrentDir,
468 gforget 1.14 I 'RL', Nr, 1, myNr,
469 jmc 1.12 O active_data_t, dummyRS,
470     I iRec, myThid )
471    
472     C Add active_var from appropriate location to data.
473     DO bj = myByLo(myThid), myByHi(myThid)
474     DO bi = myBxLo(myThid), myBxHi(myThid)
475     DO k = 1, myNr
476     DO j=1,sNy
477     DO i=1,sNx
478     active_var(i,j,k,bi,bj) = active_var(i,j,k,bi,bj)
479     & + active_data_t(i,j,k,bi,bj)
480     active_data_t(i,j,k,bi,bj) = 0. _d 0
481     ENDDO
482     ENDDO
483     ENDDO
484     ENDDO
485     ENDDO
486     CALL MDS_WRITE_FIELD(
487     I activeVar_file, prec, globalFile, useCurrentDir,
488 gforget 1.14 I 'RL', Nr, 1, myNr,
489 jmc 1.12 I active_data_t, dummyRS,
490     I iRec, myOptimIter, myThid )
491    
492     ENDIF
493    
494     C >>>>>>>>>>>>>>>>>>> TANGENT RUN <<<<<<<<<<<<<<<<<<<
495     IF (theSimulationMode .EQ. TANGENT_SIMULATION) THEN
496     CALL MDS_WRITE_FIELD(
497     I activeVar_file, prec, globalFile, useCurrentDir,
498     I 'RL', myNr, 1, myNr,
499     I active_var, dummyRS,
500     I iRec, myOptimIter, myThid )
501     ENDIF
502 heimbach 1.3
503 jmc 1.12 RETURN
504     END
505 heimbach 1.3
506 jmc 1.12 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
507 heimbach 1.3 CBOP
508 jmc 1.12 C !ROUTINE: ACTIVE_WRITE_3D_RS
509 heimbach 1.3 C !INTERFACE:
510 jmc 1.12 SUBROUTINE ACTIVE_WRITE_3D_RS(
511     I activeVar_file,
512     I active_var,
513     I globalFile,
514     I useCurrentDir,
515     I iRec,
516     I myNr,
517     I theSimulationMode,
518     I myOptimIter,
519     I myThid )
520 heimbach 1.3
521     C !DESCRIPTION: \bv
522 jmc 1.12 C ==================================================================
523     C SUBROUTINE ACTIVE_WRITE_3D_RS
524     C ==================================================================
525     C o Write an active 3D _RS variable to a file.
526     C started: Christian Eckert eckert@mit.edu Jan-1999
527     C ==================================================================
528     C SUBROUTINE ACTIVE_WRITE_3D_RS
529     C ==================================================================
530 heimbach 1.3 C \ev
531    
532     C !USES:
533 jmc 1.12 IMPLICIT NONE
534 heimbach 1.3
535 jmc 1.12 C == global variables ==
536 heimbach 1.3 #include "EEPARAMS.h"
537     #include "SIZE.h"
538     #include "PARAMS.h"
539 heimbach 1.7 #include "ctrl.h"
540 heimbach 1.3
541     C !INPUT/OUTPUT PARAMETERS:
542 jmc 1.12 C activeVar_file :: filename
543     C active_var :: array
544     C globalFile ::
545     C useCurrentDir :: always write to the current directory
546     C (even if "mdsioLocalDir" is set)
547     C iRec :: record number
548     C myNr :: vertical array dimension
549     C theSimulationMode :: forward mode or reverse mode simulation
550     C myOptimIter :: number of optimization iteration (default: 0)
551     C myThid :: thread number for this instance
552     CHARACTER*(*) activeVar_file
553     INTEGER myNr
554     _RS active_var(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
555     LOGICAL globalFile
556     LOGICAL useCurrentDir
557     INTEGER iRec
558     INTEGER theSimulationMode
559     INTEGER myOptimIter
560     INTEGER myThid
561 heimbach 1.3
562     C !LOCAL VARIABLES:
563 jmc 1.12 INTEGER i,j,k
564     INTEGER bi,bj
565     INTEGER prec
566 gforget 1.14 _RS active_data_t(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
567 jmc 1.12 _RL dummyRL(1)
568 heimbach 1.3 CEOP
569    
570 jmc 1.12 C force 64-bit io
571     prec = ctrlprec
572 heimbach 1.3
573 jmc 1.12 C >>>>>>>>>>>>>>>>>>> FORWARD RUN <<<<<<<<<<<<<<<<<<<
574     IF (theSimulationMode .EQ. FORWARD_SIMULATION) THEN
575     CALL MDS_WRITE_FIELD(
576     I activeVar_file, prec, globalFile, useCurrentDir,
577     I 'RS', myNr, 1, myNr,
578     I dummyRL, active_var,
579     I iRec, myOptimIter, myThid )
580     ENDIF
581    
582     C >>>>>>>>>>>>>>>>>>> ADJOINT RUN <<<<<<<<<<<<<<<<<<<
583     IF (theSimulationMode .EQ. REVERSE_SIMULATION) THEN
584    
585     CALL MDS_READ_FIELD(
586     I activeVar_file, prec, useCurrentDir,
587 gforget 1.14 I 'RS', Nr, 1, myNr,
588 jmc 1.12 O dummyRL, active_data_t,
589     I iRec, myThid )
590    
591     C Add active_var from appropriate location to data.
592     DO bj = myByLo(myThid), myByHi(myThid)
593     DO bi = myBxLo(myThid), myBxHi(myThid)
594     DO k = 1, myNr
595     DO j=1,sNy
596     DO i=1,sNx
597     active_var(i,j,k,bi,bj) = active_var(i,j,k,bi,bj)
598     & + active_data_t(i,j,k,bi,bj)
599     active_data_t(i,j,k,bi,bj) = 0. _d 0
600     ENDDO
601     ENDDO
602     ENDDO
603     ENDDO
604     ENDDO
605     CALL MDS_WRITE_FIELD(
606     I activeVar_file, prec, globalFile, useCurrentDir,
607 gforget 1.14 I 'RS', Nr, 1, myNr,
608 jmc 1.12 I dummyRL, active_data_t,
609     I iRec, myOptimIter, myThid )
610    
611     ENDIF
612    
613     C >>>>>>>>>>>>>>>>>>> TANGENT RUN <<<<<<<<<<<<<<<<<<<
614     IF (theSimulationMode .EQ. TANGENT_SIMULATION) THEN
615     CALL MDS_WRITE_FIELD(
616     I activeVar_file, prec, globalFile, useCurrentDir,
617     I 'RS', myNr, 1, myNr,
618     I dummyRL, active_var,
619     I iRec, myOptimIter, myThid )
620     ENDIF
621 heimbach 1.3
622 jmc 1.12 RETURN
623     END

  ViewVC Help
Powered by ViewVC 1.1.22