/[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.31 by heimbach, Sat Mar 30 01:25:44 2013 UTC revision 1.32 by jmc, Wed Nov 6 18:53:48 2013 UTC
# Line 3  C $Name$ Line 3  C $Name$
3    
4  #include "COST_OPTIONS.h"  #include "COST_OPTIONS.h"
5    
6        subroutine cost_final( mythid )        SUBROUTINE COST_FINAL( myThid )
7    
8  c     ==================================================================  c     ==================================================================
9  c     SUBROUTINE cost_final  c     SUBROUTINE cost_final
# Line 15  c     ================================== Line 15  c     ==================================
15  c     SUBROUTINE cost_final  c     SUBROUTINE cost_final
16  c     ==================================================================  c     ==================================================================
17    
18        implicit none        IMPLICIT NONE
19    
20  c     == global variables ==  c     == global variables ==
   
21  #include "EEPARAMS.h"  #include "EEPARAMS.h"
22  #include "SIZE.h"  #include "SIZE.h"
23  #include "PARAMS.h"  #include "PARAMS.h"
# Line 34  c     == global variables == Line 33  c     == global variables ==
33  # include "SHELFICE_COST.h"  # include "SHELFICE_COST.h"
34  #endif  #endif
35    
   
36  c     == routine arguments ==  c     == routine arguments ==
37          INTEGER myThid
       integer mythid  
38    
39  #ifdef ALLOW_COST  #ifdef ALLOW_COST
40  c     == local variables ==  c     == local variables ==
41          INTEGER bi,bj
42        integer bi,bj        _RL glob_fc, loc_fc
       integer itlo,ithi  
       integer jtlo,jthi  
43    
44  c     == end of interface ==  c     == end of interface ==
45    
       jtlo = mybylo(mythid)  
       jthi = mybyhi(mythid)  
       itlo = mybxlo(mythid)  
       ithi = mybxhi(mythid)  
   
46  #ifdef ALLOW_SEAICE  #ifdef ALLOW_SEAICE
47        if (useSEAICE) CALL SEAICE_COST_FINAL (myThid)        if (useSEAICE) CALL SEAICE_COST_FINAL (myThid)
48  #endif  #endif
# Line 61  c     == end of interface == Line 51  c     == end of interface ==
51        CALL SHELFICE_COST_FINAL (myThid)        CALL SHELFICE_COST_FINAL (myThid)
52  #endif  #endif
53    
54        print *, 'ph-1 in thsice_cost_final'  c     print *, 'ph-1 in thsice_cost_final'
   
55  #ifdef ALLOW_THSICE  #ifdef ALLOW_THSICE
56        if (useTHSICE) CALL THSICE_COST_FINAL (myThid)        IF (useTHSICE) CALL THSICE_COST_FINAL (myThid)
57  #endif  #endif
58    c     print *, 'ph-3 in thsice_cost_final'
       print *, 'ph-3 in thsice_cost_final'  
59    
60  #ifdef ALLOW_ECCO  #ifdef ALLOW_ECCO
61        CALL ECCO_COST_FINAL (myThid)        CALL ECCO_COST_FINAL (myThid)
# Line 104  cgf : to compile previous line user is e Line 92  cgf : to compile previous line user is e
92  cgf : to compile previous line user is expected to provide cost_temp.F  cgf : to compile previous line user is expected to provide cost_temp.F
93  #endif  #endif
94    
95          write(standardmessageunit,'(A,D22.15)') '  early fc = ', fc
96    
97  c--   Sum up all contributions.  c--   Sum up all contributions.
98        do bj = jtlo,jthi        loc_fc = 0.
99          do bi = itlo,ithi        DO bj = myByLo(myThid), myByHi(myThid)
100           DO bi = myBxLo(myThid), myBxHi(myThid)
101    
102            write(standardmessageunit,'(A,D22.15)')            write(standardmessageunit,'(A,D22.15)')
103       &          ' --> objf_test(bi,bj)   = ', objf_test(bi,bj)       &          ' --> objf_test(bi,bj)   = ', objf_test(bi,bj)
# Line 129  c--   Sum up all contributions. Line 120  c--   Sum up all contributions.
120       &         ' --> objf_transport(bi,bj) = ', objf_transport(bi,bj)       &         ' --> objf_transport(bi,bj) = ', objf_transport(bi,bj)
121  #endif  #endif
122    
123            fc = fc           tile_fc(bi,bj) = tile_fc(bi,bj)
124       &            + mult_test   * objf_test(bi,bj)       &            + mult_test   * objf_test(bi,bj)
125       &            + mult_tracer * objf_tracer(bi,bj)       &            + mult_tracer * objf_tracer(bi,bj)
126  #if ( !defined (ALLOW_ECCO) || !defined (ALLOW_COST_ATLANTIC) )  #if ( !defined (ALLOW_ECCO) || !defined (ALLOW_COST_ATLANTIC) )
# Line 144  c--   Sum up all contributions. Line 135  c--   Sum up all contributions.
135  #ifdef ALLOW_COST_HFLUXM  #ifdef ALLOW_COST_HFLUXM
136       &            + mult_hflux_tut * objf_hflux_tut(bi,bj)       &            + mult_hflux_tut * objf_hflux_tut(bi,bj)
137  #endif  #endif
138          enddo           loc_fc = loc_fc + tile_fc(bi,bj)
139        enddo         ENDDO
140          ENDDO
141    
142        write(standardmessageunit,'(A,D22.15)') '  local fc = ', fc        write(standardmessageunit,'(A,D22.15)') '  local fc = ', loc_fc
143    
144  c--   Do global summation.  c--   Do global summation.
145        _GLOBAL_SUM_RL( fc , myThid )        CALL GLOBAL_SUM_TILE_RL( tile_fc, glob_fc, myThid )
146          _BEGIN_MASTER( myThid )
147          fc = fc + glob_fc
148          _END_MASTER( myThid )
149    
150  c--   Add contributions from global mean constraints  c--   Add contributions from global mean constraints
151        fc = fc +glofc        _BEGIN_MASTER( myThid )
152          fc = fc + glofc
153          _END_MASTER( myThid )
154    
155  #ifdef ALLOW_DIC_COST  #ifdef ALLOW_DIC_COST
156  cph-- quickly for testing  cph-- quickly for testing

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32

  ViewVC Help
Powered by ViewVC 1.1.22