/[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.1 by heimbach, Thu Nov 6 22:10:07 2003 UTC revision 1.4 by heimbach, Fri Feb 17 23:48:14 2006 UTC
# Line 45  c     == routine arguments == Line 45  c     == routine arguments ==
45  c     == local variables ==  c     == local variables ==
46    
47        integer bi,bj        integer bi,bj
48        integer i,j,k,kk        integer i,j,kk
49        integer itlo,ithi        integer itlo,ithi
50        integer jtlo,jthi        integer jtlo,jthi
51        integer jmin,jmax        integer jmin,jmax
# Line 56  c     == local variables == Line 56  c     == local variables ==
56        integer ilsalt        integer ilsalt
57    
58        _RL fctilemm        _RL fctilemm
       _RL fcthreadmm  
59        _RL tmpx        _RL tmpx
60        _RL sumcos        _RL sumcos
61    
# Line 90  c--   Read tiled data. Line 89  c--   Read tiled data.
89    
90  #ifdef ALLOW_MEAN_SFLUX_COST_CONTRIBUTION  #ifdef ALLOW_MEAN_SFLUX_COST_CONTRIBUTION
91    
 #ifdef ECCO_VERBOSE  
       _BEGIN_MASTER( mythid )  
         write(msgbuf,'(a)') ' '  
         call print_message( msgbuf, standardmessageunit,  
      &                      SQUEEZE_RIGHT , mythid)  
         write(msgbuf,'(a,i8.8)')  
      &    ' cost_mean_saltflux: no. of records to process = ',nmonsrec  
         call print_message( msgbuf, standardmessageunit,  
      &                      SQUEEZE_RIGHT , mythid)  
         write(msgbuf,'(a)') ' '  
         call print_message( msgbuf, standardmessageunit,  
      &                      SQUEEZE_RIGHT , mythid)  
       _END_MASTER( mythid )  
 #endif  
   
92        if (optimcycle .ge. 0) then        if (optimcycle .ge. 0) then
93          ilsalt = ilnblnk( sfluxbarfile )          ilsalt = ilnblnk( sfluxbarfile )
94          write(fnamesflux(1:80),'(2a,i10.10)')          write(fnamesflux(1:80),'(2a,i10.10)')
95       &    sfluxbarfile(1:ilsalt),'.',optimcycle       &    sfluxbarfile(1:ilsalt),'.',optimcycle
96        endif        endif
97    
       fcthreadmm       = 0. _d 0  
   
98        irec = 1        irec = 1
99    
100  c--     Read time averages and the monthly mean data.  c--     Read time averages and the monthly mean data.
# Line 129  c--     Read time averages and the month Line 111  c--     Read time averages and the month
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 (maskw(i,j,kk,bi,bj) .ne. 0.) then                  if (maskC(i,j,kk,bi,bj) .ne. 0.) then
115                    fctilemm = fctilemm + tmpx*cos(yc(i,j,bi,bj)*deg2rad)                     fctilemm = fctilemm + tmpx
116                    sumcos = sumcos + cos(yc(i,j,bi,bj)*deg2rad)       &                  *cos(yc(i,j,bi,bj)*deg2rad)
117                       sumcos = sumcos + cos(yc(i,j,bi,bj)*deg2rad)
118                       num_sfluxmm(bi,bj) = num_sfluxmm(bi,bj) + 1
119                  endif                  endif
120                enddo                enddo
121              enddo              enddo
122    
123              if(sumcos .eq. 0.) sumcos = 1.              _GLOBAL_SUM_R8( sumcos , myThid )
124              fctilemm = (fctilemm / sumcos)              if (sumcos.eq.0.) sumcos = 1.
125              fctilemm = wsfluxmm(bi,bj)*fctilemm  
126                fctilemm = fctilemm / sumcos
127              objf_sfluxmm(bi,bj) = fctilemm              objf_sfluxmm(bi,bj) = wsfluxmm(bi,bj) * fctilemm
             fcthreadmm          = fcthreadmm + fctilemm  
   
 #ifdef ECCO_VERBOSE  
 c--     Print cost function for all tiles.  
         _GLOBAL_SUM_R8( fcthreadmm , myThid )  
         write(msgbuf,'(a)') ' '  
         call print_message( msgbuf, standardmessageunit,  
      &                      SQUEEZE_RIGHT , mythid)  
         write(msgbuf,'(a,i8.8)')  
      &    ' cost_saltflux:                       irec =  ',irec  
         call print_message( msgbuf, standardmessageunit,  
      &                      SQUEEZE_RIGHT , mythid)  
         write(msgbuf,'(a,d22.15)')  
      &    '                 global cost function value = ',  
      &    fcthreadmm  
         call print_message( msgbuf, standardmessageunit,  
      &                      SQUEEZE_RIGHT , mythid)  
         write(msgbuf,'(a)') ' '  
         call print_message( msgbuf, standardmessageunit,  
      &                      SQUEEZE_RIGHT , mythid)  
 #endif  
128    
129            enddo            enddo
130          enddo          enddo
131    
   
 #ifdef ECCO_VERBOSE  
 c--     Print cost function for all tiles.  
         _GLOBAL_SUM_R8( fcthreadmm       , myThid )  
         write(msgbuf,'(a)') ' '  
         call print_message( msgbuf, standardmessageunit,  
      &                      SQUEEZE_RIGHT , mythid)  
         write(msgbuf,'(a,i8.8)')  
      &    ' cost_: irec = ',irec  
         call print_message( msgbuf, standardmessageunit,  
      &                      SQUEEZE_RIGHT , mythid)  
         write(msgbuf,'(a,a,d22.15)')  
      &    ' global cost function value',  
      &    ' (        ) = ',fcthreadmm      
         call print_message( msgbuf, standardmessageunit,  
      &                      SQUEEZE_RIGHT , mythid)  
         write(msgbuf,'(a)') ' '  
         call print_message( msgbuf, standardmessageunit,  
      &                      SQUEEZE_RIGHT , mythid)  
 #endif  
   
 #else  
 c--   Do not enter the calculation of the temperature contribution to  
 c--   the final cost function.  
   
       fctilemm         = 0. _d 0  
       fcthreadmm       = 0. _d 0  
   
       _BEGIN_MASTER( mythid )  
         write(msgbuf,'(a)') ' '  
         call print_message( msgbuf, standardmessageunit,  
      &                      SQUEEZE_RIGHT , mythid)  
         write(msgbuf,'(a,a)')  
      &    ' cost_: no contribution of temperature field ',  
      &                 'to cost function.'  
         call print_message( msgbuf, standardmessageunit,  
      &                      SQUEEZE_RIGHT , mythid)  
         write(msgbuf,'(a,a,i9.8)')  
      &    ' cost_: number of records that would have',  
      &                ' been processed: ',nmonsrec  
         call print_message( msgbuf, standardmessageunit,  
      &                      SQUEEZE_RIGHT , mythid)  
         write(msgbuf,'(a)') ' '  
         call print_message( msgbuf, standardmessageunit,  
      &                      SQUEEZE_RIGHT , mythid)  
       _END_MASTER( mythid )  
132  #endif  #endif
133    
134        return        return

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.22