/[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.20 - (show annotations) (download)
Sun Jun 14 21:45:12 2009 UTC (16 years, 6 months ago) by jmc
Branch: MAIN
Changes since 1.19: +3 -6 lines
remove unnecessary BARRIER

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

  ViewVC Help
Powered by ViewVC 1.1.22