You are on page 1of 2

%User module for calculating mass diffusivities in a liquid or gas system

%User inputs for gas: temperature and number corresponding to system


%User inputs for liquid: temperature and number corresponding to system
%-------------------------------------------------------------------------%Gas Systems
%D1 is mass diffusivity of O2 within N2
%D2 is mass diffusivity of O2 within He
%D3 is mass diffusivity of N2 within He
%Equations for D1, D2, D3 use the equation for calculating mass diffusivity
in a gas system: 0.0103*(T^1.75)*((1/Ma +
1/Mb)^(1/2))/(P*((Va^(1/3))+(Vb^(1/3))^2))
%T is the absolute temperature (Kelvin)
%P is the standard pressure at 101,325 N/m^2
%Ma and Mb are the molecular weights of each gas(kg/mol)
%Va and Vb are the atomic diffusion volumes of each gas (m^3)
%-------------------------------------------------------------------------%Liquid Systems
%D4 is mass diffusivity of glucose within water
%D5 is mass diffusivity of lactose within water
%D6 is mass diffusivity of urea within water
%Equations for D4, D5, D6 are the Stokes-Einstein equation for calculating
%mass diffusivity in a liquid system:(((1.38*10^(23))*T)/(2*pi*u*(1.168*10^(-27))^(1/3)))
%T is the absolute temperature (Kelvin)
%u is visosity of the solvent (water) (kg/m s)
%Va is the effective solute volume (m^3)
function DiffValue = diffusivity
disp
disp
disp
disp
disp
disp

('System
('System
('System
('System
('System
('System

1
2
3
4
5
6

is
is
is
is
is
is

O2 within N2')
O2 within He')
N2 within He')
glucose within water')
lactose within water')
urea within water')

T = input('Enter temperature within range of 291 Kelvin - 305 Kelvin:')


D1 = 0.0103*(T^1.75)*((1/32 +
1/28)^(1/2))/(101325*((16.6^(1/3))+(17.9^(1/3))^2)); %Molecular weight and
Atomic Diffusion Volume (O2)
D2 = 0.0103*(T^1.75)*((1/32 +
1/4)^(1/2))/(101325*((16.6^(1/3))+(2.88^(1/3))^2)); %Molecular weight and
Atomic Diffusion Volume (N2)
D3 = 0.0103*(T^1.75)*((1/28 +
1/4)^(1/2))/(101325*((17.9^(1/3))+(2.88^(1/3))^2)); %Molecular weight and
Atomic Diffusion Volume (He)
if

291 <= T && T <= 296;


u = 0.001005
elseif 296 < T && T <= 301;
u = 0.0009011
elseif 301 < T && T <=305;
u = 0.0008007
else T > 305 | T < 291;

disp ('ERROR: Enter temperature within range of 291 Kelvin - 305


Kelvin:')
T = input('Enter temperature again:')
if 291 <= T && T <= 296;
u = 0.001005
elseif 296 < T && T <= 301;
u = 0.0009011
else 301 < T && T <=305;
u = 0.0008007
end
end
x = input ('Enter the number that corresponds to the desired system:')
if x == 4;
V = input('Enter Volume %:');
elseif x == 5;
V = input('Enter Volume %:');
elseif x== 6;
V = input('Enter Volume %:');
elseif x==1;
DiffValue = D1;
elseif x == 2;
DiffValue = D2;
elseif x == 3;
DiffValue = D3;
else x>6;
disp ('ERROR: Enter value between 1 and 6')
x = input ('Pick the number, again,that corresponds to the desired
system:');
if x == 4;
V = input('Enter Volume %:');
elseif x == 5;
V = input('Enter Volume %:');
elseif x== 6;
V = input('Enter Volume %:');
elseif x==1;
DiffValue = D1;
elseif x == 2;
DiffValue = D2;
elseif x == 3;
DiffValue = D3;
end
D4 = (((1.38*10^(-23))*T)/(2*pi*u*(1.168*10^(-27))^(1/3)))*(1+0.015*V);
D5 = (((1.38*10^(-23))*T)/(2*pi*u*(3.262*10^(-27))^(1/3)))*(1+0.015*V);
D6 = (((1.38*10^(-23))*T)/(2*pi*u*(1.492*10^(-28))^(1/3)))*(1+0.015*V);
end

You might also like