/[MITgcm]/MITgcm/pkg/cost/cost_final.F
ViewVC logotype

Diff of /MITgcm/pkg/cost/cost_final.F

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

revision 1.6 by heimbach, Thu Oct 2 21:34:45 2003 UTC revision 1.20 by heimbach, Thu Oct 15 05:21:50 2009 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2    C $Name$
3    
4    #include "PACKAGES_CONFIG.h"
5  #include "COST_CPPOPTIONS.h"  #include "COST_CPPOPTIONS.h"
6    
   
7        subroutine cost_final( mythid )        subroutine cost_final( mythid )
8    
9  c     ==================================================================  c     ==================================================================
# Line 12  c Line 13  c
13  c     o Sum of all cost function contributions.  c     o Sum of all cost function contributions.
14  c  c
15  c     started: Christian Eckert eckert@mit.edu 30-Jun-1999  c     started: Christian Eckert eckert@mit.edu 30-Jun-1999
 c  
16  c     changed: Christian Eckert eckert@mit.edu 25-Feb-2000  c     changed: Christian Eckert eckert@mit.edu 25-Feb-2000
17  c  c     heimbach@mit.edu 05-Nov-2003 Modularize cost package
 c              - Restructured the code in order to create a package  
 c                for the MITgcmUV.  
18  c  c
19  c     ==================================================================  c     ==================================================================
20  c     SUBROUTINE cost_final  c     SUBROUTINE cost_final
# Line 31  c     == global variables == Line 29  c     == global variables ==
29  #include "PARAMS.h"  #include "PARAMS.h"
30    
31  #include "cost.h"  #include "cost.h"
32  #include "ctrl.h"  #ifdef ALLOW_CTRL
33    # include "ctrl.h"
34    #endif
35    #ifdef ALLOW_DIC
36    cph-- quickly for testing
37    # include "DIC_COST.h"
38    #endif
39    
40  c     == routine arguments ==  c     == routine arguments ==
41    
# Line 52  c     == end of interface == Line 56  c     == end of interface ==
56        itlo = mybxlo(mythid)        itlo = mybxlo(mythid)
57        ithi = mybxhi(mythid)        ithi = mybxhi(mythid)
58    
59  #if (defined (ALLOW_COST_VECTOR))  #ifdef ALLOW_SEAICE
60          CALL SEAICE_COST_FINAL (myThid)
61    #endif
62    
63    #if (defined (ALLOW_ECCO))
64          CALL ECCO_COST_FINAL (myThid)
65    
66    #elif (defined (ALLOW_COST_VECTOR))
67        CALL COST_VECTOR (myThid)        CALL COST_VECTOR (myThid)
68    
69  #elif (defined (ALLOW_COST_STATE_FINAL))  #elif (defined (ALLOW_COST_STATE_FINAL))
   
70        CALL COST_STATE_FINAL (myThid)        CALL COST_STATE_FINAL (myThid)
71    
72  #else /* ALLOW_COST_VECTOR undef */  #endif /* above stuff undef */
73    
74  #ifdef ALLOW_COST_TEST  #ifndef ALLOW_ECCO
       CALL COST_TEST (myThid)  
 #endif  
75    
76  #ifdef ALLOW_COST_ATLANTIC_HEAT  # ifdef ALLOW_COST_TEST
77          CALL COST_TEST (myThid)
78    # endif
79    # ifdef ALLOW_COST_ATLANTIC_HEAT
80        CALL COST_ATLANTIC_HEAT (myThid)        CALL COST_ATLANTIC_HEAT (myThid)
81    # endif
82    #ifdef ALLOW_COST_HFLUXM
83          CALL COST_HFLUX (myThid)
84    #endif
85    #ifdef ALLOW_COST_TEMP
86          CALL COST_TEMP (myThid)
87  #endif  #endif
88    
89  c--   Sum up all contributions.  c--   Sum up all contributions.
90        do bj = jtlo,jthi        do bj = jtlo,jthi
91          do bi = itlo,ithi          do bi = itlo,ithi
92    
93            print*,' --> objf_test(bi,bj)   =',objf_test(bi,bj)            write(standardmessageunit,'(A,D22.15)')
94            print*,' --> objf_tracer(bi,bj) =',objf_tracer(bi,bj)       &          ' --> objf_test(bi,bj)   = ', objf_test(bi,bj)
95            print*,' --> objf_atl(bi,bj) =',objf_atl(bi,bj)            write(standardmessageunit,'(A,D22.15)')
96         &         ' --> objf_tracer(bi,bj) = ', objf_tracer(bi,bj)
97              write(standardmessageunit,'(A,D22.15)')
98         &         ' --> objf_atl(bi,bj)    = ', objf_atl(bi,bj)
99    #ifdef ALLOW_COST_TEMP
100              write(standardmessageunit,'(A,D22.15)')
101         &          ' --> objf_temp_tut(bi,bj)   = ', objf_temp_tut(bi,bj)
102    #endif
103    #ifdef ALLOW_COST_HFLUXM
104              write(standardmessageunit,'(A,D22.15)')
105         &         ' --> objf_hflux_tut(bi,bj) = ', objf_hflux_tut(bi,bj)
106    #endif
107    #ifdef ALLOW_COST_TRANSPORT
108              write(standardmessageunit,'(A,D22.15)')
109         &         ' --> objf_transport(bi,bj) = ', objf_transport(bi,bj)
110    #endif
111    
112            fc = fc            fc = fc
113       &            + mult_test   * objf_test(bi,bj)       &            + mult_test   * objf_test(bi,bj)
114       &            + mult_tracer * objf_tracer(bi,bj)       &            + mult_tracer * objf_tracer(bi,bj)
115       &            + mult_atl    * objf_atl(bi,bj)       &            + mult_atl    * objf_atl(bi,bj)
116    #ifdef ALLOW_COST_TRANSPORT
117         &            + mult_transport * objf_transport(bi,bj)
118    #endif
119    #ifdef ALLOW_COST_TEMP
120         &            + mult_temp_tut  * objf_temp_tut(bi,bj)
121    #endif
122    #ifdef ALLOW_COST_HFLUXM
123         &            + mult_hflux_tut * objf_hflux_tut(bi,bj)
124    #endif
125          enddo          enddo
126        enddo        enddo
127    
128        print*,' local fc = ', fc        write(standardmessageunit,'(A,D22.15)') '  local fc = ', fc
129    
130  c--   Do global summation.  c--   Do global summation.
131        _GLOBAL_SUM_R8( fc , myThid )        _GLOBAL_SUM_RL( fc , myThid )
132    
133    #ifdef ALLOW_DIC
134    cph-- quickly for testing
135          fc = totcost
136    #endif
137    
138  #endif /* ALLOW_COST_VECTOR */        write(standardmessageunit,'(A,D22.15)') ' global fc = ', fc
139    
140        print*,' global fc = ', fc  #endif /* ALLOW_ECCO */
141    
142  c--   set averaging freq. to zero to avoid re-write of  c--   set averaging freq. to zero to avoid re-write of
143  c--   averaged fields in reverse checkpointing loops  c--   averaged fields in reverse checkpointing loops
144        taveFreq = 0.        taveFreq    = 0.
145          dumpFreq    = 0.
146          pChkptFreq  = 0.
147          monitorFreq = 0.
148    
149  #endif /* ALLOW_COST */  #endif /* ALLOW_COST */
150    

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

  ViewVC Help
Powered by ViewVC 1.1.22