Home > air_sea > sw_visc.m

sw_visc

PURPOSE ^

SW_VISC kinematic viscosity

SYNOPSIS ^

function visc = sw_visc(S,T,P)

DESCRIPTION ^

 SW_VISC   kinematic viscosity 
===========================================================================
 SW_VISC  $Revision: 0.0 $  $Date: 1998/01/19 $
          Copyright (C) Ayal Anis 1998. 

 USAGE:  visc = sw_visc(S,T,P) 

 DESCRIPTION:
    Calculates kinematic viscosity of sea-water. 
    based on Dan Kelley's fit to Knauss's TABLE II-8

 INPUT:  (all must have same dimensions)
   S  = salinity    [psu      (PSS-78) ]
   T  = temperature [degree C (IPTS-68)]
   P  = pressure    [db]
       (P may have dims 1x1, mx1, 1xn or mxn for S(mxn) )

 OUTPUT:
   visc = kinematic viscosity of sea-water [m^2/s] 

   visc(40.,40.,1000.)=8.200167608E-7

 DISCLAIMER:
   This software is provided "as is" without warranty of any kind.  
=========================================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function visc = sw_visc(S,T,P)
0002 
0003 % SW_VISC   kinematic viscosity
0004 %===========================================================================
0005 % SW_VISC  $Revision: 0.0 $  $Date: 1998/01/19 $
0006 %          Copyright (C) Ayal Anis 1998.
0007 %
0008 % USAGE:  visc = sw_visc(S,T,P)
0009 %
0010 % DESCRIPTION:
0011 %    Calculates kinematic viscosity of sea-water.
0012 %    based on Dan Kelley's fit to Knauss's TABLE II-8
0013 %
0014 % INPUT:  (all must have same dimensions)
0015 %   S  = salinity    [psu      (PSS-78) ]
0016 %   T  = temperature [degree C (IPTS-68)]
0017 %   P  = pressure    [db]
0018 %       (P may have dims 1x1, mx1, 1xn or mxn for S(mxn) )
0019 %
0020 % OUTPUT:
0021 %   visc = kinematic viscosity of sea-water [m^2/s]
0022 %
0023 %   visc(40.,40.,1000.)=8.200167608E-7
0024 %
0025 % DISCLAIMER:
0026 %   This software is provided "as is" without warranty of any kind.
0027 %=========================================================================
0028 
0029 % CALLER:  general purpose
0030 % CALLEE:  sw_dens.m
0031 
0032 %-------------
0033 % CHECK INPUTS
0034 %-------------
0035 if nargin ~= 3
0036    error('sw_visc.m: Must pass 3 parameters ')
0037 end 
0038 
0039 % CHECK S,T dimensions and verify consistent
0040 [ms,ns] = size(S);
0041 [mt,nt] = size(T);
0042 
0043   % CHECK THAT S & T HAVE SAME SHAPE
0044 if (ms~=mt) | (ns~=nt)
0045    error('check_stp: S & T must have same dimensions')
0046 end %if
0047 
0048 % LET sw_dens.m DO DIMENSION CHECKING FOR P
0049 
0050 % IF ALL ROW VECTORS ARE PASSED THEN LET US PRESERVE SHAPE ON RETURN.
0051 Transpose = 0;
0052 if ms == 1  % row vector
0053    T       =  T(:);
0054    S       =  S(:);   
0055 
0056    Transpose = 1;
0057 end %if
0058 
0059 %------
0060 % BEGIN
0061 %------
0062 
0063 visc = 1e-4*(17.91-0.5381*T+0.00694*T.^2+0.02305*S)./sw_dens(S,T,P);
0064 
0065 if Transpose
0066    visc = visc';
0067 end %if
0068 
0069 return      
0070 %=========================================================================
0071

Generated on Thu 26-Apr-2007 12:23:13 by m2html © 2003