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

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

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

revision 1.8 by heimbach, Fri Oct 5 18:53:21 2007 UTC revision 1.15 by heimbach, Mon Aug 6 20:41:55 2012 UTC
# Line 1  Line 1 
1    C $Header$
2    C $Name$
3    
4  #include "COST_CPPOPTIONS.h"  #include "COST_CPPOPTIONS.h"
5    
# Line 32  c     == global variables == Line 34  c     == global variables ==
34    
35  #include "cal.h"  #include "cal.h"
36  #include "ecco_cost.h"  #include "ecco_cost.h"
37    #include "CTRL_SIZE.h"
38  #include "ctrl.h"  #include "ctrl.h"
39  #include "ctrl_dummy.h"  #include "ctrl_dummy.h"
40  #include "optim.h"  #include "optim.h"
# Line 90  c--   Read tiled data. Line 93  c--   Read tiled data.
93  #ifdef ALLOW_MEAN_SFLUX_COST_CONTRIBUTION  #ifdef ALLOW_MEAN_SFLUX_COST_CONTRIBUTION
94    
95        if (optimcycle .ge. 0) then        if (optimcycle .ge. 0) then
96          ilsalt = ilnblnk( sfluxbarfile )          ilsalt = ilnblnk( sfluxmeanbarfile )
97          write(fnamesflux(1:80),'(2a,i10.10)')          write(fnamesflux(1:80),'(2a,i10.10)')
98       &    sfluxbarfile(1:ilsalt),'.',optimcycle       &    sfluxmeanbarfile(1:ilsalt),'.',optimcycle
99        endif        endif
100    
101        do irec = 1, MAX(1,nyearsrec)        do irec = 1, MAX(1,nyearsrec)
# Line 113  c--     Read time averages and the month Line 116  c--     Read time averages and the month
116                  tmpx=tmpfld2d(i,j,bi,bj)                  tmpx=tmpfld2d(i,j,bi,bj)
117                  if (maskC(i,j,kk,bi,bj) .ne. 0.) then                  if (maskC(i,j,kk,bi,bj) .ne. 0.) then
118                     fctiletot = fctiletot                     fctiletot = fctiletot
119       &                + tmpx*cos(yc(i,j,bi,bj)*deg2rad)       &                + tmpx* _rA(i,j,bi,bj)/rhoConstFresh
120                     sumtot = sumtot                     sumtot = sumtot
121       &                + cos(yc(i,j,bi,bj)*deg2rad)       &                + _rA(i,j,bi,bj)
122                     num_sfluxmm(bi,bj) = num_sfluxmm(bi,bj) + 1                     num_sfluxmm(bi,bj) = num_sfluxmm(bi,bj) + 1
123                  endif                  endif
124                enddo                enddo
# Line 123  c--     Read time averages and the month Line 126  c--     Read time averages and the month
126            enddo            enddo
127          enddo          enddo
128    
129         _GLOBAL_SUM_R8( sumtot , myThid )         _GLOBAL_SUM_RL( sumtot , myThid )
130         _GLOBAL_SUM_R8( fctiletot , myThid )         _GLOBAL_SUM_RL( fctiletot , myThid )
131          
132         if (sumtot.eq.0.) sumtot = 1.         if (sumtot.eq.0.) sumtot = 1.
133    
134         if ( wmean_sflux .NE. 0. ) then         if ( wmean_sflux .NE. 0. ) then
135            objf_sfluxmm = objf_sfluxmm            objf_sfluxmm = objf_sfluxmm
136       &        + ( (fctiletot/sumtot-1.D0)/wmean_sflux )**2       &        + ( (fctiletot/sumtot)/wmean_sflux )**2
137         else         else
138            objf_sfluxmm = 0. _d 0            objf_sfluxmm = 0. _d 0
139         endif         endif
# Line 139  c-- diagnostic: imbalance per year: Line 142  c-- diagnostic: imbalance per year:
142         write(standardmessageunit,'(A,I5,2(X,D22.14))')         write(standardmessageunit,'(A,I5,2(X,D22.14))')
143       &      ' --> bal_sfluxmm    =', irec,       &      ' --> bal_sfluxmm    =', irec,
144       &      fctiletot/sumtot,       &      fctiletot/sumtot,
145       &      (fctiletot/sumtot/wmean_sflux)**2       &      objf_sfluxmm
146    
147        enddo        enddo
148    

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.15

  ViewVC Help
Powered by ViewVC 1.1.22