/[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.6 by heimbach, Mon Oct 30 17:01:21 2006 UTC revision 1.10 by heimbach, Tue Feb 5 12:49:10 2008 UTC
# Line 1  Line 1 
1    C $Header$
2    C $Name$
3    
4  #include "COST_CPPOPTIONS.h"  #include "COST_CPPOPTIONS.h"
5    
# Line 55  c     == local variables == Line 57  c     == local variables ==
57        integer levoff        integer levoff
58        integer ilsalt        integer ilsalt
59    
60        _RL tmpx, tmpx2        _RL tmpx
       _RL fctilemm(nSx,nSy)  
       _RL sumcos(nSx,nSy)  
61        _RL sumtot        _RL sumtot
62        _RL fctiletot        _RL fctiletot
63    
# Line 105  c--     Read time averages and the month Line 105  c--     Read time averages and the month
105       &                        optimcycle, mythid,       &                        optimcycle, mythid,
106       &                        xx_sflux_mean_dummy )       &                        xx_sflux_mean_dummy )
107    
108            sumtot    = 0.
109            fctiletot = 0.
110          do bj = jtlo,jthi          do bj = jtlo,jthi
111            do bi = itlo,ithi            do bi = itlo,ithi
112              kk = 1              kk = 1
             fctilemm(bi,bj) = 0. _d 0  
             sumcos(bi,bj)   = 0. _d 0  
113              do j = jmin,jmax              do j = jmin,jmax
114                do i = imin,imax                do i = imin,imax
115                  tmpx=tmpfld2d(i,j,bi,bj)                  tmpx=tmpfld2d(i,j,bi,bj)
116                  if (maskC(i,j,kk,bi,bj) .ne. 0.) then                  if (maskC(i,j,kk,bi,bj) .ne. 0.) then
117                     fctilemm(bi,bj) = fctilemm(bi,bj) + tmpx                     fctiletot = fctiletot
118       &                  *cos(yc(i,j,bi,bj)*deg2rad)       &                + tmpx*cos(yc(i,j,bi,bj)*deg2rad)
119                     sumcos(bi,bj) = sumcos(bi,bj)                     sumtot = sumtot
120       &                  + cos(yc(i,j,bi,bj)*deg2rad)       &                + cos(yc(i,j,bi,bj)*deg2rad)
121                     num_sfluxmm(bi,bj) = num_sfluxmm(bi,bj) + 1                     num_sfluxmm(bi,bj) = num_sfluxmm(bi,bj) + 1
122                  endif                  endif
123                enddo                enddo
# Line 125  c--     Read time averages and the month Line 125  c--     Read time averages and the month
125            enddo            enddo
126          enddo          enddo
127    
         sumtot    = 0.  
         fctiletot = 0.  
         do bj = jtlo,jthi  
            do bi = itlo,ithi  
               sumtot    = sumtot + sumcos(bi,bj)  
               fctiletot = fctiletot + fctilemm(bi,bj)  
            enddo  
         enddo  
128         _GLOBAL_SUM_R8( sumtot , myThid )         _GLOBAL_SUM_R8( sumtot , myThid )
129         _GLOBAL_SUM_R8( fctiletot , myThid )         _GLOBAL_SUM_R8( fctiletot , myThid )
130          
131         if (sumtot.eq.0.) sumtot = 1.         if (sumtot.eq.0.) sumtot = 1.
132    
133         if ( wmean_sflux .NE. 0. ) then         if ( wmean_sflux .NE. 0. ) then
134           do bj = jtlo,jthi            objf_sfluxmm = objf_sfluxmm
135             do bi = itlo,ithi       &        + ( (fctiletot/sumtot)/wmean_sflux )**2
136               fctilemm(bi,bj) = fctilemm(bi,bj) / sumtot         else
137               objf_sfluxmm(bi,bj) = objf_sfluxmm(bi,bj)            objf_sfluxmm = 0. _d 0
      &           + (fctilemm(bi,bj)/wmean_sflux/nyearsrec)**2  
            enddo  
          enddo  
138         endif         endif
139    
140  c-- diagnostic: imbalance per year:  c-- diagnostic: imbalance per year:
141         tmpx2 =  wsfluxmm(1,1) * fctiletot / sumtot         write(standardmessageunit,'(A,I5,2(X,D22.14))')
142         write(standardmessageunit,'(A,I5,D22.15)')       &      ' --> bal_sfluxmm    =', irec,
143       &      ' --> bal_sfluxmm    =', irec, tmpx2       &      fctiletot/sumtot,
144         &      ((fctiletot/sumtot)/wmean_sflux)**2
145    
146        enddo        enddo
147    

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

  ViewVC Help
Powered by ViewVC 1.1.22