Compiled Learning Tasks
Compiled Learning Tasks
Learning Tasks
COMPILATION
Submitted by:
Gomez, Marineil C.
2008102730
Submitted to:
Prof. Allan Soriano
Learning Task 1
Instructions: Plot P vs V for carbon tetrachloride (CCl4) at temperatures Tr = 0.5, 1.0 and 1.5 based
on the Peng-Robinson Equation of State
Syntax:
%Evaluate this string in the base workspace
%Evaluate this string in the base workspace
close all
clear
clc
%Header;
disp(['Homework 1']);
disp(['Pressure-Volume Graph of Carbon
Tetrachloride using Peng-Robinson Equation of State']);
disp(['Gomez, Marineil C.']);
disp(['2008102730']);
%define variables;
syms Vp
syms P1p P2p P3p;
Pcp=45.6;
%Pcp in bar;
Tcp=556.4;
%Tcp in K;
wp=0.194;
Rp=8.31451*10^(-5);
%Rp in bar m3/mol K;
Vcp=0.276*10^3;
%Vcp in m3/mol;
rAt1p=1+kp*(1-sqrt(Tr1p));
rAt2p=1+kp*(1-sqrt(Tr2p));
rAt3p=1+kp*(1-sqrt(Tr3p));
At1p=rAt1p^2;
At2p=rAt2p^2;
At3p=rAt3p^2;
a1p=0.45724*(Rp^2)*(Tcp^2)*(At1p/Pcp);
a2p=0.45724*(Rp^2)*(Tcp^2)*(At2p/Pcp);
a3p=0.45724*(Rp^2)*(Tcp^2)*(At3p/Pcp);
bp=0.0778*((Rp*Tcp)/Pcp);
Vp=0.01:0.001:300;
%substitute for equation;
P1p=PengRobinson1(Rp,T1p,Vp,a1p,bp);
P2p=PengRobinson2(Rp,T2p,Vp,a2p,bp);
P3p=PengRobinson3(Rp,T3p,Vp,a3p,bp);
%Graph of function;
G1p=semilogx(Vp,P1p,'b.');
xlabel('{\it V}, m^3/mol')
ylabel('{\it P}, bar')
title('{\it Pressure} vs{\it Volume} using Peng Robinson EOS')
text(1e-3,150,'Carbon Tetrachloride
(CCl4)','EdgeColor','green',...
'LineWidth',3,'FontSize',12, ...
'BackgroundColor',[.7 .9 .8])
axis ([0 400 -0.1 3]);
hold on
Tr1p=0.5;
Tr2p=1.0;
Tr3p=1.5;
G2p=semilogx(Vp,P2p,'r.');
T1p=Tr1p*Tcp;
T2p=Tr2p*Tcp;
T3p=Tr3p*Tcp;
G3p=semilogx(Vp,P3p,'g.');
kp=0.37464+1.54226*wp-0.26992*(wp^2);
hold on
M-File:
function [ P1p ] = PengRobinson1(Rp,T1p,Vp,bp,a1p)
%PENGROBINSON1 Summary of this function goes here
%
Detailed explanation goes here
P1p=((Rp*T1p)./(Vp-bp))-(a1p./(Vp.^2+2*Vp.*bp-bp^2));
End
function [ P2p ] = PengRobinson2( Rp,T2p,Vp,bp,a2p)
%PENGROBINSON2 Summary of this function goes here
%
Detailed explanation goes here
P2p=((Rp*T2p)./(Vp-bp))-(a2p./(Vp.^2+2*Vp.*bp-bp^2));
end
File Viewer
Learning Task 2
Instructions: Calculate the intermolecular potentials: polar/polar, polar/induction, dispersion at 100C
and for distances 5, 10, 50 100 A for the pair-molecules CCl4/HCl
Syntax:
%calculations;
%input parameters;
mudCCl4= 0; % dipole moment in debye, ppt
4 slide 60 ;
mudHCl=1.08; % dipole moment in debye.
ppt 4 slide 60 ;
muCCl4=mudCCl4*3.33569e-30; %convert debye;
muHCl=mudHCl*3.33569e-30; %convert debye;
alphaCCl4=10.5e-30; %polarizability in
m3;
alphaHCl=2.6e-30; %polarizability in m3;
iVCCl4=11; %ionization potential in eV;
iVHCl=12.8; %ionization potential in eV;
iCCl4=iVCCl4*1.60218e-19; %conv eV to J
iHCl=iVHCl*1.60218e-19; %conv eV to J
Eo=8.85419e-12; % dielectric permitivity
in vacuum in C^2/J-m;
T=373.15; % temperature (100oC) in K;
kboltz=1.3807e-23; % Boltzman constant in
J/K;
r=[5e-10 10e-10 50e-10 100e-10]; % distances in m;
E=4*pi*Eo;
k=(E^2)*kboltz*T;
x=-(2*(muCCl4^2)*(muHCl^2))/(3*k); %
collation of constants;
gpolar=x./(r.^6); %mean potential energy;
%calculation using eq 4-14 for induced
dipole interactions;
n=(alphaCCl4*(muHCl^2))+(alphaHCl*
(muCCl4^2));
ginduced=(-n/(E^2))./(r.^6);
%calculation using eq 4-18 for dispersion
interactios;
ion=(iHCl*iCCl4)/(iHCl+iCCl4);
y=(-3/2)*((alphaHCl*alphaCCl4)*ion)/
(E^2);
gdisperse=y./(r.^6);
%graphics diplay;
%table output;
gamma=cell(5,4);
gamma{1,1}='Distance';
gamma{1,2}='Polar/Polar';
gamma{1,3}='Polar/Induction';
gamma{1,4}='Dispersion';
gamma{2,1}='5 Angstrom';
gamma{3,1}='10 Angstrom';
gamma{4,1}='50 Angstrom';
gamma{5,1}='100 Angstrom';
gamma{2,2}=num2str(gpolar(1));
gamma{3,2}=num2str(gpolar(2));
gamma{4,2}=num2str(gpolar(3));
gamma{5,2}=num2str(gpolar(4));
gamma{2,3}=num2str(ginduced(1));
gamma{3,3}=num2str(ginduced(2));
gamma{4,3}=num2str(ginduced(3));
gamma{5,3}=num2str(ginduced(4));
gamma{2,4}=num2str(gdisperse(1));
gamma{3,4}=num2str(gdisperse(2));
gamma{4,4}=num2str(gdisperse(3));
gamma{5,4}=num2str(gdisperse(4));
File Viewer
Learning Task 3
Instructions: Calculate the second virial coefficient B2 for temperatures kT/ = 0.3 to 5.0 for C3H8
from (a) Lennard-Jones Potential, (b) Kihara Potantial, (cO Pitzer-Tssonopoulos correlation. Plot B2
(cm3/mol) vs Temperature (K) for three different methods in a single figure
Syntax:
For Kihara Potential
For Lennard-Jones Potential
%input data;
Na=6.02214e23; %Avogadros number in part/
mol;
sLJ=5.711e-8; %in cm;
eKLJ=233.28; %in K;
%data from table 5-1 praustnitz 1999;
%calculations;
B2=((2*pi)/3)*Na*(sK^3);
kTeK=0.3:0.01:5;
kToeK=kTeK(iK);
eokTK=1/kToeK;
kTeLJ=0.3:0.01:5;
kToeLJ=kTeLJ(iLJ);
eokTLJ=1/kToeLJ;
a=as/(1+as);
beg2a=a+0.0001;
FactorLJ=3*quadl(@(rLJ)((1-exp(4.*eokTLJ.*((rLJ).^(-12)-(rLJ).^(6)))).*rLJ.^2),0.01,15);
FactorK=quadl(@(rK)((1-exp(-4.*eokTK.*
(((1-a)./(rK-a)).^(12)-((1-a)./(rKa)).^6))).*rK.^2),beg2a,15);
integ1(iLJ)=FactorLJ;
integ2(iK)=3.*(a.^3+FactorK);
integK=integ2(iK);
integLJ=integ1(iLJ);
TLJ=kTeLJ.*eKLJ;
TK=kTeK*eKK;
BK(iK)=B2*integK;
BLJ(iLJ)=B1*integLJ;
plot(TK,BK,'*r');
plot(TLJ,BLJ,'*b');
xlabel('{\it T},K');
ylabel('{\it BLJ},cm3/mol');
xlabel('{\it T},K');
ylabel('{\it BLJ},cm3/mol');
axis tight;
axis tight;
File Viewer
Quiz 2
%problem 1a;
sb=[0 0 0];
sb(1)=0.5*(s(1)+s(1));
sb(2)=0.5*(s(1)+s(2));
sb(3)=0.5*(s(2)+s(2));
Bo=2*pi*Na;
ekb=[0 0 0];
b2i=[0 0];
for i=1:2;
ekb(1)=(ek(1)*ek(1))^0.5;
ekb(2)=(ek(1)*ek(2))^0.5;
ekb(3)=(ek(2)*ek(2))^0.5;
ekT=ek(i)/Ta;
Bm=[0 0 0];
factora=quadl(@(ra)((1-exp(-4.*ekT.*
((ra).^(-12)-(ra).^(6)))).*ra.^2),0.01,15);
BLJi(i)=Bo*s(i)^3*factora;
factora=quadl(@(ra)((1-exp(-4.*ekT.*
((ra).^(-12)-(ra).^(6)))).*ra.^2),0.01,15);
BLJi(i)=Bo*s(i)^3*factora;
end
sb;
ekb;
for j=1:3
ekTm=ekb(j)/Tb;
factorb=quadl(@(rb)((1-exp(-4.*ekTm.*
((rb).^(-12)-(rb).^(6)))).*rb.^2),0.01,15);
Bm(j)=Bo*sb(j)^3*factorb;
%output answers;
disp(['Answers']);
disp(['B of C2H6: ',num2str(BLJi(1)),'
m3/mol']);
disp(['B of C3H8: ',num2str(BLJi(2)),'
m3/mol']);
%problem 1b;
%legend;
%C2H6(1)-C2H6(1)=j(1);
%C2H6(1)-C3H8(2)=j(2);
%C3H8(2)-C3H8(2)=j(3);
ekTm=ekb(j)/Tb;
factorb=quadl(@(rb)((1-exp(-4.*ekTm.*
((rb).^(-12)-(rb).^(6)))).*rb.^2),0.01,15);
Bm(j)=Bo*sb(j)^3*factorb;
ekTm=ekb(j)/Tb;
factorb=quadl(@(rb)((1-exp(-4.*ekTm.*
((rb).^(-12)-(rb).^(6)))).*rb.^2),0.01,15);
Bm(j)=Bo*sb(j)^3*factorb;
end
Bm;
%Bmix calculations;
Tb=449.5455; %K;
Pb=7.0909; %bar;
Na=6.022e23; %particles/mol;
Bmix1=(yb(1)^2)*Bm(1);
Bmix2=2*yb(1)*yb(2)*Bm(2);
Bmix3=(yb(2)^2)*Bm(3);
% problem 2;
Bmix=Bmix1+Bmix2+Bmix3;
%input data;
%output answers;
%Problem 1c;
Gc=83.1451e-6;
Tc=449.5455; %K;
Pc=7.0909; %bar;
Na=6.022e23; %particles/mol;
Gc=83.1451e-6; %gas constant in bar m3/
mol K;
Bact=data(:,2);
Tact=data(:,1);
disp(['Answers']);
disp(['B(mixt) of C2H6-C2H6: ',num2str(Bm
(1)),' m3/mol']);
disp(['B(mixt) of C2H6-C3H8: ',num2str(Bm
(2)),' m3/mol']);
disp(['B(mixt) of C3H8-C3H8: ',num2str(Bm
(3)),' m3/mol']);
disp(['B(mix) = ',num2str(Bmix),' m3/
mol']);
%calculations;
unkhat;
lnfc1=(Pc/(Gc*Tc))*(2*((yc(1)*Bm(1))+(yc
(1)*Bm(2)))-Bmix);
lnfc2=(Pc/(Gc*Tc))*(2*((yc(2)*Bm(2))+(yc
(2)*Bm(3)))-Bmix);
fc1=exp(lnfc1);
fc2=exp(lnfc2);
%output answers;
disp(['Answers']);
disp(['Fugacity Coefficient of C2H6:
',num2str(fc1),' ']);
disp(['Fugacity Coefficient of C3H8:
',num2str(fc2),' ']);
Bcal=pct(unkhat,Tact);
disp(['Critical Parameters']);
disp([' Critical Temperature: ',num2str
(unkhat(1),' K']);
disp([' Critical Pressure: ',num2str
(unkhat(3),' bar ']);
disp([' Accentric Factor: ',num2str
(unkhat(2),' ']);
PCT M-file
function [ Bhat ] = pct(unk,Tact)
%PCT Summary of this function goes here
%
Detailed explanation goes here
Gc=83.1451e-6;
F0=0.1445-(0.330./(Tact./unk(1)))(0.1385./(Tact./unk(1)).^2)-(0.0121./
(Tact./unk(1))^3)-(0.000607./(Tact./unk
(1)).^8);
F1=0.0637+(0.331./(Tact./unk(1)).^2)(0.423./(Tact./unk(1)).^3)-(0.008./
(Tact./unk(1)).^8);
Bfunct=F0+unk(2).*F1;
Bhat=(Gc*unk(1).*Bfunct)./unk(3);
end