Problem Statement: The following is the generalized Peng-Robinson equation of state, which describes how the vapor pressure P of a pure chemical compound depends on temperature T and volume V.
R*T a(T)
P = --- - -----------------
V-b V*(V+b) + b*(V-b)
where
R2*Tc2
a(T) = 0.45724*------*alpha(T)
Pc
R*Tc
b = 0.07780*----
Pc
alpha(T) = [ 1 + k*(1-sqrt(T/Tc)) ]2
k = 0.37464 + 1.54226*w - 0.26992*w2
The critical parameters for various compounds have been tabulated, and
the following are the values for water.
Tc = 647.3 K (Critical temperature) Pc = 22.048 MPa (Critical pressure) Vc = 0.056 m3/kmol (Critical volume -- not used in this problem) w = 0.344 (acentric factor) R = 8.314x10-3 MPa m3/kmol K (Gas Constant)Write a FORTRAN program to generate a table of P at T=100C=373.15K as V increases from 0.5 to 50 m3/kmol in 0.5 m3/kmol increments.
------------------------
Volume Pressure
(m^3/kmol) (MPa)
------------------------
.5 3.174895E+00
1.0 2.314610E+00
: :
: :
50.0 6.171934E-02
Solution:
c ----------------------------------------------------------------------
c Calculate pressure based on the generalized Peng-Robinson equation of state.
c for water.
c Variables Used ...
c T ... temperature (K)
c P ... vapor pressure (MPa)
c V ... volume (m^3/kmol)
c ----------------------------------------------------------------------
c Instructor: Nam Sun Wang
c ----------------------------------------------------------------------
c Program Header -------------------------------------------------------
print *, 'This program calculates pressure based on the'
print *, 'generalized Peng-Robinson equation of state for water.'
print *, ' '
c Temperature ----------------------------------------------------------
print *, 'Enter temperature (K): '
read *, T
c Gas Constant ---------------------------------------------------------
R = 8.314E-3 ! (in MPa m3/kmol K)
c Critical parameters for water ----------------------------------------
Tc = 647.3 ! (critical temperature in K)
Pc = 22.048 ! (critical pressure in MPa)
w = 0.344 ! (acentric factor, dimensionless)
c Peng-Robinson EOS parameters -----------------------------------------
xk = 0.37464 + 1.54226*w - 0.26992*w*w
alpha = ( 1. + xk*(1.-sqrt(T/Tc)) )**2
a = 0.45724*R*R*Tc*Tc*alpha/Pc
b = 0.07780*R*Tc/Pc
c Generate a table of P at different values of V in 0.5 increments.
print *, ' '
print *, '------------------------'
print *, ' Volume Pressure '
print *, '(m^3/kmol) (MPa) '
print *, '------------------------'
c xx.x123456789012345678 --- ruler
do i=1, 100
V = 0.5*float(i)
c Peng-Robinson Equation of State
P = R*T/(V-b) - a/(V*(V+b)+b*(V-b))
print 650, V, P
enddo
c Some formats ---------------------------------------------------------
650 format(f7.1, 1p, e18.6)
end
Problem Statement: Write a function P(V) that returns the pressure of water P given explicitly the volume V. You should also provide a way for the temperature T to be varied implicitly, although there is only one formal argument in the function. Provide the first and the last FORTRAN lines of this function as well as any additional statements that are needed. To save time, you may mark or circle the portion in the above problem that you wish to include in this function and indicate where these lines should be inserted.
Solution:
c ----------------------------------------------------------------------
c Calculate pressure based on the generalized Peng-Robinson equation of state.
c for water.
c Variables Used ...
c T ... temperature (K)
c P ... vapor pressure (MPa)
c V ... volume (m^3/kmol)
c ----------------------------------------------------------------------
c Instructor: Nam Sun Wang
c ----------------------------------------------------------------------
common /cblock/T
c Program Header -------------------------------------------------------
print *, 'This program calculates pressure based on the'
print *, 'generalized Peng-Robinson equation of state for water.'
print *, ' '
c Temperature ----------------------------------------------------------
print *, 'Enter temperature (K): '
read *, T
c Generate a table of P at different values of V in 0.5 increments.
print *, ' '
print *, '------------------------'
print *, ' Volume Pressure '
print *, '(m^3/kmol) (MPa) '
print *, '------------------------'
c xx.x123456789012345678 --- ruler
do i=1, 100
V = 0.5*float(i)
print 650, V, P(V)
enddo
c Some formats ---------------------------------------------------------
650 format(f7.1, 1p, e18.6)
end
c ----------------------------------------------------------------------
function P(V)
c ----------------------------------------------------------------------
c Calculate pressure based on the generalized Peng-Robinson equation of state.
c for water.
c ----------------------------------------------------------------------
common /cblock/T
c Gas Constant ---------------------------------------------------------
R = 8.314E-3 ! (in MPa m3/kmol K)
c Critical parameters for water ----------------------------------------
Tc = 647.3 ! (critical temperature in K)
Pc = 22.048 ! (critical pressure in MPa)
w = 0.344 ! (acentric factor, dimensionless)
c Peng-Robinson EOS parameters -----------------------------------------
xk = 0.37464 + 1.54226*w - 0.26992*w*w
alpha = ( 1. + xk*(1.-sqrt(T/Tc)) )**2
a = 0.45724*R*R*Tc*Tc*alpha/Pc
b = 0.07780*R*Tc/Pc
P = R*T/(V-b) - a/(V*(V+b)+b*(V-b))
end
Problem Statement: Write a MATLAB function vpr(P,T) that returns the specific volume V (expressed in m3/kmol) as a function of P (in MPa) and T (in Kelvin) based on the Peng-Robinson equation of state. Hint: Rewrite the Peng-Robinson equation as a polynomial in V. You then call a routine to solve for the polynomial roots. If there are multiple roots, as an engineer, you need to judge which one is valid.
Solution:
Problem Statement: Write a MATLAB program to generate a table of V at T=100C=373.15K as P increases from 0.05 to 3 MPa in 0.05 MPa increments. (This utilizes the function written above.) Plot V vs. P based on the Peng-Robinson equation of state. On the same figure, also plot V vs. P based on the ideal gas law (PV=RT).
------------------------
Pressure Volume
(MPa) (m^3/kmol)
------------------------
0.05 :
0.10 :
: :
: :
3.00 :
------------------------
Solution:
Problem Statement: Write a MATLAB function vpr2(P,T,'species') that returns the specific volume V (expressed in m3/kmol) of the specified chemical species as a function of P (in MPa) and T (in Kelvin) based on the Peng-Robinson equation of state. Instead of rewriting the Peng-Robinson equation of state as a cubic polynomial, as you have done above, this time, simply bring all the terms in the Peng-Robinson equation to one side of the equation in the standard form "f(x)=0". (What is "x" in this problem?) Then, call a routine to solve the resulting nonlinear algebraic equation.
Extra Credit Only. Your vpr2 function should input the thermodynamic property data for ~700 chemical species found in critical.dat. (Watch out the dimensions; your program may need to do some unit conversion.) In theory, your vpr2 function should be able to handle any number of chemical species, provided that you have the critical data.
Solution:
Problem Statement: Re-work with Mathcad. In addition, plot P versus V for water at various values of T. (Watch out for "strange" pressures, including negative pressures. If you take care of these anomalies, the resulting graph is called a phase diagram in thermodynamics.)
R*T a(T)
P = --- - -----------------
V-b V*(V+b) + b*(V-b)
Solution:
Problem Statement: Let us continue working with the Peng-Robinson Equation of State, P(V,T) which relates pressure P of a chemical species to specific volume V and temperature T. For liquid and vapor to coexist at equilibrium, fugacities of the two phases are equal.
fugacityliquid=fugacitygaswhere fugacity is defined as:
fugacity óP p*V/(R*T) - 1
ln(--------) = ô ------------- dp
P õ0 p
ln(fugacity/P) = integral (from 0 to P) (p*V/(R*T)-1)/p dp (if you don't see the integral symbol above)
Applying the Peng-Robinson equation of state to the definition of
fugacity results in:
fugacity A Z+(1+sqrt(2))*B
ln(--------) = (Z-1) - ln(Z-B) - -----------*ln[---------------]
P 2*sqrt(2)*B Z+(1-sqrt(2))*B
where
Z = compressibility factor = P*V/(R*T)
A = a(T)*P/(R2*T2)
B = b*P/(R*T)
(When you solved V at a given P and T in a previous homework
assignment, you obtained three real roots for T<Tc.
The smaller value of V is that of the liquid phase, and the
larger value that of the vapor phase. A mole of molecules in
liquid takes up less volume than vapor!) With this additional
fugacity equation, the pressure you find is the saturation vapor
pressure in equilibrium with the liquid, and that pressure
depends on only one variable, not two variables. (Each equation
or phase reduces the degree of freedom by one.) Now, P(V,T)=Psat(T).
Compute and plot the vapor pressure of water with temperature
from 0°C up to the critical
temperature, Tc. Finally, the boiling point is the
temperature at which the vapor pressure equals the barometric
pressure, which is normally 1atm at sea level but lower
at high elevations. Calculate the boiling point of water at
1atm. Correct the liquid-vapor coexistence region in the phase
diagram of the last homework assignment. (To complete the phase
diagram, you have to take care of the solid phase in a manner
similar to what you have just done for the liquid phase, but that is
for another day.)
Solution:
Background An equation of state, along with the First and Second Law, is a very important concept in thermodynamics. We can calculate a wide range of thermodynamic properties (vapor-liquid equilibrium, enthalpy, entropy, free energy, heat capacity, Thompson expansion coefficient, viscosity, diffusivity, thermal conductivity, viscosity, boiling point, freezing point, solubility, chemical equilibrium,...) from an equation of state. These properties, in turn, determine the behavior of a wide range of chemical engineering unit operations (distillation, extraction, separation, power generation, refrigeration, reaction equilibrium, etc.). Peng-Robinson equation of state gives you certain properties that the ideal gas law fails to provide. You may see how the thermodynamic properties are derived from an equation of state when you take ENCH300 -- Chemical Thermodynamics. This problem is a preview of that.
|