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

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

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


Revision 1.21 - (show annotations) (download)
Wed Jun 17 20:00:25 2009 UTC (15 years ago) by jmc
Branch: MAIN
CVS Tags: checkpoint61q, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s
Changes since 1.20: +21 -17 lines
call PLOT_FIELD_XYZ only if debugMode=T.

1 C $Header: /u/gcmpack/MITgcm/model/src/ini_salt.F,v 1.20 2009/06/14 21:45:12 jmc Exp $
2 C $Name: $
3
4 #include "PACKAGES_CONFIG.h"
5 #include "CPP_OPTIONS.h"
6
7 CBOP
8 C !ROUTINE: INI_SALT
9 C !INTERFACE:
10 SUBROUTINE INI_SALT ( myThid )
11 C !DESCRIPTION: \bv
12 C *==========================================================*
13 C | SUBROUTINE INI_SALT
14 C | o Set model initial salinity field.
15 C *==========================================================*
16 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 C *==========================================================*
26 C \ev
27
28 C !USES:
29 IMPLICIT NONE
30 C === Global variables ===
31 #include "SIZE.h"
32 #include "EEPARAMS.h"
33 #include "PARAMS.h"
34 #include "GRID.h"
35 #include "DYNVARS.h"
36 #ifdef ALLOW_MNC
37 #include "MNC_PARAMS.h"
38 #endif
39
40 C !INPUT/OUTPUT PARAMETERS:
41 C == Routine arguments ==
42 C myThid :: Number of this instance of INI_SALT
43 INTEGER myThid
44
45 C !LOCAL VARIABLES:
46 C == Local variables ==
47 C bi,bj :: Tile indices
48 C I,J,K :: Loop counters
49 INTEGER bi, bj
50 INTEGER I, J, K, localWarnings
51 CHARACTER*(MAX_LEN_MBUF) msgBuf
52 CEOP
53
54 C-- Initialise salinity field to the vertical reference profile
55 DO bj = myByLo(myThid), myByHi(myThid)
56 DO bi = myBxLo(myThid), myBxHi(myThid)
57 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 ENDDO
62 ENDDO
63 ENDDO
64 ENDDO
65 ENDDO
66
67 IF ( hydrogSaltFile .NE. ' ' ) THEN
68 #ifdef ALLOW_MNC
69 IF ( useMNC.AND.mnc_read_salt ) THEN
70 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 CALL READ_FLD_XYZ_RL( hydrogSaltFile, ' ', salt, 0, myThid )
79 #ifdef ALLOW_MNC
80 ENDIF
81 #endif /* ALLOW_MNC */
82 _EXCH_XYZ_RL(salt , myThid )
83 ENDIF
84
85 C Apply mask and test consistancy
86 localWarnings=0
87 DO bj = myByLo(myThid), myByHi(myThid)
88 DO bi = myBxLo(myThid), myBxHi(myThid)
89 DO K=1,Nr
90 DO J=1-Oly,sNy+Oly
91 DO I=1-Olx,sNx+Olx
92 IF (maskC(I,J,K,bi,bj).EQ.0.) salt(I,J,K,bi,bj) = 0.
93 ENDDO
94 ENDDO
95 IF ( sRef(k).NE.0. ) THEN
96 DO J=1,sNy
97 DO I=1,sNx
98 IF ( maskC(I,J,K,bi,bj).NE.0.
99 & .AND. salt(I,J,K,bi,bj).EQ.0. ) THEN
100 localWarnings=localWarnings+1
101 ENDIF
102 ENDDO
103 ENDDO
104 ENDIF
105 ENDDO
106 ENDDO
107 ENDDO
108 IF (localWarnings.NE.0) THEN
109 WRITE(msgBuf,'(A,A)')
110 & 'S/R INI_SALT: salt = 0 identically. If this is intentional',
111 & 'you will need to edit ini_salt.F to avoid this safety check'
112 CALL PRINT_ERROR( msgBuf , myThid)
113 STOP 'ABNORMAL END: S/R INI_SALT'
114 ENDIF
115
116 IF (debugMode) THEN
117 CALL PLOT_FIELD_XYZRL( salt, 'Initial Salinity',
118 & Nr, 1, myThid )
119 ENDIF
120
121 RETURN
122 END

  ViewVC Help
Powered by ViewVC 1.1.22