1 |
C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_forcing.F,v 1.16 2012/08/28 19:19:18 gforget Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "ECCO_OPTIONS.h" |
5 |
|
6 |
|
7 |
subroutine cost_forcing( myiter, mytime, mythid ) |
8 |
|
9 |
c ================================================================== |
10 |
c SUBROUTINE cost_forcing |
11 |
c ================================================================== |
12 |
c |
13 |
c o Evaluate cost function contributions of surface flux forcing. |
14 |
c Now, these are heat flux, salt flux, zonal and meridional wind |
15 |
c stress. |
16 |
c |
17 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
18 |
c |
19 |
c changed: Christian Eckert eckert@mit.edu 25-Feb-2000 |
20 |
c |
21 |
c - Restructured the code in order to create a package |
22 |
c for the MITgcmUV. |
23 |
c |
24 |
c ================================================================== |
25 |
c SUBROUTINE cost_forcing |
26 |
c ================================================================== |
27 |
|
28 |
implicit none |
29 |
|
30 |
c == global variables == |
31 |
|
32 |
#include "SIZE.h" |
33 |
#include "EEPARAMS.h" |
34 |
#include "PARAMS.h" |
35 |
#include "GRID.h" |
36 |
|
37 |
#include "cal.h" |
38 |
#include "CTRL_SIZE.h" |
39 |
#include "ctrl.h" |
40 |
#include "ctrl_dummy.h" |
41 |
#include "ecco_cost.h" |
42 |
#ifdef ALLOW_EXF |
43 |
# include "EXF_PARAM.h" |
44 |
#endif |
45 |
|
46 |
c == routine arguments == |
47 |
|
48 |
integer mythid |
49 |
integer myiter |
50 |
_RL mytime |
51 |
|
52 |
c == local variables == |
53 |
|
54 |
integer startrec |
55 |
integer endrec |
56 |
|
57 |
#ifndef ALLOW_EXF |
58 |
LOGICAL useAtmWind |
59 |
PARAMETER ( useAtmWind = .TRUE. ) |
60 |
#endif |
61 |
|
62 |
c == end of interface == |
63 |
|
64 |
c-- Evaluate the individual cost function contributions. |
65 |
|
66 |
#if (defined (ALLOW_HFLUX_COST_CONTRIBUTION) && \ |
67 |
defined (ALLOW_HFLUX_CONTROL)) |
68 |
c-- Heat flux contribution to the cost function. |
69 |
startrec = ncvarrecstart(3) |
70 |
endrec = ncvarrecsend(3) |
71 |
call cost_forcing_gen ( |
72 |
& myiter, mytime, startrec, endrec, |
73 |
& xx_hflux_file, xx_hflux_dummy, xx_hfluxperiod, |
74 |
& wmean_hflux, whflux, |
75 |
& num_hflux, num_hfluxm, |
76 |
& objf_hflux, objf_hfluxm, objf_hfluxsmoo, |
77 |
& xx_hflux_remo_intercept, xx_hflux_remo_slope, |
78 |
& maskC, mythid ) |
79 |
#elif (defined (ALLOW_ATEMP_COST_CONTRIBUTION) && \ |
80 |
defined (ALLOW_ATEMP_CONTROL)) |
81 |
c-- Atmos. temp. contribution to the cost function. |
82 |
startrec = ncvarrecstart(7) |
83 |
endrec = ncvarrecsend(7) |
84 |
call cost_forcing_gen ( |
85 |
& myiter, mytime, startrec, endrec, |
86 |
& xx_atemp_file, xx_atemp_dummy, xx_atempperiod, |
87 |
& wmean_atemp, watemp, |
88 |
& num_atemp, num_atempm, |
89 |
& objf_atemp, objf_atempm, objf_atempsmoo, |
90 |
& xx_atemp_remo_intercept, xx_atemp_remo_slope, |
91 |
& maskC, mythid ) |
92 |
#endif |
93 |
|
94 |
#if (defined (ALLOW_SFLUX_COST_CONTRIBUTION) && \ |
95 |
defined (ALLOW_SFLUX_CONTROL)) |
96 |
c-- Salt flux contribution to the cost function. |
97 |
startrec = ncvarrecstart(4) |
98 |
endrec = ncvarrecsend(4) |
99 |
call cost_forcing_gen ( |
100 |
& myiter, mytime, startrec, endrec, |
101 |
& xx_sflux_file, xx_sflux_dummy, xx_sfluxperiod, |
102 |
& wmean_sflux, wsflux, |
103 |
& num_sflux, num_sfluxm, |
104 |
& objf_sflux, objf_sfluxm, objf_sfluxsmoo, |
105 |
& xx_sflux_remo_intercept, xx_sflux_remo_slope, |
106 |
& maskC, mythid ) |
107 |
#elif (defined (ALLOW_AQH_COST_CONTRIBUTION) && \ |
108 |
defined (ALLOW_AQH_CONTROL)) |
109 |
c-- Specific humidity contribution to the cost function. |
110 |
startrec = ncvarrecstart(8) |
111 |
endrec = ncvarrecsend(8) |
112 |
call cost_forcing_gen ( |
113 |
& myiter, mytime, startrec, endrec, |
114 |
& xx_aqh_file, xx_aqh_dummy, xx_aqhperiod, |
115 |
& wmean_aqh, waqh, |
116 |
& num_aqh, num_aqhm, |
117 |
& objf_aqh, objf_aqhm, objf_aqhsmoo, |
118 |
& xx_aqh_remo_intercept, xx_aqh_remo_slope, |
119 |
& maskC, mythid ) |
120 |
#endif |
121 |
|
122 |
#if (defined (ALLOW_USTRESS_COST_CONTRIBUTION )&& \ |
123 |
defined (ALLOW_USTRESS_CONTROL)) |
124 |
IF ( .NOT.useAtmWind ) THEN |
125 |
c-- Zonal wind stress contribution to the cost function. |
126 |
startrec = ncvarrecstart(5) |
127 |
endrec = ncvarrecsend(5) |
128 |
call cost_forcing_gen ( |
129 |
& myiter, mytime, startrec, endrec, |
130 |
& xx_tauu_file, xx_tauu_dummy, xx_tauuperiod, |
131 |
& wmean_tau, wtauu, |
132 |
& num_tauu, num_tauum, |
133 |
& objf_tauu, objf_tauum, objf_tauusmoo, |
134 |
& xx_tauu_remo_intercept, xx_tauu_remo_slope, |
135 |
& maskW, mythid ) |
136 |
ENDIF |
137 |
#endif |
138 |
|
139 |
#if (defined (ALLOW_UWIND_COST_CONTRIBUTION )&& \ |
140 |
defined (ALLOW_UWIND_CONTROL)) |
141 |
IF ( useAtmWind ) THEN |
142 |
c-- Zonal wind speed contribution to the cost function. |
143 |
startrec = ncvarrecstart(9) |
144 |
endrec = ncvarrecsend(9) |
145 |
call cost_forcing_gen ( |
146 |
& myiter, mytime, startrec, endrec, |
147 |
& xx_uwind_file, xx_uwind_dummy, xx_uwindperiod, |
148 |
& wmean_wind, wuwind, |
149 |
& num_uwind, num_uwindm, |
150 |
& objf_uwind, objf_uwindm, objf_uwindsmoo, |
151 |
& xx_uwind_remo_intercept, xx_uwind_remo_slope, |
152 |
& maskC, mythid ) |
153 |
ENDIF |
154 |
#endif |
155 |
|
156 |
#if (defined (ALLOW_VSTRESS_COST_CONTRIBUTION) && \ |
157 |
defined (ALLOW_VSTRESS_CONTROL)) |
158 |
IF ( .NOT.useAtmWind ) THEN |
159 |
c-- Meridional wind stress contribution to the cost function. |
160 |
startrec = ncvarrecstart(6) |
161 |
endrec = ncvarrecsend(6) |
162 |
call cost_forcing_gen ( |
163 |
& myiter, mytime, startrec, endrec, |
164 |
& xx_tauv_file, xx_tauv_dummy, xx_tauvperiod, |
165 |
& wmean_tau, wtauv, |
166 |
& num_tauv, num_tauvm, |
167 |
& objf_tauv, objf_tauvm, objf_tauvsmoo, |
168 |
& xx_tauv_remo_intercept, xx_tauv_remo_slope, |
169 |
& maskS, mythid ) |
170 |
ENDIF |
171 |
#endif |
172 |
|
173 |
#if (defined (ALLOW_VWIND_COST_CONTRIBUTION) && \ |
174 |
defined (ALLOW_VWIND_CONTROL)) |
175 |
IF ( useAtmWind ) THEN |
176 |
c-- Meridional wind speed contribution to the cost function. |
177 |
startrec = ncvarrecstart(10) |
178 |
endrec = ncvarrecsend(10) |
179 |
call cost_forcing_gen ( |
180 |
& myiter, mytime, startrec, endrec, |
181 |
& xx_vwind_file, xx_vwind_dummy, xx_vwindperiod, |
182 |
& wmean_wind, wvwind, |
183 |
& num_vwind, num_vwindm, |
184 |
& objf_vwind, objf_vwindm, objf_vwindsmoo, |
185 |
& xx_vwind_remo_intercept, xx_vwind_remo_slope, |
186 |
& maskC, mythid ) |
187 |
ENDIF |
188 |
#endif |
189 |
|
190 |
#if (defined (ALLOW_PRECIP_COST_CONTRIBUTION) && \ |
191 |
defined (ALLOW_PRECIP_CONTROL)) |
192 |
c-- Atmos. precip. contribution to the cost function. |
193 |
startrec = ncvarrecstart(32) |
194 |
endrec = ncvarrecsend(32) |
195 |
call cost_forcing_gen ( |
196 |
& myiter, mytime, startrec, endrec, |
197 |
& xx_precip_file, xx_precip_dummy, xx_precipperiod, |
198 |
& wmean_precip, wprecip, |
199 |
& num_precip, num_precipm, |
200 |
& objf_precip, objf_precipm, objf_precipsmoo, |
201 |
& xx_precip_remo_intercept, xx_precip_remo_slope, |
202 |
& maskC, mythid ) |
203 |
#endif |
204 |
|
205 |
#if (defined (ALLOW_SWFLUX_COST_CONTRIBUTION) && \ |
206 |
defined (ALLOW_SWFLUX_CONTROL)) |
207 |
c-- Atmos. swflux. contribution to the cost function. |
208 |
startrec = ncvarrecstart(33) |
209 |
endrec = ncvarrecsend(33) |
210 |
call cost_forcing_gen ( |
211 |
& myiter, mytime, startrec, endrec, |
212 |
& xx_swflux_file, xx_swflux_dummy, xx_swfluxperiod, |
213 |
& wmean_swflux, wswflux, |
214 |
& num_swflux, num_swfluxm, |
215 |
& objf_swflux, objf_swfluxm, objf_swfluxsmoo, |
216 |
& xx_swflux_remo_intercept, xx_swflux_remo_slope, |
217 |
& maskC, mythid ) |
218 |
#endif |
219 |
|
220 |
#if (defined (ALLOW_SWDOWN_COST_CONTRIBUTION) && \ |
221 |
defined (ALLOW_SWDOWN_CONTROL)) |
222 |
c-- Atmos. swdown. contribution to the cost function. |
223 |
startrec = ncvarrecstart(34) |
224 |
endrec = ncvarrecsend(34) |
225 |
call cost_forcing_gen ( |
226 |
& myiter, mytime, startrec, endrec, |
227 |
& xx_swdown_file, xx_swdown_dummy, xx_swdownperiod, |
228 |
& wmean_swdown, wswdown, |
229 |
& num_swdown, num_swdownm, |
230 |
& objf_swdown, objf_swdownm, objf_swdownsmoo, |
231 |
& xx_swdown_remo_intercept, xx_swdown_remo_slope, |
232 |
& maskC, mythid ) |
233 |
#endif |
234 |
|
235 |
#if (defined (ALLOW_LWFLUX_COST_CONTRIBUTION) && \ |
236 |
defined (ALLOW_LWFLUX_CONTROL)) |
237 |
c-- Atmos. lwflux. contribution to the cost function. |
238 |
startrec = ncvarrecstart(35) |
239 |
endrec = ncvarrecsend(35) |
240 |
call cost_forcing_gen ( |
241 |
& myiter, mytime, startrec, endrec, |
242 |
& xx_lwflux_file, xx_lwflux_dummy, xx_lwfluxperiod, |
243 |
& wmean_lwflux, wlwflux, |
244 |
& num_lwflux, num_lwfluxm, |
245 |
& objf_lwflux, objf_lwfluxm, objf_lwfluxsmoo, |
246 |
& xx_lwflux_remo_intercept, xx_lwflux_remo_slope, |
247 |
& maskC, mythid ) |
248 |
#endif |
249 |
|
250 |
#if (defined (ALLOW_LWDOWN_COST_CONTRIBUTION) && \ |
251 |
defined (ALLOW_LWDOWN_CONTROL)) |
252 |
c-- Atmos. lwdown. contribution to the cost function. |
253 |
startrec = ncvarrecstart(36) |
254 |
endrec = ncvarrecsend(36) |
255 |
call cost_forcing_gen ( |
256 |
& myiter, mytime, startrec, endrec, |
257 |
& xx_lwdown_file, xx_lwdown_dummy, xx_lwdownperiod, |
258 |
& wmean_lwdown, wlwdown, |
259 |
& num_lwdown, num_lwdownm, |
260 |
& objf_lwdown, objf_lwdownm, objf_lwdownsmoo, |
261 |
& xx_lwdown_remo_intercept, xx_lwdown_remo_slope, |
262 |
& maskC, mythid ) |
263 |
#endif |
264 |
|
265 |
#if (defined (ALLOW_EVAP_COST_CONTRIBUTION) && \ |
266 |
defined (ALLOW_EVAP_CONTROL)) |
267 |
c-- Atmos. evap. contribution to the cost function. |
268 |
startrec = ncvarrecstart(36) |
269 |
endrec = ncvarrecsend(36) |
270 |
call cost_forcing_gen ( |
271 |
& myiter, mytime, startrec, endrec, |
272 |
& xx_evap_file, xx_evap_dummy, xx_evapperiod, |
273 |
& wmean_evap, wevap, |
274 |
& num_evap, num_evapm, |
275 |
& objf_evap, objf_evapm, objf_evapsmoo, |
276 |
& xx_evap_remo_intercept, xx_evap_remo_slope, |
277 |
& maskC, mythid ) |
278 |
#endif |
279 |
|
280 |
#if (defined (ALLOW_SNOWPRECIP_COST_CONTRIBUTION) && \ |
281 |
defined (ALLOW_SNOWPRECIP_CONTROL)) |
282 |
c-- Atmos. snowprecip. contribution to the cost function. |
283 |
startrec = ncvarrecstart(36) |
284 |
endrec = ncvarrecsend(36) |
285 |
call cost_forcing_gen ( |
286 |
& myiter, mytime, startrec, endrec, |
287 |
& xx_snowprecip_file, xx_snowprecip_dummy, xx_snowprecipperiod, |
288 |
& wmean_snowprecip, wsnowprecip, |
289 |
& num_snowprecip, num_snowprecipm, |
290 |
& objf_snowprecip, objf_snowprecipm, objf_snowprecipsmoo, |
291 |
& xx_snowprecip_remo_intercept, xx_snowprecip_remo_slope, |
292 |
& maskC, mythid ) |
293 |
#endif |
294 |
|
295 |
#if (defined (ALLOW_APRESSURE_COST_CONTRIBUTION) && \ |
296 |
defined (ALLOW_APRESSURE_CONTROL)) |
297 |
c-- Atmos. apressure. contribution to the cost function. |
298 |
startrec = ncvarrecstart(36) |
299 |
endrec = ncvarrecsend(36) |
300 |
call cost_forcing_gen ( |
301 |
& myiter, mytime, startrec, endrec, |
302 |
& xx_apressure_file, xx_apressure_dummy, xx_apressureperiod, |
303 |
& wmean_apressure, wapressure, |
304 |
& num_apressure, num_apressurem, |
305 |
& objf_apressure, objf_apressurem, objf_apressuresmoo, |
306 |
& xx_apressure_remo_intercept, xx_apressure_remo_slope, |
307 |
& maskC, mythid ) |
308 |
#endif |
309 |
|
310 |
#if (defined (ALLOW_RUNOFF_COST_CONTRIBUTION) && \ |
311 |
defined (ALLOW_RUNOFF_CONTROL)) |
312 |
c-- Atmos. runoff. contribution to the cost function. |
313 |
startrec = ncvarrecstart(36) |
314 |
endrec = ncvarrecsend(36) |
315 |
call cost_forcing_gen ( |
316 |
& myiter, mytime, startrec, endrec, |
317 |
& xx_runoff_file, xx_runoff_dummy, xx_runoffperiod, |
318 |
& wmean_runoff, wrunoff, |
319 |
& num_runoff, num_runoffm, |
320 |
& objf_runoff, objf_runoffm, objf_runoffsmoo, |
321 |
& xx_runoff_remo_intercept, xx_runoff_remo_slope, |
322 |
& maskC, mythid ) |
323 |
#endif |
324 |
|
325 |
end |