** Warning **

Issuing rollback() due to DESTROY without explicit disconnect() of DBD::mysql::db handle dbname=MITgcm at /usr/local/share/lxr/lib/LXR/Common.pm line 1224.

Last-Modified: Sun, 18 May 2024 05:11:33 GMT Content-Type: text/html; charset=utf-8 MITgcm/MITgcm/verification/advect_xy/code/ini_salt.F
Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:45:17 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
5273e7d26a Alis*0001 #include "CPP_OPTIONS.h"
                0002 
46fb26357b Jean*0003 CBOP
                0004 C     !ROUTINE: INI_SALT
                0005 C     !INTERFACE:
                0006       SUBROUTINE INI_SALT( myThid )
                0007 C     !DESCRIPTION: \bv
                0008 C     *==========================================================*
                0009 C     | SUBROUTINE INI_SALT
                0010 C     | o Set model initial salinity field.
                0011 C     *==========================================================*
                0012 C     | There are several options for setting the initial
                0013 C     | temperature file
                0014 C     |  1. Inline code
                0015 C     |  2. Vertical profile ( uniform S in X and Y )
                0016 C     |  3. Three-dimensional data from a file. For example from
                0017 C     |     Levitus or from a checkpoint file from a previous
                0018 C     |     integration.
                0019 C     | In addition to setting the salinity field we also
                0020 C     | set the initial salinity tendency term here.
                0021 C     *==========================================================*
                0022 C     \ev
5273e7d26a Alis*0023 
46fb26357b Jean*0024 C     !USES:
                0025       IMPLICIT NONE
5273e7d26a Alis*0026 C     === Global variables ===
                0027 #include "SIZE.h"
                0028 #include "EEPARAMS.h"
                0029 #include "PARAMS.h"
                0030 #include "GRID.h"
                0031 #include "DYNVARS.h"
                0032 
46fb26357b Jean*0033 C     !INPUT/OUTPUT PARAMETERS:
5273e7d26a Alis*0034 C     == Routine arguments ==
46fb26357b Jean*0035 C     myThid :: Number of this instance of INI_SALT
5273e7d26a Alis*0036       INTEGER myThid
                0037 
46fb26357b Jean*0038 C     !LOCAL VARIABLES:
5273e7d26a Alis*0039 C     == Local variables ==
46fb26357b Jean*0040 C     bi,bj  :: Tile indices
                0041 C     i,j,k  :: Loop counters
                0042 C     rD     :: Radial displacement of point i,j
5273e7d26a Alis*0043       INTEGER bi, bj
46fb26357b Jean*0044       INTEGER i, j, k, localWarnings
                0045       _RL     rD
5273e7d26a Alis*0046       CHARACTER*(MAX_LEN_MBUF) msgBuf
46fb26357b Jean*0047 CEOP
5273e7d26a Alis*0048 
                0049 C--   Initialise salinity field to the vertical reference profile
                0050       DO bj = myByLo(myThid), myByHi(myThid)
                0051        DO bi = myBxLo(myThid), myBxHi(myThid)
46fb26357b Jean*0052         DO k=1,Nr
                0053          DO j=1-Oly,sNy+Oly
                0054           DO i=1-Olx,sNx+Olx
                0055            salt(i,j,k,bi,bj) = sRef(k)
                0056           ENDDO
                0057          ENDDO
                0058 C=== Set-up specific modification starts here ===
                0059 C--    Initialise salinity field to a circular patch.
                0060          DO j=1-Oly,sNy+Oly
                0061           DO i=1-Olx,sNx+Olx
                0062             rD = SQRT( ( xC(i,j,bi,bj) - 40. _d 3 )**2
                0063      &                +( yC(i,j,bi,bj) - 40. _d 3 )**2
                0064      &                +( rC(k) + 50. _d 3 )**2
                0065      &               )
                0066             IF ( rD.LE.60. _d 3 ) salt(i,j,k,bi,bj) = sRef(k)+1. _d 0
5273e7d26a Alis*0067           ENDDO
                0068          ENDDO
46fb26357b Jean*0069 C=== Set-up specific modification ends here  ===
5273e7d26a Alis*0070         ENDDO
                0071        ENDDO
                0072       ENDDO
a8bea676dd Jean*0073 C=== Set-up specific modification starts here ===
                0074       _EXCH_XYZ_RL( salt, myThid )
                0075 C=== Set-up specific modification ends here  ===
5273e7d26a Alis*0076 
                0077       IF ( hydrogSaltFile .NE. ' ' ) THEN
46fb26357b Jean*0078         CALL READ_FLD_XYZ_RL( hydrogSaltFile, ' ', salt, 0, myThid )
                0079         _EXCH_XYZ_RL( salt, myThid )
5273e7d26a Alis*0080       ENDIF
                0081 
46fb26357b Jean*0082 C--   Apply mask and test consistency
5273e7d26a Alis*0083       localWarnings=0
                0084       DO bj = myByLo(myThid), myByHi(myThid)
                0085        DO bi = myBxLo(myThid), myBxHi(myThid)
46fb26357b Jean*0086         DO k=1,Nr
                0087          IF ( maskIniSalt ) THEN
                0088           DO j=1-Oly,sNy+Oly
                0089            DO i=1-Olx,sNx+Olx
                0090             IF (maskC(i,j,k,bi,bj).EQ.0.) salt(i,j,k,bi,bj) = 0.
                0091            ENDDO
                0092           ENDDO
                0093          ENDIF
                0094          IF ( sRef(k).NE.0. ) THEN
                0095           DO j=1,sNy
                0096            DO i=1,sNx
                0097             IF ( maskC(i,j,k,bi,bj).NE.0.
                0098      &      .AND. salt(i,j,k,bi,bj).EQ.0. ) THEN
                0099               localWarnings=localWarnings+1
5273e7d26a Alis*0100             ENDIF
46fb26357b Jean*0101            ENDDO
5273e7d26a Alis*0102           ENDDO
46fb26357b Jean*0103          ENDIF
5273e7d26a Alis*0104         ENDDO
                0105        ENDDO
                0106       ENDDO
46fb26357b Jean*0107       IF ( localWarnings.NE.0 ) THEN
                0108        IF ( checkIniSalt ) THEN
                0109         WRITE(msgBuf,'(A,I10,A)')
                0110      &   ' INI_SALT: found', localWarnings,
                0111      &   ' wet grid-pts with salt=0 identically.'
                0112         CALL PRINT_ERROR( msgBuf , myThid)
                0113         WRITE(msgBuf,'(A,A)')
                0114      &  ' If this is intentional, you need to',
                0115      &  ' set checkIniSalt=.false. in "data", namelist PARM05'
                0116         CALL PRINT_ERROR( msgBuf , myThid)
                0117         STOP 'ABNORMAL END: S/R INI_SALT'
                0118        ELSE
                0119         WRITE(msgBuf,'(A,I10,A)')
                0120      &   '** WARNINGS ** INI_SALT: found', localWarnings,
                0121      &   ' wet grid-pts with salt=0 identically.'
                0122         CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                0123      &                      SQUEEZE_RIGHT, myThid )
                0124        ENDIF
5273e7d26a Alis*0125       ENDIF
                0126 
a8bea676dd Jean*0127       IF ( debugLevel.GE.debLevC ) THEN
46fb26357b Jean*0128         CALL PLOT_FIELD_XYZRL( salt, 'Initial Salinity',
                0129      &                         Nr, 1, myThid )
                0130       ENDIF
5273e7d26a Alis*0131 
                0132       RETURN
                0133       END