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

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

  ViewVC Help
Powered by ViewVC 1.1.22