1 |
C $Header: /u/gcmpack/MITgcm/pkg/ctrl/ctrl_pack.F,v 1.49 2013/01/26 14:45:56 heimbach Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CTRL_OPTIONS.h" |
5 |
#ifdef ALLOW_EXF |
6 |
# include "EXF_OPTIONS.h" |
7 |
#endif |
8 |
|
9 |
subroutine ctrl_pack( first, mythid ) |
10 |
|
11 |
c ================================================================== |
12 |
c SUBROUTINE ctrl_pack |
13 |
c ================================================================== |
14 |
c |
15 |
c o Compress the control vector such that only ocean points are |
16 |
c written to file. |
17 |
c |
18 |
c started: Christian Eckert eckert@mit.edu 10-Mar=2000 |
19 |
c |
20 |
c changed: Patrick Heimbach heimbach@mit.edu 06-Jun-2000 |
21 |
c - Transferred some filename declarations |
22 |
c from here to namelist in ctrl_init |
23 |
c |
24 |
c Patrick Heimbach heimbach@mit.edu 16-Jun-2000 |
25 |
c - single file name convention with or without |
26 |
c ALLOW_ECCO_OPTIMIZATION |
27 |
c |
28 |
c G. Gebbie, added open boundary control packing, |
29 |
c gebbie@mit.edu 18 -Mar- 2003 |
30 |
c |
31 |
c heimbach@mit.edu totally restructured 28-Oct-2003 |
32 |
c |
33 |
c ================================================================== |
34 |
c SUBROUTINE ctrl_pack |
35 |
c ================================================================== |
36 |
|
37 |
implicit none |
38 |
|
39 |
c == global variables == |
40 |
|
41 |
#include "EEPARAMS.h" |
42 |
#include "SIZE.h" |
43 |
#include "PARAMS.h" |
44 |
#include "GRID.h" |
45 |
|
46 |
#include "ctrl.h" |
47 |
#include "CTRL_SIZE.h" |
48 |
#include "CTRL_GENARR.h" |
49 |
#include "optim.h" |
50 |
|
51 |
#ifdef ALLOW_COST |
52 |
# include "cost.h" |
53 |
#endif |
54 |
#ifdef ALLOW_ECCO |
55 |
# include "ecco_cost.h" |
56 |
#else |
57 |
# include "ctrl_weights.h" |
58 |
#endif |
59 |
#ifdef ALLOW_EXF |
60 |
# include "EXF_PARAM.h" |
61 |
#endif |
62 |
|
63 |
c == routine arguments == |
64 |
logical first |
65 |
integer mythid |
66 |
|
67 |
#ifndef EXCLUDE_CTRL_PACK |
68 |
c == external == |
69 |
integer ilnblnk |
70 |
external ilnblnk |
71 |
|
72 |
c == local variables == |
73 |
|
74 |
_RL fcloc |
75 |
|
76 |
integer i, j, k |
77 |
integer ii |
78 |
integer il |
79 |
integer irec |
80 |
integer ig,jg |
81 |
integer ivartype |
82 |
integer iobcs |
83 |
#if (defined ALLOW_GENARR2D_CONTROL) || (defined ALLOW_GENARR3D_CONTROL) || (defined ALLOW_GENTIM2D_CONTROL) |
84 |
C- Provided we set the file name just before calling ctrl_set_pack, |
85 |
C the same local file name variable can be used for different variables. |
86 |
C This is how GENARR2/3D_CONTROL is implemented (+ provides an example) |
87 |
integer iarr |
88 |
character*(80) fname_local(3) |
89 |
#endif |
90 |
|
91 |
logical doglobalread |
92 |
logical ladinit |
93 |
integer cbuffindex |
94 |
logical lxxadxx |
95 |
|
96 |
integer cunit |
97 |
integer ictrlgrad |
98 |
|
99 |
character*(128) cfile |
100 |
character*( 80) weighttype |
101 |
|
102 |
c == end of interface == |
103 |
|
104 |
#ifndef ALLOW_ECCO_OPTIMIZATION |
105 |
fmin = 0. _d 0 |
106 |
#endif |
107 |
|
108 |
c-- Tiled files are used. |
109 |
doglobalread = .false. |
110 |
|
111 |
c-- Initialise adjoint variables on active files. |
112 |
ladinit = .false. |
113 |
|
114 |
c-- Initialise global buffer index |
115 |
nbuffglobal = 0 |
116 |
|
117 |
c-- Assign file names. |
118 |
|
119 |
call ctrl_set_fname(xx_theta_file, fname_theta, mythid) |
120 |
call ctrl_set_fname(xx_salt_file, fname_salt, mythid) |
121 |
call ctrl_set_fname(xx_hflux_file, fname_hflux, mythid) |
122 |
call ctrl_set_fname(xx_sflux_file, fname_sflux, mythid) |
123 |
call ctrl_set_fname(xx_tauu_file, fname_tauu, mythid) |
124 |
call ctrl_set_fname(xx_tauv_file, fname_tauv, mythid) |
125 |
call ctrl_set_fname(xx_atemp_file, fname_atemp, mythid) |
126 |
call ctrl_set_fname(xx_aqh_file, fname_aqh, mythid) |
127 |
call ctrl_set_fname(xx_precip_file, fname_precip, mythid) |
128 |
call ctrl_set_fname(xx_swflux_file, fname_swflux, mythid) |
129 |
call ctrl_set_fname(xx_swdown_file, fname_swdown, mythid) |
130 |
call ctrl_set_fname(xx_lwflux_file, fname_lwflux, mythid) |
131 |
call ctrl_set_fname(xx_lwdown_file, fname_lwdown, mythid) |
132 |
call ctrl_set_fname(xx_evap_file, fname_evap, mythid) |
133 |
call ctrl_set_fname(xx_snowprecip_file, fname_snowprecip, mythid) |
134 |
call ctrl_set_fname(xx_apressure_file, fname_apressure, mythid) |
135 |
call ctrl_set_fname(xx_runoff_file, fname_runoff, mythid) |
136 |
call ctrl_set_fname(xx_uwind_file, fname_uwind, mythid) |
137 |
call ctrl_set_fname(xx_vwind_file, fname_vwind, mythid) |
138 |
call ctrl_set_fname(xx_obcsn_file, fname_obcsn, mythid) |
139 |
call ctrl_set_fname(xx_obcss_file, fname_obcss, mythid) |
140 |
call ctrl_set_fname(xx_obcsw_file, fname_obcsw, mythid) |
141 |
call ctrl_set_fname(xx_obcse_file, fname_obcse, mythid) |
142 |
call ctrl_set_fname(xx_diffkr_file, fname_diffkr, mythid) |
143 |
call ctrl_set_fname(xx_kapgm_file, fname_kapgm, mythid) |
144 |
call ctrl_set_fname(xx_kapredi_file, fname_kapredi, mythid) |
145 |
call ctrl_set_fname(xx_tr1_file, fname_tr1, mythid) |
146 |
call ctrl_set_fname(xx_sst_file, fname_sst, mythid) |
147 |
call ctrl_set_fname(xx_sss_file, fname_sss, mythid) |
148 |
call ctrl_set_fname(xx_depth_file, fname_depth, mythid) |
149 |
call ctrl_set_fname(xx_efluxy_file, fname_efluxy, mythid) |
150 |
call ctrl_set_fname(xx_efluxp_file, fname_efluxp, mythid) |
151 |
call ctrl_set_fname(xx_bottomdrag_file, fname_bottomdrag, mythid) |
152 |
call ctrl_set_fname(xx_edtaux_file, fname_edtaux, mythid) |
153 |
call ctrl_set_fname(xx_edtauy_file, fname_edtauy, mythid) |
154 |
call ctrl_set_fname(xx_uvel_file, fname_uvel, mythid) |
155 |
call ctrl_set_fname(xx_vvel_file, fname_vvel, mythid) |
156 |
call ctrl_set_fname(xx_etan_file, fname_etan, mythid) |
157 |
call ctrl_set_fname(xx_relaxsst_file, fname_relaxsst, mythid) |
158 |
call ctrl_set_fname(xx_relaxsss_file, fname_relaxsss, mythid) |
159 |
call ctrl_set_fname(xx_siarea_file, fname_siarea, mythid) |
160 |
call ctrl_set_fname(xx_siheff_file, fname_siheff, mythid) |
161 |
call ctrl_set_fname(xx_sihsnow_file, fname_sihsnow, mythid) |
162 |
call ctrl_set_fname(xx_shifwflx_file, fname_shifwflx, mythid) |
163 |
cHFLUXM_CONTROL |
164 |
call ctrl_set_fname(xx_hfluxm_file, fname_hfluxm, mythid) |
165 |
cHFLUXM_CONTROL |
166 |
|
167 |
c-- Only the master thread will do I/O. |
168 |
_BEGIN_MASTER( mythid ) |
169 |
|
170 |
if ( first ) then |
171 |
c >>> Initialise control vector for optimcycle=0 <<< |
172 |
lxxadxx = .TRUE. |
173 |
ictrlgrad = 1 |
174 |
fcloc = fmin |
175 |
write(cfile(1:128),'(4a,i4.4)') |
176 |
& ctrlname(1:9),'_',yctrlid(1:10), |
177 |
& yctrlpospack, optimcycle |
178 |
print *, 'ph-pack: packing ', ctrlname(1:9) |
179 |
else |
180 |
c >>> Write gradient vector <<< |
181 |
lxxadxx = .FALSE. |
182 |
ictrlgrad = 2 |
183 |
#ifdef ALLOW_AUTODIFF_OPENAD |
184 |
fcloc = fc%v |
185 |
#else |
186 |
fcloc = fc |
187 |
#endif |
188 |
write(cfile(1:128),'(4a,i4.4)') |
189 |
& costname(1:9),'_',yctrlid(1:10), |
190 |
& yctrlpospack, optimcycle |
191 |
print *, 'ph-pack: packing ', costname(1:9) |
192 |
endif |
193 |
|
194 |
c-- Only Proc 0 will do I/O. |
195 |
IF ( myProcId .eq. 0 ) THEN |
196 |
|
197 |
call mdsfindunit( cunit, mythid ) |
198 |
open( cunit, file = cfile, |
199 |
& status = 'unknown', |
200 |
& form = 'unformatted', |
201 |
& access = 'sequential' ) |
202 |
|
203 |
c-- Header information. |
204 |
write(cunit) nvartype |
205 |
write(cunit) nvarlength |
206 |
write(cunit) yctrlid |
207 |
write(cunit) optimCycle |
208 |
write(cunit) fc |
209 |
C place holder of obsolete variable iG |
210 |
write(cunit) 1 |
211 |
C place holder of obsolete variable jG |
212 |
write(cunit) 1 |
213 |
write(cunit) nsx |
214 |
write(cunit) nsy |
215 |
write(cunit) (nWetcGlobal(k), k=1,nr) |
216 |
write(cunit) (nWetsGlobal(k), k=1,nr) |
217 |
write(cunit) (nWetwGlobal(k), k=1,nr) |
218 |
#ifdef ALLOW_CTRL_WETV |
219 |
write(cunit) (nWetvGlobal(k), k=1,nr) |
220 |
#endif |
221 |
#ifdef ALLOW_SHIFWFLX_CONTROL |
222 |
write(cunit) (nWetiGlobal(k), k=1,nr) |
223 |
c write(cunit) nWetiGlobal(1) |
224 |
#endif |
225 |
|
226 |
#ifdef ALLOW_OBCSN_CONTROL |
227 |
write(cunit) ((nWetobcsnGlo(k,iobcs), k=1,nr),iobcs= 1,nobcs) |
228 |
#endif |
229 |
#ifdef ALLOW_OBCSS_CONTROL |
230 |
write(cunit) ((nWetobcssGlo(k,iobcs), k=1,nr),iobcs= 1,nobcs) |
231 |
#endif |
232 |
#ifdef ALLOW_OBCSW_CONTROL |
233 |
write(cunit) ((nWetobcswGlo(k,iobcs), k=1,nr),iobcs= 1,nobcs) |
234 |
#endif |
235 |
#ifdef ALLOW_OBCSE_CONTROL |
236 |
write(cunit) ((nWetobcseGlo(k,iobcs), k=1,nr),iobcs= 1,nobcs) |
237 |
#endif |
238 |
write(cunit) (ncvarindex(i), i=1,maxcvars) |
239 |
write(cunit) (ncvarrecs(i), i=1,maxcvars) |
240 |
write(cunit) (ncvarxmax(i), i=1,maxcvars) |
241 |
write(cunit) (ncvarymax(i), i=1,maxcvars) |
242 |
write(cunit) (ncvarnrmax(i), i=1,maxcvars) |
243 |
write(cunit) (ncvargrd(i), i=1,maxcvars) |
244 |
write(cunit) |
245 |
|
246 |
#ifdef ALLOW_PACKUNPACK_METHOD2 |
247 |
ENDIF |
248 |
_END_MASTER( mythid ) |
249 |
_BARRIER |
250 |
#endif |
251 |
|
252 |
#ifdef ALLOW_THETA0_CONTROL |
253 |
ivartype = 1 |
254 |
write(weighttype(1:80),'(80a)') ' ' |
255 |
write(weighttype(1:80),'(a)') "wthetaLev" |
256 |
call ctrl_set_pack_xyz( |
257 |
& cunit, ivartype, fname_theta(ictrlgrad), "maskCtrlC", |
258 |
& weighttype, wtheta, lxxadxx, mythid) |
259 |
#endif |
260 |
|
261 |
#ifdef ALLOW_SALT0_CONTROL |
262 |
ivartype = 2 |
263 |
write(weighttype(1:80),'(80a)') ' ' |
264 |
write(weighttype(1:80),'(a)') "wsaltLev" |
265 |
call ctrl_set_pack_xyz( |
266 |
& cunit, ivartype, fname_salt(ictrlgrad), "maskCtrlC", |
267 |
& weighttype, wsalt, lxxadxx, mythid) |
268 |
#endif |
269 |
|
270 |
#if (defined (ALLOW_HFLUX_CONTROL) || defined (ALLOW_HFLUX0_CONTROL)) |
271 |
ivartype = 3 |
272 |
write(weighttype(1:80),'(80a)') ' ' |
273 |
write(weighttype(1:80),'(a)') "whflux" |
274 |
call ctrl_set_pack_xy( |
275 |
& cunit, ivartype, forcingPrecond, |
276 |
& fname_hflux(ictrlgrad), "maskCtrlC", |
277 |
& weighttype, lxxadxx, mythid) |
278 |
#endif |
279 |
|
280 |
#if (defined (ALLOW_SFLUX_CONTROL) || defined (ALLOW_SFLUX0_CONTROL)) |
281 |
ivartype = 4 |
282 |
write(weighttype(1:80),'(80a)') ' ' |
283 |
write(weighttype(1:80),'(a)') "wsflux" |
284 |
call ctrl_set_pack_xy( |
285 |
& cunit, ivartype, forcingPrecond, |
286 |
& fname_sflux(ictrlgrad), "maskCtrlC", |
287 |
& weighttype, lxxadxx, mythid) |
288 |
#endif |
289 |
|
290 |
#if (defined (ALLOW_USTRESS_CONTROL) || defined (ALLOW_TAUU0_CONTROL)) |
291 |
#ifdef ALLOW_EXF |
292 |
IF ( .NOT.useAtmWind ) THEN |
293 |
#endif |
294 |
ivartype = 5 |
295 |
write(weighttype(1:80),'(80a)') ' ' |
296 |
write(weighttype(1:80),'(a)') "wtauu" |
297 |
call ctrl_set_pack_xy( |
298 |
#ifndef ALLOW_ROTATE_UV_CONTROLS |
299 |
& cunit, ivartype, forcingPrecond, |
300 |
& fname_tauu(ictrlgrad), "maskCtrlW", |
301 |
#else |
302 |
& cunit, ivartype, forcingPrecond, |
303 |
& fname_tauu(ictrlgrad), "maskCtrlC", |
304 |
#endif |
305 |
& weighttype, lxxadxx, mythid) |
306 |
#ifdef ALLOW_EXF |
307 |
ENDIF |
308 |
#endif |
309 |
#endif |
310 |
|
311 |
#if (defined (ALLOW_VSTRESS_CONTROL) || defined (ALLOW_TAUV0_CONTROL)) |
312 |
#ifdef ALLOW_EXF |
313 |
IF ( .NOT.useAtmWind ) THEN |
314 |
#endif |
315 |
ivartype = 6 |
316 |
write(weighttype(1:80),'(80a)') ' ' |
317 |
write(weighttype(1:80),'(a)') "wtauv" |
318 |
call ctrl_set_pack_xy( |
319 |
#ifndef ALLOW_ROTATE_UV_CONTROLS |
320 |
& cunit, ivartype, forcingPrecond, |
321 |
& fname_tauv(ictrlgrad), "maskCtrlS", |
322 |
#else |
323 |
& cunit, ivartype, forcingPrecond, |
324 |
& fname_tauv(ictrlgrad), "maskCtrlC", |
325 |
#endif |
326 |
& weighttype, lxxadxx, mythid) |
327 |
#ifdef ALLOW_EXF |
328 |
ENDIF |
329 |
#endif |
330 |
#endif |
331 |
|
332 |
#ifdef ALLOW_ATEMP_CONTROL |
333 |
ivartype = 7 |
334 |
write(weighttype(1:80),'(80a)') ' ' |
335 |
write(weighttype(1:80),'(a)') "watemp" |
336 |
call ctrl_set_pack_xy( |
337 |
& cunit, ivartype, forcingPrecond, |
338 |
& fname_atemp(ictrlgrad), "maskCtrlC", |
339 |
& weighttype, lxxadxx, mythid) |
340 |
#endif |
341 |
|
342 |
#ifdef ALLOW_AQH_CONTROL |
343 |
ivartype = 8 |
344 |
write(weighttype(1:80),'(80a)') ' ' |
345 |
write(weighttype(1:80),'(a)') "waqh" |
346 |
call ctrl_set_pack_xy( |
347 |
& cunit, ivartype, forcingPrecond, |
348 |
& fname_aqh(ictrlgrad), "maskCtrlC", |
349 |
& weighttype, lxxadxx, mythid) |
350 |
#endif |
351 |
|
352 |
#ifdef ALLOW_UWIND_CONTROL |
353 |
#ifdef ALLOW_EXF |
354 |
IF ( useAtmWind ) THEN |
355 |
#endif |
356 |
ivartype = 9 |
357 |
write(weighttype(1:80),'(80a)') ' ' |
358 |
write(weighttype(1:80),'(a)') "wuwind" |
359 |
call ctrl_set_pack_xy( |
360 |
& cunit, ivartype, forcingPrecond, |
361 |
& fname_uwind(ictrlgrad), "maskCtrlC", |
362 |
& weighttype, lxxadxx, mythid) |
363 |
#ifdef ALLOW_EXF |
364 |
ENDIF |
365 |
#endif |
366 |
#endif |
367 |
|
368 |
#ifdef ALLOW_VWIND_CONTROL |
369 |
#ifdef ALLOW_EXF |
370 |
IF ( useAtmWind ) THEN |
371 |
#endif |
372 |
ivartype = 10 |
373 |
write(weighttype(1:80),'(80a)') ' ' |
374 |
write(weighttype(1:80),'(a)') "wvwind" |
375 |
call ctrl_set_pack_xy( |
376 |
& cunit, ivartype, forcingPrecond, |
377 |
& fname_vwind(ictrlgrad), "maskCtrlC", |
378 |
& weighttype, lxxadxx, mythid) |
379 |
#ifdef ALLOW_EXF |
380 |
ENDIF |
381 |
#endif |
382 |
#endif |
383 |
|
384 |
#ifdef ALLOW_OBCSN_CONTROL |
385 |
ivartype = 11 |
386 |
write(weighttype(1:80),'(80a)') ' ' |
387 |
write(weighttype(1:80),'(a)') "wobcsn" |
388 |
call ctrl_set_pack_xz( |
389 |
& cunit, ivartype, fname_obcsn(ictrlgrad), "maskobcsn", |
390 |
& weighttype, wobcsn, lxxadxx, mythid) |
391 |
#endif |
392 |
|
393 |
#ifdef ALLOW_OBCSS_CONTROL |
394 |
ivartype = 12 |
395 |
write(weighttype(1:80),'(80a)') ' ' |
396 |
write(weighttype(1:80),'(a)') "wobcss" |
397 |
call ctrl_set_pack_xz( |
398 |
& cunit, ivartype, fname_obcss(ictrlgrad), "maskobcss", |
399 |
& weighttype, wobcss, lxxadxx, mythid) |
400 |
#endif |
401 |
|
402 |
#ifdef ALLOW_OBCSW_CONTROL |
403 |
ivartype = 13 |
404 |
write(weighttype(1:80),'(80a)') ' ' |
405 |
write(weighttype(1:80),'(a)') "wobcsw" |
406 |
call ctrl_set_pack_yz( |
407 |
& cunit, ivartype, fname_obcsw(ictrlgrad), "maskobcsw", |
408 |
& weighttype, wobcsw, lxxadxx, mythid) |
409 |
#endif |
410 |
|
411 |
#ifdef ALLOW_OBCSE_CONTROL |
412 |
ivartype = 14 |
413 |
write(weighttype(1:80),'(80a)') ' ' |
414 |
write(weighttype(1:80),'(a)') "wobcse" |
415 |
call ctrl_set_pack_yz( |
416 |
& cunit, ivartype, fname_obcse(ictrlgrad), "maskobcse", |
417 |
& weighttype, wobcse, lxxadxx, mythid) |
418 |
#endif |
419 |
|
420 |
#ifdef ALLOW_DIFFKR_CONTROL |
421 |
ivartype = 15 |
422 |
write(weighttype(1:80),'(80a)') ' ' |
423 |
write(weighttype(1:80),'(a)') "wdiffkr" |
424 |
call ctrl_set_pack_xyz( |
425 |
& cunit, ivartype, fname_diffkr(ictrlgrad), "maskCtrlC", |
426 |
& weighttype, wdiffkr, lxxadxx, mythid) |
427 |
#endif |
428 |
|
429 |
#ifdef ALLOW_KAPGM_CONTROL |
430 |
ivartype = 16 |
431 |
write(weighttype(1:80),'(80a)') ' ' |
432 |
write(weighttype(1:80),'(a)') "wkapgm" |
433 |
call ctrl_set_pack_xyz( |
434 |
& cunit, ivartype, fname_kapgm(ictrlgrad), "maskCtrlC", |
435 |
& weighttype, wkapgm, lxxadxx, mythid) |
436 |
#endif |
437 |
|
438 |
#ifdef ALLOW_TR10_CONTROL |
439 |
ivartype = 17 |
440 |
write(weighttype(1:80),'(80a)') ' ' |
441 |
write(weighttype(1:80),'(a)') "wtr1" |
442 |
call ctrl_set_pack_xyz( |
443 |
& cunit, ivartype, fname_tr1(ictrlgrad), "maskCtrlC", |
444 |
& weighttype, wunit, lxxadxx, mythid) |
445 |
#endif |
446 |
|
447 |
#if (defined (ALLOW_SST_CONTROL) || defined (ALLOW_SST0_CONTROL)) |
448 |
ivartype = 18 |
449 |
write(weighttype(1:80),'(80a)') ' ' |
450 |
write(weighttype(1:80),'(a)') "wsst" |
451 |
call ctrl_set_pack_xy( |
452 |
& cunit, ivartype, forcingPrecond, |
453 |
& fname_sst(ictrlgrad), "maskCtrlC", |
454 |
& weighttype, lxxadxx, mythid) |
455 |
#endif |
456 |
|
457 |
#if (defined (ALLOW_SSS_CONTROL) || defined (ALLOW_SSS0_CONTROL)) |
458 |
ivartype = 19 |
459 |
write(weighttype(1:80),'(80a)') ' ' |
460 |
write(weighttype(1:80),'(a)') "wsss" |
461 |
call ctrl_set_pack_xy( |
462 |
& cunit, ivartype, forcingPrecond, |
463 |
& fname_sss(ictrlgrad), |
464 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
465 |
#endif |
466 |
|
467 |
#ifdef ALLOW_DEPTH_CONTROL |
468 |
ivartype = 20 |
469 |
write(weighttype(1:80),'(80a)') ' ' |
470 |
write(weighttype(1:80),'(a)') "wdepth" |
471 |
call ctrl_set_pack_xy( |
472 |
& cunit, ivartype, forcingPrecond, |
473 |
& fname_depth(ictrlgrad), |
474 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
475 |
#endif /* ALLOW_DEPTH_CONTROL */ |
476 |
|
477 |
#ifdef ALLOW_EFLUXY0_CONTROL |
478 |
ivartype = 21 |
479 |
write(weighttype(1:80),'(80a)') ' ' |
480 |
write(weighttype(1:80),'(a)') "wefluxy0" |
481 |
call ctrl_set_pack_xyz( |
482 |
& cunit, ivartype, fname_efluxy(ictrlgrad), "maskCtrlS", |
483 |
& weighttype, wunit, lxxadxx, mythid) |
484 |
#endif |
485 |
|
486 |
#ifdef ALLOW_EFLUXP0_CONTROL |
487 |
ivartype = 22 |
488 |
write(weighttype(1:80),'(80a)') ' ' |
489 |
write(weighttype(1:80),'(a)') "wefluxp0" |
490 |
call ctrl_set_pack_xyz( |
491 |
& cunit, ivartype, fname_efluxp(ictrlgrad), "maskhFacV", |
492 |
& weighttype, wunit, lxxadxx, mythid) |
493 |
#endif |
494 |
|
495 |
#ifdef ALLOW_BOTTOMDRAG_CONTROL |
496 |
ivartype = 23 |
497 |
write(weighttype(1:80),'(80a)') ' ' |
498 |
write(weighttype(1:80),'(a)') "wbottomdrag" |
499 |
call ctrl_set_pack_xy( |
500 |
& cunit, ivartype, forcingPrecond, |
501 |
& fname_bottomdrag(ictrlgrad), "maskCtrlC", |
502 |
& weighttype, lxxadxx, mythid) |
503 |
#endif |
504 |
|
505 |
#ifdef ALLOW_HFLUXM_CONTROL |
506 |
ivartype = 24 |
507 |
write(weighttype(1:80),'(80a)') ' ' |
508 |
write(weighttype(1:80),'(a)') "whfluxm" |
509 |
call ctrl_set_pack_xy( |
510 |
& cunit, ivartype, forcingPrecond, |
511 |
& fname_hfluxm(ictrlgrad), "maskCtrlC", |
512 |
& weighttype, lxxadxx, mythid) |
513 |
#endif |
514 |
|
515 |
#ifdef ALLOW_EDDYPSI_CONTROL |
516 |
ivartype = 25 |
517 |
write(weighttype(1:80),'(80a)') ' ' |
518 |
write(weighttype(1:80),'(a)') "wedtaux" |
519 |
call ctrl_set_pack_xyz( |
520 |
& cunit, ivartype, fname_edtaux(ictrlgrad), "maskCtrlW", |
521 |
& weighttype, wedtaux, lxxadxx, mythid) |
522 |
|
523 |
ivartype = 26 |
524 |
write(weighttype(1:80),'(80a)') ' ' |
525 |
write(weighttype(1:80),'(a)') "wedtauy" |
526 |
call ctrl_set_pack_xyz( |
527 |
& cunit, ivartype, fname_edtauy(ictrlgrad), "maskCtrlS", |
528 |
& weighttype, wedtauy, lxxadxx, mythid) |
529 |
#endif |
530 |
|
531 |
#ifdef ALLOW_UVEL0_CONTROL |
532 |
ivartype = 27 |
533 |
write(weighttype(1:80),'(80a)') ' ' |
534 |
write(weighttype(1:80),'(a)') "wuvel" |
535 |
call ctrl_set_pack_xyz( |
536 |
& cunit, ivartype, fname_uvel(ictrlgrad), "maskCtrlW", |
537 |
& weighttype, wuvel, lxxadxx, mythid) |
538 |
#endif |
539 |
|
540 |
#ifdef ALLOW_VVEL0_CONTROL |
541 |
ivartype = 28 |
542 |
write(weighttype(1:80),'(80a)') ' ' |
543 |
write(weighttype(1:80),'(a)') "wvvel" |
544 |
call ctrl_set_pack_xyz( |
545 |
& cunit, ivartype, fname_vvel(ictrlgrad), "maskCtrlS", |
546 |
& weighttype, wvvel, lxxadxx, mythid) |
547 |
#endif |
548 |
|
549 |
#ifdef ALLOW_ETAN0_CONTROL |
550 |
ivartype = 29 |
551 |
write(weighttype(1:80),'(80a)') ' ' |
552 |
write(weighttype(1:80),'(a)') "wetan" |
553 |
call ctrl_set_pack_xy( |
554 |
& cunit, ivartype, forcingPrecond, |
555 |
& fname_etan(ictrlgrad), |
556 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
557 |
#endif |
558 |
|
559 |
#ifdef ALLOW_RELAXSST_CONTROL |
560 |
ivartype = 30 |
561 |
write(weighttype(1:80),'(80a)') ' ' |
562 |
write(weighttype(1:80),'(a)') "wrelaxsst" |
563 |
call ctrl_set_pack_xy( |
564 |
& cunit, ivartype, forcingPrecond, |
565 |
& fname_relaxsst(ictrlgrad), |
566 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
567 |
#endif |
568 |
|
569 |
#ifdef ALLOW_RELAXSSS_CONTROL |
570 |
ivartype = 31 |
571 |
write(weighttype(1:80),'(80a)') ' ' |
572 |
write(weighttype(1:80),'(a)') "wrelaxsss" |
573 |
call ctrl_set_pack_xy( |
574 |
& cunit, ivartype, forcingPrecond, |
575 |
& fname_relaxsss(ictrlgrad), |
576 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
577 |
#endif |
578 |
|
579 |
#ifdef ALLOW_PRECIP_CONTROL |
580 |
ivartype = 32 |
581 |
write(weighttype(1:80),'(80a)') ' ' |
582 |
write(weighttype(1:80),'(a)') "wprecip" |
583 |
call ctrl_set_pack_xy( |
584 |
& cunit, ivartype, forcingPrecond, |
585 |
& fname_precip(ictrlgrad), |
586 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
587 |
#endif |
588 |
|
589 |
#ifdef ALLOW_SWFLUX_CONTROL |
590 |
ivartype = 33 |
591 |
write(weighttype(1:80),'(80a)') ' ' |
592 |
write(weighttype(1:80),'(a)') "wswflux" |
593 |
call ctrl_set_pack_xy( |
594 |
& cunit, ivartype, forcingPrecond, |
595 |
& fname_swflux(ictrlgrad), |
596 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
597 |
#endif |
598 |
|
599 |
#ifdef ALLOW_SWDOWN_CONTROL |
600 |
ivartype = 34 |
601 |
write(weighttype(1:80),'(80a)') ' ' |
602 |
write(weighttype(1:80),'(a)') "wswdown" |
603 |
call ctrl_set_pack_xy( |
604 |
& cunit, ivartype, forcingPrecond, |
605 |
& fname_swdown(ictrlgrad), |
606 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
607 |
#endif |
608 |
|
609 |
#ifdef ALLOW_LWFLUX_CONTROL |
610 |
ivartype = 35 |
611 |
write(weighttype(1:80),'(80a)') ' ' |
612 |
write(weighttype(1:80),'(a)') "wlwflux" |
613 |
call ctrl_set_pack_xy( |
614 |
& cunit, ivartype, forcingPrecond, |
615 |
& fname_lwflux(ictrlgrad), |
616 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
617 |
#endif |
618 |
|
619 |
#ifdef ALLOW_LWDOWN_CONTROL |
620 |
ivartype = 36 |
621 |
write(weighttype(1:80),'(80a)') ' ' |
622 |
write(weighttype(1:80),'(a)') "wlwdown" |
623 |
call ctrl_set_pack_xy( |
624 |
& cunit, ivartype, forcingPrecond, |
625 |
& fname_lwdown(ictrlgrad), |
626 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
627 |
#endif |
628 |
|
629 |
#ifdef ALLOW_EVAP_CONTROL |
630 |
ivartype = 37 |
631 |
write(weighttype(1:80),'(80a)') ' ' |
632 |
write(weighttype(1:80),'(a)') "wevap" |
633 |
call ctrl_set_pack_xy( |
634 |
& cunit, ivartype, forcingPrecond, |
635 |
& fname_evap(ictrlgrad), |
636 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
637 |
#endif |
638 |
|
639 |
#ifdef ALLOW_SNOWPRECIP_CONTROL |
640 |
ivartype = 38 |
641 |
write(weighttype(1:80),'(80a)') ' ' |
642 |
write(weighttype(1:80),'(a)') "wsnowprecip" |
643 |
call ctrl_set_pack_xy( |
644 |
& cunit, ivartype, forcingPrecond, |
645 |
& fname_snowprecip(ictrlgrad), |
646 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
647 |
#endif |
648 |
|
649 |
#ifdef ALLOW_APRESSURE_CONTROL |
650 |
ivartype = 39 |
651 |
write(weighttype(1:80),'(80a)') ' ' |
652 |
write(weighttype(1:80),'(a)') "wapressure" |
653 |
call ctrl_set_pack_xy( |
654 |
& cunit, ivartype, forcingPrecond, |
655 |
& fname_apressure(ictrlgrad), |
656 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
657 |
#endif |
658 |
|
659 |
#ifdef ALLOW_RUNOFF_CONTROL |
660 |
ivartype = 40 |
661 |
write(weighttype(1:80),'(80a)') ' ' |
662 |
write(weighttype(1:80),'(a)') "wrunoff" |
663 |
call ctrl_set_pack_xy( |
664 |
& cunit, ivartype, forcingPrecond, |
665 |
& fname_runoff(ictrlgrad), |
666 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
667 |
#endif |
668 |
|
669 |
#ifdef ALLOW_SIAREA_CONTROL |
670 |
ivartype = 41 |
671 |
write(weighttype(1:80),'(80a)') ' ' |
672 |
write(weighttype(1:80),'(a)') "wunit" |
673 |
call ctrl_set_pack_xy( |
674 |
& cunit, ivartype, forcingPrecond, |
675 |
& fname_siarea(ictrlgrad), |
676 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
677 |
#endif |
678 |
|
679 |
#ifdef ALLOW_SIHEFF_CONTROL |
680 |
ivartype = 42 |
681 |
write(weighttype(1:80),'(80a)') ' ' |
682 |
write(weighttype(1:80),'(a)') "wunit" |
683 |
call ctrl_set_pack_xy( |
684 |
& cunit, ivartype, forcingPrecond, |
685 |
& fname_siheff(ictrlgrad), |
686 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
687 |
#endif |
688 |
|
689 |
#ifdef ALLOW_SIHSNOW_CONTROL |
690 |
ivartype = 43 |
691 |
write(weighttype(1:80),'(80a)') ' ' |
692 |
write(weighttype(1:80),'(a)') "wunit" |
693 |
call ctrl_set_pack_xy( |
694 |
& cunit, ivartype, forcingPrecond, |
695 |
& fname_sihsnow(ictrlgrad), |
696 |
& "maskCtrlC", weighttype, lxxadxx, mythid) |
697 |
#endif |
698 |
|
699 |
#ifdef ALLOW_KAPREDI_CONTROL |
700 |
ivartype = 44 |
701 |
write(weighttype(1:80),'(80a)') ' ' |
702 |
write(weighttype(1:80),'(a)') "wkapredi" |
703 |
call ctrl_set_pack_xyz( |
704 |
& cunit, ivartype, fname_kapredi(ictrlgrad), "maskCtrlC", |
705 |
& weighttype, wkapredi, lxxadxx, mythid) |
706 |
#endif |
707 |
|
708 |
#ifdef ALLOW_SHIFWFLX_CONTROL |
709 |
ivartype = 45 |
710 |
write(weighttype(1:80),'(80a)') ' ' |
711 |
write(weighttype(1:80),'(a)') "wshifwflx" |
712 |
call ctrl_set_pack_xy( |
713 |
& cunit, ivartype, forcingPrecond, |
714 |
& fname_shifwflx(ictrlgrad), |
715 |
& "maskCtrlI", weighttype, lxxadxx, mythid) |
716 |
#endif |
717 |
|
718 |
#ifdef ALLOW_GENARR2D_CONTROL |
719 |
do iarr = 1, maxCtrlArr2D |
720 |
call ctrl_set_fname( xx_genarr2d_file(iarr), |
721 |
O fname_local, mythid ) |
722 |
ivartype = 100+iarr |
723 |
cc write(weighttype(1:80),'(80a)') ' ' |
724 |
cc write(weighttype(1:80),'(a)') "wunit" |
725 |
call ctrl_set_pack_xy( |
726 |
& cunit, ivartype, genarr2dPrecond(iarr), |
727 |
& fname_local(ictrlgrad), "maskCtrlC", |
728 |
& xx_genarr2d_weight(iarr), |
729 |
& lxxadxx, mythid) |
730 |
enddo |
731 |
#endif |
732 |
|
733 |
#ifdef ALLOW_GENARR3D_CONTROL |
734 |
do iarr = 1, maxCtrlArr3D |
735 |
call ctrl_set_fname( xx_genarr3d_file(iarr), |
736 |
O fname_local, mythid ) |
737 |
ivartype = 200+iarr |
738 |
cc write(weighttype(1:80),'(80a)') ' ' |
739 |
cc write(weighttype(1:80),'(a)') "wunit" |
740 |
call ctrl_set_pack_xyz( |
741 |
& cunit, ivartype, fname_local(ictrlgrad), "maskCtrlC", |
742 |
& xx_genarr3d_weight(iarr), |
743 |
& wunit, lxxadxx, mythid) |
744 |
enddo |
745 |
#endif |
746 |
|
747 |
#ifdef ALLOW_GENTIM2D_CONTROL |
748 |
do iarr = 1, maxCtrlTim2D |
749 |
call ctrl_set_fname( xx_gentim2d_file(iarr), |
750 |
O fname_local, mythid ) |
751 |
ivartype = 300+iarr |
752 |
cc write(weighttype(1:80),'(80a)') ' ' |
753 |
cc write(weighttype(1:80),'(a)') "wunit" |
754 |
call ctrl_set_pack_xy( |
755 |
& cunit, ivartype, gentim2dPrecond(iarr), |
756 |
& fname_local(ictrlgrad), "maskCtrlC", |
757 |
& xx_gentim2d_weight(iarr), |
758 |
& lxxadxx, mythid) |
759 |
enddo |
760 |
#endif |
761 |
|
762 |
#ifdef ALLOW_PACKUNPACK_METHOD2 |
763 |
_BEGIN_MASTER( mythid ) |
764 |
IF ( myProcId .eq. 0 ) THEN |
765 |
#endif |
766 |
|
767 |
close ( cunit ) |
768 |
ENDIF !IF ( myProcId .eq. 0 ) |
769 |
_END_MASTER( mythid ) |
770 |
_BARRIER |
771 |
#endif /* EXCLUDE_CTRL_PACK */ |
772 |
|
773 |
return |
774 |
end |