/[MITgcm]/MITgcm/pkg/ecco/ecco_cost_driver.F
ViewVC logotype

Diff of /MITgcm/pkg/ecco/ecco_cost_driver.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.5 by gforget, Fri Aug 10 14:34:41 2012 UTC revision 1.20 by gforget, Mon Oct 26 14:10:18 2015 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2  C $Name$  C $Name$
3    
4  #include "COST_CPPOPTIONS.h"  #include "ECCO_OPTIONS.h"
5    
6        subroutine ecco_cost_driver(  myTime, myIter, mythid  )        subroutine ecco_cost_driver(  myTime, myIter, myThid  )
7    
8  c     ==================================================================  c     ==================================================================
9  c     SUBROUTINE ecco_cost_driver  c     SUBROUTINE ecco_cost_driver
# Line 22  c     == global variables == Line 22  c     == global variables ==
22  #include "EEPARAMS.h"  #include "EEPARAMS.h"
23  #include "SIZE.h"  #include "SIZE.h"
24  #include "PARAMS.h"  #include "PARAMS.h"
25    #ifdef ALLOW_ECCO
26  c     == routine arguments ==  # include "ecco.h"
27        integer mythid  #endif
       integer myiter  
       _RL     mytime  
   
 #ifdef ALLOW_ECCO_EVOLUTION  
   
28  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
29  # ifdef ALLOW_SSH_COST_CONTRIBUTION  # ifdef ALLOW_SSH_COST_CONTRIBUTION
30  #  ifdef ALLOW_PROFILES  #  ifdef ALLOW_PROFILES
31    #   include "PROFILES_SIZE.h"
32  #   include "profiles.h"  #   include "profiles.h"
33  #  endif  #  endif
34  # endif  # endif
 # ifdef ALLOW_MEAN_HFLUX_COST_CONTRIBUTION  
 #  include "ecco_cost.h"  
 # endif  
