Lab 7
Lab 7
7
Equations of States: Single Non-linear Equations
1. Objective:
The activity aims to solve problems involving equations of states.
3. Discussion:
At a specified temperature and pressure, solving equations of state allows us to find the specific
volume of a gaseous mixture of chemicals. It would be impossible to design a chemical plant without using
equations of state. By the knowledge of specific volume, one can determine the size, and thus, cost of the
plant, including the diameter of pipes, the horsepower of compressor and pumps, and the diameter of
distillation towers and chemical reactors. To design a plant without this important information is a very
challenging task.
To calculate the enthalpy and vapor-liquid properties of mixtures, determining the specific volume is
also the first step. Calculating this enthalpy is especially important when making energy balances to reduce
energy use and help the environment.
The ideal gas equation of state , which relates the pressure, temperature and specific volume, is a
familiar equation:
This equation is quite adequate when the pressure is low (such as one atmosphere). However, many
chemical processes take place at very high pressure. For example, ammonia is made at pressures of 220
atmospheres or more. Under these conditions, the ideal gas equation of state may not be a valid
representation of reality.
The first generalization of the ideal gas law was the van der Waal’s equation of state:
where b accounts for excluded volume ( a second molecule cannot use the same space already use by the
first molecule), and a accounts for the interaction force between two molecules. This extension is just a first
step, however, it will not be a good approximation at extremely high temperatures.
The Redlich-Kwong equation of state is a modification of van der Waal’s equation of state:
where
The Redlich-Kwong equation of state was modified further by Soave to give the Redlich-Kwong-
Soave equation of state ( called RK-Soave ), which is common one in process simulators:
The ω is the acentric factor, which is a tabulated quantity for many substances. Thus, the value of alpha
can be computed for each chemical and reduced temperature.
All these equations can be rearranged into a cubic function of specific volume. The form of the
Redlich-Kwong and Redlich-Kwong-Soave equation of state is
When given the temperature and pressure of a gaseous mixture, and the parameters a and b, then to find
the specific volume one would have to solve the cubic equation of state for specific volume.
For a pure component, the parameters a and b are determined from the critical temperature and
critical pressure, and possibly acentric factor. These are all tabulated quantities, and there are even
correlations for them in terms of vapor pressure and normal boiling point.
For mixtures, it is necessary to combine the values of a and b for each component according to the
composition of the gaseous mixture. Common mixing rules are shown below, in which the ys are the mole
fraction of each chemical in the vapor phase.
or
where
or
Thus, the only difference between the problem for a pure component and that for a mixture is in evaluation
of the parameters a and b.
4. Resources:
Matlab
5. Procedure:
1. a. To determine the value of x that will satisfy the equation:
In the parameter of fzero function, 0.5 is a value of x near to where the function crosses the x-axis.
It may also represent the best guess of the solution.Try other values. Show the results.
clc
x = fzero(f, 0.5)
c. To create a function file and an m-file (filename: yourSurname_le06_p1c), the contents of the
files will be
f = cos(x) – 2*x^3;
end
For m-file:
clc
x = fzero(‘myfunction’,0.5)
2. a.To determine the graph of 2sin(x) – x1/2 + 2.5 from 0 to 4π. Issue the command in MATLAB
command window:
Notice that the graph passes the x axis near x=3. To determine the value where the graph
Notice that the graph passes the x axis near x=6. To determine the value where the graph
Notice that the graph passes the x axis near x=6. To determine the value where the graph
b. Create an m-file for Procedure 2a. Show the contents of the m-file and the results.
c. Create a function and m-files for Procedure 2a. Show the contents of the files and the results.
3. To calculate the volume of 2 moles of CO2 ( a = 3.59 L3-atm/mol2, and b = 0.0427 L/mol) at
temperature of 50oC, and pressure of 6 atm using van der Waal’s equation.
global P T n a b R
R=0 08206;
Vest = n*R*T/P;
V = fzero(‘Waals’, Vest)
The contents of function file will be:
function f = Waals(x)
global P T n a b R
f = (P + n^2*a/x^2)*(x-n*b) – n*R*T;
end
In order for the m-file and function files to work correctly, the variables P, T, n, a, b, and R are
declared global. Run the MATLAB program and show the results.
4. To determine the specific volume of n-butane at 500 K and 18 atm using Redlich –Kwong
equation of state,
a. Create a function file with the temperature, pressure, and thermodynamic properties with
the following contents:
function y = specvol(v)
pc = 37.5; % Data from Perry’s Chemical Handbook { bar*1x10^5 Pa/bar*1 atm/101,325 Pa}
%Ness/Abbot
T = 500;
p = 18;
R = 0.08205;
aRK = 0.42748*(R*Tc)^2/pc
aRK = arK*(Tc/T)^0.5
bRK = 0.08664*(T*Tc/pc)
b. To evaluate the value of v , having a guess of v=0.2, in the matlab command window issue
the command;
>>v = fzero(‘specvol’,0.2)
Show the results.
5. To determine the molar volume for gaseous ammonia at a pressure P = 56 atm and a
temperature T = 450 K using the van der Waals equation of state for the following reduced
pressures: Pr = 0.0503144, 1, 2, 4, 10, and 20.
function x = waalsvol(vol)
global press a b R T
% filename: yourSurname_le6_p05b.m
clear all
format short e
global press a b R T
T = 450 ; % in K
a = 27/64*R^2*Tcrit^2/Pcrit;
b = R*Tcrit/(8*Pcrit);
% each pass in a loop varies the press and then the volume is calculated
for j = 1:6
press = Pcrit*Preduced(j)
volguess = R*T/press;
result(j,1) = Preduced(j);
result(j,2) = vol;
end
% end of calculation
disp(result)
6. Repeat Procedure 4 using five different gases to be assigned by your instructor. Use Perry’s
Chemical Handbook/2-138 Critical Constants.
7. Repeat Procedure 5 using the same five different gases assigned to you by your instructor.
clc
x = fzero(f, 0.5)
1c Editor Window
function f = myfunction (x)
end
Command Window
x = fzero('myfunction',0.5)
x=
0.7214
2a Command Window
Plot
Command Window
x1 =
3.4664
x2 =
6.2869
x3 =
9.1585
2b Editor Window
clc
%plot
fplot('2*sin(x)-sqrt(x)+2.5',[0,4*pi])
disp(x1)
disp(x2)
disp(x3)
Plot
2c Function File
end
m-File
clc
%plot
fplot('functiontwo',[0,4*pi])
x1 = fzero('functiontwo',3);
x2 = fzero('functiontwo',6);
x3 = fzero('functiontwo',9);
disp(x1)
disp(x2)
disp(x3)
COMMAND WINDOW
3.4664
6.2869
9.1585
3 FUNCTION FILE
function f = Waals(x)
global P T n a b R
f = (P + n^2*a/x^2)*(x-n*b) - n*R*T;
end
m.FILE
clc;
global P T n a b R
R=0.08206;P=6; T = 323.2; n = 2; a =
3.59; b=0.047;
Vest = n*R*T/P;
fun=@Waals;
V=fzero(fun, Vest)
COMMAND WINDOW
V =
8.6613
COMMAND WINDOW
v = fzero('specvol',0.2)
v=
-0.0014
4c FUNCTION FILE
function y = specvol(v)
global Tc pc T p R
Tc = 425.2; % Data from Perry’s Chem-
ical Handbook/2-138 Critical Con-
stants
pc = 37.5; % Data from Perry’s Chemi-
cal Handbook { bar*1x10^5 Pa/bar*1
atm/101,325 Pa}
% Table B.1 Characteris-
tic Properties of Pure Species / In-
tro ChE Thermo/Smith/Van
%Ness/Abbot
T = 500;
p = 18;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(T*Tc/pc);
y = p*v^3 - R*T*v^2 + (aRK - p*bRK
^2 - R*T*bRK) *v - aRK*bRK;
COMMAND WINDOW
v = fsolve('specvol',0.2)
Equation solved.
v=
-0.0014
5 FUNCTION FILE
function x = waalsvol(vol)
global press a b R T
x = press*vol^3 - press*b*vol^2 -
R*T*vol^2 + a*vol - a*b;
m.FILE
clc
global press a b R T
% set the constants
Pcrit = 111.3 ; % in atm
Tcrit = 405.5; % in Kelvin
R = 0.08206; % in li. atm/mole.K
T = 450 ; % in K
% the different values of pressure
are stored in a single vector
Preduced = [ 0.0503144 1 2 4 10 20];
a = 27/64*R^2*Tcrit^2/Pcrit;
b = R*Tcrit/(8*Pcrit);
% each pass in a loop varies the
press and then the volume is calcu-
lated
for j = 1:6
press = Pcrit*Preduced(j);
volguess = R*T/press;
% Use fzero or fsolve to calcu-
late volume
vol = fzero('waalsvol',
volguess);
result(j,1) = Preduced(j);
result(j,2) = vol;
end
% end of calculation
disp('Preduced Molar Vol')
disp(result)
COMMAND WINDOW
Preduced Molar Vol
0.0503 6.5171
1.0000 0.2335
2.0000 0.0773
4.0000 0.0607
10.0000 0.0509
20.0000 0.0462
COMMAND WINDOW
>> v = fzero('specvol1',0.2)
v=
-0.0030
>> v = fsolve('specvol1',0.2)
Equation solved.
v=
-0.0030
6-2 FUNCTION FILE
(Compound # 77:1-Decene) function y = specvol2(v)
global Tc pc T p R
Tc = 616.6;
pc = 21.94;
T = 500;
p = 18;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(T*Tc/pc);
y = p*v^3 - R*T*v^2 + (aRK - p*bRK
^2 - R*T*bRK) *v - aRK*bRK;
COMMAND WINDOW
>> v = fzero('specvol2',0.2)
v=
-0.0025
>> v = fsolve('specvol2',0.2)
Equation solved, fsolve stalled.
v=
-0.0025
COMMAND WINDOW
>> v = fzero('specvol3',0.2)
v=
-0.0030
>> v = fsolve('specvol3',0.2)
Equation solved.
COMMAND WINDOW
>> v = fzero('specvol4',0.2)
v=
-0.0025
>> v = fsolve('specvol4',0.2)
Equation solved.
fsolve completed because the vector of function
values is near zero
as measured by the default value of the function
tolerance, and
the problem appears regular as measured by the
gradient.
v=
-0.0025
6-5 FUNCTION FILE
(Compound # 80: Deuterium) function y = specvol5(v)
global Tc pc T p R
Tc = 38.35;
pc = 16.4;
T = 500;
p = 18;
R = 0.08205;
arK = 0.42748*(R*Tc)^2/pc;
aRK = arK*(Tc/T)^0.5;
bRK = 0.08664*(T*Tc/pc);
y = p*v^3 - R*T*v^2 + (aRK - p*bRK
^2 - R*T*bRK) *v - aRK*bRK;
COMMAND WINDOW
>> v = fzero('specvol5',0.2)
v=
-3.8336e-05
>> v = fsolve('specvol5',0.2)
Equation solved.
COMMAND WINDOW
9. Assessment (Rubric for Laboratory Performance):
TECHNOLOGICAL INSTITUTE OF THE PHILIPPINES
1 2 3
I. Laboratory Skills
Manipulative
Members do not demonstrate Members occasionally Members always demonstrate
needed skills. demonstrate needed skills. needed skills.
Skills
Members occasionally
Member do not demonstrate Members always demonstrate
Process Skills demonstrate targeted process
targeted process skills. targeted process skills.
skills.
Members do not follow safety Members follow safety Members follow safety
Safety Precautions
precautions. precautions most of the time. precautions at all times.
Members do not know their Members have defined Members are on tasks and
tasks and have no defined responsibilities most of the have defined responsibilities at
Cooperative and
responsibilities. Group time. Group conflicts are all times. Group conflicts are
Teamwork
conflicts have to be settled by cooperatively managed most cooperatively managed at all
the teacher. of the time. times.
Ability to do Members require supervision Members require occasional Members do not need to be
independent work by the teacher. supervision by the teacher. supervised by the teacher.
TOTAL SCORE
Other Comments / Observations:
RATING = ( )x
100%
Evaluated by: