1 |
C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_forcing.F,v 1.10 2006/03/02 02:53:23 heimbach Exp $ |
2 |
|
3 |
cc#include "COST_CPPOPTIONS.h" |
4 |
#include "CPP_OPTIONS.h" |
5 |
|
6 |
subroutine smooth_inv_cost_forcing( myiter, mytime, mythid ) |
7 |
|
8 |
c ================================================================== |
9 |
c SUBROUTINE cost_forcing |
10 |
c ================================================================== |
11 |
c |
12 |
c o Evaluate cost function contributions of surface flux forcing. |
13 |
c Now, these are heat flux, salt flux, zonal and meridional wind |
14 |
c stress. |
15 |
c |
16 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
17 |
c |
18 |
c changed: Christian Eckert eckert@mit.edu 25-Feb-2000 |
19 |
c |
20 |
c - Restructured the code in order to create a package |
21 |
c for the MITgcmUV. |
22 |
c |
23 |
c ================================================================== |
24 |
c SUBROUTINE cost_forcing |
25 |
c ================================================================== |
26 |
|
27 |
implicit none |
28 |
|
29 |
c == global variables == |
30 |
|
31 |
#include "SIZE.h" |
32 |
#include "EEPARAMS.h" |
33 |
#include "PARAMS.h" |
34 |
#include "GRID.h" |
35 |
|
36 |
#include "cal.h" |
37 |
#ifdef ALLOW_CTRL |
38 |
#include "ctrl.h" |
39 |
#include "ctrl_dummy.h" |
40 |
#endif |
41 |
#ifdef ALLOW_COST |
42 |
#include "ecco_cost.h" |
43 |
#endif |
44 |
#include "smooth_inv.h" |
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 |
c == end of interface == |
58 |
|
59 |
#ifdef ALLOW_SMOOTH_INV |
60 |
|
61 |
c-- Evaluate the individual cost function contributions. |
62 |
|
63 |
#if (defined (ALLOW_HFLUX_COST_CONTRIBUTION) && \ |
64 |
defined (ALLOW_HFLUX_CONTROL)) |
65 |
c-- Heat flux contribution to the cost function. |
66 |
startrec = ncvarrecstart(3) |
67 |
endrec = ncvarrecsend(3) |
68 |
call cost_forcing_gen ( |
69 |
& myiter, mytime, startrec, endrec, |
70 |
& xx_hfluxSMmR_file, xx_hfluxSMmR_dummy, xx_hfluxperiod, |
71 |
& wmean_hflux, whflux, |
72 |
& num_hflux, num_hfluxm, |
73 |
& objf_hflux, objf_hfluxm, objf_hfluxsmoo, |
74 |
& xx_hflux_remo_intercept, xx_hflux_remo_slope, |
75 |
& maskC, mythid ) |
76 |
#elif (defined (ALLOW_ATEMP_COST_CONTRIBUTION) && \ |
77 |
defined (ALLOW_ATEMP_CONTROL)) |
78 |
c-- Atmos. temp. contribution to the cost function. |
79 |
startrec = ncvarrecstart(7) |
80 |
endrec = ncvarrecsend(7) |
81 |
call cost_forcing_gen ( |
82 |
& myiter, mytime, startrec, endrec, |
83 |
& xx_atempSMmR_file, xx_atempSMmR_dummy, xx_atempperiod, |
84 |
& wmean_atemp, watemp, |
85 |
& num_atemp, num_atempm, |
86 |
& objf_atemp, objf_atempm, objf_atempsmoo, |
87 |
& xx_atemp_remo_intercept, xx_atemp_remo_slope, |
88 |
& maskC, mythid ) |
89 |
#endif |
90 |
|
91 |
#if (defined (ALLOW_SFLUX_COST_CONTRIBUTION) && \ |
92 |
defined (ALLOW_SFLUX_CONTROL)) |
93 |
c-- Salt flux contribution to the cost function. |
94 |
startrec = ncvarrecstart(4) |
95 |
endrec = ncvarrecsend(4) |
96 |
call cost_forcing_gen ( |
97 |
& myiter, mytime, startrec, endrec, |
98 |
& xx_sfluxSMmR_file, xx_sfluxSMmR_dummy, xx_sfluxperiod, |
99 |
& wmean_sflux, wsflux, |
100 |
& num_sflux, num_sfluxm, |
101 |
& objf_sflux, objf_sfluxm, objf_sfluxsmoo, |
102 |
& xx_sflux_remo_intercept, xx_sflux_remo_slope, |
103 |
& maskC, mythid ) |
104 |
#elif (defined (ALLOW_AQH_COST_CONTRIBUTION) && \ |
105 |
defined (ALLOW_AQH_CONTROL)) |
106 |
c-- Specific humidity contribution to the cost function. |
107 |
startrec = ncvarrecstart(8) |
108 |
endrec = ncvarrecsend(8) |
109 |
call cost_forcing_gen ( |
110 |
& myiter, mytime, startrec, endrec, |
111 |
& xx_aqhSMmR_file, xx_aqhSMmR_dummy, xx_aqhperiod, |
112 |
& wmean_aqh, waqh, |
113 |
& num_aqh, num_aqhm, |
114 |
& objf_aqh, objf_aqhm, objf_aqhsmoo, |
115 |
& xx_aqh_remo_intercept, xx_aqh_remo_slope, |
116 |
& maskC, mythid ) |
117 |
#endif |
118 |
|
119 |
#if (defined (ALLOW_USTRESS_COST_CONTRIBUTION )&& \ |
120 |
defined (ALLOW_USTRESS_CONTROL)) |
121 |
c-- Zonal wind stress contribution to the cost function. |
122 |
startrec = ncvarrecstart(5) |
123 |
endrec = ncvarrecsend(5) |
124 |
call cost_forcing_gen ( |
125 |
& myiter, mytime, startrec, endrec, |
126 |
& xx_tauuSMmR_file, xx_tauuSMmR_dummy, xx_tauuperiod, |
127 |
& wmean_tau, wtauu, |
128 |
& num_tauu, num_tauum, |
129 |
& objf_tauu, objf_tauum, objf_tauusmoo, |
130 |
& xx_tauu_remo_intercept, xx_tauu_remo_slope, |
131 |
& maskW, mythid ) |
132 |
#elif (defined (ALLOW_UWIND_COST_CONTRIBUTION )&& \ |
133 |
defined (ALLOW_UWIND_CONTROL)) |
134 |
c-- Zonal wind speed contribution to the cost function. |
135 |
startrec = ncvarrecstart(9) |
136 |
endrec = ncvarrecsend(9) |
137 |
call cost_forcing_gen ( |
138 |
& myiter, mytime, startrec, endrec, |
139 |
& xx_uwindSMmR_file, xx_uwindSMmR_dummy, xx_uwindperiod, |
140 |
& wmean_wind, wuwind, |
141 |
& num_uwind, num_uwindm, |
142 |
& objf_uwind, objf_uwindm, objf_uwindsmoo, |
143 |
& xx_uwind_remo_intercept, xx_uwind_remo_slope, |
144 |
& maskC, mythid ) |
145 |
#endif |
146 |
|
147 |
#if (defined (ALLOW_VSTRESS_COST_CONTRIBUTION) && \ |
148 |
defined (ALLOW_VSTRESS_CONTROL)) |
149 |
c-- Meridional wind stress contribution to the cost function. |
150 |
startrec = ncvarrecstart(6) |
151 |
endrec = ncvarrecsend(6) |
152 |
call cost_forcing_gen ( |
153 |
& myiter, mytime, startrec, endrec, |
154 |
& xx_tauvSMmR_file, xx_tauvSMmR_dummy, xx_tauvperiod, |
155 |
& wmean_tau, wtauv, |
156 |
& num_tauv, num_tauvm, |
157 |
& objf_tauv, objf_tauvm, objf_tauvsmoo, |
158 |
& xx_tauv_remo_intercept, xx_tauv_remo_slope, |
159 |
& maskS, mythid ) |
160 |
#elif (defined (ALLOW_VWIND_COST_CONTRIBUTION) && \ |
161 |
defined (ALLOW_VWIND_CONTROL)) |
162 |
c-- Meridional wind speed contribution to the cost function. |
163 |
startrec = ncvarrecstart(10) |
164 |
endrec = ncvarrecsend(10) |
165 |
call cost_forcing_gen ( |
166 |
& myiter, mytime, startrec, endrec, |
167 |
& xx_vwindSMmR_file, xx_vwindSMmR_dummy, xx_vwindperiod, |
168 |
& wmean_wind, wvwind, |
169 |
& num_vwind, num_vwindm, |
170 |
& objf_vwind, objf_vwindm, objf_vwindsmoo, |
171 |
& xx_vwind_remo_intercept, xx_vwind_remo_slope, |
172 |
& maskC, mythid ) |
173 |
#endif |
174 |
|
175 |
#if (defined (ALLOW_PRECIP_COST_CONTRIBUTION) && \ |
176 |
defined (ALLOW_PRECIP_CONTROL)) |
177 |
c-- Atmos. precip. contribution to the cost function. |
178 |
startrec = ncvarrecstart(32) |
179 |
endrec = ncvarrecsend(32) |
180 |
call cost_forcing_gen ( |
181 |
& myiter, mytime, startrec, endrec, |
182 |
& xx_precipSMmR_file, xx_precipSMmR_dummy, xx_precipperiod, |
183 |
& wmean_precip, wprecip, |
184 |
& num_precip, num_precipm, |
185 |
& objf_precip, objf_precipm, objf_precipsmoo, |
186 |
& xx_precip_remo_intercept, xx_precip_remo_slope, |
187 |
& maskC, mythid ) |
188 |
#endif |
189 |
|
190 |
#if (defined (ALLOW_SWFLUX_COST_CONTRIBUTION) && \ |
191 |
defined (ALLOW_SWFLUX_CONTROL)) |
192 |
c-- Atmos. swflux. contribution to the cost function. |
193 |
startrec = ncvarrecstart(33) |
194 |
endrec = ncvarrecsend(33) |
195 |
call cost_forcing_gen ( |
196 |
& myiter, mytime, startrec, endrec, |
197 |
& xx_swfluxSMmR_file, xx_swfluxSMmR_dummy, xx_swfluxperiod, |
198 |
& wmean_swflux, wswflux, |
199 |
& num_swflux, num_swfluxm, |
200 |
& objf_swflux, objf_swfluxm, objf_swfluxsmoo, |
201 |
& xx_swflux_remo_intercept, xx_swflux_remo_slope, |
202 |
& maskC, mythid ) |
203 |
#endif |
204 |
|
205 |
#if (defined (ALLOW_SWDOWN_COST_CONTRIBUTION) && \ |
206 |
defined (ALLOW_SWDOWN_CONTROL)) |
207 |
c-- Atmos. swdown. 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_swdownSMmR_file, xx_swdownSMmR_dummy, xx_swdownperiod, |
213 |
& wmean_swdown, wswdown, |
214 |
& num_swdown, num_swdownm, |
215 |
& objf_swdown, objf_swdownm, objf_swdownsmoo, |
216 |
& xx_swdown_remo_intercept, xx_swdown_remo_slope, |
217 |
& maskC, mythid ) |
218 |
#endif |
219 |
|
220 |
#endif |
221 |
|
222 |
end |