/[MITgcm]/MITgcm/model/src/find_rho.F
ViewVC logotype

Diff of /MITgcm/model/src/find_rho.F

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

revision 1.21 by mlosch, Wed Sep 25 19:36:50 2002 UTC revision 1.22 by mlosch, Fri Nov 1 22:00:33 2002 UTC
# Line 66  CEOP Line 66  CEOP
66        ENDDO        ENDDO
67  #endif  #endif
68    
69    #ifdef CHECK_SALINITY_FOR_NEGATIVE_VALUES
70          CALL LOOK_FOR_NEG_SALINITY( bi, bj, iMin, iMax, jMin, jMax,  k,
71         &     sFld, myThid )
72    #endif
73    
74        if (equationOfState.eq.'LINEAR') then        if (equationOfState.eq.'LINEAR') then
75    
76  C ***NOTE***  C ***NOTE***
# Line 229  C     abbreviations Line 234  C     abbreviations
234              t4 = t3*t              t4 = t3*t
235    
236              s  = sFld(i,j,k,bi,bj)              s  = sFld(i,j,k,bi,bj)
             if ( s .lt. 0. _d 0 ) then  
 C     issue a warning  
                write(*,'(a,i3,a,i3,a,i3,a,i3,a,i3,a,e13.5)')  
      &           ' FIND_RHOP0:   WARNING, salinity(',  
      &              i,',',j,',',k,',',bi,',',bj,') = ', s  
                s = 0. _d 0  
             end if  
237              s3o2 = s*sqrt(s)              s3o2 = s*sqrt(s)
238                            
239  C     density of freshwater at the surface  C     density of freshwater at the surface
# Line 324  C     abbreviations Line 322  C     abbreviations
322              t4 = t3*t              t4 = t3*t
323    
324              s  = sFld(i,j,k,bi,bj)              s  = sFld(i,j,k,bi,bj)
             if ( s .lt. 0. _d 0 ) then  
 C     issue a warning  
                write(*,'(a,i3,a,i3,a,i3,a,i3,a,i3,a,e13.5)')  
      &           ' FIND_BULKMOD: WARNING, salinity(',  
      &              i,',',j,',',k,',',bi,',',bj,') = ', s  
                s = 0. _d 0  
             end if  
325              s3o2 = s*sqrt(s)              s3o2 = s*sqrt(s)
326  C  C
327              p = pressure(i,j,kRef,bi,bj)*SItoBar              p = pressure(i,j,kRef,bi,bj)*SItoBar
# Line 506  C     abbreviations Line 497  C     abbreviations
497              t1  = tFld(i,j,k,bi,bj)              t1  = tFld(i,j,k,bi,bj)
498              t2 = t1*t1              t2 = t1*t1
499              s1  = sFld(i,j,k,bi,bj)              s1  = sFld(i,j,k,bi,bj)
             if ( s1 .lt. 0. _d 0 ) then  
 C     issue a warning  
                write(*,'(a,i3,a,i3,a,i3,a,i3,a,i3,a,e13.5)')  
      &           ' FIND_RHODEN: WARNING, salinity(',  
      &              i,',',j,',',k,',',bi,',',bj,') = ', s1  
                s1 = 0. _d 0  
             end if  
500              sp5 = sqrt(s1)              sp5 = sqrt(s1)
501                            
502              p1   = pressure(i,j,kRef,bi,bj)*SItodBar              p1   = pressure(i,j,kRef,bi,bj)*SItodBar
# Line 737  C Line 721  C
721    
722        return        return
723        end        end
724    
725    CBOP
726    C     !ROUTINE: LOOK_FOR_NEG_SALINITY
727    C     !INTERFACE:
728          subroutine LOOK_FOR_NEG_SALINITY(
729         I     bi, bj, iMin, iMax, jMin, jMax,  k,
730         I     sFld,
731         I     myThid )
732    
733    C     !DESCRIPTION: \bv
734    C     *==========================================================*
735    C     | o SUBROUTINE LOOK_FOR_NEG_SALINITY
736    C     |   looks for and fixes negative salinity values
737    C     |   this is necessary if the equation of state uses
738    C     |   the square root of salinity
739    C     *==========================================================*
740    C     |                                                          
741    C     | k - is the Salt level                              
742    C     |                                                          
743    C     *==========================================================*
744    C     \ev
745    
746    C     !USES:
747          implicit none
748    C     == Global variables ==
749    #include "SIZE.h"
750    #include "EEPARAMS.h"
751    #include "PARAMS.h"
752    #include "GRID.h"
753    
754    C     !INPUT/OUTPUT PARAMETERS:
755    C     == Routine arguments ==
756          integer bi,bj,iMin,iMax,jMin,jMax
757          integer k                 ! Level of Salt slice
758          _RL sFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
759          integer myThid
760    
761    C     !LOCAL VARIABLES:
762    C     == Local variables ==
763          integer i,j, localWarning
764          character*(max_len_mbuf) msgbuf
765    CEOP
766    
767          localWarning = 0
768          do j=jMin,jMax
769           do i=iMin,iMax
770    C     abbreviations
771            if ( sFld(i,j,k,bi,bj) .lt. 0. _d 0 ) then
772             localWarning = localWarning + 1
773             sFld(i,j,k,bi,bj) = 0. _d 0
774            end if
775           end do
776          end do
777    C     issue a warning
778          if ( localWarning .gt. 0 ) then
779           write(*,'(a,a)')
780         &      'S/R LOOK_FOR_NEG_SALINITY: found negative salinity',
781         &      'values and reset them to zero.'
782           write(*,'(a,I3)')
783         &      'S/R LOOK_FOR_NEG_SALINITY: current level is k = ', k
784          end if
785    
786          return
787          end

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

  ViewVC Help
Powered by ViewVC 1.1.22