1 |
C $Header: /u/gcmpack/MITgcm/pkg/profiles/active_file_profiles_ad.F,v 1.6 2007/10/09 00:07:59 jmc 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.h" |
47 |
#endif |
48 |
|
49 |
c == routine arguments == |
50 |
c active_var_file: filename |
51 |
c nadactive_var: integer size of adactive_var |
52 |
c adactive_var: array |
53 |
c irec: record number |
54 |
c myIter: number of optimization iteration (default: 0) |
55 |
c mythid: thread number for this instance |
56 |
c doglobalread: flag for global or local read/write |
57 |
c (default: .false.) |
58 |
c lAdInit: initialisation of corresponding adjoint |
59 |
c variable and write to active file |
60 |
integer nadactive_var,active_num_file |
61 |
_RL adactive_var(nadactive_var) |
62 |
integer irec,active_varnum |
63 |
integer myiter |
64 |
integer bi,bj,mythid |
65 |
logical lAdInit |
66 |
|
67 |
#ifdef ALLOW_PROFILES |
68 |
|
69 |
call active_read_profile_rl( fidadjoint(active_num_file,bi,bj) , |
70 |
& active_num_file, |
71 |
& nadactive_var, adactive_var, active_varnum, lAdInit, |
72 |
& irec, prof_ind_glob(active_num_file,irec,bi,bj), |
73 |
& REVERSE_SIMULATION, myiter,bi,bj, mythid) |
74 |
|
75 |
#endif |
76 |
|
77 |
end |
78 |
|
79 |
c ================================================================== |
80 |
c ================================================================== |
81 |
c ================================================================== |
82 |
|
83 |
|
84 |
subroutine adactive_write_profile( |
85 |
I active_num_file, |
86 |
I nadactive_var, |
87 |
I adactive_var, |
88 |
I active_varnum, |
89 |
I irec, |
90 |
I myiter, |
91 |
I bi, |
92 |
I bj, |
93 |
I mythid, |
94 |
I dummy |
95 |
& ) |
96 |
|
97 |
C !DESCRIPTION: \bv |
98 |
c ================================================================== |
99 |
c SUBROUTINE adactive_write_profile |
100 |
c ================================================================== |
101 |
c o Adjoint of active_write_profile. |
102 |
c ================================================================== |
103 |
|
104 |
implicit none |
105 |
|
106 |
c == global variables == |
107 |
#include "EEPARAMS.h" |
108 |
#include "SIZE.h" |
109 |
#ifdef ALLOW_PROFILES |
110 |
# include "profiles.h" |
111 |
#endif |
112 |
|
113 |
c == routine arguments == |
114 |
c active_var_file: filename |
115 |
c nadactive_var: integer size of adactive_var |
116 |
c adactive_var: array |
117 |
c irec: record number |
118 |
c myIter: number of optimization iteration (default: 0) |
119 |
c mythid: thread number for this instance |
120 |
c doglobalread: flag for global or local read/write |
121 |
c (default: .false.) |
122 |
c lAdInit: initialisation of corresponding adjoint |
123 |
c variable and write to active file |
124 |
integer nadactive_var,active_num_file |
125 |
_RL adactive_var(nadactive_var) |
126 |
integer irec,active_varnum |
127 |
integer myiter |
128 |
integer bi,bj,mythid |
129 |
_RL dummy |
130 |
|
131 |
|
132 |
c == end of interface == |
133 |
|
134 |
#ifdef ALLOW_PROFILES |
135 |
|
136 |
call active_write_profile_rl( fidadjoint(active_num_file,bi,bj) , |
137 |
& active_num_file, |
138 |
& nadactive_var, adactive_var, active_varnum, |
139 |
& irec, prof_ind_glob(active_num_file,irec,bi,bj), |
140 |
& REVERSE_SIMULATION, myiter,bi,bj, mythid) |
141 |
|
142 |
#endif |
143 |
|
144 |
end |
145 |
|
146 |
c ================================================================== |
147 |
|
148 |
|