1 |
%$$$ |
---|
2 |
%$$$ #undef __PR |
---|
3 |
%$$$ #include "VARIANT.h" |
---|
4 |
|
---|
5 |
function c = sw_satN2(S,T) |
---|
6 |
|
---|
7 |
% SW_SATN2 Satuaration of N2 in sea water |
---|
8 |
%========================================================================= |
---|
9 |
% sw_satN2 $Id: sw_satN2.m,v 1.1 2003/12/12 04:23:22 pen078 Exp $ |
---|
10 |
% Copyright (C) CSIRO, Phil Morgan 1998. |
---|
11 |
% |
---|
12 |
% USAGE: satN2 = sw_satN2(S,T) |
---|
13 |
% |
---|
14 |
% DESCRIPTION: |
---|
15 |
% Solubility (satuaration) of Nitrogen (N2) in sea water |
---|
16 |
% |
---|
17 |
% INPUT: (all must have same dimensions) |
---|
18 |
% S = salinity [psu (PSS-78)] |
---|
19 |
% T = temperature [degree C (ITS-90)] |
---|
20 |
% |
---|
21 |
% OUTPUT: |
---|
22 |
% satN2 = solubility of N2 [ml/l] |
---|
23 |
% |
---|
24 |
% AUTHOR: Phil Morgan 97-11-05, Lindsay Pender (Lindsay.Pender@csiro.au) |
---|
25 |
% |
---|
26 |
%$$$ #include "disclaimer_in_code.inc" |
---|
27 |
% |
---|
28 |
% REFERENCES: |
---|
29 |
% Weiss, R. F. 1970 |
---|
30 |
% "The solubility of nitrogen, oxygen and argon in water and seawater." |
---|
31 |
% Deap-Sea Research., 1970, Vol 17, pp721-735. |
---|
32 |
%========================================================================= |
---|
33 |
|
---|
34 |
% Modifications |
---|
35 |
% 99-06-25. Lindsay Pender, Fixed transpose of row vectors. |
---|
36 |
% 03-12-12. Lindsay Pender, Converted to ITS-90. |
---|
37 |
|
---|
38 |
% CALLER: general purpose |
---|
39 |
% CALLEE: |
---|
40 |
|
---|
41 |
%$$$ #ifdef VARIANT_PRIVATE |
---|
42 |
%$$$ %*********************************************************** |
---|
43 |
%$$$ %$Id: sw_satN2.m,v 1.1 2003/12/12 04:23:22 pen078 Exp $ |
---|
44 |
%$$$ % |
---|
45 |
%$$$ %$Log: sw_satN2.m,v $ |
---|
46 |
%$$$ %Revision 1.1 2003/12/12 04:23:22 pen078 |
---|
47 |
%$$$ %*** empty log message *** |
---|
48 |
%$$$ % |
---|
49 |
|
---|
50 |
%$$$ % |
---|
51 |
%$$$ %*********************************************************** |
---|
52 |
%$$$ #endif |
---|
53 |
|
---|
54 |
%---------------------- |
---|
55 |
% CHECK INPUT ARGUMENTS |
---|
56 |
%---------------------- |
---|
57 |
if nargin ~=2 |
---|
58 |
error('sw_satN2.m: Must pass 2 parameters') |
---|
59 |
end %if |
---|
60 |
|
---|
61 |
% CHECK S,T dimensions and verify consistent |
---|
62 |
[ms,ns] = size(S); |
---|
63 |
[mt,nt] = size(T); |
---|
64 |
|
---|
65 |
|
---|
66 |
% CHECK THAT S & T HAVE SAME SHAPE |
---|
67 |
if (ms~=mt) | (ns~=nt) |
---|
68 |
error('sw_satN2: S & T must have same dimensions') |
---|
69 |
end %if |
---|
70 |
|
---|
71 |
%------ |
---|
72 |
% BEGIN |
---|
73 |
%------ |
---|
74 |
|
---|
75 |
% convert T to Kelvin |
---|
76 |
T = 273.15 + T * 1.00024; |
---|
77 |
|
---|
78 |
% constants for Eqn (4) of Weiss 1970 |
---|
79 |
a1 = -172.4965; |
---|
80 |
a2 = 248.4262; |
---|
81 |
a3 = 143.0738; |
---|
82 |
a4 = -21.7120; |
---|
83 |
b1 = -0.049781; |
---|
84 |
b2 = 0.025018; |
---|
85 |
b3 = -0.0034861; |
---|
86 |
|
---|
87 |
% Eqn (4) of Weiss 1970 |
---|
88 |
lnC = a1 + a2.*(100./T) + a3.*log(T./100) + a4.*(T./100) + ... |
---|
89 |
S.*( b1 + b2.*(T./100) + b3.*((T./100).^2) ); |
---|
90 |
|
---|
91 |
c = exp(lnC); |
---|
92 |
|
---|