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

Annotation of /MITgcm/model/src/ini_salt.F

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


Revision 1.23 - (hide annotations) (download)
Mon Jan 18 19:37:35 2010 UTC (15 years, 11 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62c, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62w, checkpoint62y, checkpoint62x, checkpoint62b
Changes since 1.22: +5 -5 lines
typo in comments

1 jmc 1.23 C $Header: /u/gcmpack/MITgcm/model/src/ini_salt.F,v 1.22 2009/10/15 01:06:51 jmc Exp $
2 adcroft 1.13 C $Name: $
3 cnh 1.1
4 jmc 1.21 #include "PACKAGES_CONFIG.h"
5 cnh 1.7 #include "CPP_OPTIONS.h"
6 cnh 1.1
7 cnh 1.14 CBOP
8     C !ROUTINE: INI_SALT
9     C !INTERFACE:
10 jmc 1.23 SUBROUTINE INI_SALT( myThid )
11 cnh 1.14 C !DESCRIPTION: \bv
12     C *==========================================================*
13 jmc 1.21 C | SUBROUTINE INI_SALT
14     C | o Set model initial salinity field.
15 cnh 1.14 C *==========================================================*
16 jmc 1.21 C | There are several options for setting the initial
17     C | temperature file
18     C | 1. Inline code
19     C | 2. Vertical profile ( uniform S in X and Y )
20     C | 3. Three-dimensional data from a file. For example from
21     C | Levitus or from a checkpoint file from a previous
22     C | integration.
23     C | In addition to setting the salinity field we also
24     C | set the initial salinity tendency term here.
25 cnh 1.14 C *==========================================================*
26     C \ev
27    
28     C !USES:
29 adcroft 1.9 IMPLICIT NONE
30 cnh 1.1 C === Global variables ===
31     #include "SIZE.h"
32     #include "EEPARAMS.h"
33     #include "PARAMS.h"
34     #include "GRID.h"
35     #include "DYNVARS.h"
36 edhill 1.18 #ifdef ALLOW_MNC
37     #include "MNC_PARAMS.h"
38     #endif
39 cnh 1.1
40 cnh 1.14 C !INPUT/OUTPUT PARAMETERS:
41 cnh 1.1 C == Routine arguments ==
42 jmc 1.21 C myThid :: Number of this instance of INI_SALT
43 cnh 1.1 INTEGER myThid
44    
45 cnh 1.14 C !LOCAL VARIABLES:
46 cnh 1.1 C == Local variables ==
47 jmc 1.21 C bi,bj :: Tile indices
48 jmc 1.22 C i,j,k :: Loop counters
49 cnh 1.1 INTEGER bi, bj
50 jmc 1.22 INTEGER i, j, k, localWarnings
51 adcroft 1.13 CHARACTER*(MAX_LEN_MBUF) msgBuf
52 cnh 1.14 CEOP
53 cnh 1.1
54 adcroft 1.13 C-- Initialise salinity field to the vertical reference profile
55     DO bj = myByLo(myThid), myByHi(myThid)
56     DO bi = myBxLo(myThid), myBxHi(myThid)
57 jmc 1.22 DO k=1,Nr
58     DO j=1-Oly,sNy+Oly
59     DO i=1-Olx,sNx+Olx
60     salt(i,j,k,bi,bj) = sRef(k)
61 cnh 1.1 ENDDO
62     ENDDO
63     ENDDO
64     ENDDO
65 adcroft 1.13 ENDDO
66    
67     IF ( hydrogSaltFile .NE. ' ' ) THEN
68 edhill 1.18 #ifdef ALLOW_MNC
69 jmc 1.21 IF ( useMNC.AND.mnc_read_salt ) THEN
70 edhill 1.18 CALL MNC_FILE_CLOSE_ALL_MATCHING(hydrogSaltFile, myThid)
71     CALL MNC_CW_SET_UDIM(hydrogSaltFile, 1, myThid)
72     CALL MNC_CW_SET_CITER(hydrogSaltFile, 2, -1, -1, -1, myThid)
73     CALL MNC_CW_SET_UDIM(hydrogSaltFile, 1, myThid)
74     CALL MNC_CW_RL_R('D',hydrogSaltFile,0,0,'S',salt, myThid)
75     CALL MNC_FILE_CLOSE_ALL_MATCHING(hydrogSaltFile, myThid)
76     ELSE
77     #endif /* ALLOW_MNC */
78 jmc 1.23 CALL READ_FLD_XYZ_RL( hydrogSaltFile, ' ', salt, 0, myThid )
79 edhill 1.18 #ifdef ALLOW_MNC
80     ENDIF
81     #endif /* ALLOW_MNC */
82 jmc 1.23 _EXCH_XYZ_RL( salt, myThid )
83 cnh 1.3 ENDIF
84 adcroft 1.13
85 jmc 1.23 C-- Apply mask and test consistency
86 adcroft 1.13 localWarnings=0
87 cnh 1.1 DO bj = myByLo(myThid), myByHi(myThid)
88     DO bi = myBxLo(myThid), myBxHi(myThid)
89 jmc 1.22 DO k=1,Nr
90     IF ( maskIniSalt ) THEN
91     DO j=1-Oly,sNy+Oly
92     DO i=1-Olx,sNx+Olx
93     IF (maskC(i,j,k,bi,bj).EQ.0.) salt(i,j,k,bi,bj) = 0.
94     ENDDO
95 jmc 1.15 ENDDO
96 jmc 1.22 ENDIF
97 jmc 1.15 IF ( sRef(k).NE.0. ) THEN
98 jmc 1.22 DO j=1,sNy
99     DO i=1,sNx
100     IF ( maskC(i,j,k,bi,bj).NE.0.
101     & .AND. salt(i,j,k,bi,bj).EQ.0. ) THEN
102 jmc 1.15 localWarnings=localWarnings+1
103 adcroft 1.13 ENDIF
104 jmc 1.15 ENDDO
105 cnh 1.1 ENDDO
106 jmc 1.15 ENDIF
107 cnh 1.1 ENDDO
108     ENDDO
109     ENDDO
110 jmc 1.22 IF ( localWarnings.NE.0 ) THEN
111     IF ( checkIniSalt ) THEN
112     WRITE(msgBuf,'(A,I10,A)')
113     & ' INI_SALT: found', localWarnings,
114     & ' wet grid-pts with salt=0 identically.'
115     CALL PRINT_ERROR( msgBuf , myThid)
116     WRITE(msgBuf,'(A,A)')
117     & ' If this is intentional, you need to',
118     & ' set checkIniSalt=.false. in "data", namelist PARM05'
119     CALL PRINT_ERROR( msgBuf , myThid)
120     STOP 'ABNORMAL END: S/R INI_SALT'
121     ELSE
122     WRITE(msgBuf,'(A,I10,A)')
123     & '** WARNINGS ** INI_SALT: found', localWarnings,
124     & ' wet grid-pts with salt=0 identically.'
125     CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
126     & SQUEEZE_RIGHT, myThid )
127     ENDIF
128 adcroft 1.13 ENDIF
129 cnh 1.5
130 jmc 1.21 IF (debugMode) THEN
131     CALL PLOT_FIELD_XYZRL( salt, 'Initial Salinity',
132     & Nr, 1, myThid )
133     ENDIF
134 cnh 1.5
135 cnh 1.1 RETURN
136     END

  ViewVC Help
Powered by ViewVC 1.1.22