Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1.  
  2. function S = sw_sals(Rt,T)
  3.  
  4. % SW_SALS Salinity of sea water
  5. %=========================================================================
  6. % SW_SALS $Id: sw_sals.m,v 1.1 2003/12/12 04:23:22 pen078 Exp $
  7. % Copyright (C) CSIRO, Phil Morgan 1993.
  8. %
  9. % USAGE: S = sw_sals(Rt,T)
  10. %
  11. % DESCRIPTION:
  12. % Salinity of sea water as a function of Rt and T.
  13. % UNESCO 1983 polynomial.
  14. %
  15. % INPUT:
  16. % Rt = Rt(S,T) = C(S,T,0)/C(35,T(IPTS-68),0)
  17. % T = temperature [degree C (ITS-90)]
  18. %
  19. % OUTPUT:
  20. % S = salinity [psu (PSS-78)]
  21. %
  22. % AUTHOR: Phil Morgan 93-04-17, Lindsay Pender (Lindsay.Pender@csiro.au)
  23. %
  24. % DISCLAIMER:
  25. % This software is provided "as is" without warranty of any kind.
  26. % See the file sw_copy.m for conditions of use and licence.
  27. %
  28. % REFERENCES:
  29. % Fofonoff, P. and Millard, R.C. Jr
  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.  
  34. % Modifications
  35. % 03-12-12. Lindsay Pender, Converted to ITS-90.
  36.  
  37. % CALLER: sw_salt
  38. % CALLEE: none
  39.  
  40. %--------------------------
  41. % CHECK INPUTS
  42. %--------------------------
  43. if nargin~=2
  44. error('sw_sals.m: requires 2 input arguments')
  45. end %if
  46.  
  47. [mrt,nrt] = size(Rt);
  48. [mT,nT] = size(T);
  49. if ~(mrt==mT | nrt==nT)
  50. error('sw_sals.m: Rt and T must have the same shape')
  51. end %if
  52.  
  53. %--------------------------
  54. % eqn (1) & (2) p6,7 unesco
  55. %--------------------------
  56.  
  57. del_T68 = T * 1.00024 - 15;
  58.  
  59. a0 = 0.0080;
  60. a1 = -0.1692;
  61. a2 = 25.3851;
  62. a3 = 14.0941;
  63. a4 = -7.0261;
  64. a5 = 2.7081;
  65.  
  66. b0 = 0.0005;
  67. b1 = -0.0056;
  68. b2 = -0.0066;
  69. b3 = -0.0375;
  70. b4 = 0.0636;
  71. b5 = -0.0144;
  72.  
  73. k = 0.0162;
  74.  
  75. Rtx = sqrt(Rt);
  76. del_S = (del_T68 ./ (1+k*del_T68) ) .* ...
  77. ( b0 + (b1 + (b2+ (b3 + (b4 + b5.*Rtx).*Rtx).*Rtx).*Rtx).*Rtx);
  78.  
  79. S = a0 + (a1 + (a2 + (a3 + (a4 + a5.*Rtx).*Rtx).*Rtx).*Rtx).*Rtx;
  80.  
  81. S = S + del_S;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement