1 |
heimbach |
1.1 |
|
2 |
|
|
#include "CPP_OPTIONS.h" |
3 |
|
|
|
4 |
|
|
c ================================================================== |
5 |
|
|
c |
6 |
|
|
c adopen_adclose.F: Routines to handle the I/O of the TAMC generated |
7 |
|
|
c code. All files are direct access files. |
8 |
|
|
c Routines: |
9 |
|
|
c |
10 |
|
|
c o adopen - Open file (here a dummy routine). |
11 |
|
|
c o adclose - Close file (here a dummy routine). |
12 |
|
|
c |
13 |
|
|
c |
14 |
|
|
c The following input veriables are used throughout in the argument |
15 |
|
|
c lists: |
16 |
|
|
c |
17 |
|
|
c name - character |
18 |
|
|
c On entry, name is the extended tape name. |
19 |
|
|
c len - integer |
20 |
|
|
c On entry, len is the number of characters in name. |
21 |
|
|
c tid - integer |
22 |
|
|
c On entry, tid identifies the tape. |
23 |
|
|
c vid - integer |
24 |
|
|
c On entry, vid identifies the variable to be stored on |
25 |
|
|
c the tape. |
26 |
|
|
c var - real array of dimension length |
27 |
|
|
c On entry, var contains the values to be stored. |
28 |
|
|
c var must not be changed. |
29 |
|
|
c size - integer |
30 |
|
|
c On entry, size is the size in bytes of the type of |
31 |
|
|
c variable var. |
32 |
|
|
c length - integer |
33 |
|
|
c On entry, length is the dimension of the variable |
34 |
|
|
c stored on the tape. |
35 |
|
|
c irec - integer |
36 |
|
|
c On entry, irec is the record number to be written. |
37 |
|
|
c mythid - integer |
38 |
|
|
c On entry, mythid is the number of the thread or |
39 |
|
|
c instance of the program. |
40 |
|
|
c myiter - integer |
41 |
|
|
c On entry, myiter is the current iteration step during |
42 |
|
|
c the integration. |
43 |
|
|
c |
44 |
|
|
c For further details on this see the TAMC Users Manual, Appendix B, |
45 |
|
|
c User defined Storage Subroutines. |
46 |
|
|
c |
47 |
|
|
c TAMC does not provide the two leading arguments mythid and myiter |
48 |
|
|
c when compiling the MITgcmUV code. Instead the is a sed script avail- |
49 |
|
|
c able that does change the TAMC-generated adjoint code. |
50 |
|
|
c |
51 |
|
|
c Only the master thread is allowed to write data and only gobal |
52 |
|
|
c model arrays are allowed to be written be the subsequent routines. |
53 |
|
|
c Tiled data are to be stored in common blocks. This implies that at |
54 |
|
|
c least a two level checkpointing for the adjoint code has to be |
55 |
|
|
c available. |
56 |
|
|
c |
57 |
|
|
c ================================================================== |
58 |
|
|
|
59 |
|
|
|
60 |
|
|
subroutine adopen( |
61 |
|
|
I mythid, |
62 |
|
|
cph( |
63 |
|
|
cph I myiter, |
64 |
|
|
cph) |
65 |
|
|
I name, |
66 |
|
|
I len, |
67 |
|
|
I tid, |
68 |
|
|
I vid, |
69 |
|
|
I size, |
70 |
|
|
I length |
71 |
|
|
& ) |
72 |
|
|
|
73 |
|
|
c ================================================================== |
74 |
|
|
c SUBROUTINE adopen |
75 |
|
|
c ================================================================== |
76 |
|
|
c |
77 |
|
|
c o Dummy routine expected to be available by TAMC I/O. |
78 |
|
|
c |
79 |
|
|
c This routine is simply a dummy routine expected to be available by |
80 |
|
|
c the Tangent Linear and Adjoint Model Compiler(TAMC). Files are |
81 |
|
|
c opened and closed by the routines that are called by *adread* and |
82 |
|
|
c *adwrite*. |
83 |
|
|
c |
84 |
|
|
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
85 |
|
|
c |
86 |
|
|
c changed: Christian Eckert eckert@mit.edu 15-Feb-2000 |
87 |
|
|
c |
88 |
|
|
c - Restructured the code in order to create a package |
89 |
|
|
c for the MITgcmUV. |
90 |
|
|
c |
91 |
|
|
c ================================================================== |
92 |
|
|
c SUBROUTINE adopen |
93 |
|
|
c ================================================================== |
94 |
|
|
|
95 |
|
|
implicit none |
96 |
|
|
|
97 |
|
|
c == global variables == |
98 |
|
|
|
99 |
|
|
c == routine arguments == |
100 |
|
|
|
101 |
|
|
integer mythid |
102 |
|
|
cph( |
103 |
|
|
cph integer myiter |
104 |
|
|
cph) |
105 |
|
|
character*(*) name |
106 |
|
|
integer len |
107 |
|
|
integer tid |
108 |
|
|
integer vid |
109 |
|
|
integer size |
110 |
|
|
integer length |
111 |
|
|
|
112 |
|
|
c == local variables == |
113 |
|
|
|
114 |
|
|
c == end of interface == |
115 |
|
|
|
116 |
|
|
return |
117 |
|
|
end |
118 |
|
|
|
119 |
|
|
|
120 |
|
|
subroutine adclose( |
121 |
|
|
I mythid, |
122 |
|
|
cph( |
123 |
|
|
cph I myiter, |
124 |
|
|
cph) |
125 |
|
|
I name, |
126 |
|
|
I len, |
127 |
|
|
I tid, |
128 |
|
|
I vid, |
129 |
|
|
I size, |
130 |
|
|
I length |
131 |
|
|
& ) |
132 |
|
|
|
133 |
|
|
|
134 |
|
|
c ================================================================== |
135 |
|
|
c SUBROUTINE adclose |
136 |
|
|
c ================================================================== |
137 |
|
|
c |
138 |
|
|
c o Dummy routine expected to be available by TAMC I/O. |
139 |
|
|
c |
140 |
|
|
c This routine is simply a dummy routine expected to be available by |
141 |
|
|
c the Tangent Linear and Adjoint Model Compiler(TAMC). Files are |
142 |
|
|
c opened and closed by the routines that are called by *adread* and |
143 |
|
|
c *adwrite*. |
144 |
|
|
c |
145 |
|
|
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
146 |
|
|
c |
147 |
|
|
c changed: Christian Eckert eckert@mit.edu 15-Feb-2000 |
148 |
|
|
c |
149 |
|
|
c - Restructured the code in order to create a package |
150 |
|
|
c for the MITgcmUV. |
151 |
|
|
c |
152 |
|
|
c ================================================================== |
153 |
|
|
c SUBROUTINE adclose |
154 |
|
|
c ================================================================== |
155 |
|
|
|
156 |
|
|
implicit none |
157 |
|
|
|
158 |
|
|
c == global variables == |
159 |
|
|
|
160 |
|
|
c == routine arguments == |
161 |
|
|
|
162 |
|
|
integer mythid |
163 |
|
|
cph( |
164 |
|
|
cph integer myiter |
165 |
|
|
cph) |
166 |
|
|
character*(*) name |
167 |
|
|
integer len |
168 |
|
|
integer tid |
169 |
|
|
integer vid |
170 |
|
|
integer size |
171 |
|
|
integer length |
172 |
|
|
|
173 |
|
|
c == local variables == |
174 |
|
|
|
175 |
|
|
c == end of interface == |
176 |
|
|
|
177 |
|
|
return |
178 |
|
|
end |