1 |
C $Header: /u/gcmpack/MITgcm/model/src/seawater.F,v 1.10 2015/02/15 16:47:32 mlosch Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_OPTIONS.h" |
5 |
|
6 |
C-- File seawater.F: routines that compute quantities related to seawater. |
7 |
C-- Contents |
8 |
C Seawater (SW) librabry routines |
9 |
C-- o SW_PTMP: function to compute potential temperature |
10 |
C-- o SW_TEMP: function to compute in-situ temperature from pot. temp. |
11 |
C-- o SW_ADTG: function to compute adiabatic temperature gradient |
12 |
C-- (used by both SW_PTMP & SW_TEMP) |
13 |
|
14 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
15 |
|
16 |
CBOP |
17 |
C !ROUTINE: SW_PTMP |
18 |
C !INTERFACE: |
19 |
_RL FUNCTION SW_PTMP (S,T,P,PR) |
20 |
|
21 |
C !DESCRIPTION: \bv |
22 |
C *=============================================================* |
23 |
C | S/R SW_PTMP |
24 |
C | o compute potential temperature as per UNESCO 1983 report. |
25 |
C *=============================================================* |
26 |
C |
27 |
C started: |
28 |
C Armin Koehl akoehl@ucsd.edu |
29 |
C |
30 |
C ================================================================== |
31 |
C SUBROUTINE SW_PTMP |
32 |
C ================================================================== |
33 |
C S :: salinity [psu (PSS-78) ] |
34 |
C T :: temperature [degree C (IPTS-68)] |
35 |
C P :: pressure [db] |
36 |
C PR :: Reference pressure [db] |
37 |
C \ev |
38 |
|
39 |
C !USES: |
40 |
IMPLICIT NONE |
41 |
|
42 |
C !INPUT/OUTPUT PARAMETERS: |
43 |
_RL S,T,P,PR |
44 |
|
45 |
C !FUNCTIONS: |
46 |
_RL sw_adtg |
47 |
EXTERNAL sw_adtg |
48 |
|
49 |
C !LOCAL VARIABLES |
50 |
_RL del_P ,del_th, th, q |
51 |
_RL onehalf, two, three |
52 |
PARAMETER ( onehalf = 0.5 _d 0, two = 2. _d 0, three = 3. _d 0 ) |
53 |
CEOP |
54 |
|
55 |
C theta1 |
56 |
del_P = PR - P |
57 |
del_th = del_P*sw_adtg(S,T,P) |
58 |
th = T + onehalf*del_th |
59 |
q = del_th |
60 |
C theta2 |
61 |
del_th = del_P*sw_adtg(S,th,P+onehalf*del_P) |
62 |
|
63 |
th = th + (1 - 1/sqrt(two))*(del_th - q) |
64 |
q = (two-sqrt(two))*del_th + (-two+three/sqrt(two))*q |
65 |
|
66 |
C theta3 |
67 |
del_th = del_P*sw_adtg(S,th,P+onehalf*del_P) |
68 |
th = th + (1 + 1/sqrt(two))*(del_th - q) |
69 |
q = (two + sqrt(two))*del_th + (-two-three/sqrt(two))*q |
70 |
|
71 |
C theta4 |
72 |
del_th = del_P*sw_adtg(S,th,P+del_P) |
73 |
SW_PTMP = th + (del_th - two*q)/(two*three) |
74 |
|
75 |
RETURN |
76 |
END |
77 |
|
78 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
79 |
|
80 |
CBOP |
81 |
C !ROUTINE: SW_TEMP |
82 |
C !INTERFACE: |
83 |
_RL FUNCTION SW_TEMP( S, T, P, PR ) |
84 |
C !DESCRIPTION: \bv |
85 |
C *=============================================================* |
86 |
C | S/R SW_TEMP |
87 |
C | o compute in-situ temperature from potential temperature |
88 |
C *=============================================================* |
89 |
C |
90 |
C REFERENCES: |
91 |
C Fofonoff, P. and Millard, R.C. Jr |
92 |
C Unesco 1983. Algorithms for computation of fundamental properties of |
93 |
C seawater, 1983. _Unesco Tech. Pap. in Mar. Sci._, No. 44, 53 pp. |
94 |
C Eqn.(31) p.39 |
95 |
C |
96 |
C Bryden, H. 1973. |
97 |
C New Polynomials for thermal expansion, adiabatic temperature gradient |
98 |
C and potential temperature of sea water. |
99 |
C DEEP-SEA RES., 1973, Vol20,401-408. |
100 |
C \ev |
101 |
|
102 |
C !USES: |
103 |
IMPLICIT NONE |
104 |
C === Global variables === |
105 |
|
106 |
C !INPUT/OUTPUT PARAMETERS: |
107 |
C === Routine arguments === |
108 |
C S :: salinity |
109 |
C T :: potential temperature |
110 |
C P :: pressure |
111 |
C PR :: reference pressure |
112 |
_RL S, T, P, PR |
113 |
CEOP |
114 |
|
115 |
C !FUNCTIONS: |
116 |
_RL sw_ptmp |
117 |
EXTERNAL sw_ptmp |
118 |
|
119 |
SW_temp = SW_PTMP (S,T,PR,P) |
120 |
|
121 |
RETURN |
122 |
END |
123 |
|
124 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
125 |
|
126 |
CBOP |
127 |
C !ROUTINE: SW_ADTG |
128 |
C !INTERFACE: |
129 |
_RL FUNCTION SW_ADTG (S,T,P) |
130 |
|
131 |
C !DESCRIPTION: \bv |
132 |
C *=============================================================* |
133 |
C | S/R SW_ADTG |
134 |
C | o compute adiabatic temperature gradient as per UNESCO 1983 routines. |
135 |
C *=============================================================* |
136 |
C |
137 |
C started: |
138 |
C Armin Koehl akoehl@ucsd.edu |
139 |
C \ev |
140 |
|
141 |
C !USES: |
142 |
IMPLICIT NONE |
143 |
|
144 |
C !INPUT/OUTPUT PARAMETERS: |
145 |
_RL S,T,P |
146 |
|
147 |
C !LOCAL VARIABLES: |
148 |
_RL a0,a1,a2,a3,b0,b1,c0,c1,c2,c3,d0,d1,e0,e1,e2 |
149 |
_RL sref |
150 |
CEOP |
151 |
|
152 |
sref = 35. _d 0 |
153 |
a0 = 3.5803 _d -5 |
154 |
a1 = +8.5258 _d -6 |
155 |
a2 = -6.836 _d -8 |
156 |
a3 = 6.6228 _d -10 |
157 |
|
158 |
b0 = +1.8932 _d -6 |
159 |
b1 = -4.2393 _d -8 |
160 |
|
161 |
c0 = +1.8741 _d -8 |
162 |
c1 = -6.7795 _d -10 |
163 |
c2 = +8.733 _d -12 |
164 |
c3 = -5.4481 _d -14 |
165 |
|
166 |
d0 = -1.1351 _d -10 |
167 |
d1 = 2.7759 _d -12 |
168 |
|
169 |
e0 = -4.6206 _d -13 |
170 |
e1 = +1.8676 _d -14 |
171 |
e2 = -2.1687 _d -16 |
172 |
|
173 |
SW_ADTG = a0 + (a1 + (a2 + a3*T)*T)*T |
174 |
& + (b0 + b1*T)*(S-sref) |
175 |
& + ( (c0 + (c1 + (c2 + c3*T)*T)*T) + (d0 + d1*T)*(S-sref) )*P |
176 |
& + ( e0 + (e1 + e2*T)*T )*P*P |
177 |
|
178 |
RETURN |
179 |
END |