1 |
C $Header: /u/gcmpack/models/MITgcmUV/model/src/ini_salt.F,v 1.12.2.1 2001/03/16 18:03:59 adcroft Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_OPTIONS.h" |
5 |
|
6 |
CStartOfInterface |
7 |
SUBROUTINE INI_SALT ( myThid ) |
8 |
C /==========================================================\ |
9 |
C | SUBROUTINE INI_SALT | |
10 |
C | o Set model initial salinity field. | |
11 |
C |==========================================================| |
12 |
C | There are several options for setting the initial | |
13 |
C | temperature file | |
14 |
C | 1. Inline code | |
15 |
C | 2. Vertical profile ( uniform S in X and Y ) | |
16 |
C | 3. Three-dimensional data from a file. For example from | |
17 |
C | Levitus or from a checkpoint file from a previous | |
18 |
C | integration. | |
19 |
C | In addition to setting the salinity field we also | |
20 |
C | set the initial salinity tendency term here. | |
21 |
C \==========================================================/ |
22 |
IMPLICIT NONE |
23 |
|
24 |
C === Global variables === |
25 |
#include "SIZE.h" |
26 |
#include "EEPARAMS.h" |
27 |
#include "PARAMS.h" |
28 |
#include "GRID.h" |
29 |
#include "DYNVARS.h" |
30 |
|
31 |
C == Routine arguments == |
32 |
C myThid - Number of this instance of INI_SALT |
33 |
INTEGER myThid |
34 |
CEndOfInterface |
35 |
|
36 |
C == Local variables == |
37 |
C bi,bj - Loop counters |
38 |
C I,J,K |
39 |
INTEGER bi, bj |
40 |
INTEGER I, J, K, localWarnings |
41 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
42 |
|
43 |
C-- Initialise salinity field to the vertical reference profile |
44 |
DO bj = myByLo(myThid), myByHi(myThid) |
45 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
46 |
DO K=1,Nr |
47 |
DO J=1-Oly,sNy+Oly |
48 |
DO I=1-Olx,sNx+Olx |
49 |
salt(I,J,K,bi,bj) = sRef(K) |
50 |
ENDDO |
51 |
ENDDO |
52 |
ENDDO |
53 |
ENDDO |
54 |
ENDDO |
55 |
|
56 |
IF ( hydrogSaltFile .NE. ' ' ) THEN |
57 |
_BEGIN_MASTER( myThid ) |
58 |
CALL READ_FLD_XYZ_RL( hydrogSaltFile, ' ', salt, 0, myThid ) |
59 |
_END_MASTER(myThid) |
60 |
_EXCH_XYZ_R8(salt , myThid ) |
61 |
ENDIF |
62 |
|
63 |
C Apply mask and test consistancy |
64 |
localWarnings=0 |
65 |
DO bj = myByLo(myThid), myByHi(myThid) |
66 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
67 |
DO K=1,Nr |
68 |
DO J=1,sNy |
69 |
DO I=1,sNx |
70 |
IF (hFacC(I,J,K,bi,bj).EQ.0) salt(I,J,K,bi,bj) = 0. |
71 |
IF (hFacC(I,J,K,bi,bj).NE.0.AND.salt(I,J,K,bi,bj).EQ.0. |
72 |
& .AND. sRef(k).NE.0.) THEN |
73 |
localWarnings=localWarnings+1 |
74 |
ENDIF |
75 |
ENDDO |
76 |
ENDDO |
77 |
ENDDO |
78 |
ENDDO |
79 |
ENDDO |
80 |
IF (localWarnings.NE.0) THEN |
81 |
WRITE(msgBuf,'(A,A)') |
82 |
& 'S/R INI_SALT: salt = 0 identically. If this is intentional', |
83 |
& 'you will need to edit ini_salt.F to avoid this safety check' |
84 |
CALL PRINT_ERROR( msgBuf , myThid) |
85 |
STOP 'ABNORMAL END: S/R INI_SALT' |
86 |
ENDIF |
87 |
|
88 |
CALL PLOT_FIELD_XYZRL( salt, 'Initial Salinity' , Nr, 1, myThid ) |
89 |
|
90 |
RETURN |
91 |
END |