This program can be copied and pasted into the Matlab editor and saved as 'viscosity.m' in order to be able to run it.
function MU = viscosity (T,state,index) % function MU = viscosity(T,state,index) % % Argument List: % T [=] temperature in the units of Tdeg % state [=] state of the compound ('l' for liquid, 'v' for vapor) % index [=] index of compounds in cnms whose viscosities are to be found % (If this argument is omitted, all viscosities will be found.) % Returns: % MU [=] viscosity in units of kg/m/s % % Chapman-Enskog formula for viscosity of monatomic and polyatomic gases % % Ex: >> start301 (specify new session, E&M balances, ceng301 data base, % K as temp, 1 compound: air) % >> viscosity(298,'v') %ans = % 1.8356e-05 % % Empirical correlation for viscosity of liquids % % Ex: >> start301 (specify new session, E&M balances, ceng301 data base, % K as temp, 1 compound: water) % >> viscosity(298,'l') %ans = % 9.1083e-4 Created 4/13/2003 Shannon Duffy and Ternika Gibson global mw lvp Tdeg if state=='v' lj = checklj; T=at(T); if nargin==2 [omega_mu k D] = omegacalc(T./lj(:,2)); MU = 2.6693e-6 * sqrt(mw*T) ./ (lj(:,1).^2.*omega_mu); else [omega_mu k D] = omegacalc(T./lj(index,2)); MU = 2.6693e-6 * sqrt(mw(index)*T) ./ (lj(index,1).^2.*omega_mu); end end if state=='l' if Tdeg=='F' T=(T-32)/1.8+273.15; elseif Tdeg=='R' T=T/1.8; elseif Tdeg=='C' T=T+273.15; end if nargin == 2 MU=exp(lvp(:,1)+lvp(:,2)/T+lvp(:,3)*T+lvp(:,4)*T^2)/1000; else MU=exp(lvp(index,1)+lvp(index,2)/T+lvp(index,3)*T+lvp(index,4)*T^2)/1000; end endBack to main page.