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