1 |
gforget |
1.3 |
C $Header: /u/gcmpack/MITgcm/pkg/profiles/active_file_profiles.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.F: Routines to handle the I/O of the active file for |
8 |
|
|
c the adjoint calculations. All files are direct |
9 |
|
|
c access files. |
10 |
|
|
c |
11 |
|
|
c Routines |
12 |
|
|
c |
13 |
|
|
c o active_read_profile - Read an active 1D record. |
14 |
|
|
c o active_write_profile - Write an active 1D record. |
15 |
|
|
c |
16 |
|
|
c |
17 |
|
|
c changed: gforget@ocean.mit.edu 23-Mar-2006 |
18 |
|
|
c |
19 |
|
|
c ================================================================== |
20 |
|
|
|
21 |
|
|
C !ROUTINE: active_read_profile |
22 |
|
|
C !INTERFACE: |
23 |
|
|
subroutine active_read_profile( |
24 |
|
|
I active_num_file, |
25 |
|
|
I nactive_var, |
26 |
|
|
O active_var, |
27 |
|
|
I active_varnum, |
28 |
|
|
I irec, |
29 |
|
|
I lAdInit, |
30 |
|
|
I myOptimIter, |
31 |
gforget |
1.3 |
I bi, |
32 |
|
|
I bj, |
33 |
heimbach |
1.1 |
I mythid, |
34 |
|
|
I dummy |
35 |
|
|
& ) |
36 |
|
|
|
37 |
|
|
c ================================================================== |
38 |
|
|
c SUBROUTINE 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 |
|
|
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 active_varname: name fo the quantity to save |
56 |
|
|
c irec: record number |
57 |
|
|
c myOptimIter: number of optimization iteration (default: 0) |
58 |
|
|
c mythid: thread number for this instance |
59 |
|
|
c lAdInit: initialisation of corresponding adjoint |
60 |
|
|
c variable and write to active file |
61 |
|
|
integer nactive_var,active_num_file |
62 |
|
|
_RL active_var(nactive_var) |
63 |
|
|
integer irec,active_varnum |
64 |
|
|
integer myOptimIter |
65 |
gforget |
1.3 |
integer bi,bj,mythid |
66 |
heimbach |
1.1 |
logical lAdInit |
67 |
|
|
_RL dummy |
68 |
|
|
|
69 |
|
|
#ifdef ALLOW_PROFILES |
70 |
|
|
|
71 |
gforget |
1.3 |
call active_read_profile_rl( fidforward(active_num_file,bi,bj), |
72 |
heimbach |
1.1 |
& active_num_file, |
73 |
|
|
& nactive_var, active_var, active_varnum, lAdInit, |
74 |
gforget |
1.3 |
& irec, prof_ind_glob(active_num_file,irec,bi,bj), |
75 |
|
|
& FORWARD_SIMULATION, myOptimIter,bi,bj, mythid) |
76 |
heimbach |
1.1 |
|
77 |
|
|
#endif |
78 |
|
|
|
79 |
|
|
return |
80 |
|
|
end |
81 |
|
|
|
82 |
|
|
c ================================================================== |
83 |
|
|
c ================================================================== |
84 |
|
|
c ================================================================== |
85 |
|
|
|
86 |
|
|
C !ROUTINE: active_write_profile |
87 |
|
|
C !INTERFACE: |
88 |
|
|
subroutine active_write_profile( |
89 |
|
|
I active_num_file, |
90 |
|
|
I nactive_var, |
91 |
|
|
I active_var, |
92 |
|
|
I active_varnum, |
93 |
|
|
I irec, |
94 |
|
|
I myOptimIter, |
95 |
gforget |
1.3 |
I bi, |
96 |
|
|
I bj, |
97 |
heimbach |
1.1 |
I mythid, |
98 |
|
|
I dummy |
99 |
|
|
& ) |
100 |
|
|
|
101 |
|
|
C !DESCRIPTION: \bv |
102 |
|
|
c ================================================================== |
103 |
|
|
c SUBROUTINE active_write_profile |
104 |
|
|
c ================================================================== |
105 |
|
|
c o Write an active 1D record from file. |
106 |
|
|
c ================================================================== |
107 |
|
|
|
108 |
|
|
C !USES: |
109 |
|
|
implicit none |
110 |
|
|
|
111 |
|
|
c == global variables == |
112 |
|
|
#include "EEPARAMS.h" |
113 |
|
|
#include "SIZE.h" |
114 |
|
|
#ifdef ALLOW_PROFILES |
115 |
|
|
# include "profiles.h" |
116 |
|
|
#endif |
117 |
|
|
|
118 |
|
|
c == routine arguments == |
119 |
|
|
c active_var_file: filename |
120 |
|
|
c nactive_var: integer size of active_var |
121 |
|
|
c active_var: array |
122 |
|
|
c active_varname: name fo the quantity to save |
123 |
|
|
c irec: record number |
124 |
|
|
c myOptimIter: number of optimization iteration (default: 0) |
125 |
|
|
c mythid: thread number for this instance |
126 |
|
|
integer nactive_var,active_num_file, active_varnum |
127 |
|
|
_RL active_var(nactive_var) |
128 |
|
|
integer irec |
129 |
|
|
integer myOptimIter |
130 |
gforget |
1.3 |
integer bi,bj,mythid |
131 |
heimbach |
1.1 |
_RL dummy |
132 |
|
|
|
133 |
|
|
#ifdef ALLOW_PROFILES |
134 |
|
|
|
135 |
gforget |
1.3 |
call active_write_profile_rl( fidforward(active_num_file,bi,bj), |
136 |
heimbach |
1.1 |
& active_num_file, |
137 |
gforget |
1.3 |
& nactive_var, active_var, active_varnum, |
138 |
|
|
& irec, prof_ind_glob(active_num_file,irec,bi,bj), |
139 |
|
|
& FORWARD_SIMULATION, myOptimIter,bi,bj, mythid) |
140 |
heimbach |
1.1 |
|
141 |
|
|
#endif |
142 |
|
|
|
143 |
|
|
return |
144 |
|
|
end |
145 |
|
|
|
146 |
|
|
c ================================================================== |
147 |
|
|
|
148 |
|
|
|