1 |
C $Header: /u/gcmpack/MITgcm/pkg/profiles/active_file_profiles.F,v 1.1 2006/03/24 22:58:25 heimbach Exp $ |
2 |
|
3 |
#include "CPP_OPTIONS.h" |
4 |
|
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 |
I mythid, |
32 |
I dummy |
33 |
& ) |
34 |
|
35 |
c ================================================================== |
36 |
c SUBROUTINE active_read_profile |
37 |
c ================================================================== |
38 |
c o Read an active 1D record from an profile data file. |
39 |
c ================================================================== |
40 |
|
41 |
implicit none |
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 nactive_var: integer size of active_var |
52 |
c active_var: array |
53 |
c active_varname: name fo the quantity to save |
54 |
c irec: record number |
55 |
c myOptimIter: number of optimization iteration (default: 0) |
56 |
c mythid: thread number for this instance |
57 |
c lAdInit: initialisation of corresponding adjoint |
58 |
c variable and write to active file |
59 |
integer nactive_var,active_num_file |
60 |
_RL active_var(nactive_var) |
61 |
integer irec,active_varnum |
62 |
integer myOptimIter |
63 |
integer mythid |
64 |
logical lAdInit |
65 |
_RL dummy |
66 |
|
67 |
#ifdef ALLOW_PROFILES |
68 |
|
69 |
call active_read_profile_rl( fidforward(active_num_file), |
70 |
& active_num_file, |
71 |
& nactive_var, active_var, active_varnum, lAdInit, |
72 |
& irec, prof_ind_glob(active_num_file,irec), |
73 |
& FORWARD_SIMULATION, myOptimIter, mythid) |
74 |
|
75 |
#endif |
76 |
|
77 |
return |
78 |
end |
79 |
|
80 |
c ================================================================== |
81 |
c ================================================================== |
82 |
c ================================================================== |
83 |
|
84 |
C !ROUTINE: active_write_profile |
85 |
C !INTERFACE: |
86 |
subroutine active_write_profile( |
87 |
I active_num_file, |
88 |
I nactive_var, |
89 |
I active_var, |
90 |
I active_varnum, |
91 |
I irec, |
92 |
I myOptimIter, |
93 |
I mythid, |
94 |
I dummy |
95 |
& ) |
96 |
|
97 |
C !DESCRIPTION: \bv |
98 |
c ================================================================== |
99 |
c SUBROUTINE active_write_profile |
100 |
c ================================================================== |
101 |
c o Write an active 1D record from file. |
102 |
c ================================================================== |
103 |
|
104 |
C !USES: |
105 |
implicit none |
106 |
|
107 |
c == global variables == |
108 |
#include "EEPARAMS.h" |
109 |
#include "SIZE.h" |
110 |
#ifdef ALLOW_PROFILES |
111 |
# include "profiles.h" |
112 |
#endif |
113 |
|
114 |
c == routine arguments == |
115 |
c active_var_file: filename |
116 |
c nactive_var: integer size of active_var |
117 |
c active_var: array |
118 |
c active_varname: name fo the quantity to save |
119 |
c irec: record number |
120 |
c myOptimIter: number of optimization iteration (default: 0) |
121 |
c mythid: thread number for this instance |
122 |
integer nactive_var,active_num_file, active_varnum |
123 |
_RL active_var(nactive_var) |
124 |
integer irec |
125 |
integer myOptimIter |
126 |
integer mythid |
127 |
_RL dummy |
128 |
|
129 |
#ifdef ALLOW_PROFILES |
130 |
|
131 |
call active_write_profile_rl( fidforward(active_num_file), |
132 |
& active_num_file, |
133 |
& nactive_var, active_var, active_varnum, |
134 |
& irec, prof_ind_glob(active_num_file,irec), |
135 |
& FORWARD_SIMULATION, myOptimIter, mythid) |
136 |
|
137 |
#endif |
138 |
|
139 |
return |
140 |
end |
141 |
|
142 |
c ================================================================== |
143 |
|
144 |
|