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