1 |
C $Header: /u/gcmpack/MITgcm/pkg/ecco/ecco_cost_driver.F,v 1.7 2012/09/30 20:33:55 gforget Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "ECCO_OPTIONS.h" |
5 |
|
6 |
subroutine ecco_cost_driver( myTime, myIter, mythid ) |
7 |
|
8 |
c ================================================================== |
9 |
c SUBROUTINE ecco_cost_driver |
10 |
c ================================================================== |
11 |
c |
12 |
c o Compute all ecco cost function contributions. |
13 |
c |
14 |
c ================================================================== |
15 |
c SUBROUTINE ecco_cost_driver |
16 |
c ================================================================== |
17 |
|
18 |
implicit none |
19 |
|
20 |
c == global variables == |
21 |
|
22 |
#include "EEPARAMS.h" |
23 |
#include "SIZE.h" |
24 |
#include "PARAMS.h" |
25 |
#include "ecco_cost.h" |
26 |
|
27 |
c == routine arguments == |
28 |
integer mythid |
29 |
integer myiter |
30 |
_RL mytime |
31 |
|
32 |
#ifdef ALLOW_ECCO_EVOLUTION |
33 |
|
34 |
#ifdef ALLOW_AUTODIFF_TAMC |
35 |
# ifdef ALLOW_SSH_COST_CONTRIBUTION |
36 |
# ifdef ALLOW_PROFILES |
37 |
# include "profiles.h" |
38 |
# endif |
39 |
# endif |
40 |
#endif |
41 |
|
42 |
c-- Compute the cost function contribution of the boundary forcing, |
43 |
c-- i.e. heat flux, salt flux, zonal and meridional wind stress. |
44 |
#ifdef ALLOW_DEBUG |
45 |
IF (debugMode) CALL DEBUG_CALL('cost_forcing',myThid) |
46 |
#endif |
47 |
call timer_start('cost_forcing [ECCO SPIN-DOWN]', mythid) |
48 |
call cost_forcing( myiter, mytime, mythid ) |
49 |
call timer_stop ('cost_forcing [ECCO SPIN-DOWN]', mythid) |
50 |
cph( |
51 |
c-- Compute cost function contribution of wind stress observations. |
52 |
#ifdef ALLOW_MEAN_HFLUX_COST_CONTRIBUTION |
53 |
call cost_mean_heatflux( myiter, mytime, mythid ) |
54 |
# ifdef ALLOW_AUTODIFF_TAMC |
55 |
CADJ STORE objf_hfluxmm = tapelev_init, key=1 |
56 |
# endif |
57 |
#endif |
58 |
|
59 |
c-- Compute cost function contribution of wind stress observations. |
60 |
#ifdef ALLOW_MEAN_SFLUX_COST_CONTRIBUTION |
61 |
call cost_mean_saltflux( myiter, mytime, mythid ) |
62 |
# ifdef ALLOW_AUTODIFF_TAMC |
63 |
CADJ STORE objf_sfluxmm = tapelev_init, key=1 |
64 |
# endif |
65 |
#endif |
66 |
cph) |
67 |
|
68 |
c-- Compute cost function contribution of SSH. |
69 |
#ifdef ALLOW_SSH_COST_CONTRIBUTION |
70 |
IF (using_cost_altim) THEN |
71 |
# ifdef ALLOW_DEBUG |
72 |
IF (debugMode) CALL DEBUG_CALL('cost_ssh',myThid) |
73 |
# endif |
74 |
# if (defined(ALLOW_SSHV4_COST)) |
75 |
call timer_start('cost_sshv4 [ECCO SPIN-DOWN]', mythid) |
76 |
call cost_sshv4( myiter, mytime, mythid ) |
77 |
call timer_stop ('cost_sshv4 [ECCO SPIN-DOWN]', mythid) |
78 |
# elif (defined(ALLOW_NEW_SSH_COST)) |
79 |
call timer_start('cost_ssh_new [ECCO SPIN-DOWN]', mythid) |
80 |
call cost_ssh_new( myiter, mytime, mythid ) |
81 |
call timer_stop ('cost_ssh_new [ECCO SPIN-DOWN]', mythid) |
82 |
# elif (!defined (ALLOW_GENCOST_SSHV4)) |
83 |
call timer_start('cost_ssh [ECCO SPIN-DOWN]', mythid) |
84 |
call cost_ssh( myiter, mytime, mythid ) |
85 |
call timer_stop ('cost_ssh [ECCO SPIN-DOWN]', mythid) |
86 |
# endif |
87 |
ENDIF !IF (using_cost_altim) THEN |
88 |
# ifdef ALLOW_AUTODIFF_TAMC |
89 |
# ifdef ALLOW_PROFILES |
90 |
CADJ STORE prof_etan_mean = tapelev_init, key=1 |
91 |
# endif |
92 |
# endif |
93 |
#endif |
94 |
|
95 |
#ifdef ALLOW_BP_COST_CONTRIBUTION |
96 |
c-- Compute bottom pressure cost |
97 |
IF (using_cost_bp) THEN |
98 |
call timer_start('cost_bp [ECCO SPIN-DOWN]', mythid) |
99 |
call cost_bp( myiter, mytime, mythid ) |
100 |
call timer_stop ('cost_bp [ECCO SPIN-DOWN]', mythid) |
101 |
ENDIF |
102 |
#endif |
103 |
|
104 |
c-- Compute cost function contribution of Temperature and Salinity. |
105 |
#ifdef ALLOW_DEBUG |
106 |
IF (debugMode) CALL DEBUG_CALL('cost_hyd',myThid) |
107 |
#endif |
108 |
call timer_start('cost_hyd [ECCO SPIN-DOWN]', mythid) |
109 |
call cost_hyd( myiter, mytime, mythid ) |
110 |
call timer_stop ('cost_hyd [ECCO SPIN-DOWN]', mythid) |
111 |
|
112 |
#ifdef ALLOW_SEAICE |
113 |
#ifdef ALLOW_DEBUG |
114 |
IF (debugMode) CALL DEBUG_CALL('seaice_cost_driver',myThid) |
115 |
#endif |
116 |
IF ( useSeaice) THEN |
117 |
call timer_start('seaice_cost_driver [ECCO SPIN-DOWN]', mythid) |
118 |
call seaice_cost_driver( myiter, mytime, mythid ) |
119 |
call timer_stop ('seaice_cost_driver [ECCO SPIN-DOWN]', mythid) |
120 |
ENDIF |
121 |
#endif |
122 |
|
123 |
#ifdef ALLOW_OBCS_COST_CONTRIBUTION |
124 |
#ifdef ALLOW_DEBUG |
125 |
IF (debugMode) CALL DEBUG_CALL('cost_obcs',myThid) |
126 |
#endif |
127 |
call timer_start('cost_obcs [ECCO SPIN-DOWN]', mythid) |
128 |
call cost_obcs( myiter, mytime, mythid ) |
129 |
call timer_stop ('cost_obcs [ECCO SPIN-DOWN]', mythid) |
130 |
#endif |
131 |
|
132 |
#ifdef ALLOW_CURMTR_COST_CONTRIBUTION |
133 |
#ifdef ALLOW_DEBUG |
134 |
IF (debugMode) CALL DEBUG_CALL('cost_curmtr',myThid) |
135 |
#endif |
136 |
call timer_start('cost_curmtr [ECCO SPIN-DOWN]', mythid) |
137 |
call cost_curmtr( myiter, mytime, mythid ) |
138 |
call timer_stop ('cost_curmtr [ECCO SPIN-DOWN]', mythid) |
139 |
#endif |
140 |
|
141 |
c-- Compute cost function contribution of drifter velocities. |
142 |
#ifdef ALLOW_DRIFTER_COST_CONTRIBUTION |
143 |
#ifndef ALLOW_AUTODIFF_WHTAPEIO |
144 |
#ifdef ALLOW_DEBUG |
145 |
IF (debugMode) CALL DEBUG_CALL('cost_drifter',myThid) |
146 |
#endif |
147 |
call timer_start('cost_drifter [ECCO SPIN-DOWN]', mythid) |
148 |
call cost_drifter( myiter, mytime, mythid ) |
149 |
call timer_stop ('cost_drifter [ECCO SPIN-DOWN]', mythid) |
150 |
#endif |
151 |
#endif |
152 |
|
153 |
c-- Compute cost function contribution of wind stress observations. |
154 |
#if (defined (ALLOW_SCAT_COST_CONTRIBUTION) || \ |
155 |
defined (ALLOW_DAILYSCAT_COST_CONTRIBUTION) ) |
156 |
#ifdef ALLOW_DEBUG |
157 |
IF (debugMode) CALL DEBUG_CALL('cost_scat',myThid) |
158 |
#endif |
159 |
IF (using_cost_scat) THEN |
160 |
call timer_start('cost_scat [ECCO SPIN-DOWN]', mythid) |
161 |
call cost_scat( myiter, mytime, mythid ) |
162 |
call timer_stop ('cost_scat [ECCO SPIN-DOWN]', mythid) |
163 |
ENDIF |
164 |
#endif |
165 |
|
166 |
c-- Compute cost function contribution of drift between the first |
167 |
c and the last year. |
168 |
#ifdef ALLOW_DRIFT_COST_CONTRIBUTION |
169 |
#ifdef ALLOW_DEBUG |
170 |
IF (debugMode) CALL DEBUG_CALL('cost_drift',myThid) |
171 |
#endif |
172 |
call timer_start('cost_drift [ECCO SPIN-DOWN]', mythid) |
173 |
call cost_drift( myiter, mytime, mythid ) |
174 |
call timer_stop ('cost_drift [ECCO SPIN-DOWN]', mythid) |
175 |
#endif |
176 |
#ifdef ALLOW_DRIFTW_COST_CONTRIBUTION |
177 |
#ifdef ALLOW_DEBUG |
178 |
IF (debugMode) CALL DEBUG_CALL('cost_driftw',myThid) |
179 |
#endif |
180 |
call timer_start('cost_driftw [ECCO SPIN-DOWN]', mythid) |
181 |
call cost_driftw( myiter, mytime, mythid ) |
182 |
call timer_stop ('cost_driftw [ECCO SPIN-DOWN]', mythid) |
183 |
#endif |
184 |
_BARRIER |
185 |
|
186 |
c-- Compute initial vs. final T/S deviation |
187 |
#ifdef ALLOW_COST_INI_FIN |
188 |
call timer_start('cost_ini_fin [ECCO SPIN-DOWN]', mythid) |
189 |
call cost_theta_ini_fin( myiter, mytime, mythid ) |
190 |
call cost_salt_ini_fin( myiter, mytime, mythid ) |
191 |
call timer_stop ('cost_ini_fin [ECCO SPIN-DOWN]', mythid) |
192 |
#endif |
193 |
_BARRIER |
194 |
|
195 |
c-- Internal Parameter controls cost terms: |
196 |
call timer_start('cost_internal_params [ECCO SPIN-DOWN]', mythid) |
197 |
call cost_internal_params( myiter, mytime, mythid ) |
198 |
call timer_stop ('cost_internal_params [ECCO SPIN-DOWN]', mythid) |
199 |
_BARRIER |
200 |
|
201 |
c-- Compute user defined cost function contributions (elaborate) |
202 |
call timer_start('cost_gencost_all [ECCO SPIN-DOWN]', mythid) |
203 |
call cost_gencost_all( myiter, mytime, mythid ) |
204 |
call timer_stop ('cost_gencost_all [ECCO SPIN-DOWN]', mythid) |
205 |
|
206 |
c-- Compute user defined cost function contributions (basic) |
207 |
call timer_start('cost_usercost_all [ECCO SPIN-DOWN]', mythid) |
208 |
call cost_usercost_all( myiter, mytime, mythid ) |
209 |
call timer_stop ('cost_usercost_all [ECCO SPIN-DOWN]', mythid) |
210 |
|
211 |
c-- Compute user defined cost function contributions (controls) |
212 |
call timer_start('cost_genctrl [ECCO SPIN-DOWN]', mythid) |
213 |
call cost_genctrl( myiter, mytime, mythid ) |
214 |
call timer_stop ('cost_genctrl [ECCO SPIN-DOWN]', mythid) |
215 |
|
216 |
#endif /* ALLOW_ECCO_EVOLUTION */ |
217 |
|
218 |
return |
219 |
end |