1 |
|
---|
2 |
function K = sw_seck(S,T,P) |
---|
3 |
|
---|
4 |
% SW_SECK Secant bulk modulus (K) of sea water |
---|
5 |
%========================================================================= |
---|
6 |
% SW_SECK $Id: sw_seck.m,v 1.1 2003/12/12 04:23:22 pen078 Exp $ |
---|
7 |
% Copyright (C) CSIRO, Phil Morgan 1992. |
---|
8 |
% |
---|
9 |
% USAGE: dens = sw_seck(S,T,P) |
---|
10 |
% |
---|
11 |
% DESCRIPTION: |
---|
12 |
% Secant Bulk Modulus (K) of Sea Water using Equation of state 1980. |
---|
13 |
% UNESCO polynomial implementation. |
---|
14 |
% |
---|
15 |
% INPUT: (all must have same dimensions) |
---|
16 |
% S = salinity [psu (PSS-78) ] |
---|
17 |
% T = temperature [degree C (ITS-90)] |
---|
18 |
% P = pressure [db] |
---|
19 |
% (alternatively, may have dimensions 1*1 or 1*n where n is columns in S) |
---|
20 |
% |
---|
21 |
% OUTPUT: |
---|
22 |
% K = Secant Bulk Modulus [bars] |
---|
23 |
% |
---|
24 |
% AUTHOR: Phil Morgan 92-11-05, Lindsay Pender (Lindsay.Pender@csiro.au) |
---|
25 |
% |
---|
26 |
% DISCLAIMER: |
---|
27 |
% This software is provided "as is" without warranty of any kind. |
---|
28 |
% See the file sw_copy.m for conditions of use and licence. |
---|
29 |
% |
---|
30 |
% REFERENCES: |
---|
31 |
% Fofonoff, P. and Millard, R.C. Jr |
---|
32 |
% Unesco 1983. Algorithms for computation of fundamental properties of |
---|
33 |
% seawater, 1983. _Unesco Tech. Pap. in Mar. Sci._, No. 44, 53 pp. |
---|
34 |
% Eqn.(15) p.18 |
---|
35 |
% |
---|
36 |
% Millero, F.J. and Poisson, A. |
---|
37 |
% International one-atmosphere equation of state of seawater. |
---|
38 |
% Deep-Sea Res. 1981. Vol28A(6) pp625-629. |
---|
39 |
%========================================================================= |
---|
40 |
|
---|
41 |
% Modifications |
---|
42 |
% 99-06-25. Lindsay Pender, Fixed transpose of row vectors. |
---|
43 |
% 03-12-12. Lindsay Pender, Converted to ITS-90. |
---|
44 |
|
---|
45 |
% CALLER: sw_dens.m |
---|
46 |
% CALLEE: none |
---|
47 |
|
---|
48 |
%---------------------- |
---|
49 |
% CHECK INPUT ARGUMENTS |
---|
50 |
%---------------------- |
---|
51 |
if nargin ~=3 |
---|
52 |
error('sw_seck.m: Must pass 3 parameters') |
---|
53 |
end %if |
---|
54 |
|
---|
55 |
% CHECK S,T,P dimensions and verify consistent |
---|
56 |
[ms,ns] = size(S); |
---|
57 |
[mt,nt] = size(T); |
---|
58 |
[mp,np] = size(P); |
---|
59 |
|
---|
60 |
|
---|
61 |
% CHECK THAT S & T HAVE SAME SHAPE |
---|
62 |
if (ms~=mt) | (ns~=nt) |
---|
63 |
error('check_stp: S & T must have same dimensions') |
---|
64 |
end %if |
---|
65 |
|
---|
66 |
% CHECK OPTIONAL SHAPES FOR P |
---|
67 |
if mp==1 & np==1 % P is a scalar. Fill to size of S |
---|
68 |
P = P(1)*ones(ms,ns); |
---|
69 |
elseif np==ns & mp==1 % P is row vector with same cols as S |
---|
70 |
P = P( ones(1,ms), : ); % Copy down each column. |
---|
71 |
elseif mp==ms & np==1 % P is column vector |
---|
72 |
P = P( :, ones(1,ns) ); % Copy across each row |
---|
73 |
elseif mp==ms & np==ns % PR is a matrix size(S) |
---|
74 |
% shape ok |
---|
75 |
else |
---|
76 |
error('check_stp: P has wrong dimensions') |
---|
77 |
end %if |
---|
78 |
|
---|
79 |
%***check_stp |
---|
80 |
|
---|
81 |
%-------------------------------------------------------------------- |
---|
82 |
% COMPUTE COMPRESSION TERMS |
---|
83 |
%-------------------------------------------------------------------- |
---|
84 |
P = P/10; %convert from db to atmospheric pressure units |
---|
85 |
T68 = T * 1.00024; |
---|
86 |
|
---|
87 |
% Pure water terms of the secant bulk modulus at atmos pressure. |
---|
88 |
% UNESCO eqn 19 p 18 |
---|
89 |
|
---|
90 |
h3 = -5.77905E-7; |
---|
91 |
h2 = +1.16092E-4; |
---|
92 |
h1 = +1.43713E-3; |
---|
93 |
h0 = +3.239908; %[-0.1194975]; |
---|
94 |
|
---|
95 |
AW = h0 + (h1 + (h2 + h3.*T68).*T68).*T68; |
---|
96 |
|
---|
97 |
k2 = 5.2787E-8; |
---|
98 |
k1 = -6.12293E-6; |
---|
99 |
k0 = +8.50935E-5; %[+3.47718E-5]; |
---|
100 |
|
---|
101 |
BW = k0 + (k1 + k2*T68).*T68; |
---|
102 |
|
---|
103 |
e4 = -5.155288E-5; |
---|
104 |
e3 = +1.360477E-2; |
---|
105 |
e2 = -2.327105; |
---|
106 |
e1 = +148.4206; |
---|
107 |
e0 = 19652.21; %[-1930.06]; |
---|
108 |
|
---|
109 |
KW = e0 + (e1 + (e2 + (e3 + e4*T68).*T68).*T68).*T68; % eqn 19 |
---|
110 |
|
---|
111 |
%-------------------------------------------------------------------- |
---|
112 |
% SEA WATER TERMS OF SECANT BULK MODULUS AT ATMOS PRESSURE. |
---|
113 |
%-------------------------------------------------------------------- |
---|
114 |
j0 = 1.91075E-4; |
---|
115 |
|
---|
116 |
i2 = -1.6078E-6; |
---|
117 |
i1 = -1.0981E-5; |
---|
118 |
i0 = 2.2838E-3; |
---|
119 |
|
---|
120 |
SR = sqrt(S); |
---|
121 |
|
---|
122 |
A = AW + (i0 + (i1 + i2*T68).*T68 + j0*SR).*S; |
---|
123 |
|
---|
124 |
|
---|
125 |
m2 = 9.1697E-10; |
---|
126 |
m1 = +2.0816E-8; |
---|
127 |
m0 = -9.9348E-7; |
---|
128 |
|
---|
129 |
B = BW + (m0 + (m1 + m2*T68).*T68).*S; % eqn 18 |
---|
130 |
|
---|
131 |
f3 = -6.1670E-5; |
---|
132 |
f2 = +1.09987E-2; |
---|
133 |
f1 = -0.603459; |
---|
134 |
f0 = +54.6746; |
---|
135 |
|
---|
136 |
g2 = -5.3009E-4; |
---|
137 |
g1 = +1.6483E-2; |
---|
138 |
g0 = +7.944E-2; |
---|
139 |
|
---|
140 |
K0 = KW + ( f0 + (f1 + (f2 + f3*T68).*T68).*T68 ... |
---|
141 |
+ (g0 + (g1 + g2*T68).*T68).*SR ).*S; % eqn 16 |
---|
142 |
|
---|
143 |
K = K0 + (A + B.*P).*P; % eqn 15 |
---|
144 |
return |
---|
145 |
%---------------------------------------------------------------------------- |
---|
146 |
|
---|
147 |
|
---|