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