1 |
jmc |
1.49 |
C $Header: /u/gcmpack/MITgcm/pkg/ctrl/ctrl_init.F,v 1.48 2012/07/31 17:43:52 heimbach Exp $ |
2 |
heimbach |
1.14 |
C $Name: $ |
3 |
heimbach |
1.1 |
|
4 |
jmc |
1.49 |
#include "CTRL_OPTIONS.h" |
5 |
heimbach |
1.1 |
|
6 |
jmc |
1.43 |
C-- File ctrl_init.F: |
7 |
|
|
C-- Contents |
8 |
|
|
C-- o CTRL_INIT |
9 |
|
|
C-- o CTRL_INIT_REC |
10 |
|
|
|
11 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
12 |
|
|
|
13 |
heimbach |
1.5 |
subroutine ctrl_init( mythid ) |
14 |
heimbach |
1.1 |
|
15 |
|
|
c ================================================================== |
16 |
heimbach |
1.5 |
c SUBROUTINE ctrl_init |
17 |
heimbach |
1.1 |
c ================================================================== |
18 |
|
|
c |
19 |
jmc |
1.49 |
c o The vector of control variables is defined here. |
20 |
heimbach |
1.11 |
c |
21 |
heimbach |
1.1 |
c ================================================================== |
22 |
heimbach |
1.5 |
c SUBROUTINE ctrl_init |
23 |
heimbach |
1.1 |
c ================================================================== |
24 |
|
|
|
25 |
|
|
implicit none |
26 |
|
|
|
27 |
|
|
c == global variables == |
28 |
|
|
|
29 |
|
|
#include "EEPARAMS.h" |
30 |
|
|
#include "SIZE.h" |
31 |
|
|
#include "PARAMS.h" |
32 |
|
|
#include "GRID.h" |
33 |
heimbach |
1.47 |
#include "CTRL_SIZE.h" |
34 |
heimbach |
1.1 |
#include "ctrl.h" |
35 |
heimbach |
1.47 |
#include "CTRL_GENARR.h" |
36 |
heimbach |
1.12 |
#include "optim.h" |
37 |
heimbach |
1.1 |
|
38 |
heimbach |
1.33 |
#ifdef ALLOW_DIC_CONTROL |
39 |
|
|
# include "DIC_CTRL.h" |
40 |
|
|
#endif |
41 |
heimbach |
1.5 |
|
42 |
heimbach |
1.1 |
c == routine arguments == |
43 |
|
|
|
44 |
|
|
integer mythid |
45 |
|
|
|
46 |
|
|
c == local variables == |
47 |
|
|
|
48 |
heimbach |
1.21 |
integer bi,bj |
49 |
mlosch |
1.36 |
integer i,j |
50 |
heimbach |
1.21 |
integer itlo,ithi |
51 |
|
|
integer jtlo,jthi |
52 |
|
|
integer jmin,jmax |
53 |
|
|
integer imin,imax |
54 |
|
|
|
55 |
heimbach |
1.11 |
integer ivar |
56 |
heimbach |
1.1 |
integer startrec |
57 |
|
|
integer endrec |
58 |
heimbach |
1.11 |
integer diffrec |
59 |
heimbach |
1.46 |
integer iarr |
60 |
heimbach |
1.5 |
|
61 |
mmazloff |
1.38 |
#ifdef ALLOW_OBCS_CONTROL_MODES |
62 |
|
|
INTEGER k,length_of_rec,dUnit |
63 |
|
|
INTEGER MDS_RECLEN |
64 |
|
|
EXTERNAL MDS_RECLEN |
65 |
|
|
#endif |
66 |
|
|
|
67 |
heimbach |
1.1 |
c == external == |
68 |
|
|
|
69 |
|
|
integer ilnblnk |
70 |
|
|
external ilnblnk |
71 |
|
|
|
72 |
|
|
c == end of interface == |
73 |
|
|
|
74 |
heimbach |
1.21 |
jtlo = mybylo(mythid) |
75 |
|
|
jthi = mybyhi(mythid) |
76 |
|
|
itlo = mybxlo(mythid) |
77 |
|
|
ithi = mybxhi(mythid) |
78 |
|
|
jmin = 1-oly |
79 |
|
|
jmax = sny+oly |
80 |
|
|
imin = 1-olx |
81 |
|
|
imax = snx+olx |
82 |
|
|
|
83 |
heimbach |
1.1 |
c-- Set default values. |
84 |
heimbach |
1.11 |
do ivar = 1,maxcvars |
85 |
mlosch |
1.36 |
ncvarindex(ivar) = -1 |
86 |
|
|
ncvarrecs(ivar) = 0 |
87 |
|
|
ncvarxmax(ivar) = 0 |
88 |
|
|
ncvarymax(ivar) = 0 |
89 |
|
|
ncvarnrmax(ivar) = 0 |
90 |
|
|
ncvargrd(ivar) = '?' |
91 |
heimbach |
1.11 |
enddo |
92 |
heimbach |
1.1 |
|
93 |
|
|
_BARRIER |
94 |
|
|
|
95 |
|
|
c-- ===================== |
96 |
|
|
c-- Initial state fields. |
97 |
|
|
c-- ===================== |
98 |
|
|
|
99 |
heimbach |
1.5 |
cph( |
100 |
|
|
cph index 7-10 reserved for atmos. state, |
101 |
|
|
cph index 11-14 reserved for open boundaries, |
102 |
|
|
cph index 15-16 reserved for mixing coeff. |
103 |
heimbach |
1.18 |
cph index 17 reserved for passive tracer TR1 |
104 |
heimbach |
1.5 |
cph index 18,19 reserved for sst, sss |
105 |
|
|
cph index 20 for hFacC |
106 |
heimbach |
1.6 |
cph index 21-22 for efluxy, efluxp |
107 |
heimbach |
1.17 |
cph index 23 for bottom drag |
108 |
|
|
cph index 24 |
109 |
|
|
cph index 25-26 for edtaux, edtauy |
110 |
|
|
cph index 27-29 for uvel0, vvel0, etan0 |
111 |
heimbach |
1.32 |
cph index 30-31 for generic 2d, 3d field |
112 |
heimbach |
1.18 |
cph index 32 reserved for precip (atmos. state) |
113 |
|
|
cph index 33 reserved for swflux (atmos. state) |
114 |
heimbach |
1.19 |
cph index 34 reserved for swdown (atmos. state) |
115 |
heimbach |
1.24 |
cph 35 lwflux |
116 |
|
|
cph 36 lwdown |
117 |
|
|
cph 37 evap |
118 |
|
|
cph 38 snowprecip |
119 |
|
|
cph 39 apressure |
120 |
|
|
cph 40 runoff |
121 |
heimbach |
1.26 |
cph 41 seaice SIAREA |
122 |
|
|
cph 42 seaice SIHEFF |
123 |
|
|
cph 43 seaice SIHSNOW |
124 |
mlosch |
1.39 |
cph 44 gmredi kapredi |
125 |
|
|
cph 45 shelfice shifwflx |
126 |
heimbach |
1.45 |
cph 47-52 mean atmos. state |
127 |
heimbach |
1.5 |
cph) |
128 |
|
|
|
129 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
130 |
heimbach |
1.6 |
c-- |
131 |
heimbach |
1.1 |
#ifdef ALLOW_THETA0_CONTROL |
132 |
heimbach |
1.5 |
c-- Initial state temperature contribution. |
133 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
134 |
|
|
& xx_theta_file, 1, 101, 1, 1, 1, |
135 |
heimbach |
1.11 |
& snx, sny, nr, 'c', '3d', mythid ) |
136 |
heimbach |
1.1 |
#endif /* ALLOW_THETA0_CONTROL */ |
137 |
|
|
|
138 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
139 |
heimbach |
1.6 |
c-- |
140 |
heimbach |
1.1 |
#ifdef ALLOW_SALT0_CONTROL |
141 |
heimbach |
1.5 |
c-- Initial state salinity contribution. |
142 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
143 |
heimbach |
1.11 |
& xx_salt_file, 2, 102, 1, 1, 1, |
144 |
|
|
& snx, sny, nr, 'c', '3d', mythid ) |
145 |
heimbach |
1.1 |
#endif /* ALLOW_SALT0_CONTROL */ |
146 |
|
|
|
147 |
heimbach |
1.5 |
c-- =========================== |
148 |
|
|
c-- Surface flux contributions. |
149 |
|
|
c-- =========================== |
150 |
|
|
|
151 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
152 |
heimbach |
1.6 |
c-- |
153 |
heimbach |
1.5 |
#if (defined (ALLOW_HFLUX_CONTROL)) |
154 |
|
|
c-- Heat flux. |
155 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_hflux_file, |
156 |
jmc |
1.40 |
I xx_hfluxstartdate1, xx_hfluxstartdate2, xx_hfluxperiod, 1, |
157 |
mlosch |
1.36 |
O xx_hfluxstartdate, diffrec, startrec, endrec, |
158 |
|
|
I mythid ) |
159 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
160 |
mlosch |
1.36 |
& xx_hflux_file, 3, 103, diffrec, startrec, endrec, |
161 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
162 |
heimbach |
1.5 |
|
163 |
|
|
#elif (defined (ALLOW_ATEMP_CONTROL)) |
164 |
|
|
c-- Atmos. temperature |
165 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_atemp_file, |
166 |
mlosch |
1.36 |
I xx_atempstartdate1, xx_atempstartdate2, xx_atempperiod, 1, |
167 |
|
|
O xx_atempstartdate, diffrec, startrec, endrec, |
168 |
|
|
I mythid ) |
169 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
170 |
mlosch |
1.36 |
& xx_atemp_file, 7, 107, diffrec, startrec, endrec, |
171 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
172 |
jmc |
1.40 |
|
173 |
heimbach |
1.5 |
#elif (defined (ALLOW_HFLUX0_CONTROL)) |
174 |
|
|
c-- initial forcing only |
175 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
176 |
|
|
& xx_hflux_file, 3, 103, 1, 1, 1, |
177 |
mlosch |
1.36 |
& snx, sny, 1, 'c', 'xy', mythid ) |
178 |
heimbach |
1.1 |
|
179 |
heimbach |
1.5 |
#endif /* ALLOW_HFLUX_CONTROL */ |
180 |
|
|
|
181 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
182 |
heimbach |
1.6 |
c-- |
183 |
heimbach |
1.5 |
#if (defined (ALLOW_SFLUX_CONTROL)) |
184 |
|
|
c-- Salt flux. |
185 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_sflux_file, |
186 |
mlosch |
1.36 |
I xx_sfluxstartdate1, xx_sfluxstartdate2, xx_sfluxperiod, 1, |
187 |
|
|
O xx_sfluxstartdate, diffrec, startrec, endrec, |
188 |
|
|
I mythid ) |
189 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
190 |
mlosch |
1.36 |
& xx_sflux_file, 4, 104, diffrec, startrec, endrec, |
191 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
192 |
jmc |
1.40 |
|
193 |
heimbach |
1.5 |
#elif (defined (ALLOW_AQH_CONTROL)) |
194 |
|
|
c-- Atmos. humidity |
195 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_aqh_file, |
196 |
mlosch |
1.36 |
I xx_aqhstartdate1, xx_aqhstartdate2, xx_aqhperiod, 1, |
197 |
|
|
O xx_aqhstartdate, diffrec, startrec, endrec, |
198 |
|
|
I mythid ) |
199 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
200 |
mlosch |
1.36 |
& xx_aqh_file, 8, 108, diffrec, startrec, endrec, |
201 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
202 |
heimbach |
1.5 |
|
203 |
|
|
#elif (defined (ALLOW_SFLUX0_CONTROL)) |
204 |
|
|
c-- initial forcing only |
205 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
206 |
|
|
& xx_sflux_file, 4, 104, 1, 1, 1, |
207 |
mlosch |
1.36 |
& snx, sny, 1, 'c', 'xy', mythid ) |
208 |
heimbach |
1.1 |
|
209 |
heimbach |
1.5 |
#endif /* ALLOW_SFLUX_CONTROL */ |
210 |
|
|
|
211 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
212 |
heimbach |
1.6 |
c-- |
213 |
heimbach |
1.5 |
#if (defined (ALLOW_USTRESS_CONTROL)) |
214 |
|
|
c-- Zonal wind stress. |
215 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_tauu_file, |
216 |
mlosch |
1.36 |
I xx_tauustartdate1, xx_tauustartdate2, xx_tauuperiod, 1, |
217 |
|
|
O xx_tauustartdate, diffrec, startrec, endrec, |
218 |
|
|
I mythid ) |
219 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
220 |
mlosch |
1.36 |
& xx_tauu_file, 5, 105, diffrec, startrec, endrec, |
221 |
gforget |
1.34 |
#ifndef ALLOW_ROTATE_UV_CONTROLS |
222 |
mlosch |
1.36 |
& snx, sny, 1, 'w', 'xy', mythid ) |
223 |
gforget |
1.34 |
#else |
224 |
mlosch |
1.36 |
& snx, sny, 1, 'c', 'xy', mythid ) |
225 |
gforget |
1.34 |
#endif |
226 |
heimbach |
1.5 |
|
227 |
|
|
#elif (defined (ALLOW_UWIND_CONTROL)) |
228 |
|
|
c-- Zonal wind speed. |
229 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_uwind_file, |
230 |
mlosch |
1.36 |
I xx_uwindstartdate1, xx_uwindstartdate2, xx_uwindperiod, 1, |
231 |
|
|
O xx_uwindstartdate, diffrec, startrec, endrec, |
232 |
|
|
I mythid ) |
233 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
234 |
mlosch |
1.36 |
& xx_uwind_file, 9, 109, diffrec, startrec, endrec, |
235 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
236 |
heimbach |
1.5 |
|
237 |
|
|
#elif (defined (ALLOW_TAUU0_CONTROL)) |
238 |
|
|
c-- initial forcing only |
239 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
240 |
mlosch |
1.36 |
& xx_tauu_file, 5, 105, 1, 1, 1, |
241 |
|
|
& snx, sny, 1, 'w', 'xy', mythid ) |
242 |
heimbach |
1.1 |
|
243 |
heimbach |
1.5 |
#endif /* ALLOW_USTRESS_CONTROL */ |
244 |
|
|
|
245 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
246 |
heimbach |
1.6 |
c-- |
247 |
heimbach |
1.5 |
#if (defined (ALLOW_VSTRESS_CONTROL)) |
248 |
|
|
c-- Meridional wind stress. |
249 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_tauv_file, |
250 |
mlosch |
1.36 |
I xx_tauvstartdate1, xx_tauvstartdate2, xx_tauvperiod, 1, |
251 |
|
|
O xx_tauvstartdate, diffrec, startrec, endrec, |
252 |
|
|
I mythid ) |
253 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
254 |
mlosch |
1.36 |
& xx_tauv_file, 6, 106, diffrec, startrec, endrec, |
255 |
gforget |
1.34 |
#ifndef ALLOW_ROTATE_UV_CONTROLS |
256 |
mlosch |
1.36 |
& snx, sny, 1, 's', 'xy', mythid ) |
257 |
jmc |
1.40 |
#else |
258 |
mlosch |
1.36 |
& snx, sny, 1, 'c', 'xy', mythid ) |
259 |
gforget |
1.34 |
#endif |
260 |
heimbach |
1.5 |
|
261 |
|
|
#elif (defined (ALLOW_VWIND_CONTROL)) |
262 |
|
|
c-- Meridional wind speed. |
263 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_vwind_file, |
264 |
mlosch |
1.36 |
I xx_vwindstartdate1, xx_vwindstartdate2, xx_vwindperiod, 1, |
265 |
|
|
O xx_vwindstartdate, diffrec, startrec, endrec, |
266 |
|
|
I mythid ) |
267 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
268 |
mlosch |
1.36 |
& xx_vwind_file, 10, 110, diffrec, startrec, endrec, |
269 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
270 |
heimbach |
1.5 |
|
271 |
|
|
#elif (defined (ALLOW_TAUV0_CONTROL)) |
272 |
|
|
c-- initial forcing only |
273 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
274 |
mlosch |
1.36 |
& xx_tauv_file, 6, 106, 1, 1, 1, |
275 |
|
|
& snx, sny, 1, 's', 'xy', mythid ) |
276 |
heimbach |
1.1 |
|
277 |
heimbach |
1.5 |
#endif /* ALLOW_VSTRESS_CONTROL */ |
278 |
|
|
|
279 |
heimbach |
1.11 |
c-- =========================== |
280 |
|
|
c-- Open boundary contributions. |
281 |
|
|
c-- =========================== |
282 |
|
|
|
283 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
284 |
heimbach |
1.6 |
c-- |
285 |
heimbach |
1.5 |
#ifdef ALLOW_OBCSN_CONTROL |
286 |
|
|
c-- Northern obc. |
287 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_obcsn_file, |
288 |
mlosch |
1.36 |
I xx_obcsnstartdate1, xx_obcsnstartdate2, xx_obcsnperiod, 4, |
289 |
|
|
O xx_obcsnstartdate, diffrec, startrec, endrec, |
290 |
|
|
I mythid ) |
291 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
292 |
mlosch |
1.36 |
& xx_obcsn_file, 11, 111, diffrec, startrec, endrec, |
293 |
|
|
& snx, 1, nr, 'm', 'xz', mythid ) |
294 |
heimbach |
1.5 |
#endif /* ALLOW_OBCSN_CONTROL */ |
295 |
|
|
|
296 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
297 |
heimbach |
1.11 |
c-- |
298 |
heimbach |
1.5 |
#ifdef ALLOW_OBCSS_CONTROL |
299 |
|
|
c-- Southern obc. |
300 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_obcss_file, |
301 |
mlosch |
1.36 |
I xx_obcssstartdate1, xx_obcssstartdate2, xx_obcssperiod, 4, |
302 |
|
|
O xx_obcssstartdate, diffrec, startrec, endrec, |
303 |
|
|
I mythid ) |
304 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
305 |
mlosch |
1.36 |
& xx_obcss_file, 12, 112, diffrec, startrec, endrec, |
306 |
|
|
& snx, 1, nr, 'm', 'xz', mythid ) |
307 |
heimbach |
1.5 |
#endif /* ALLOW_OBCSS_CONTROL */ |
308 |
|
|
|
309 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
310 |
heimbach |
1.6 |
c-- |
311 |
heimbach |
1.5 |
#ifdef ALLOW_OBCSW_CONTROL |
312 |
|
|
c-- Western obc. |
313 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_obcsw_file, |
314 |
mlosch |
1.36 |
I xx_obcswstartdate1, xx_obcswstartdate2, xx_obcswperiod, 4, |
315 |
|
|
O xx_obcswstartdate, diffrec, startrec, endrec, |
316 |
|
|
I mythid ) |
317 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
318 |
mlosch |
1.36 |
& xx_obcsw_file, 13, 113, diffrec, startrec, endrec, |
319 |
|
|
& 1, sny, nr, 'm', 'yz', mythid ) |
320 |
heimbach |
1.11 |
#endif /* ALLOW_OBCSW_CONTROL */ |
321 |
heimbach |
1.5 |
|
322 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
323 |
heimbach |
1.6 |
c-- |
324 |
heimbach |
1.5 |
#ifdef ALLOW_OBCSE_CONTROL |
325 |
|
|
c-- Eastern obc. |
326 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_obcse_file, |
327 |
mlosch |
1.36 |
I xx_obcsestartdate1, xx_obcsestartdate2, xx_obcseperiod, 4, |
328 |
|
|
O xx_obcsestartdate, diffrec, startrec, endrec, |
329 |
|
|
I mythid ) |
330 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
331 |
mlosch |
1.36 |
& xx_obcse_file, 14, 114, diffrec, startrec, endrec, |
332 |
|
|
& 1, sny, nr, 'm', 'yz', mythid ) |
333 |
heimbach |
1.5 |
#endif /* ALLOW_OBCSE_CONTROL */ |
334 |
heimbach |
1.2 |
|
335 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
336 |
heimbach |
1.6 |
c-- |
337 |
mmazloff |
1.38 |
#ifdef ALLOW_OBCS_CONTROL_MODES |
338 |
|
|
cih Get matrices for reconstruction from barotropic-barclinic modes |
339 |
|
|
CMM To use modes now hardcoded with ECCO_CPPOPTION. Would be good to have |
340 |
|
|
c run-time option and also define filename=baro_invmodes.bin |
341 |
|
|
CALL MDSFINDUNIT( dUnit, myThid ) |
342 |
|
|
length_of_rec = MDS_RECLEN( 64, NR*NR, myThid ) |
343 |
|
|
open(dUnit, file='baro_invmodes.bin', status='old', |
344 |
|
|
& access='direct', recl=length_of_rec ) |
345 |
|
|
do j = 1,Nr |
346 |
|
|
read(dUnit,rec=j) ((modesv(k,i,j), k=1,Nr), i=1,Nr) |
347 |
|
|
end do |
348 |
|
|
CLOSE( dUnit ) |
349 |
|
|
CMM double precision modesv is size [NR,NR,NR] |
350 |
jmc |
1.40 |
c dim one is z-space |
351 |
|
|
c dim two is mode space |
352 |
mmazloff |
1.38 |
c dim three is the total depth for which this set of modes applies |
353 |
|
|
c so for example modesv(:,2,nr) will be the second mode |
354 |
|
|
c in z-space for the full model depth |
355 |
jmc |
1.40 |
c The modes are to be orthogonal when weighted by dz. |
356 |
mmazloff |
1.38 |
c i.e. if f_i(z) = mode i, sum_j(f_i(z_j)*f_j(z_j)*dz_j = delta_ij |
357 |
|
|
c first mode should also be constant in depth...barotropic |
358 |
jmc |
1.40 |
c For a matlab code example how to construct the orthonormal modes, |
359 |
mmazloff |
1.38 |
c which are ideally the solution of planetary vertical mode equation |
360 |
jmc |
1.40 |
c using model mean dRho/dz, see |
361 |
mmazloff |
1.38 |
c MITgcm/verification/obcs_ctrl/input/gendata.m |
362 |
|
|
c This code is compatible with partial cells |
363 |
|
|
#endif |
364 |
|
|
|
365 |
|
|
c---------------------------------------------------------------------- |
366 |
|
|
c-- |
367 |
heimbach |
1.3 |
#ifdef ALLOW_DIFFKR_CONTROL |
368 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
369 |
mlosch |
1.36 |
& xx_diffkr_file, 15, 115, 1, 1, 1, |
370 |
|
|
& snx, sny, nr, 'c', '3d', mythid ) |
371 |
heimbach |
1.3 |
#endif /* ALLOW_DIFFKR_CONTROL */ |
372 |
|
|
|
373 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
374 |
heimbach |
1.6 |
c-- |
375 |
heimbach |
1.3 |
#ifdef ALLOW_KAPGM_CONTROL |
376 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
377 |
mlosch |
1.36 |
& xx_kapgm_file, 16, 116, 1, 1, 1, |
378 |
|
|
& snx, sny, nr, 'c', '3d', mythid ) |
379 |
heimbach |
1.3 |
#endif /* ALLOW_KAPGM_CONTROL */ |
380 |
|
|
|
381 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
382 |
heimbach |
1.6 |
c-- |
383 |
heimbach |
1.18 |
#ifdef ALLOW_TR10_CONTROL |
384 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
385 |
mlosch |
1.36 |
& xx_tr1_file, 17, 117, 1, 1, 1, |
386 |
|
|
& snx, sny, nr, 'c', '3d', mythid ) |
387 |
heimbach |
1.18 |
#endif /* ALLOW_TR10_CONTROL */ |
388 |
heimbach |
1.2 |
|
389 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
390 |
heimbach |
1.6 |
c-- |
391 |
heimbach |
1.20 |
#if (defined (ALLOW_SST_CONTROL)) |
392 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_sst_file, |
393 |
mlosch |
1.36 |
I xx_sststartdate1, xx_sststartdate2, xx_sstperiod, 1, |
394 |
|
|
O xx_sststartdate, diffrec, startrec, endrec, |
395 |
|
|
I mythid ) |
396 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
397 |
mlosch |
1.36 |
& xx_sst_file, 18, 118, diffrec, startrec, endrec, |
398 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
399 |
heimbach |
1.20 |
|
400 |
|
|
#elif (defined (ALLOW_SST0_CONTROL)) |
401 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
402 |
mlosch |
1.36 |
& xx_sst_file, 18, 118, 1, 1, 1, |
403 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
404 |
heimbach |
1.20 |
|
405 |
|
|
#endif /* ALLOW_SST_CONTROL */ |
406 |
heimbach |
1.6 |
|
407 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
408 |
heimbach |
1.6 |
c-- |
409 |
heimbach |
1.20 |
#if (defined (ALLOW_SSS_CONTROL)) |
410 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_sss_file, |
411 |
mlosch |
1.36 |
I xx_sssstartdate1, xx_sssstartdate2, xx_sssperiod, 1, |
412 |
|
|
O xx_sssstartdate, diffrec, startrec, endrec, |
413 |
|
|
I mythid ) |
414 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
415 |
mlosch |
1.36 |
& xx_sss_file, 19, 119, diffrec, startrec, endrec, |
416 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
417 |
heimbach |
1.20 |
|
418 |
|
|
#elif (defined (ALLOW_SSS0_CONTROL)) |
419 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
420 |
mlosch |
1.36 |
& xx_sss_file, 19, 119, 1, 1, 1, |
421 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
422 |
jmc |
1.40 |
|
423 |
heimbach |
1.6 |
#endif /* ALLOW_SSS0_CONTROL */ |
424 |
|
|
|
425 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
426 |
heimbach |
1.6 |
c-- |
427 |
heimbach |
1.23 |
#ifdef ALLOW_DEPTH_CONTROL |
428 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
429 |
heimbach |
1.23 |
& xx_depth_file, 20, 120, 1, 1, 1, |
430 |
heimbach |
1.11 |
& snx, sny, 1, 'c', 'xy', mythid ) |
431 |
heimbach |
1.23 |
#endif /* ALLOW_DEPTH_CONTROL */ |
432 |
heimbach |
1.6 |
|
433 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
434 |
heimbach |
1.6 |
c-- |
435 |
heimbach |
1.5 |
#ifdef ALLOW_EFLUXY0_CONTROL |
436 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
437 |
heimbach |
1.11 |
& xx_efluxy_file, 21, 121, 1, 1, 1, |
438 |
|
|
& snx, sny, nr, 's', '3d', mythid ) |
439 |
heimbach |
1.5 |
#endif /* ALLOW_EFLUXY0_CONTROL */ |
440 |
|
|
|
441 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
442 |
heimbach |
1.6 |
c-- |
443 |
heimbach |
1.5 |
#ifdef ALLOW_EFLUXP0_CONTROL |
444 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
445 |
heimbach |
1.11 |
& xx_efluxp_file, 22, 122, 1, 1, 1, |
446 |
|
|
& snx, sny, nr, 'v', '3d', mythid ) |
447 |
heimbach |
1.5 |
#endif /* ALLOW_EFLUXP0_CONTROL */ |
448 |
heimbach |
1.6 |
|
449 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
450 |
heimbach |
1.6 |
c-- |
451 |
heimbach |
1.48 |
#ifdef ALLOW_BOTTOMDRAG_CONTROL_NONGENERIC |
452 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
453 |
heimbach |
1.11 |
& xx_bottomdrag_file, 23, 123, 1, 1, 1, |
454 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
455 |
heimbach |
1.6 |
#endif /* ALLOW_BOTTOMDRAG_CONTROL */ |
456 |
|
|
|
457 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
458 |
heimbach |
1.15 |
c-- |
459 |
dfer |
1.28 |
#ifdef ALLOW_HFLUXM_CONTROL |
460 |
|
|
call ctrl_init_ctrlvar ( |
461 |
|
|
& xx_hfluxm_file, 24, 124, 1, 1, 1, |
462 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
463 |
|
|
#endif /* ALLOW_HFLUXM_CONTROL */ |
464 |
|
|
|
465 |
|
|
c---------------------------------------------------------------------- |
466 |
|
|
c-- |
467 |
gforget |
1.30 |
#ifdef ALLOW_EDDYPSI_CONTROL |
468 |
heimbach |
1.15 |
call ctrl_init_ctrlvar ( |
469 |
|
|
& xx_edtaux_file, 25, 125, 1, 1, 1, |
470 |
|
|
& snx, sny, nr, 'w', '3d', mythid ) |
471 |
|
|
|
472 |
|
|
call ctrl_init_ctrlvar ( |
473 |
|
|
& xx_edtauy_file, 26, 126, 1, 1, 1, |
474 |
|
|
& snx, sny, nr, 's', '3d', mythid ) |
475 |
gforget |
1.30 |
#endif /* ALLOW_EDDYPSI_CONTROL */ |
476 |
heimbach |
1.15 |
|
477 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
478 |
|
|
c-- |
479 |
|
|
#ifdef ALLOW_UVEL0_CONTROL |
480 |
|
|
call ctrl_init_ctrlvar ( |
481 |
|
|
& xx_uvel_file, 27, 127, 1, 1, 1, |
482 |
|
|
& snx, sny, nr, 'w', '3d', mythid ) |
483 |
|
|
#endif /* ALLOW_UVEL0_CONTROL */ |
484 |
|
|
|
485 |
|
|
c---------------------------------------------------------------------- |
486 |
|
|
c-- |
487 |
|
|
#ifdef ALLOW_VVEL0_CONTROL |
488 |
|
|
call ctrl_init_ctrlvar ( |
489 |
|
|
& xx_vvel_file, 28, 128, 1, 1, 1, |
490 |
|
|
& snx, sny, nr, 's', '3d', mythid ) |
491 |
|
|
#endif /* ALLOW_VVEL0_CONTROL */ |
492 |
|
|
|
493 |
|
|
c---------------------------------------------------------------------- |
494 |
|
|
c-- |
495 |
|
|
#ifdef ALLOW_ETAN0_CONTROL |
496 |
|
|
call ctrl_init_ctrlvar ( |
497 |
|
|
& xx_etan_file, 29, 129, 1, 1, 1, |
498 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
499 |
|
|
#endif /* ALLOW_VVEL0_CONTROL */ |
500 |
|
|
|
501 |
|
|
c---------------------------------------------------------------------- |
502 |
|
|
c-- |
503 |
heimbach |
1.32 |
#ifdef ALLOW_GEN2D_CONTROL |
504 |
heimbach |
1.16 |
call ctrl_init_ctrlvar ( |
505 |
heimbach |
1.32 |
& xx_gen2d_file, 30, 130, 1, 1, 1, |
506 |
heimbach |
1.16 |
& snx, sny, 1, 'c', 'xy', mythid ) |
507 |
heimbach |
1.32 |
#endif /* ALLOW_GEN2D_CONTROL */ |
508 |
heimbach |
1.16 |
|
509 |
|
|
c---------------------------------------------------------------------- |
510 |
|
|
c-- |
511 |
heimbach |
1.32 |
#ifdef ALLOW_GEN3D_CONTROL |
512 |
heimbach |
1.16 |
call ctrl_init_ctrlvar ( |
513 |
heimbach |
1.32 |
& xx_gen3d_file, 31, 131, 1, 1, 1, |
514 |
|
|
& snx, sny, nr, 'c', '3d', mythid ) |
515 |
|
|
#endif /* ALLOW_GEN3D_CONTROL */ |
516 |
heimbach |
1.16 |
|
517 |
|
|
c---------------------------------------------------------------------- |
518 |
heimbach |
1.17 |
c-- |
519 |
heimbach |
1.18 |
#ifdef ALLOW_PRECIP_CONTROL |
520 |
|
|
c-- Atmos. precipitation |
521 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_precip_file, |
522 |
mlosch |
1.36 |
I xx_precipstartdate1, xx_precipstartdate2, xx_precipperiod,1, |
523 |
|
|
O xx_precipstartdate, diffrec, startrec, endrec, |
524 |
|
|
I mythid ) |
525 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
526 |
mlosch |
1.36 |
& xx_precip_file, 32, 132, diffrec, startrec, endrec, |
527 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
528 |
heimbach |
1.18 |
|
529 |
|
|
#endif /* ALLOW_PRECIP_CONTROL */ |
530 |
|
|
|
531 |
|
|
c---------------------------------------------------------------------- |
532 |
|
|
c-- |
533 |
|
|
#ifdef ALLOW_SWFLUX_CONTROL |
534 |
|
|
c-- Atmos. swflux |
535 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_swflux_file, |
536 |
mlosch |
1.36 |
I xx_swfluxstartdate1, xx_swfluxstartdate2, xx_swfluxperiod, 1, |
537 |
|
|
O xx_swfluxstartdate, diffrec, startrec, endrec, |
538 |
|
|
I mythid ) |
539 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
540 |
mlosch |
1.36 |
& xx_swflux_file, 33, 133, diffrec, startrec, endrec, |
541 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
542 |
heimbach |
1.18 |
|
543 |
|
|
#endif /* ALLOW_SWFLUX_CONTROL */ |
544 |
heimbach |
1.17 |
|
545 |
|
|
c---------------------------------------------------------------------- |
546 |
heimbach |
1.19 |
c-- |
547 |
|
|
#ifdef ALLOW_SWDOWN_CONTROL |
548 |
|
|
c-- Atmos. swdown |
549 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_swdown_file, |
550 |
mlosch |
1.36 |
I xx_swdownstartdate1, xx_swdownstartdate2, xx_swdownperiod, 1, |
551 |
|
|
O xx_swdownstartdate, diffrec, startrec, endrec, |
552 |
|
|
I mythid ) |
553 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
554 |
mlosch |
1.36 |
& xx_swdown_file, 34, 134, diffrec, startrec, endrec, |
555 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
556 |
heimbach |
1.19 |
|
557 |
|
|
#endif /* ALLOW_SWDOWN_CONTROL */ |
558 |
|
|
|
559 |
|
|
c---------------------------------------------------------------------- |
560 |
heimbach |
1.24 |
c-- |
561 |
|
|
#ifdef ALLOW_LWFLUX_CONTROL |
562 |
|
|
c-- Atmos. lwflux |
563 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_lwflux_file, |
564 |
mlosch |
1.36 |
I xx_lwfluxstartdate1, xx_lwfluxstartdate2, xx_lwfluxperiod, 1, |
565 |
|
|
O xx_lwfluxstartdate, diffrec, startrec, endrec, |
566 |
|
|
I mythid ) |
567 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
568 |
mlosch |
1.36 |
& xx_lwflux_file, 35, 135, diffrec, startrec, endrec, |
569 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
570 |
heimbach |
1.24 |
|
571 |
|
|
#endif /* ALLOW_LWFLUX_CONTROL */ |
572 |
|
|
|
573 |
|
|
c---------------------------------------------------------------------- |
574 |
|
|
c-- |
575 |
|
|
#ifdef ALLOW_LWDOWN_CONTROL |
576 |
|
|
c-- Atmos. lwdown |
577 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_lwdown_file, |
578 |
mlosch |
1.36 |
I xx_lwdownstartdate1, xx_lwdownstartdate2, xx_lwdownperiod, 1, |
579 |
|
|
O xx_lwdownstartdate, diffrec, startrec, endrec, |
580 |
|
|
I mythid ) |
581 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
582 |
mlosch |
1.36 |
& xx_lwdown_file, 36, 136, diffrec, startrec, endrec, |
583 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
584 |
heimbach |
1.24 |
|
585 |
|
|
#endif /* ALLOW_LWDOWN_CONTROL */ |
586 |
|
|
|
587 |
|
|
c---------------------------------------------------------------------- |
588 |
|
|
c-- |
589 |
|
|
#ifdef ALLOW_EVAP_CONTROL |
590 |
|
|
c-- Atmos. evap |
591 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_evap_file, |
592 |
mlosch |
1.36 |
I xx_evapstartdate1, xx_evapstartdate2, xx_evapperiod, 1, |
593 |
|
|
O xx_evapstartdate, diffrec, startrec, endrec, |
594 |
|
|
I mythid ) |
595 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
596 |
mlosch |
1.36 |
& xx_evap_file, 37, 137, diffrec, startrec, endrec, |
597 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
598 |
heimbach |
1.24 |
|
599 |
|
|
#endif /* ALLOW_EVAP_CONTROL */ |
600 |
|
|
|
601 |
|
|
c---------------------------------------------------------------------- |
602 |
|
|
c-- |
603 |
|
|
#ifdef ALLOW_SNOWPRECIP_CONTROL |
604 |
|
|
c-- Atmos. snowprecip |
605 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_snowprecip_file, |
606 |
jmc |
1.40 |
I xx_snowprecipstartdate1, xx_snowprecipstartdate2, |
607 |
mlosch |
1.36 |
I xx_snowprecipperiod, 1, |
608 |
|
|
O xx_snowprecipstartdate, diffrec, startrec, endrec, |
609 |
|
|
I mythid ) |
610 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
611 |
mlosch |
1.36 |
& xx_snowprecip_file, 38, 138, diffrec, startrec, endrec, |
612 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
613 |
heimbach |
1.24 |
|
614 |
|
|
#endif /* ALLOW_SNOWPRECIP_CONTROL */ |
615 |
|
|
|
616 |
|
|
c---------------------------------------------------------------------- |
617 |
|
|
c-- |
618 |
|
|
#ifdef ALLOW_APRESSURE_CONTROL |
619 |
|
|
c-- Atmos. apressure |
620 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_apressure_file, |
621 |
jmc |
1.40 |
I xx_apressurestartdate1, xx_apressurestartdate2, |
622 |
mlosch |
1.36 |
I xx_apressureperiod, 1, |
623 |
|
|
O xx_apressurestartdate, diffrec, startrec, endrec, |
624 |
|
|
I mythid ) |
625 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
626 |
mlosch |
1.36 |
& xx_apressure_file, 39, 139, diffrec, startrec, endrec, |
627 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
628 |
heimbach |
1.24 |
|
629 |
|
|
#endif /* ALLOW_APRESSURE_CONTROL */ |
630 |
|
|
|
631 |
|
|
c---------------------------------------------------------------------- |
632 |
|
|
c-- |
633 |
|
|
#ifdef ALLOW_RUNOFF_CONTROL |
634 |
|
|
c-- Atmos. runoff |
635 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_runoff_file, |
636 |
mlosch |
1.36 |
I xx_runoffstartdate1, xx_runoffstartdate2, xx_runoffperiod, 1, |
637 |
|
|
O xx_runoffstartdate, diffrec, startrec, endrec, |
638 |
|
|
I mythid ) |
639 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
640 |
mlosch |
1.36 |
& xx_runoff_file, 40, 140, diffrec, startrec, endrec, |
641 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
642 |
heimbach |
1.24 |
#endif /* ALLOW_RUNOFF_CONTROL */ |
643 |
|
|
|
644 |
|
|
c---------------------------------------------------------------------- |
645 |
heimbach |
1.26 |
c-- |
646 |
|
|
#ifdef ALLOW_SIAREA_CONTROL |
647 |
mlosch |
1.36 |
C-- so far there are no xx_siareastartdate1, etc., so we need to fudge it. |
648 |
mlosch |
1.44 |
CML call ctrl_init_rec ( xx_siarea_file, |
649 |
mlosch |
1.36 |
CML I xx_siareastartdate1, xx_siareastartdate2, xx_siareaperiod, 1, |
650 |
|
|
CML O xx_siareastartdate, diffrec, startrec, endrec, |
651 |
|
|
CML I mythid ) |
652 |
|
|
startrec = 1 |
653 |
|
|
endrec = 1 |
654 |
|
|
diffrec = endrec - startrec + 1 |
655 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
656 |
mlosch |
1.36 |
& xx_siarea_file, 41, 141, diffrec, startrec, endrec, |
657 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
658 |
heimbach |
1.26 |
#endif /* ALLOW_siarea_CONTROL */ |
659 |
|
|
|
660 |
|
|
c---------------------------------------------------------------------- |
661 |
|
|
c-- |
662 |
|
|
#ifdef ALLOW_SIHEFF_CONTROL |
663 |
mlosch |
1.36 |
C-- so far there are no xx_siheffstartdate1, etc., so we need to fudge it. |
664 |
mlosch |
1.44 |
CML call ctrl_init_rec ( xx_siheff_file, |
665 |
mlosch |
1.36 |
CML I xx_siheffstartdate1, xx_siheffstartdate2, xx_siheffperiod, 1, |
666 |
|
|
CML O xx_siheffstartdate, diffrec, startrec, endrec, |
667 |
|
|
CML I mythid ) |
668 |
|
|
startrec = 1 |
669 |
|
|
endrec = 1 |
670 |
|
|
diffrec = endrec - startrec + 1 |
671 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
672 |
mlosch |
1.36 |
& xx_siheff_file, 42, 142, diffrec, startrec, endrec, |
673 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
674 |
heimbach |
1.26 |
#endif /* ALLOW_siheff_CONTROL */ |
675 |
|
|
|
676 |
|
|
c---------------------------------------------------------------------- |
677 |
|
|
c-- |
678 |
|
|
#ifdef ALLOW_SIHSNOW_CONTROL |
679 |
mlosch |
1.36 |
C-- so far there are no xx_sihsnowstartdate1, etc., so we need to fudge it. |
680 |
mlosch |
1.44 |
CML call ctrl_init_rec ( xx_sihsnow_file, |
681 |
mlosch |
1.36 |
CML I xx_sihsnowstartdate1, xx_sihsnowstartdate2, xx_sihsnowperiod, 1, |
682 |
|
|
CML O xx_sihsnowstartdate, diffrec, startrec, endrec, |
683 |
|
|
CML I mythid ) |
684 |
|
|
startrec = 1 |
685 |
|
|
endrec = 1 |
686 |
|
|
diffrec = endrec - startrec + 1 |
687 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
688 |
mlosch |
1.36 |
& xx_sihsnow_file, 43, 143, diffrec, startrec, endrec, |
689 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
690 |
heimbach |
1.26 |
#endif /* ALLOW_sihsnow_CONTROL */ |
691 |
|
|
|
692 |
gforget |
1.29 |
|
693 |
|
|
c---------------------------------------------------------------------- |
694 |
|
|
c-- |
695 |
|
|
#ifdef ALLOW_KAPREDI_CONTROL |
696 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
697 |
mlosch |
1.36 |
& xx_kapredi_file, 44, 144, 1, 1, 1, |
698 |
|
|
& snx, sny, nr, 'c', '3d', mythid ) |
699 |
gforget |
1.29 |
#endif /* ALLOW_KAPREDI_CONTROL */ |
700 |
|
|
|
701 |
heimbach |
1.26 |
c---------------------------------------------------------------------- |
702 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
703 |
heimbach |
1.21 |
|
704 |
mlosch |
1.39 |
#ifdef ALLOW_SHIFWFLX_CONTROL |
705 |
|
|
c-- freshwater flux underneath ice-shelves |
706 |
mlosch |
1.44 |
call ctrl_init_rec ( xx_shifwflx_file, |
707 |
mlosch |
1.39 |
I xx_shifwflxstartdate1, xx_shifwflxstartdate2, |
708 |
|
|
I xx_shifwflxperiod, 1, |
709 |
|
|
O xx_shifwflxstartdate, diffrec, startrec, endrec, |
710 |
|
|
I mythid ) |
711 |
jmc |
1.40 |
call ctrl_init_ctrlvar ( |
712 |
mlosch |
1.39 |
& xx_shifwflx_file, 45, 145, diffrec, startrec, endrec, |
713 |
|
|
& snx, sny, 1, 'i', 'xy', mythid ) |
714 |
|
|
#endif /* ALLOW_SHIFWFLX_CONTROL */ |
715 |
|
|
|
716 |
|
|
c---------------------------------------------------------------------- |
717 |
heimbach |
1.45 |
c-- |
718 |
|
|
#ifdef ALLOW_ATM_MEAN_CONTROL |
719 |
|
|
# ifdef ALLOW_ATEMP_CONTROL |
720 |
|
|
call ctrl_init_ctrlvar ( |
721 |
|
|
& xx_atemp_mean_file, 47, 147, 1, 1, 1, |
722 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
723 |
|
|
# endif |
724 |
|
|
# ifdef ALLOW_AQH_CONTROL |
725 |
|
|
call ctrl_init_ctrlvar ( |
726 |
|
|
& xx_aqh_mean_file, 48, 148, 1, 1, 1, |
727 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
728 |
|
|
# endif |
729 |
|
|
# ifdef ALLOW_UWIND_CONTROL |
730 |
|
|
call ctrl_init_ctrlvar ( |
731 |
|
|
& xx_uwind_mean_file, 49, 149, 1, 1, 1, |
732 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
733 |
|
|
# endif |
734 |
|
|
# ifdef ALLOW_VWIND_CONTROL |
735 |
|
|
call ctrl_init_ctrlvar ( |
736 |
|
|
& xx_vwind_mean_file, 50, 150, 1, 1, 1, |
737 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
738 |
|
|
# endif |
739 |
|
|
# ifdef ALLOW_PRECIP_CONTROL |
740 |
|
|
call ctrl_init_ctrlvar ( |
741 |
|
|
& xx_precip_mean_file,51, 151, 1, 1, 1, |
742 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
743 |
|
|
# endif |
744 |
|
|
# ifdef ALLOW_SWDOWN_CONTROL |
745 |
|
|
call ctrl_init_ctrlvar ( |
746 |
|
|
& xx_swdown_mean_file,52, 152, 1, 1, 1, |
747 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
748 |
|
|
# endif |
749 |
|
|
#endif /* ALLOW_ATM_MEAN_CONTROL */ |
750 |
|
|
|
751 |
|
|
c---------------------------------------------------------------------- |
752 |
heimbach |
1.46 |
c-- |
753 |
|
|
#ifdef ALLOW_GENARR2D_CONTROL |
754 |
|
|
do iarr = 1, maxCtrlArr2D |
755 |
|
|
call ctrl_init_ctrlvar ( |
756 |
jmc |
1.49 |
& xx_genarr2d_file(iarr)(1:MAX_LEN_FNAM), |
757 |
heimbach |
1.46 |
& 100+iarr, 200+iarr, 1, 1, 1, |
758 |
|
|
& snx, sny, 1, 'c', 'xy', mythid ) |
759 |
|
|
enddo |
760 |
|
|
#endif /* ALLOW_GENARR2D_CONTROL */ |
761 |
|
|
|
762 |
|
|
c---------------------------------------------------------------------- |
763 |
|
|
c-- |
764 |
|
|
#ifdef ALLOW_GENARR3D_CONTROL |
765 |
|
|
do iarr = 1, maxCtrlArr3D |
766 |
|
|
call ctrl_init_ctrlvar ( |
767 |
jmc |
1.49 |
& xx_genarr3d_file(iarr)(1:MAX_LEN_FNAM), |
768 |
heimbach |
1.46 |
& 200+iarr, 300+iarr, 1, 1, 1, |
769 |
|
|
& snx, sny, nr, 'c', '3d', mythid ) |
770 |
|
|
enddo |
771 |
|
|
#endif /* ALLOW_GENARR3D_CONTROL */ |
772 |
|
|
|
773 |
|
|
c---------------------------------------------------------------------- |
774 |
mlosch |
1.39 |
c---------------------------------------------------------------------- |
775 |
|
|
|
776 |
mlosch |
1.36 |
call ctrl_init_wet( mythid ) |
777 |
jmc |
1.40 |
|
778 |
heimbach |
1.21 |
c---------------------------------------------------------------------- |
779 |
heimbach |
1.16 |
c---------------------------------------------------------------------- |
780 |
heimbach |
1.1 |
|
781 |
heimbach |
1.33 |
#ifdef ALLOW_DIC_CONTROL |
782 |
mlosch |
1.36 |
do i = 1, dic_n_control |
783 |
|
|
xx_dic(i) = 0. _d 0 |
784 |
|
|
enddo |
785 |
heimbach |
1.33 |
#endif |
786 |
|
|
|
787 |
|
|
c---------------------------------------------------------------------- |
788 |
|
|
c---------------------------------------------------------------------- |
789 |
|
|
|
790 |
heimbach |
1.21 |
do bj = jtlo,jthi |
791 |
mlosch |
1.36 |
do bi = itlo,ithi |
792 |
|
|
do j = jmin,jmax |
793 |
|
|
do i = imin,imax |
794 |
|
|
wareaunit (i,j,bi,bj) = 1.0 |
795 |
heimbach |
1.21 |
#ifndef ALLOW_ECCO |
796 |
mlosch |
1.36 |
whflux (i,j,bi,bj) = maskC(i,j,1,bi,bj) |
797 |
|
|
wsflux (i,j,bi,bj) = maskC(i,j,1,bi,bj) |
798 |
|
|
wtauu (i,j,bi,bj) = maskW(i,j,1,bi,bj) |
799 |
|
|
wtauv (i,j,bi,bj) = maskS(i,j,1,bi,bj) |
800 |
|
|
watemp (i,j,bi,bj) = maskC(i,j,1,bi,bj) |
801 |
|
|
waqh (i,j,bi,bj) = maskC(i,j,1,bi,bj) |
802 |
|
|
wprecip (i,j,bi,bj) = maskC(i,j,1,bi,bj) |
803 |
|
|
wswflux (i,j,bi,bj) = maskC(i,j,1,bi,bj) |
804 |
|
|
wswdown (i,j,bi,bj) = maskC(i,j,1,bi,bj) |
805 |
|
|
wuwind (i,j,bi,bj) = maskC(i,j,1,bi,bj) |
806 |
|
|
wvwind (i,j,bi,bj) = maskC(i,j,1,bi,bj) |
807 |
|
|
wlwflux (i,j,bi,bj) = maskC(i,j,1,bi,bj) |
808 |
|
|
wlwdown (i,j,bi,bj) = maskC(i,j,1,bi,bj) |
809 |
|
|
wevap (i,j,bi,bj) = maskC(i,j,1,bi,bj) |
810 |
|
|
wsnowprecip(i,j,bi,bj) = maskC(i,j,1,bi,bj) |
811 |
|
|
wapressure(i,j,bi,bj) = maskC(i,j,1,bi,bj) |
812 |
|
|
wrunoff (i,j,bi,bj) = maskC(i,j,1,bi,bj) |
813 |
|
|
wsst (i,j,bi,bj) = maskC(i,j,1,bi,bj) |
814 |
|
|
wsss (i,j,bi,bj) = maskC(i,j,1,bi,bj) |
815 |
heimbach |
1.21 |
#endif |
816 |
mlosch |
1.36 |
enddo |
817 |
heimbach |
1.21 |
enddo |
818 |
mlosch |
1.36 |
enddo |
819 |
heimbach |
1.21 |
enddo |
820 |
jmc |
1.40 |
|
821 |
heimbach |
1.1 |
return |
822 |
|
|
end |
823 |
|
|
|
824 |
jmc |
1.43 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
825 |
|
|
|
826 |
jmc |
1.40 |
subroutine ctrl_init_rec( |
827 |
mlosch |
1.44 |
I fldname, |
828 |
jmc |
1.40 |
I fldstartdate1, fldstartdate2, fldperiod, nfac, |
829 |
mlosch |
1.36 |
O fldstartdate, diffrec, startrec, endrec, |
830 |
|
|
I mythid ) |
831 |
|
|
|
832 |
|
|
c ================================================================== |
833 |
|
|
c SUBROUTINE ctrl_init_rec |
834 |
|
|
c ================================================================== |
835 |
|
|
c |
836 |
jmc |
1.40 |
c helper routine to compute the first and last record of a |
837 |
mlosch |
1.36 |
c time dependent control variable |
838 |
|
|
c |
839 |
|
|
c Martin.Losch@awi.de, 2011-Mar-15 |
840 |
|
|
c |
841 |
|
|
c ================================================================== |
842 |
|
|
c SUBROUTINE ctrl_init_rec |
843 |
|
|
c ================================================================== |
844 |
|
|
|
845 |
jmc |
1.40 |
implicit none |
846 |
mlosch |
1.36 |
|
847 |
|
|
c == global variables == |
848 |
|
|
#include "SIZE.h" |
849 |
|
|
#include "EEPARAMS.h" |
850 |
|
|
#include "PARAMS.h" |
851 |
|
|
#ifdef ALLOW_CAL |
852 |
|
|
# include "cal.h" |
853 |
|
|
#endif |
854 |
jmc |
1.40 |
|
855 |
mlosch |
1.36 |
c == input variables == |
856 |
|
|
c fldstartdate1/2 : start time (date/time) of fld |
857 |
|
|
c fldperod : sampling interval of fld |
858 |
|
|
c nfac : factor for the case that fld is an obcs variable |
859 |
|
|
c in this case nfac = 4, otherwise nfac = 1 |
860 |
|
|
c mythid : thread ID of this instance |
861 |
mlosch |
1.44 |
character*(*) fldname |
862 |
mlosch |
1.36 |
integer fldstartdate1 |
863 |
|
|
integer fldstartdate2 |
864 |
|
|
_RL fldperiod |
865 |
|
|
integer nfac |
866 |
|
|
integer mythid |
867 |
jmc |
1.40 |
|
868 |
mlosch |
1.36 |
c == output variables == |
869 |
|
|
c fldstartdate : full date from fldstartdate1 and 2 |
870 |
|
|
c startrec : first record of ctrl variable |
871 |
|
|
c startrec : last record of ctrl variable |
872 |
|
|
c diffrec : difference between first and last record of ctrl variable |
873 |
|
|
integer fldstartdate(4) |
874 |
|
|
integer startrec |
875 |
|
|
integer endrec |
876 |
|
|
integer diffrec |
877 |
|
|
|
878 |
|
|
c == local variables == |
879 |
jmc |
1.40 |
integer i |
880 |
mlosch |
1.36 |
#ifdef ALLOW_CAL |
881 |
|
|
integer difftime(4) |
882 |
|
|
_RL diffsecs |
883 |
|
|
#endif /* ALLOW_CAL */ |
884 |
mlosch |
1.44 |
character*(max_len_mbuf) msgbuf |
885 |
|
|
integer il |
886 |
mlosch |
1.36 |
|
887 |
mlosch |
1.44 |
c == functions == |
888 |
|
|
integer ilnblnk |
889 |
|
|
external ilnblnk |
890 |
|
|
|
891 |
|
|
if ( debugLevel .GE. debLevB ) then |
892 |
|
|
il=ilnblnk(fldname) |
893 |
|
|
WRITE( msgBuf,'(A,A)') |
894 |
|
|
& 'CTRL_INIT_REC: Getting record indices for ',fldname(1:il) |
895 |
|
|
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
896 |
|
|
& SQUEEZE_RIGHT , myThid ) |
897 |
|
|
endif |
898 |
jmc |
1.49 |
|
899 |
mlosch |
1.36 |
c initialise some output |
900 |
|
|
do i = 1,4 |
901 |
|
|
fldstartdate(i) = 0 |
902 |
|
|
end do |
903 |
|
|
startrec = 0 |
904 |
jmc |
1.40 |
endrec = 0 |
905 |
mlosch |
1.36 |
diffrec = 0 |
906 |
|
|
if ( fldperiod .EQ. -12. ) then |
907 |
|
|
startrec = 1 |
908 |
|
|
endrec = 12*nfac |
909 |
|
|
elseif ( fldperiod .EQ. 0. ) then |
910 |
|
|
startrec = 1 |
911 |
|
|
endrec = 1*nfac |
912 |
|
|
else |
913 |
mlosch |
1.44 |
# ifdef ALLOW_CAL |
914 |
|
|
call cal_FullDate( fldstartdate1, fldstartdate2, |
915 |
|
|
& fldstartdate , mythid ) |
916 |
|
|
call cal_TimePassed( fldstartdate, modelstartdate, |
917 |
|
|
& difftime, mythid ) |
918 |
|
|
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
919 |
mlosch |
1.36 |
startrec = int((modelstart + startTime - diffsecs)/ |
920 |
|
|
& fldperiod) + 1 |
921 |
|
|
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
922 |
|
|
& fldperiod) + 2 |
923 |
|
|
if ( nfac .ne. 1 ) then |
924 |
mlosch |
1.41 |
c This is the case of obcs. |
925 |
mlosch |
1.36 |
startrec = (startrec - 1)*nfac + 1 |
926 |
mlosch |
1.42 |
endrec = endrec*nfac |
927 |
mlosch |
1.36 |
endif |
928 |
|
|
# else /* ndef ALLOW_CAL */ |
929 |
|
|
startrec = 1 |
930 |
|
|
endrec = (int((endTime - startTime)/fldperiod) + 1)*nfac |
931 |
mlosch |
1.44 |
#endif /* ALLOW_CAL */ |
932 |
mlosch |
1.36 |
endif |
933 |
|
|
diffrec = endrec - startrec + 1 |
934 |
|
|
|
935 |
mlosch |
1.44 |
if ( debugLevel .GE. debLevB ) then |
936 |
jmc |
1.49 |
WRITE( msgBuf,'(A,A,A)') |
937 |
mlosch |
1.44 |
& 'CTRL_INIT_REC: Record indices for ',fldname(1:il),':' |
938 |
|
|
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
939 |
|
|
& SQUEEZE_RIGHT , myThid ) |
940 |
jmc |
1.49 |
WRITE( msgBuf,'(A,I10,A,I10)') |
941 |
mlosch |
1.44 |
& 'CTRL_INIT_REC: startrec = ',startrec,', endrec = ',endrec |
942 |
|
|
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
943 |
|
|
& SQUEEZE_RIGHT , myThid ) |
944 |
|
|
endif |
945 |
|
|
|
946 |
mlosch |
1.36 |
return |
947 |
|
|
end |