NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/seawater/sw_dens0.m

Revision 495 (checked in by cbc, 12 years ago)

Initial import of Stark code.

Line 
1
2 function dens = sw_dens0(S,T)
3
4 % SW_DENS0   Denisty of sea water at atmospheric pressure
5 %=========================================================================
6 % SW_DENS0  $Id: sw_dens0.m,v 1.1 2003/12/12 04:23:22 pen078 Exp $
7 %           Copyright (C) CSIRO, Phil Morgan 1992
8 %
9 % USAGE:  dens0 = sw_dens0(S,T)
10 %
11 % DESCRIPTION:
12 %    Density of Sea Water at atmospheric pressure using
13 %    UNESCO 1983 (EOS 1980) polynomial.
14 %
15 % INPUT:  (all must have same dimensions)
16 %   S = salinity    [psu      (PSS-78)]
17 %   T = temperature [degree C (ITS-90)]
18 %
19 % OUTPUT:
20 %   dens0 = density  [kg/m^3] of salt water with properties S,T,
21 %           P=0 (0 db gauge pressure)
22 %
23 % AUTHOR:  Phil Morgan 92-11-05, Lindsay Pender (Lindsay.Pender@csiro.au)
24 %
25 % DISCLAIMER:
26 %   This software is provided "as is" without warranty of any kind.
27 %   See the file sw_copy.m for conditions of use and licence.
28 %
29 % REFERENCES:
30 %     Unesco 1983. Algorithms for computation of fundamental properties of
31 %     seawater, 1983. _Unesco Tech. Pap. in Mar. Sci._, No. 44, 53 pp.
32 %
33 %     Millero, F.J. and  Poisson, A.
34 %     International one-atmosphere equation of state of seawater.
35 %     Deep-Sea Res. 1981. Vol28A(6) pp625-629.
36 %=========================================================================
37
38 % Modifications
39 % 03-12-12. Lindsay Pender, Converted to ITS-90.
40
41 % CALLER: general purpose, sw_dens.m
42 % CALLEE: sw_smow.m
43
44 %----------------------
45 % CHECK INPUT ARGUMENTS
46 %----------------------
47 if nargin ~=2
48    error('sw_dens0.m: Must pass 2 parameters')
49 end %if
50
51 [mS,nS] = size(S);
52 [mT,nT] = size(T);
53
54 if (mS~=mT) | (nS~=nT)
55    error('sw_dens0.m: S,T inputs must have the same dimensions')
56 end %if
57
58 %----------------------
59 % DEFINE CONSTANTS
60 %----------------------
61
62 T68 = T * 1.00024;
63
64 %     UNESCO 1983 eqn(13) p17.
65
66 b0 =  8.24493e-1;
67 b1 = -4.0899e-3;
68 b2 =  7.6438e-5;
69 b3 = -8.2467e-7;
70 b4 =  5.3875e-9;
71
72 c0 = -5.72466e-3;
73 c1 = +1.0227e-4;
74 c2 = -1.6546e-6;
75
76 d0 = 4.8314e-4;
77 dens = sw_smow(T) + (b0 + (b1 + (b2 + (b3 + b4*T68).*T68).*T68).*T68).*S  ...
78                    + (c0 + (c1 + c2*T68).*T68).*S.*sqrt(S) + d0*S.^2;
79 return
80 %--------------------------------------------------------------------
81
82
Note: See TracBrowser for help on using the browser.