Saturday, July 31, 2021

Roots Finding: Open Methods

Problem 6.15.


The Redlich-Kwong equation of state is given by
 Eq.(6.15(a))
where R = the universal gas constant [= 0.518 kJ/(kg K)], T = absolute temperature (K), p = absolute pressure (kPa), and v = the volume of a kg of gas (m3/kg). The parameters a and b are calculated by 
where pc = 4600 kPa and Tc = 191 K. As a chemical engineering, you are asked to determine the amount of methane fuel that can be held in a 3-m3 tank at a temperature of -40°C with a pressure of 65000 kPa. Use a root-locating method of your choice to calculate v and then determine the mass of methane contained in the tank.

Solution:


The parameters and other values can be substituted into Eq.(6.15(a)). *Remember to express T in unit K (T(K) = T(°C) + 273.15)

 Eq.(6.15(b))
Therefore, we need to find out v, which is the specific volume (m3/kg) using root-locating method. Because it is relatively complicated, I will store it as an M-file:

function f = redlichkwong(v,P,T)
% v = specific volume (m3/kg)
% P = absolute pressure (kPa)
% T = absolute temperature (K)
R = 0.518; %kJ/kg.K
TC = 191; %K
PC = 4600; %kPa
a = 0.427*(R^2)*(TC^2.5)/(PC);
b = 0.0866*R*TC/PC;
f = P-R*T./(v-b)+a./(v.*(v+b).*sqrt(T));
end

Before determining the root, it is advisable to plot the function to estimate the initial guesses. 

>> v = linspace(0.002,0.0035);
>> f = redlichkwong(v,65000,233.15);
>> plot(v,f),grid,xlabel('v'),ylabel('f')

Hence, from the graph, we can obtain a rough estimate of the root, which is about 0.0028. We can either choose to use bracketing method or open method to solve the problem. I will recommend to use open method due to quicker convergence. In this case, we can use modified secant method with an initial guess, v0 = 0.002 and perturbation fraction, δ = 0.001.
The above iterative equation can be applied to compute:
Therefore, after seven iterations, the approximate error falls below 0.1% and the root estimate is 0.002808 m3/kg

Mass of methane contained in the tank is:
m = 3 m3/0.002808 m3/kg = 1068.376 kg

No comments:

Post a Comment

Numerical Integration Formulas

Here are the M-files to implement composite trapezoidal rule for equally spaced data and unequally spaced data.  Composite Trapezoidal Rule ...