| 1 |
adcroft |
1.13 |
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 |
cnh |
1.1 |
|
| 4 |
cnh |
1.7 |
#include "CPP_OPTIONS.h" |
| 5 |
cnh |
1.1 |
|
| 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 |
adcroft |
1.9 |
IMPLICIT NONE |
| 23 |
cnh |
1.1 |
|
| 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 |
adcroft |
1.13 |
INTEGER I, J, K, localWarnings |
| 41 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
| 42 |
cnh |
1.1 |
|
| 43 |
adcroft |
1.13 |
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 |
cnh |
1.1 |
ENDDO |
| 51 |
|
|
ENDDO |
| 52 |
|
|
ENDDO |
| 53 |
|
|
ENDDO |
| 54 |
adcroft |
1.13 |
ENDDO |
| 55 |
|
|
|
| 56 |
|
|
IF ( hydrogSaltFile .NE. ' ' ) THEN |
| 57 |
cnh |
1.3 |
_BEGIN_MASTER( myThid ) |
| 58 |
cnh |
1.4 |
CALL READ_FLD_XYZ_RL( hydrogSaltFile, ' ', salt, 0, myThid ) |
| 59 |
cnh |
1.3 |
_END_MASTER(myThid) |
| 60 |
adcroft |
1.13 |
_EXCH_XYZ_R8(salt , myThid ) |
| 61 |
cnh |
1.3 |
ENDIF |
| 62 |
adcroft |
1.13 |
|
| 63 |
|
|
C Apply mask and test consistancy |
| 64 |
|
|
localWarnings=0 |
| 65 |
cnh |
1.1 |
DO bj = myByLo(myThid), myByHi(myThid) |
| 66 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
| 67 |
cnh |
1.6 |
DO K=1,Nr |
| 68 |
cnh |
1.1 |
DO J=1,sNy |
| 69 |
|
|
DO I=1,sNx |
| 70 |
adcroft |
1.8 |
IF (hFacC(I,J,K,bi,bj).EQ.0) salt(I,J,K,bi,bj) = 0. |
| 71 |
adcroft |
1.13 |
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 |
cnh |
1.1 |
ENDDO |
| 76 |
|
|
ENDDO |
| 77 |
|
|
ENDDO |
| 78 |
|
|
ENDDO |
| 79 |
|
|
ENDDO |
| 80 |
adcroft |
1.13 |
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 |
cnh |
1.5 |
|
| 88 |
cnh |
1.6 |
CALL PLOT_FIELD_XYZRL( salt, 'Initial Salinity' , Nr, 1, myThid ) |
| 89 |
cnh |
1.5 |
|
| 90 |
cnh |
1.1 |
RETURN |
| 91 |
|
|
END |