/[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.7 by heimbach, Sun Dec 24 14:23:44 2006 UTC
# Line 55  c     == local variables == Line 55  c     == local variables ==
55        integer levoff        integer levoff
56        integer ilsalt        integer ilsalt
57    
58        _RL tmpx, tmpx2        _RL tmpx
       _RL fctilemm(nSx,nSy)  
       _RL sumcos(nSx,nSy)  
59        _RL sumtot        _RL sumtot
60        _RL fctiletot        _RL fctiletot
61    
# Line 105  c--     Read time averages and the month Line 103  c--     Read time averages and the month
103       &                        optimcycle, mythid,       &                        optimcycle, mythid,
104       &                        xx_sflux_mean_dummy )       &                        xx_sflux_mean_dummy )
105    
106            sumtot    = 0.
107            fctiletot = 0.
108          do bj = jtlo,jthi          do bj = jtlo,jthi
109            do bi = itlo,ithi            do bi = itlo,ithi
110              kk = 1              kk = 1
             fctilemm(bi,bj) = 0. _d 0  
             sumcos(bi,bj)   = 0. _d 0  
111              do j = jmin,jmax              do j = jmin,jmax
112                do i = imin,imax                do i = imin,imax
113                  tmpx=tmpfld2d(i,j,bi,bj)                  tmpx=tmpfld2d(i,j,bi,bj)
114                  if (maskC(i,j,kk,bi,bj) .ne. 0.) then                  if (maskC(i,j,kk,bi,bj) .ne. 0.) then
115                     fctilemm(bi,bj) = fctilemm(bi,bj) + tmpx                     fctiletot = fctiletot
116       &                  *cos(yc(i,j,bi,bj)*deg2rad)       &                + tmpx*cos(yc(i,j,bi,bj)*deg2rad)
117                     sumcos(bi,bj) = sumcos(bi,bj)                     sumtot = sumtot
118       &                  + cos(yc(i,j,bi,bj)*deg2rad)       &                + cos(yc(i,j,bi,bj)*deg2rad)
119                     num_sfluxmm(bi,bj) = num_sfluxmm(bi,bj) + 1                     num_sfluxmm(bi,bj) = num_sfluxmm(bi,bj) + 1
120                  endif                  endif
121                enddo                enddo
# Line 125  c--     Read time averages and the month Line 123  c--     Read time averages and the month
123            enddo            enddo
124          enddo          enddo
125    
         sumtot    = 0.  
         fctiletot = 0.  
         do bj = jtlo,jthi  
            do bi = itlo,ithi  
               sumtot    = sumtot + sumcos(bi,bj)  
               fctiletot = fctiletot + fctilemm(bi,bj)  
            enddo  
         enddo  
126         _GLOBAL_SUM_R8( sumtot , myThid )         _GLOBAL_SUM_R8( sumtot , myThid )
127         _GLOBAL_SUM_R8( fctiletot , myThid )         _GLOBAL_SUM_R8( fctiletot , myThid )
128                
129         if (sumtot.eq.0.) sumtot = 1.         if (sumtot.eq.0.) sumtot = 1.
130    
131         if ( wmean_sflux .NE. 0. ) then         if ( wmean_sflux .NE. 0. ) then
132           do bj = jtlo,jthi            objf_sfluxmm = objf_sfluxmm
133             do bi = itlo,ithi       &        + (fctiletot/sumtot/wmean_sflux)**2
134               fctilemm(bi,bj) = fctilemm(bi,bj) / sumtot         else
135               objf_sfluxmm(bi,bj) = objf_sfluxmm(bi,bj)            objf_sfluxmm = 0. _d 0
      &           + (fctilemm(bi,bj)/wmean_sflux/nyearsrec)**2  
            enddo  
          enddo  
136         endif         endif
137    
138  c-- diagnostic: imbalance per year:  c-- diagnostic: imbalance per year:
139         tmpx2 =  wsfluxmm(1,1) * fctiletot / sumtot         write(standardmessageunit,'(A,I5,2(X,D22.14))')
140         write(standardmessageunit,'(A,I5,D22.15)')       &      ' --> bal_sfluxmm    =', irec,
141       &      ' --> bal_sfluxmm    =', irec, tmpx2       &      fctiletot/sumtot,
142         &      (fctiletot/sumtot/wmean_sflux)**2
143    
144        enddo        enddo
145    

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

  ViewVC Help
Powered by ViewVC 1.1.22