1 |
C $Header: /u/gcmpack/MITgcm/pkg/profiles/active_file_profiles_ad.F,v 1.7 2008/06/27 19:04:14 heimbach Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PROFILES_OPTIONS.h" |
5 |
|
6 |
c ================================================================== |
7 |
c |
8 |
c active_files_ad.F: Routines to handle the I/O of the active file |
9 |
c for the adjoint calculations. All files are |
10 |
c direct access files. |
11 |
c |
12 |
c Routines |
13 |
c |
14 |
c o adactive_read_profile - Adjoint of active_read_profile |
15 |
c o adactive_write_profile - Adjoint of active_write_profile |
16 |
c |
17 |
c changed: gforget@ocean.mit.edu 23-Mar-2006 |
18 |
c |
19 |
c ================================================================== |
20 |
|
21 |
subroutine adactive_read_profile( |
22 |
I active_num_file, |
23 |
I nadactive_var, |
24 |
I adactive_var, |
25 |
I active_varnum, |
26 |
I irec, |
27 |
I lAdInit, |
28 |
I myiter, |
29 |
I bi, |
30 |
I bj, |
31 |
I mythid |
32 |
& ) |
33 |
|
34 |
C !DESCRIPTION: \bv |
35 |
c ================================================================== |
36 |
c SUBROUTINE adactive_read_profile |
37 |
c ================================================================== |
38 |
c o Adjoint of active_read_profile. |
39 |
c ================================================================== |
40 |
implicit none |
41 |
|
42 |
c == global variables == |
43 |
#include "EEPARAMS.h" |
44 |
#include "SIZE.h" |
45 |
#ifdef ALLOW_PROFILES |
46 |
# include "PROFILES_SIZE.h" |
47 |
# include "profiles.h" |
48 |
#endif |
49 |
|
50 |
c == routine arguments == |
51 |
c active_var_file: filename |
52 |
c nadactive_var: integer size of adactive_var |
53 |
c adactive_var: array |
54 |
c irec: record number |
55 |
c myIter: number of optimization iteration (default: 0) |
56 |
c mythid: thread number for this instance |
57 |
c doglobalread: flag for global or local read/write |
58 |
c (default: .false.) |
59 |
c lAdInit: initialisation of corresponding adjoint |
60 |
c variable and write to active file |
61 |
integer nadactive_var,active_num_file |
62 |
_RL adactive_var(nadactive_var) |
63 |
integer irec,active_varnum |
64 |
integer myiter |
65 |
integer bi,bj,mythid |
66 |
logical lAdInit |
67 |
|
68 |
#ifdef ALLOW_PROFILES |
69 |
|
70 |
call active_read_profile_rl( fidadjoint(active_num_file,bi,bj) , |
71 |
& active_num_file, |
72 |
& nadactive_var, adactive_var, active_varnum, lAdInit, |
73 |
& irec, prof_ind_glob(active_num_file,irec,bi,bj), |
74 |
& REVERSE_SIMULATION, myiter,bi,bj, mythid) |
75 |
|
76 |
#endif |
77 |
|
78 |
end |
79 |
|
80 |
c ================================================================== |
81 |
c ================================================================== |
82 |
c ================================================================== |
83 |
|
84 |
|
85 |
subroutine adactive_write_profile( |
86 |
I active_num_file, |
87 |
I nadactive_var, |
88 |
I adactive_var, |
89 |
I active_varnum, |
90 |
I irec, |
91 |
I myiter, |
92 |
I bi, |
93 |
I bj, |
94 |
I mythid, |
95 |
I dummy |
96 |
& ) |
97 |
|
98 |
C !DESCRIPTION: \bv |
99 |
c ================================================================== |
100 |
c SUBROUTINE adactive_write_profile |
101 |
c ================================================================== |
102 |
c o Adjoint of active_write_profile. |
103 |
c ================================================================== |
104 |
|
105 |
implicit none |
106 |
|
107 |
c == global variables == |
108 |
#include "EEPARAMS.h" |
109 |
#include "SIZE.h" |
110 |
#ifdef ALLOW_PROFILES |
111 |
# include "PROFILES_SIZE.h" |
112 |
# include "profiles.h" |
113 |
#endif |
114 |
|
115 |
c == routine arguments == |
116 |
c active_var_file: filename |
117 |
c nadactive_var: integer size of adactive_var |
118 |
c adactive_var: array |
119 |
c irec: record number |
120 |
c myIter: number of optimization iteration (default: 0) |
121 |
c mythid: thread number for this instance |
122 |
c doglobalread: flag for global or local read/write |
123 |
c (default: .false.) |
124 |
c lAdInit: initialisation of corresponding adjoint |
125 |
c variable and write to active file |
126 |
integer nadactive_var,active_num_file |
127 |
_RL adactive_var(nadactive_var) |
128 |
integer irec,active_varnum |
129 |
integer myiter |
130 |
integer bi,bj,mythid |
131 |
_RL dummy |
132 |
|
133 |
|
134 |
c == end of interface == |
135 |
|
136 |
#ifdef ALLOW_PROFILES |
137 |
|
138 |
call active_write_profile_rl( fidadjoint(active_num_file,bi,bj) , |
139 |
& active_num_file, |
140 |
& nadactive_var, adactive_var, active_varnum, |
141 |
& irec, prof_ind_glob(active_num_file,irec,bi,bj), |
142 |
& REVERSE_SIMULATION, myiter,bi,bj, mythid) |
143 |
|
144 |
#endif |
145 |
|
146 |
end |
147 |
|
148 |
c ================================================================== |
149 |
|
150 |
|