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