/[MITgcm]/MITgcm/verification/fizhi-cs-aqualev20/code/ini_salt.F
ViewVC logotype

Annotation of /MITgcm/verification/fizhi-cs-aqualev20/code/ini_salt.F

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


Revision 1.2 - (hide annotations) (download)
Tue Apr 28 18:06:14 2009 UTC (15 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint62, checkpoint63, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint61n, checkpoint61o, checkpoint61m, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y, HEAD
Changes since 1.1: +2 -2 lines
change macros (EXCH & GLOBAL_SUM/MAX) sufix _R4/_R8 to _RS/_RL
 when applied to _RS/_RL variable

1 jmc 1.2 C $Header: /u/gcmpack/MITgcm/verification/fizhi-cs-aqualev20/code/ini_salt.F,v 1.1 2006/04/03 20:55:14 molod Exp $
2 molod 1.1 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    
36     C !INPUT/OUTPUT PARAMETERS:
37     C == Routine arguments ==
38     C myThid - Number of this instance of INI_SALT
39     INTEGER myThid
40    
41     C !LOCAL VARIABLES:
42     C == Local variables ==
43     C bi,bj - Loop counters
44     C I,J,K
45     INTEGER bi, bj
46     INTEGER I, J, K, localWarnings
47     CHARACTER*(MAX_LEN_MBUF) msgBuf
48     CEOP
49    
50     _RL pedyn(Nr+1), pdyn(Nr), pkappa(Nr)
51     integer Lbotij
52     _RL getcon, kappa, dum, pinmb
53     _RL temperature(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
54     _RL rhum(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
55     _RL qstar(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy)
56    
57     C Need to convert from input RH to q -- Need pressure, temperature
58     C Build pressures - we know there is no topography and eta = 0
59     pedyn(1) = 100000.
60     do K = 2,Nr+1
61     pedyn(K) = pedyn(K-1) - drF(K-1)
62     enddo
63     do K = 1,Nr
64     pdyn(K)=(pedyn(K+1)+pedyn(K))/2.
65     enddo
66     kappa = getcon('KAPPA')
67     do K = 1,Nr
68     pkappa(K)=(pdyn(K)/100000.)**kappa
69     enddo
70     C Now convert from theta to Temperature
71     DO bj = myByLo(myThid), myByHi(myThid)
72     DO bi = myBxLo(myThid), myBxHi(myThid)
73     DO K=1,Nr
74     DO J=1,sNy
75     DO I=1,sNx
76     temperature(I,J,K,bi,bj) = theta(I,J,K,bi,bj) * pkappa(K)
77     ENDDO
78     ENDDO
79     ENDDO
80     ENDDO
81     ENDDO
82    
83     C-- Initialise salinity field to the vertical reference profile
84     DO bj = myByLo(myThid), myByHi(myThid)
85     DO bi = myBxLo(myThid), myBxHi(myThid)
86     DO K=1,Nr
87     DO J=1-Oly,sNy+Oly
88     DO I=1-Olx,sNx+Olx
89     salt(I,J,K,bi,bj) = sRef(K)
90     ENDDO
91     ENDDO
92     ENDDO
93     ENDDO
94     ENDDO
95    
96     IF ( hydrogSaltFile .NE. ' ' ) THEN
97     _BEGIN_MASTER( myThid )
98     CALL READ_FLD_XYZ_RL( hydrogSaltFile, ' ', rhum, 0, myThid )
99     _END_MASTER(myThid)
100    
101     C Now convert from rh to q
102     DO bj = myByLo(myThid), myByHi(myThid)
103     DO bi = myBxLo(myThid), myBxHi(myThid)
104     DO K=1,Nr-1
105     DO J=1,sNy
106     DO I=1,sNx
107     pinmb = pdyn(K)/100.
108     call qsat(temperature(i,j,k,bi,bj),pinmb,qstar(i,j,k,bi,bj),
109     . dum,.false.)
110     salt(I,J,K,bi,bj) = rhum(i,j,k,bi,bj) * qstar(i,j,k,bi,bj)
111     ENDDO
112     ENDDO
113     ENDDO
114     ENDDO
115     ENDDO
116    
117 jmc 1.2 _EXCH_XYZ_RL(salt , myThid )
118 molod 1.1
119     ENDIF
120    
121     C Apply mask and test consistancy
122     localWarnings=0
123     DO bj = myByLo(myThid), myByHi(myThid)
124     DO bi = myBxLo(myThid), myBxHi(myThid)
125     DO K=1,Nr
126     DO J=1,sNy
127     DO I=1,sNx
128     IF (hFacC(I,J,K,bi,bj).EQ.0) salt(I,J,K,bi,bj) = 0.
129     IF (hFacC(I,J,K,bi,bj).NE.0.AND.salt(I,J,K,bi,bj).EQ.0.
130     & .AND. sRef(k).NE.0.) THEN
131     localWarnings=localWarnings+1
132     ENDIF
133     ENDDO
134     ENDDO
135     ENDDO
136     ENDDO
137     ENDDO
138     IF (localWarnings.NE.0) THEN
139     WRITE(msgBuf,'(A,A)')
140     & 'S/R INI_SALT: salt = 0 identically. If this is intentional',
141     & 'you will need to edit ini_salt.F to avoid this safety check'
142     CALL PRINT_ERROR( msgBuf , myThid)
143     STOP 'ABNORMAL END: S/R INI_SALT'
144     ENDIF
145    
146     CALL PLOT_FIELD_XYZRL( salt, 'Initial Salinity' , Nr, 1, myThid )
147    
148     RETURN
149     END

  ViewVC Help
Powered by ViewVC 1.1.22