1 |
C $Header$ |
C $Header$ |
2 |
|
|
3 |
#include "CPP_OPTIONS.h" |
#include "COST_CPPOPTIONS.h" |
4 |
|
|
5 |
|
subroutine ecco_readparms( mythid ) |
|
subroutine ecco_readparms( |
|
|
I mythid |
|
|
& ) |
|
6 |
|
|
7 |
c ================================================================== |
c ================================================================== |
8 |
c SUBROUTINE ecco_readparms |
c SUBROUTINE ecco_readparms |
9 |
c ================================================================== |
c ================================================================== |
10 |
c |
c |
11 |
c o Initialize the ECCO release of the MITgcmUV. |
c o This routine initialises the package cost. |
12 |
c |
c started: Ralf Giering 18-Jan-2001 |
|
c started: Christian Eckert eckert@mit.edu 29-Feb-1999 |
|
|
c |
|
|
c - Introduced to create a package for the MITgcmUV. |
|
|
c |
|
|
c changed: Christian Eckert eckert@mit.edu |
|
13 |
c |
c |
14 |
c ================================================================== |
c ================================================================== |
15 |
c SUBROUTINE ecco_readparms |
c SUBROUTINE ecco_readparms |
19 |
|
|
20 |
c == global variables == |
c == global variables == |
21 |
|
|
|
#include "SIZE.h" |
|
22 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
23 |
|
#include "SIZE.h" |
24 |
|
#include "GRID.h" |
25 |
#include "PARAMS.h" |
#include "PARAMS.h" |
26 |
#include "ecco.h" |
|
27 |
|
#include "ecco_cost.h" |
28 |
|
|
29 |
c == routine arguments == |
c == routine arguments == |
30 |
|
|
31 |
integer mythid |
integer mythid |
32 |
|
|
33 |
c == local variables == |
c == local variables == |
34 |
|
C msgBuf - Informational/error meesage buffer |
35 |
integer errio |
C iUnit - Work variable for IO unit number |
36 |
integer il |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
37 |
|
INTEGER iUnit |
|
character*(max_len_prec) record |
|
|
|
|
|
c == external == |
|
|
|
|
|
integer ilnblnk |
|
|
external ilnblnk |
|
38 |
|
|
39 |
c == end of interface == |
c == end of interface == |
40 |
|
|
41 |
c-- ECCO parameters. |
c-- Read the namelist input. |
42 |
namelist /ECCO_PARMS/ |
namelist /ecco_cost_nml/ |
43 |
& expId |
& data_errfile, |
44 |
|
& tbarfile, sbarfile, psbarfile, |
45 |
_BEGIN_MASTER( myThid ) |
& ubarfile, vbarfile, wbarfile, |
46 |
open( unit=scrunit1, status='scratch' ) |
& tauxbarfile, tauybarfile, |
47 |
|
& hfluxbarfile, sfluxbarfile, |
48 |
c-- Next, read the ECCO data file. |
& using_topex, |
49 |
open( unit = modeldataunit, |
& topexstartdate1, topexstartdate2, |
50 |
& file = 'data.ecco', |
& topexperiod, topexfile, topexmeanfile, |
51 |
& status = 'old', |
& using_ers, |
52 |
& iostat = errio) |
& ersstartdate1, ersstartdate2, |
53 |
|
& ersperiod, ersfile, |
54 |
if ( errio .lt. 0 ) then |
& scatstartdate1, scatstartdate2, |
55 |
stop ' stopped in ecco_readparms.' |
& scatperiod, scatxdatfile, scatydatfile, |
56 |
endif |
& scatx_errfile, scaty_errfile, |
57 |
|
& ssh_errfile, |
58 |
do while ( .true. ) |
& tmistartdate1, tmistartdate2, tmidatfile, |
59 |
read(modeldataunit, fmt='(a)', end=1001) record |
& sststartdate1, sststartdate2, sstdatfile, |
60 |
il = max(ilnblnk(record),1) |
& sssstartdate1, sssstartdate2, sssdatfile, |
61 |
if ( record(1:1) .ne. commentcharacter ) |
& tdatfile, sdatfile, |
62 |
& write(unit=scrunit1, fmt='(a)') record(:il) |
& ctdtfile, ctdsfile, |
63 |
enddo |
& ctdtclimfile, ctdsclimfile, |
64 |
1001 continue |
& xbtfile, |
65 |
close( modeldataunit ) |
& argotstartdate1, argotstartdate2, argotfile, |
66 |
|
& argosstartdate1, argosstartdate2, argosfile, |
67 |
rewind( scrunit1 ) |
& udriftfile, vdriftfile, |
68 |
read ( unit = scrunit1, nml = ecco_parms) |
& udrifterrfile, vdrifterrfile, |
69 |
close ( scrunit1 ) |
& curmtrufile,curmtrvfile, |
70 |
|
& salterrfile, temperrfile, velerrfile, |
71 |
c-------------------------------- ECCO -------------------------------- |
& hflux_errfile, sflux_errfile, |
72 |
|
& tauu_errfile, tauv_errfile, |
73 |
#ifdef INCLUDE_ECCO_PACKAGE |
& atemp_errfile, aqh_errfile, |
74 |
C-- Initialise the ECCO State Estimation package. |
& precip_errfile, swflux_errfile, swdown_errfile, |
75 |
|
& uwind_errfile, vwind_errfile, |
76 |
#ifdef ALLOW_CALENDAR |
& geoid_errfile, geoid_covariancefile, |
77 |
C-- Initialise the calendar package. |
& mult_hflux, mult_sflux, mult_tauu, mult_tauv, |
78 |
#ifdef ALLOW_CAL_NENDITER |
& mult_atemp, mult_aqh, |
79 |
CALL cal_Init( |
& mult_precip, mult_swflux, mult_swdown, |
80 |
I startTime, |
& mult_uwind, mult_vwind, |
81 |
I endTime, |
& mult_hmean, mult_h, mult_temp, mult_salt, |
82 |
I deltaTclock, |
& mult_tmi, mult_sst, mult_sss, |
83 |
I nIter0, |
& mult_ctdt, mult_ctds, |
84 |
I nEndIter, |
& mult_ctdtclim, mult_ctdsclim, |
85 |
I nTimeSteps, |
& mult_xbt, mult_drift, |
86 |
I myThid |
& mult_argot, mult_argos, |
87 |
& ) |
& mult_scatx, mult_scaty, |
88 |
#else |
& mult_sdrift, mult_tdrift, mult_wdrift, |
89 |
CALL cal_Init( |
& mult_temp0, mult_salt0, |
90 |
I startTime, |
& mult_obcsn, mult_obcss, |
91 |
I endTime, |
& mult_obcsw, mult_obcse, mult_obcsvol, |
92 |
I deltaTclock, |
& mult_curmtr, mult_ageos, |
93 |
I nIter0, |
& mult_ice, |
94 |
I nTimeSteps, |
& mult_kapgm, mult_diffkr, |
95 |
I myThid |
& whflux0, wsflux0, wtau0, |
96 |
& ) |
& watemp0, waqh0, |
97 |
#endif |
& wprecip0, wswflux0, wswdown0, wwind0, |
98 |
_BARRIER |
& wmean_hflux, wmean_sflux, wmean_tau, |
99 |
#endif |
& wmean_atemp, wmean_aqh, wmean_precip, |
100 |
|
& wmean_swflux, wmean_swdown, wmean_wind, |
101 |
C-- Custom routine to set forcing fields. |
& costIceStart1, costIceStart2, |
102 |
#ifdef INCLUDE_EXTERNAL_FORCING_PACKAGE |
& costIceEnd1, costIceEnd2, |
103 |
call exf_readparms ( mythid ) |
& cost_ice_flag, |
104 |
call exf_init( mythid ) |
& cost_iprec, cost_yftype |
|
#endif /* INCLUDE_EXTERNAL_FORCING_PACKAGE */ |
|
|
|
|
|
#ifdef ALLOW_ECCO_OPTIMIZATION |
|
|
c-- Initialise the optimization-related parts of the ECCO State |
|
|
c-- Estimation package. |
|
|
CALL optim_Init( myThid ) |
|
|
_BARRIER |
|
|
#else |
|
|
c-- Optimization not enabled. |
|
|
#endif |
|
|
|
|
|
#ifndef ALLOW_ECCO_FORWARD_RUN |
|
|
C-- Initialise the cost function. |
|
|
call cost_readparms( mythid ) |
|
|
call cost_init( myThid ) |
|
|
_BARRIER |
|
|
|
|
|
C-- Initialise the control vector. |
|
|
CALL ctrl_Init( myThid ) |
|
|
_BARRIER |
|
|
#else |
|
|
c not needed for forward run only |
|
|
#endif |
|
|
|
|
|
|
|
|
#ifdef ALLOW_ECCO_GRADIENT_CHECK |
|
|
c-- Initialise the gradient check for the TAMC generated adjoint |
|
|
c-- model. |
|
|
CALL grdchk_Init( myThid ) |
|
|
_BARRIER |
|
|
#else |
|
|
c-- Gradient check not enabled. |
|
|
#endif |
|
105 |
|
|
106 |
|
_BEGIN_MASTER( myThid ) |
107 |
|
|
108 |
#ifdef ALLOW_ECCO_DIAGNOSTICS_RUN |
c-- Set default values. |
109 |
c-- Initialise the ECCO diagnostics package. |
data_errfile = ' ' |
110 |
CALL diagnos_Init( myThid ) |
tbarfile = 'tbar' |
111 |
_BARRIER |
sbarfile = 'sbar' |
112 |
#else |
psbarfile = 'psbar' |
113 |
c-- Diagnostics not enabled. |
ubarfile = 'ubar' |
114 |
|
vbarfile = 'vbar' |
115 |
|
wbarfile = 'wbar' |
116 |
|
tauxbarfile = 'tauxbar' |
117 |
|
tauybarfile = 'tauybar' |
118 |
|
hfluxbarfile = 'hfluxbar' |
119 |
|
sfluxbarfile = 'sfluxbar' |
120 |
|
using_topex = .false. |
121 |
|
topexstartdate1 = 0 |
122 |
|
topexstartdate2 = 0 |
123 |
|
topexperiod = 0. _d 0 |
124 |
|
topexfile = ' ' |
125 |
|
topexmeanfile = ' ' |
126 |
|
using_ers = .false. |
127 |
|
ersstartdate1 = 0 |
128 |
|
ersstartdate2 = 0 |
129 |
|
ersperiod = 0. _d 0 |
130 |
|
ersfile = ' ' |
131 |
|
scatstartdate1 = 0 |
132 |
|
scatstartdate2 = 0 |
133 |
|
scatperiod = 0. _d 0 |
134 |
|
scatxdatfile = ' ' |
135 |
|
scatydatfile = ' ' |
136 |
|
ssh_errfile = ' ' |
137 |
|
scatx_errfile = ' ' |
138 |
|
scaty_errfile = ' ' |
139 |
|
tmistartdate1 = 0 |
140 |
|
tmistartdate2 = 0 |
141 |
|
tmidatfile = ' ' |
142 |
|
sststartdate1 = 0 |
143 |
|
sststartdate2 = 0 |
144 |
|
sstdatfile = ' ' |
145 |
|
sssstartdate1 = 0 |
146 |
|
sssstartdate2 = 0 |
147 |
|
sssdatfile = ' ' |
148 |
|
tdatfile = ' ' |
149 |
|
sdatfile = ' ' |
150 |
|
ctdtfile = ' ' |
151 |
|
ctdsfile = ' ' |
152 |
|
ctdtclimfile = ' ' |
153 |
|
ctdsclimfile = ' ' |
154 |
|
curmtrufile = ' ' |
155 |
|
curmtrvfile = ' ' |
156 |
|
xbtfile = ' ' |
157 |
|
argotstartdate1 = 0 |
158 |
|
argotstartdate2 = 0 |
159 |
|
argotfile = ' ' |
160 |
|
argosstartdate1 = 0 |
161 |
|
argosstartdate2 = 0 |
162 |
|
argosfile = ' ' |
163 |
|
udriftfile = ' ' |
164 |
|
vdriftfile = ' ' |
165 |
|
udrifterrfile = ' ' |
166 |
|
vdrifterrfile = ' ' |
167 |
|
salterrfile = ' ' |
168 |
|
temperrfile = ' ' |
169 |
|
velerrfile = ' ' |
170 |
|
hflux_errfile = ' ' |
171 |
|
sflux_errfile = ' ' |
172 |
|
tauu_errfile = ' ' |
173 |
|
tauv_errfile = ' ' |
174 |
|
atemp_errfile = ' ' |
175 |
|
aqh_errfile = ' ' |
176 |
|
precip_errfile = ' ' |
177 |
|
swflux_errfile = ' ' |
178 |
|
swdown_errfile = ' ' |
179 |
|
uwind_errfile = ' ' |
180 |
|
vwind_errfile = ' ' |
181 |
|
geoid_errfile = ' ' |
182 |
|
geoid_covariancefile = ' ' |
183 |
|
mult_hflux = 0. _d 0 |
184 |
|
mult_sflux = 0. _d 0 |
185 |
|
mult_tauu = 0. _d 0 |
186 |
|
mult_tauv = 0. _d 0 |
187 |
|
mult_atemp = 0. _d 0 |
188 |
|
mult_aqh = 0. _d 0 |
189 |
|
mult_precip = 0. _d 0 |
190 |
|
mult_swflux = 0. _d 0 |
191 |
|
mult_swdown = 0. _d 0 |
192 |
|
mult_uwind = 0. _d 0 |
193 |
|
mult_vwind = 0. _d 0 |
194 |
|
mult_hmean = 0. _d 0 |
195 |
|
mult_h = 0. _d 0 |
196 |
|
mult_temp = 0. _d 0 |
197 |
|
mult_salt = 0. _d 0 |
198 |
|
mult_temp0 = 0. _d 0 |
199 |
|
mult_salt0 = 0. _d 0 |
200 |
|
mult_tmi = 0. _d 0 |
201 |
|
mult_sst = 0. _d 0 |
202 |
|
mult_sss = 0. _d 0 |
203 |
|
mult_ctdt = 0. _d 0 |
204 |
|
mult_ctds = 0. _d 0 |
205 |
|
mult_ctdtclim = 0. _d 0 |
206 |
|
mult_ctdsclim = 0. _d 0 |
207 |
|
mult_xbt = 0. _d 0 |
208 |
|
mult_argot = 0. _d 0 |
209 |
|
mult_argos = 0. _d 0 |
210 |
|
mult_drift = 0. _d 0 |
211 |
|
mult_tdrift = 0. _d 0 |
212 |
|
mult_sdrift = 0. _d 0 |
213 |
|
mult_wdrift = 0. _d 0 |
214 |
|
mult_scatx = 0. _d 0 |
215 |
|
mult_scaty = 0. _d 0 |
216 |
|
mult_obcsn = 0. _d 0 |
217 |
|
mult_obcss = 0. _d 0 |
218 |
|
mult_obcsw = 0. _d 0 |
219 |
|
mult_obcse = 0. _d 0 |
220 |
|
mult_obcsvol = 0. _d 0 |
221 |
|
mult_ageos = 0. _d 0 |
222 |
|
mult_curmtr = 0. _d 0 |
223 |
|
mult_ice = 0. _d 0 |
224 |
|
mult_kapgm = 0. _d 0 |
225 |
|
mult_diffkr = 0. _d 0 |
226 |
|
watemp0 = 0. _d 0 |
227 |
|
waqh0 = 0. _d 0 |
228 |
|
wprecip0 = 0. _d 0 |
229 |
|
wswflux0 = 0. _d 0 |
230 |
|
wswdown0 = 0. _d 0 |
231 |
|
wwind0 = 0. _d 0 |
232 |
|
whflux0 = 0. _d 0 |
233 |
|
wsflux0 = 0. _d 0 |
234 |
|
wtau0 = 0. _d 0 |
235 |
|
wmean_atemp = 0. _d 0 |
236 |
|
wmean_aqh = 0. _d 0 |
237 |
|
wmean_precip = 0. _d 0 |
238 |
|
wmean_swflux = 0. _d 0 |
239 |
|
wmean_swdown = 0. _d 0 |
240 |
|
wmean_wind = 0. _d 0 |
241 |
|
wmean_hflux = 0. _d 0 |
242 |
|
wmean_sflux = 0. _d 0 |
243 |
|
wmean_tau = 0. _d 0 |
244 |
|
costIceStart1 = 0 |
245 |
|
costIceStart2 = 0 |
246 |
|
costIceEnd1 = 0 |
247 |
|
costIceEnd2 = 0 |
248 |
|
cost_ice_flag = 1 |
249 |
|
|
250 |
|
c-- Next, read the cost data file. |
251 |
|
WRITE(msgBuf,'(A)') 'ECCO_READPARMS: opening data.ecco' |
252 |
|
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
253 |
|
& SQUEEZE_RIGHT , 1) |
254 |
|
|
255 |
|
CALL OPEN_COPY_DATA_FILE( |
256 |
|
I 'data.ecco', 'ECCO_READPARMS', |
257 |
|
O iUnit, |
258 |
|
I myThid ) |
259 |
|
|
260 |
|
READ( iUnit, nml = ecco_cost_nml ) |
261 |
|
|
262 |
|
WRITE(msgBuf,'(A)') 'ECCO_READPARMS: finished reading data.ecco' |
263 |
|
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
264 |
|
& SQUEEZE_RIGHT , 1) |
265 |
|
|
266 |
|
CLOSE( iUnit ) |
267 |
|
|
268 |
|
#ifdef ALLOW_CAL |
269 |
|
c-- Get the complete dates of the ... |
270 |
|
c-- ... SST data. |
271 |
|
call cal_FullDate( sststartdate1, sststartdate2, |
272 |
|
& sststartdate, mythid ) |
273 |
|
c-- ... TMI data. |
274 |
|
call cal_FullDate( tmistartdate1, tmistartdate2, |
275 |
|
& tmistartdate, mythid ) |
276 |
|
c-- ... SSS data. |
277 |
|
call cal_FullDate( sssstartdate1, sssstartdate2, |
278 |
|
& sssstartdate, mythid ) |
279 |
|
c-- ... T/P data. |
280 |
|
call cal_FullDate( topexstartdate1, topexstartdate2, |
281 |
|
& topexstartdate, mythid ) |
282 |
|
c-- ... ERS data. |
283 |
|
call cal_FullDate( ersstartdate1, ersstartdate2, |
284 |
|
& ersstartdate, mythid ) |
285 |
|
c-- ... SCAT data. |
286 |
|
call cal_FullDate( scatstartdate1, scatstartdate2, |
287 |
|
& scatxstartdate, mythid ) |
288 |
|
call cal_FullDate( scatstartdate1, scatstartdate2, |
289 |
|
& scatystartdate, mythid ) |
290 |
#endif |
#endif |
291 |
|
|
|
#endif /* INCLUDE_ECCO_PACKAGE */ |
|
|
|
|
|
c-------------------------------- ECCO -------------------------------- |
|
|
|
|
|
c-- Summarize the setup of the ECCO release. |
|
|
c call ecco_Summary( mythid ) |
|
292 |
_END_MASTER( mythid ) |
_END_MASTER( mythid ) |
293 |
|
|
|
c-- Everyone else must wait for the parameters to be loaded and |
|
|
c-- the setup to be completed. |
|
294 |
_BARRIER |
_BARRIER |
295 |
|
|
296 |
end |
end |