35  #endif  #endif
36    
37    c     == routine arguments ==
38          integer myThid
39          integer myIter
40          _RL     myTime
41    
42    #ifdef ECCO_CTRL_DEPRECATED
43    
44  c--   Compute the cost function contribution of the boundary forcing,  c--   Compute the cost function contribution of the boundary forcing,
45  c--   i.e. heat flux, salt flux, zonal and meridional wind stress.  c--   i.e. heat flux, salt flux, zonal and meridional wind stress.
46  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
47        IF (debugMode) CALL DEBUG_CALL('cost_forcing',myThid)        IF (debugMode) CALL DEBUG_CALL('cost_forcing',myThid)
48  #endif  #endif
49        call timer_start('cost_forcing       [ECCO SPIN-DOWN]', mythid)        call timer_start('cost_forcing       [ECCO SPIN-DOWN]', myThid)
50        call cost_forcing( myiter, mytime, mythid )        call cost_forcing( myThid )
51        call timer_stop ('cost_forcing       [ECCO SPIN-DOWN]', mythid)        call timer_stop ('cost_forcing       [ECCO SPIN-DOWN]', myThid)
52  cph(  cph(
53  c--   Compute cost function contribution of wind stress observations.  c--   Compute cost function contribution of wind stress observations.
54  #ifdef ALLOW_MEAN_HFLUX_COST_CONTRIBUTION  #ifdef ALLOW_MEAN_HFLUX_COST_CONTRIBUTION
55        call cost_mean_heatflux( myiter, mytime, mythid )        call cost_mean_heatflux( myIter, myTime, myThid )
56  # ifdef ALLOW_AUTODIFF_TAMC  # ifdef ALLOW_AUTODIFF_TAMC
57  CADJ STORE objf_hfluxmm = tapelev_init, key=1  CADJ STORE objf_hfluxmm = tapelev_init, key=1
58  # endif  # endif
# Line 60  CADJ STORE objf_hfluxmm = tapelev_init, Line 60  CADJ STORE objf_hfluxmm = tapelev_init,
60    
61  c--   Compute cost function contribution of wind stress observations.  c--   Compute cost function contribution of wind stress observations.
62  #ifdef ALLOW_MEAN_SFLUX_COST_CONTRIBUTION  #ifdef ALLOW_MEAN_SFLUX_COST_CONTRIBUTION
63        call cost_mean_saltflux( myiter, mytime, mythid )        call cost_mean_saltflux( myIter, myTime, myThid )
64  # ifdef ALLOW_AUTODIFF_TAMC  # ifdef ALLOW_AUTODIFF_TAMC
65  CADJ STORE objf_sfluxmm = tapelev_init, key=1  CADJ STORE objf_sfluxmm = tapelev_init, key=1
66  # endif  # endif
# Line 69  cph) Line 69  cph)
69    
70  c--   Compute cost function contribution of SSH.  c--   Compute cost function contribution of SSH.
71  #ifdef ALLOW_SSH_COST_CONTRIBUTION  #ifdef ALLOW_SSH_COST_CONTRIBUTION
72          IF (using_cost_altim) THEN
73  # ifdef ALLOW_DEBUG  # ifdef ALLOW_DEBUG
74        IF (debugMode) CALL DEBUG_CALL('cost_ssh',myThid)        IF (debugMode) CALL DEBUG_CALL('cost_ssh',myThid)
75  # endif  # endif
76  # if (defined(ALLOW_SSHV4_COST))  # if (defined(ALLOW_NEW_SSH_COST))
77        call timer_start('cost_sshv4         [ECCO SPIN-DOWN]', mythid)        call timer_start('cost_ssh_new       [ECCO SPIN-DOWN]', myThid)
78        call cost_sshv4( myiter, mytime, mythid )        call cost_ssh_new( myIter, myTime, myThid )
79        call timer_stop ('cost_sshv4         [ECCO SPIN-DOWN]', mythid)        call timer_stop ('cost_ssh_new       [ECCO SPIN-DOWN]', myThid)
 # elif (defined(ALLOW_NEW_SSH_COST))  
       call timer_start('cost_ssh_new       [ECCO SPIN-DOWN]', mythid)  
       call cost_ssh_new( myiter, mytime, mythid )  
       call timer_stop ('cost_ssh_new       [ECCO SPIN-DOWN]', mythid)  
80  # elif (!defined (ALLOW_GENCOST_SSHV4))  # elif (!defined (ALLOW_GENCOST_SSHV4))
81        call timer_start('cost_ssh           [ECCO SPIN-DOWN]', mythid)        call timer_start('cost_ssh           [ECCO SPIN-DOWN]', myThid)
82        call cost_ssh( myiter, mytime, mythid )        call cost_ssh( myIter, myTime, myThid )
83        call timer_stop ('cost_ssh           [ECCO SPIN-DOWN]', mythid)        call timer_stop ('cost_ssh           [ECCO SPIN-DOWN]', myThid)
84  # endif  # endif
85          ENDIF !IF (using_cost_altim) THEN
86  # ifdef ALLOW_AUTODIFF_TAMC  # ifdef ALLOW_AUTODIFF_TAMC
87  #  ifdef ALLOW_PROFILES  #  ifdef ALLOW_PROFILES
88  CADJ STORE prof_etan_mean = tapelev_init, key=1  CADJ STORE prof_etan_mean = tapelev_init, key=1
# Line 94  CADJ STORE prof_etan_mean = tapelev_init Line 92  CADJ STORE prof_etan_mean = tapelev_init
92    
93  #ifdef ALLOW_BP_COST_CONTRIBUTION  #ifdef ALLOW_BP_COST_CONTRIBUTION
94  c--   Compute bottom pressure cost  c--   Compute bottom pressure cost
95        call timer_start('cost_bp    [ECCO SPIN-DOWN]', mythid)        IF (using_cost_bp) THEN
96        call cost_bp( myiter, mytime, mythid )        call timer_start('cost_bp    [ECCO SPIN-DOWN]', myThid)
97        call timer_stop ('cost_bp    [ECCO SPIN-DOWN]', mythid)        call cost_generic(
98         &     1, bpfile, xx_bpbar_mean_dummy,
99         &     1, bpdatfile, bperrfile, mult_bp,
100         &     nmonsrec, nmonsrec, bpstartdate, 0. _d 0,
101         &     'C', -1. _d 2, 1. _d 2, 0. _d 0,
102         &     anom_preproc, no_preproc_c, no_preproc_i, no_preproc_r,
103         &     no_posproc, no_posproc_c, no_posproc_i, no_posproc_r,
104         &     0, bpdatfile, objf_bp, num_bp,
105         &     myiter, mytime, mythid )
106          call timer_stop ('cost_bp    [ECCO SPIN-DOWN]', myThid)
107          no_preproc(1)=' '
108          ENDIF
109  #endif  #endif
110    
111  c--   Compute cost function contribution of Temperature and Salinity.  c--   Compute cost function contribution of Temperature and Salinity.
112  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
113        IF (debugMode) CALL DEBUG_CALL('cost_hyd',myThid)        IF (debugMode) CALL DEBUG_CALL('cost_hyd',myThid)
114  #endif  #endif
115        call timer_start('cost_hyd           [ECCO SPIN-DOWN]', mythid)        call timer_start('cost_hyd           [ECCO SPIN-DOWN]', myThid)
116        call cost_hyd( myiter, mytime, mythid )        call cost_hyd( myIter, myTime, myThid )
117        call timer_stop ('cost_hyd           [ECCO SPIN-DOWN]', mythid)        call timer_stop ('cost_hyd           [ECCO SPIN-DOWN]', myThid)
118    
119  #ifdef ALLOW_SEAICE  #ifdef ALLOW_SEAICE
120  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
121        IF (debugMode) CALL DEBUG_CALL('seaice_cost_driver',myThid)        IF (debugMode) CALL DEBUG_CALL('seaice_cost_driver',myThid)
122  #endif  #endif
123        IF ( useSeaice) THEN        IF ( useSeaice) THEN
124        call timer_start('seaice_cost_driver [ECCO SPIN-DOWN]', mythid)        call timer_start('seaice_cost_driver [ECCO SPIN-DOWN]', myThid)
125        call seaice_cost_driver( myiter, mytime, mythid )        call seaice_cost_driver( myIter, myTime, myThid )
126        call timer_stop ('seaice_cost_driver [ECCO SPIN-DOWN]', mythid)        call timer_stop ('seaice_cost_driver [ECCO SPIN-DOWN]', myThid)
127        ENDIF        ENDIF
128  #endif  #endif
129    
# Line 122  c--   Compute cost function contribution Line 131  c--   Compute cost function contribution
131  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
132        IF (debugMode) CALL DEBUG_CALL('cost_obcs',myThid)        IF (debugMode) CALL DEBUG_CALL('cost_obcs',myThid)
133  #endif  #endif
134        call timer_start('cost_obcs          [ECCO SPIN-DOWN]', mythid)        call timer_start('cost_obcs          [ECCO SPIN-DOWN]', myThid)
135        call cost_obcs( myiter, mytime, mythid )        call cost_obcs( myIter, myTime, myThid )
136        call timer_stop ('cost_obcs          [ECCO SPIN-DOWN]', mythid)        call timer_stop ('cost_obcs          [ECCO SPIN-DOWN]', myThid)
137  #endif  #endif
138    
139  #ifdef ALLOW_CURMTR_COST_CONTRIBUTION  #ifdef ALLOW_CURMTR_COST_CONTRIBUTION
140  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
141        IF (debugMode) CALL DEBUG_CALL('cost_curmtr',myThid)        IF (debugMode) CALL DEBUG_CALL('cost_curmtr',myThid)
142  #endif  #endif
143        call timer_start('cost_curmtr        [ECCO SPIN-DOWN]', mythid)        call timer_start('cost_curmtr        [ECCO SPIN-DOWN]', myThid)
144        call cost_curmtr( myiter, mytime, mythid )        call cost_curmtr( myIter, myTime, myThid )
145        call timer_stop ('cost_curmtr        [ECCO SPIN-DOWN]', mythid)        call timer_stop ('cost_curmtr        [ECCO SPIN-DOWN]', myThid)
146  #endif  #endif
147    
148  c--   Compute cost function contribution of drifter velocities.  c--   Compute cost function contribution of drifter velocities.
# Line 142  c--   Compute cost function contribution Line 151  c--   Compute cost function contribution
151  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
152        IF (debugMode) CALL DEBUG_CALL('cost_drifter',myThid)        IF (debugMode) CALL DEBUG_CALL('cost_drifter',myThid)
153  #endif  #endif
154        call timer_start('cost_drifter         [ECCO SPIN-DOWN]', mythid)        call timer_start('cost_drifter         [ECCO SPIN-DOWN]', myThid)
155        call cost_drifter( myiter, mytime, mythid )        call cost_drifter( myIter, myTime, myThid )
156        call timer_stop ('cost_drifter         [ECCO SPIN-DOWN]', mythid)        call timer_stop ('cost_drifter         [ECCO SPIN-DOWN]', myThid)
157  #endif  #endif
158  #endif  #endif
159    
# Line 154  c--   Compute cost function contribution Line 163  c--   Compute cost function contribution
163  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
164        IF (debugMode) CALL DEBUG_CALL('cost_scat',myThid)        IF (debugMode) CALL DEBUG_CALL('cost_scat',myThid)
165  #endif  #endif
166        call timer_start('cost_scat            [ECCO SPIN-DOWN]', mythid)        IF (using_cost_scat) THEN
167        call cost_scat( myiter, mytime, mythid )        call timer_start('cost_scat            [ECCO SPIN-DOWN]', myThid)
168        call timer_stop ('cost_scat            [ECCO SPIN-DOWN]', mythid)        call cost_scat( myIter, myTime, myThid )
169          call timer_stop ('cost_scat            [ECCO SPIN-DOWN]', myThid)
170          ENDIF
171  #endif  #endif
172    
173  c--   Compute cost function contribution of drift between the first  c--   Compute cost function contribution of drift between the first
# Line 165  c     and the last year. Line 176  c     and the last year.
176  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
177        IF (debugMode) CALL DEBUG_CALL('cost_drift',myThid)        IF (debugMode) CALL DEBUG_CALL('cost_drift',myThid)
178  #endif  #endif
179        call timer_start('cost_drift         [ECCO SPIN-DOWN]', mythid)        call timer_start('cost_drift         [ECCO SPIN-DOWN]', myThid)
180        call cost_drift( myiter, mytime, mythid )        call cost_drift( myIter, myTime, myThid )
181        call timer_stop ('cost_drift         [ECCO SPIN-DOWN]', mythid)        call timer_stop ('cost_drift         [ECCO SPIN-DOWN]', myThid)
182  #endif  #endif
183  #ifdef ALLOW_DRIFTW_COST_CONTRIBUTION  #ifdef ALLOW_DRIFTW_COST_CONTRIBUTION
184  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
185        IF (debugMode) CALL DEBUG_CALL('cost_driftw',myThid)        IF (debugMode) CALL DEBUG_CALL('cost_driftw',myThid)
186  #endif  #endif
187        call timer_start('cost_driftw        [ECCO SPIN-DOWN]', mythid)        call timer_start('cost_driftw        [ECCO SPIN-DOWN]', myThid)
188        call cost_driftw( myiter, mytime, mythid )        call cost_driftw( myIter, myTime, myThid )
189        call timer_stop ('cost_driftw        [ECCO SPIN-DOWN]', mythid)        call timer_stop ('cost_driftw        [ECCO SPIN-DOWN]', myThid)
190  #endif  #endif
191        _BARRIER        _BARRIER
192    
193  c--   Compute initial vs. final T/S deviation  c--   Compute initial vs. final T/S deviation
194  #ifdef ALLOW_COST_INI_FIN  #ifdef ALLOW_COST_INI_FIN
195        call timer_start('cost_ini_fin       [ECCO SPIN-DOWN]', mythid)        call timer_start('cost_ini_fin       [ECCO SPIN-DOWN]', myThid)
196        call cost_theta_ini_fin( myiter, mytime, mythid )        call cost_theta_ini_fin( myIter, myTime, myThid )
197        call cost_salt_ini_fin( myiter, mytime, mythid )        call cost_salt_ini_fin( myIter, myTime, myThid )
198        call timer_stop ('cost_ini_fin       [ECCO SPIN-DOWN]', mythid)        call timer_stop ('cost_ini_fin       [ECCO SPIN-DOWN]', myThid)
199  #endif  #endif
200        _BARRIER        _BARRIER
201    
202  c--   Internal Parameter controls cost terms:  c--   Internal Parameter controls cost terms:
203        call timer_start('cost_internal_params  [ECCO SPIN-DOWN]', mythid)        call timer_start('cost_internal_params  [ECCO SPIN-DOWN]', myThid)
204        call cost_internal_params( myiter, mytime, mythid )        call cost_internal_params( myIter, myTime, myThid )
205        call timer_stop ('cost_internal_params  [ECCO SPIN-DOWN]', mythid)        call timer_stop ('cost_internal_params  [ECCO SPIN-DOWN]', myThid)
206        _BARRIER        _BARRIER
207    
208  c--   Compute user defined cost function contributions (elaborate)  #endif /* ECCO_CTRL_DEPRECATED */
       call timer_start('cost_gencost_all    [ECCO SPIN-DOWN]', mythid)  
       call cost_gencost_all( myiter, mytime, mythid )  
       call timer_stop ('cost_gencost_all    [ECCO SPIN-DOWN]', mythid)  
   
 c--   Compute user defined cost function contributions (basic)  
       call timer_start('cost_usercost_all    [ECCO SPIN-DOWN]', mythid)  
       call cost_usercost_all( myiter, mytime, mythid )  
       call timer_stop ('cost_usercost_all    [ECCO SPIN-DOWN]', mythid)  
209    
210  #endif /* ALLOW_ECCO_EVOLUTION */  c--   Compute user defined cost function contributions (elaborate)
211          call timer_start('cost_gencost_all    [ECCO SPIN-DOWN]', myThid)
212          call cost_gencost_all( myIter, myTime, myThid )
213          call timer_stop ('cost_gencost_all    [ECCO SPIN-DOWN]', myThid)
214    
215    #ifdef ALLOW_CTRL
216          IF (useCTRL) THEN
217    #ifdef ALLOW_DEBUG
218          IF (debugMode) CALL DEBUG_CALL('ctrl_cost_driver',myThid)
219    #endif
220          call timer_start('ctrl_cost_driver [ECCO SPIN-DOWN]', myThid)
221          call ctrl_cost_driver( myThid )
222          call timer_stop ('ctrl_cost_driver [ECCO SPIN-DOWN]', myThid)
223          ENDIF
224    #endif
225    
226        return        return
227        end        end

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.20

  ViewVC Help
Powered by ViewVC 1.1.22