1 |
edhill |
1.5 |
C |
2 |
heimbach |
1.7 |
C $Header: /u/gcmpack/MITgcm/pkg/ctrl/ctrl_readparms.F,v 1.6 2004/05/28 16:04:42 heimbach Exp $ |
3 |
heimbach |
1.6 |
C $Name: $ |
4 |
heimbach |
1.2 |
|
5 |
edhill |
1.5 |
#include "AD_CONFIG.h" |
6 |
heimbach |
1.2 |
#include "CTRL_CPPOPTIONS.h" |
7 |
|
|
|
8 |
|
|
|
9 |
|
|
subroutine ctrl_readparms( mythid ) |
10 |
|
|
|
11 |
|
|
c ================================================================== |
12 |
|
|
c SUBROUTINE ctrl_readparms |
13 |
|
|
c ================================================================== |
14 |
|
|
c |
15 |
|
|
c o read ctrl parameters |
16 |
|
|
c split from ctrl_init |
17 |
|
|
c |
18 |
|
|
c started: heimbach@mit.edu 12-Jun-2003 |
19 |
|
|
c |
20 |
|
|
c ================================================================== |
21 |
|
|
c SUBROUTINE ctrl_readparms |
22 |
|
|
c ================================================================== |
23 |
|
|
|
24 |
|
|
implicit none |
25 |
|
|
|
26 |
|
|
c == global variables == |
27 |
|
|
|
28 |
|
|
#include "EEPARAMS.h" |
29 |
|
|
#include "SIZE.h" |
30 |
|
|
#include "PARAMS.h" |
31 |
|
|
#include "GRID.h" |
32 |
|
|
#include "ctrl.h" |
33 |
|
|
|
34 |
|
|
#ifdef ALLOW_OBCS_CONTROL |
35 |
|
|
# include "OBCS.h" |
36 |
|
|
#endif |
37 |
|
|
#ifdef ALLOW_ECCO_OPTIMIZATION |
38 |
|
|
# include "optim.h" |
39 |
|
|
#endif |
40 |
|
|
|
41 |
|
|
c == routine arguments == |
42 |
|
|
|
43 |
|
|
integer mythid |
44 |
|
|
|
45 |
|
|
c == local variables == |
46 |
|
|
|
47 |
|
|
integer bi,bj |
48 |
|
|
integer i,j,k |
49 |
|
|
integer ntmp |
50 |
|
|
integer ivarindex |
51 |
|
|
|
52 |
|
|
integer iobcs |
53 |
|
|
integer il |
54 |
|
|
integer errio |
55 |
|
|
integer startrec |
56 |
|
|
integer endrec |
57 |
|
|
integer difftime(4) |
58 |
|
|
_RL diffsecs |
59 |
|
|
_RL dummy |
60 |
|
|
|
61 |
|
|
character*(80) ymaskobcs |
62 |
|
|
character*(max_len_prec) record |
63 |
|
|
character*(max_len_mbuf) msgbuf |
64 |
|
|
|
65 |
|
|
integer nwetc3d |
66 |
|
|
|
67 |
|
|
c == external == |
68 |
|
|
|
69 |
|
|
integer ilnblnk |
70 |
|
|
external ilnblnk |
71 |
|
|
|
72 |
|
|
c == end of interface == |
73 |
|
|
|
74 |
|
|
c-- Read the namelist input. |
75 |
|
|
namelist /ctrl_nml/ |
76 |
|
|
& xx_theta_file, |
77 |
|
|
& xx_salt_file, |
78 |
|
|
& xx_hflux_file, |
79 |
|
|
& xx_hfluxstartdate1, xx_hfluxstartdate2, xx_hfluxperiod, |
80 |
|
|
& xx_sflux_file, |
81 |
|
|
& xx_sfluxstartdate1, xx_sfluxstartdate2, xx_sfluxperiod, |
82 |
|
|
& xx_tauu_file, |
83 |
|
|
& xx_tauustartdate1, xx_tauustartdate2, xx_tauuperiod, |
84 |
|
|
& xx_tauv_file, |
85 |
|
|
& xx_tauvstartdate1, xx_tauvstartdate2, xx_tauvperiod, |
86 |
|
|
& xx_atemp_file, |
87 |
|
|
& xx_atempstartdate1, xx_atempstartdate2, xx_atempperiod, |
88 |
|
|
& xx_aqh_file, |
89 |
|
|
& xx_aqhstartdate1, xx_aqhstartdate2, xx_aqhperiod, |
90 |
|
|
& xx_uwind_file, |
91 |
|
|
& xx_uwindstartdate1, xx_uwindstartdate2, xx_uwindperiod, |
92 |
|
|
& xx_vwind_file, |
93 |
|
|
& xx_vwindstartdate1, xx_vwindstartdate2, xx_vwindperiod, |
94 |
|
|
& xx_obcsn_file, |
95 |
|
|
& xx_obcsnstartdate1, xx_obcsnstartdate2, xx_obcsnperiod, |
96 |
|
|
& xx_obcss_file, |
97 |
|
|
& xx_obcssstartdate1, xx_obcssstartdate2, xx_obcssperiod, |
98 |
|
|
& xx_obcsw_file, |
99 |
|
|
& xx_obcswstartdate1, xx_obcswstartdate2, xx_obcswperiod, |
100 |
|
|
& xx_obcse_file, |
101 |
|
|
& xx_obcsestartdate1, xx_obcsestartdate2, xx_obcseperiod, |
102 |
|
|
& xx_diffkr_file, |
103 |
|
|
& xx_kapgm_file, |
104 |
|
|
& xx_tr1_file, |
105 |
|
|
& xx_sst_file, |
106 |
|
|
& xx_sss_file, |
107 |
|
|
& xx_hfacc_file, |
108 |
|
|
& xx_efluxy_file, |
109 |
|
|
& xx_efluxp_file, |
110 |
heimbach |
1.7 |
& xx_bottomdrag_file, |
111 |
|
|
& doInitXX |
112 |
heimbach |
1.2 |
|
113 |
|
|
namelist /ctrl_packnames/ |
114 |
heimbach |
1.6 |
& yadmark, yctrlid, yctrlposunpack, yctrlpospack, |
115 |
heimbach |
1.2 |
& ctrlname, costname, scalname, maskname, metaname |
116 |
|
|
|
117 |
|
|
_BEGIN_MASTER( myThid ) |
118 |
|
|
|
119 |
|
|
c-- Set default values. |
120 |
|
|
xx_theta_file = ' ' |
121 |
|
|
xx_salt_file = ' ' |
122 |
|
|
xx_hfluxstartdate1 = 0 |
123 |
|
|
xx_hfluxstartdate2 = 0 |
124 |
|
|
xx_hfluxperiod = 0. _d 0 |
125 |
|
|
xx_hflux_file = ' ' |
126 |
|
|
xx_sfluxstartdate1 = 0 |
127 |
|
|
xx_sfluxstartdate2 = 0 |
128 |
|
|
xx_sfluxperiod = 0. _d 0 |
129 |
|
|
xx_sflux_file = ' ' |
130 |
|
|
xx_tauustartdate1 = 0 |
131 |
|
|
xx_tauustartdate2 = 0 |
132 |
|
|
xx_tauuperiod = 0. _d 0 |
133 |
|
|
xx_tauu_file = ' ' |
134 |
|
|
xx_tauvstartdate1 = 0 |
135 |
|
|
xx_tauvstartdate2 = 0 |
136 |
|
|
xx_tauvperiod = 0. _d 0 |
137 |
|
|
xx_tauv_file = ' ' |
138 |
|
|
xx_atempstartdate1 = 0 |
139 |
|
|
xx_atempstartdate2 = 0 |
140 |
|
|
xx_atempperiod = 0. _d 0 |
141 |
|
|
xx_atemp_file = ' ' |
142 |
|
|
xx_aqhstartdate1 = 0 |
143 |
|
|
xx_aqhstartdate2 = 0 |
144 |
|
|
xx_aqhperiod = 0. _d 0 |
145 |
|
|
xx_aqh_file = ' ' |
146 |
|
|
xx_uwindstartdate1 = 0 |
147 |
|
|
xx_uwindstartdate2 = 0 |
148 |
|
|
xx_uwindperiod = 0. _d 0 |
149 |
|
|
xx_uwind_file = ' ' |
150 |
|
|
xx_vwindstartdate1 = 0 |
151 |
|
|
xx_vwindstartdate2 = 0 |
152 |
|
|
xx_vwindperiod = 0. _d 0 |
153 |
|
|
xx_vwind_file = ' ' |
154 |
|
|
xx_obcsnstartdate1 = 0 |
155 |
|
|
xx_obcsnstartdate2 = 0 |
156 |
|
|
xx_obcsnperiod = 0. _d 0 |
157 |
|
|
xx_obcsn_file = ' ' |
158 |
|
|
xx_obcssstartdate1 = 0 |
159 |
|
|
xx_obcssstartdate2 = 0 |
160 |
|
|
xx_obcssperiod = 0. _d 0 |
161 |
|
|
xx_obcss_file = ' ' |
162 |
|
|
xx_obcswstartdate1 = 0 |
163 |
|
|
xx_obcswstartdate2 = 0 |
164 |
|
|
xx_obcswperiod = 0. _d 0 |
165 |
|
|
xx_obcsw_file = ' ' |
166 |
|
|
xx_obcsestartdate1 = 0 |
167 |
|
|
xx_obcsestartdate2 = 0 |
168 |
|
|
xx_obcseperiod = 0. _d 0 |
169 |
|
|
xx_obcse_file = ' ' |
170 |
|
|
xx_diffkr_file = ' ' |
171 |
|
|
xx_kapgm_file = ' ' |
172 |
|
|
xx_tr1_file = ' ' |
173 |
|
|
xx_sst_file = ' ' |
174 |
|
|
xx_sss_file = ' ' |
175 |
|
|
xx_hfacc_file = ' ' |
176 |
|
|
xx_efluxy_file = ' ' |
177 |
|
|
xx_efluxp_file = ' ' |
178 |
|
|
xx_bottomdrag_file = ' ' |
179 |
|
|
|
180 |
heimbach |
1.7 |
doInitXX = .TRUE. |
181 |
|
|
|
182 |
heimbach |
1.4 |
#ifdef ALLOW_TANGENTLINEAR_RUN |
183 |
|
|
yadprefix = 'g_' |
184 |
|
|
yadmark = 'g_' |
185 |
|
|
#else |
186 |
|
|
yadprefix = 'ad' |
187 |
heimbach |
1.2 |
yadmark = 'ad' |
188 |
|
|
#endif |
189 |
|
|
yctrlid = 'MIT_CE_000' |
190 |
heimbach |
1.6 |
yctrlposunpack = '.opt' |
191 |
|
|
yctrlpospack = '.opt' |
192 |
heimbach |
1.2 |
ctrlname = ' ' |
193 |
|
|
costname = ' ' |
194 |
|
|
scalname = ' ' |
195 |
|
|
maskname = ' ' |
196 |
|
|
metaname = ' ' |
197 |
|
|
|
198 |
|
|
c-- Check versions. |
199 |
|
|
|
200 |
|
|
open(unit=scrunit1,status='scratch') |
201 |
|
|
|
202 |
|
|
c-- Next, read the ecco data file. |
203 |
|
|
open(unit = modeldataunit,file = 'data.ctrl', |
204 |
|
|
& status = 'old', iostat = errio) |
205 |
|
|
if ( errio .lt. 0 ) then |
206 |
|
|
stop ' stopped in ctrl_readparms' |
207 |
|
|
endif |
208 |
|
|
|
209 |
|
|
do while ( .true. ) |
210 |
|
|
read(modeldataunit, fmt='(a)', end=1001) record |
211 |
|
|
il = max(ilnblnk(record),1) |
212 |
|
|
if ( record(1:1) .ne. commentcharacter ) |
213 |
|
|
& write(unit=scrunit1, fmt='(a)') record(:il) |
214 |
|
|
enddo |
215 |
|
|
1001 continue |
216 |
|
|
close( modeldataunit ) |
217 |
|
|
|
218 |
|
|
rewind( scrunit1 ) |
219 |
|
|
read(unit = scrunit1, nml = ctrl_nml) |
220 |
|
|
read(unit = scrunit1, nml = ctrl_packnames) |
221 |
|
|
close( scrunit1 ) |
222 |
|
|
|
223 |
|
|
_END_MASTER( myThid ) |
224 |
|
|
|
225 |
|
|
_BARRIER |
226 |
|
|
|
227 |
|
|
return |
228 |
|
|
end |
229 |
|
|
|