1 |
C $Header: /u/gcmpack/MITgcm/pkg/ecco/cost_forcing.F,v 1.4 2005/07/28 19:51:58 heimbach Exp $ |
2 |
|
3 |
#include "COST_CPPOPTIONS.h" |
4 |
|
5 |
|
6 |
subroutine cost_forcing( |
7 |
I myiter, |
8 |
I mytime, |
9 |
I mythid |
10 |
& ) |
11 |
|
12 |
c ================================================================== |
13 |
c SUBROUTINE cost_forcing |
14 |
c ================================================================== |
15 |
c |
16 |
c o Evaluate cost function contributions of surface flux forcing. |
17 |
c Now, these are heat flux, salt flux, zonal and meridional wind |
18 |
c stress. |
19 |
c |
20 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
21 |
c |
22 |
c changed: Christian Eckert eckert@mit.edu 25-Feb-2000 |
23 |
c |
24 |
c - Restructured the code in order to create a package |
25 |
c for the MITgcmUV. |
26 |
c |
27 |
c ================================================================== |
28 |
c SUBROUTINE cost_forcing |
29 |
c ================================================================== |
30 |
|
31 |
implicit none |
32 |
|
33 |
c == global variables == |
34 |
|
35 |
#include "SIZE.h" |
36 |
#include "EEPARAMS.h" |
37 |
#include "PARAMS.h" |
38 |
#include "GRID.h" |
39 |
|
40 |
#include "cal.h" |
41 |
#include "ctrl.h" |
42 |
#include "ctrl_dummy.h" |
43 |
#include "ecco_cost.h" |
44 |
|
45 |
c == routine arguments == |
46 |
|
47 |
integer mythid |
48 |
integer myiter |
49 |
_RL mytime |
50 |
|
51 |
c == local variables == |
52 |
|
53 |
integer startrec |
54 |
integer endrec |
55 |
|
56 |
c == end of interface == |
57 |
|
58 |
c-- Evaluate the individual cost function contributions. |
59 |
|
60 |
#if (defined (ALLOW_HFLUX_COST_CONTRIBUTION) && \ |
61 |
defined (ALLOW_HFLUX_CONTROL)) |
62 |
c-- Heat flux contribution to the cost function. |
63 |
startrec = ncvarrecstart(3) |
64 |
endrec = ncvarrecsend(3) |
65 |
call cost_forcing_gen ( |
66 |
& myiter, mytime, startrec, endrec, |
67 |
& xx_hflux_file, xx_hflux_dummy, wmean_hflux, whflux, |
68 |
& num_hflux, num_hfluxm, objf_hflux, objf_hfluxm, maskC, |
69 |
& 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, wmean_atemp, watemp, |
78 |
& num_atemp, num_atempm, objf_atemp, objf_atempm, maskC, |
79 |
& mythid ) |
80 |
#endif |
81 |
|
82 |
#if (defined (ALLOW_SFLUX_COST_CONTRIBUTION) && \ |
83 |
defined (ALLOW_SFLUX_CONTROL)) |
84 |
c-- Salt flux contribution to the cost function. |
85 |
startrec = ncvarrecstart(4) |
86 |
endrec = ncvarrecsend(4) |
87 |
call cost_forcing_gen ( |
88 |
& myiter, mytime, startrec, endrec, |
89 |
& xx_sflux_file, xx_sflux_dummy, wmean_sflux, wsflux, |
90 |
& num_sflux, num_sfluxm, objf_sflux, objf_sfluxm, maskC, |
91 |
& mythid ) |
92 |
#elif (defined (ALLOW_AQH_COST_CONTRIBUTION) && \ |
93 |
defined (ALLOW_AQH_CONTROL)) |
94 |
c-- Specific humidity contribution to the cost function. |
95 |
startrec = ncvarrecstart(8) |
96 |
endrec = ncvarrecsend(8) |
97 |
call cost_forcing_gen ( |
98 |
& myiter, mytime, startrec, endrec, |
99 |
& xx_aqh_file, xx_aqh_dummy, wmean_aqh, waqh, |
100 |
& num_aqh, num_aqhm, objf_aqh, objf_aqhm, maskC, |
101 |
& mythid ) |
102 |
#endif |
103 |
|
104 |
#if (defined (ALLOW_USTRESS_COST_CONTRIBUTION )&& \ |
105 |
defined (ALLOW_USTRESS_CONTROL)) |
106 |
c-- Zonal wind stress contribution to the cost function. |
107 |
startrec = ncvarrecstart(5) |
108 |
endrec = ncvarrecsend(5) |
109 |
call cost_forcing_gen ( |
110 |
& myiter, mytime, startrec, endrec, |
111 |
& xx_tauu_file, xx_tauu_dummy, wmean_tau, wtauu, |
112 |
& num_tauu, num_tauum, objf_tauu, objf_tauum, maskW, |
113 |
& mythid ) |
114 |
#elif (defined (ALLOW_UWIND_COST_CONTRIBUTION )&& \ |
115 |
defined (ALLOW_UWIND_CONTROL)) |
116 |
c-- Zonal wind speed contribution to the cost function. |
117 |
startrec = ncvarrecstart(9) |
118 |
endrec = ncvarrecsend(9) |
119 |
call cost_forcing_gen ( |
120 |
& myiter, mytime, startrec, endrec, |
121 |
& xx_uwind_file, xx_uwind_dummy, wmean_wind, wuwind, |
122 |
& num_uwind, num_uwindm, objf_uwind, objf_uwindm, maskC, |
123 |
& mythid ) |
124 |
#endif |
125 |
|
126 |
#if (defined (ALLOW_VSTRESS_COST_CONTRIBUTION) && \ |
127 |
defined (ALLOW_VSTRESS_CONTROL)) |
128 |
c-- Meridional wind stress contribution to the cost function. |
129 |
startrec = ncvarrecstart(6) |
130 |
endrec = ncvarrecsend(6) |
131 |
call cost_forcing_gen ( |
132 |
& myiter, mytime, startrec, endrec, |
133 |
& xx_tauv_file, xx_tauv_dummy, wmean_tau, wtauv, |
134 |
& num_tauv, num_tauvm, objf_tauv, objf_tauvm, maskS, |
135 |
& mythid ) |
136 |
#elif (defined (ALLOW_VWIND_COST_CONTRIBUTION) && \ |
137 |
defined (ALLOW_VWIND_CONTROL)) |
138 |
c-- Meridional wind speed contribution to the cost function. |
139 |
startrec = ncvarrecstart(10) |
140 |
endrec = ncvarrecsend(10) |
141 |
call cost_forcing_gen ( |
142 |
& myiter, mytime, startrec, endrec, |
143 |
& xx_vwind_file, xx_vwind_dummy, wmean_wind, wvwind, |
144 |
& num_vwind, num_vwindm, objf_vwind, objf_vwindm, maskC, |
145 |
& mythid ) |
146 |
#endif |
147 |
|
148 |
#if (defined (ALLOW_PRECIP_COST_CONTRIBUTION) && \ |
149 |
defined (ALLOW_PRECIP_CONTROL)) |
150 |
c-- Atmos. temp. contribution to the cost function. |
151 |
startrec = ncvarrecstart(32) |
152 |
endrec = ncvarrecsend(32) |
153 |
call cost_forcing_gen ( |
154 |
& myiter, mytime, startrec, endrec, |
155 |
& xx_precip_file, xx_precip_dummy, wmean_precip, wprecip, |
156 |
& num_precip, num_precipm, objf_precip, objf_precipm, maskC, |
157 |
& mythid ) |
158 |
#endif |
159 |
|
160 |
#if (defined (ALLOW_SWFLUX_COST_CONTRIBUTION) && \ |
161 |
defined (ALLOW_SWFLUX_CONTROL)) |
162 |
c-- Atmos. temp. contribution to the cost function. |
163 |
startrec = ncvarrecstart(33) |
164 |
endrec = ncvarrecsend(33) |
165 |
call cost_forcing_gen ( |
166 |
& myiter, mytime, startrec, endrec, |
167 |
& xx_swflux_file, xx_swflux_dummy, wmean_swflux, wswflux, |
168 |
& num_swflux, num_swfluxm, objf_swflux, objf_swfluxm, maskC, |
169 |
& mythid ) |
170 |
#endif |
171 |
|
172 |
end |