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