a mathematica program for the accurate correlation of

2 downloads 0 Views 829KB Size Report
Nov 29, 2012 - Keywords General correlation model; Mathematica; Saturated fluids; ... Several studies have implemented Mathematica programs to use or ...
This article was downloaded by: [Biblioteca. Universidad de Extremadura], [Maribel Parra] On: 29 November 2012, At: 03:15 Publisher: Taylor & Francis Informa Ltd Registered in England and Wales Registered Number: 1072954 Registered office: Mortimer House, 37-41 Mortimer Street, London W1T 3JH, UK

Chemical Engineering Communications Publication details, including instructions for authors and subscription information: http://www.tandfonline.com/loi/gcec20

A MATHEMATICA PROGRAM FOR THE ACCURATE CORRELATION OF DIFFERENT THERMODYNAMIC PROPERTIES OF SATURATED PURE FLUIDS a

M. Isabel Parra & Ángel Mulero

b

a

Department of Mathematics, University of Extremadura, Badajoz, Spain b

Department of Applied Physics, University of Extremadura, Badajoz, Spain

To cite this article: M. Isabel Parra & Ángel Mulero (2013): A MATHEMATICA PROGRAM FOR THE ACCURATE CORRELATION OF DIFFERENT THERMODYNAMIC PROPERTIES OF SATURATED PURE FLUIDS, Chemical Engineering Communications, 200:3, 317-326 To link to this article: http://dx.doi.org/10.1080/00986445.2012.703149

PLEASE SCROLL DOWN FOR ARTICLE Full terms and conditions of use: http://www.tandfonline.com/page/terms-and-conditions This article may be used for research, teaching, and private study purposes. Any substantial or systematic reproduction, redistribution, reselling, loan, sub-licensing, systematic supply, or distribution in any form to anyone is expressly forbidden. The publisher does not give any warranty express or implied or make any representation that the contents will be complete or accurate or up to date. The accuracy of any instructions, formulae, and drug doses should be independently verified with primary sources. The publisher shall not be liable for any loss, actions, claims, proceedings, demand, or costs or damages whatsoever or howsoever caused arising directly or indirectly in connection with or arising out of the use of this material.

Downloaded by [Biblioteca. Universidad de Extremadura], [Maribel Parra] at 03:15 29 November 2012

Chem. Eng. Comm., 200:317–326, 2013 Copyright # Taylor & Francis Group, LLC ISSN: 0098-6445 print=1563-5201 online DOI: 10.1080/00986445.2012.703149

A Mathematica Program for the Accurate Correlation of Different Thermodynamic Properties of Saturated Pure Fluids ´ NGEL MULERO2 M. ISABEL PARRA1 AND A 1

Department of Mathematics, University of Extremadura, Badajoz, Spain 2 Department of Applied Physics, University of Extremadura, Badajoz, Spain We present a simple program written in Mathematica 8.0 that permits using a general analytical expression to accurately correlate different thermodynamic properties of a saturated pure fluid. In particular, the program permits one to obtain simple analytical expressions for the liquid density, vaporization enthalpy, surface tension, and the inverse of the isobaric heat capacity of a saturated liquid as a function of the temperature along the entire vapor-liquid coexistence curve. The general expression used is the same for all four thermodynamic properties. It takes the values at both critical and triple temperatures as referents and four or fewer adjustable coefficients for each property. The program displays the absolute and relative errors together with wide information about the error distribution. It can be therefore used as a research or a pedagogical tool. Keywords General correlation model; Mathematica; Saturated fluids; Thermodynamic properties

Introduction The computer program Wolfram Mathematica (http://www.wolfram.com/) is a symbolic manipulator that provides powerful tools for solving problems and exploring the results. These symbolic, numerical, and graphical tools allow one to focus more upon the physics, chemical engineering, or other scientific aspects than upon the algebra or numerical algorithms. In particular, it can be very useful for many algebraic, numeric, and statistical problems, such as those related to chemical engineering thermodynamics, fluid phase equilibria, and statistical mechanics, because it eliminates the need to program such basic operations as data fitting, integration, differentiation, and solving algebraic or differential equations (Wolfram, 2003). Therefore, this kind of program is very useful in both scientific and teaching tools. In particular, in chemical engineering thermodynamics subjects, students must to master not only the conceptual aspects of thermodynamic properties, but also how to estimate them with adequate thermodynamic models. Thus, one can find several computer programs that are excellent teaching tools, and many modern textbooks (Sandler, 2006) include some programs in user-friendly software or in spreadsheets (Castier, 1999) Address correspondence to M. Isabel Parra, Departamento de Matema´ticas, Avenida de Elvas s=n, 06007-Badajoz, Spain. E-mail: [email protected]

317

Downloaded by [Biblioteca. Universidad de Extremadura], [Maribel Parra] at 03:15 29 November 2012

318

M. I. Parra and A´. Mulero

Several studies have implemented Mathematica programs to use or solve equations of state along the vapor-liquid equilibrium curve (Polishuk and Yona, 2009; Polishuk et al., 2009a, 2009b) or to calculate different thermodynamic properties of interest (Castier, 1999; Domı´nguez and Castier, 2002; Macedo et al., 2008; Alfradique et al., 2002; Castier and Amer, 2011). The focus of the present work is on the properties of a fluid along the vapor-liquid equilibrium curve. Many important practical applications require accurate knowledge of these properties, and indeed for each thermodynamic property there are many empirical correlations that use certain physical constants and=or adjustable parameters to correlate the experimental data versus the temperature (Poling, 2001; Xiang, 2005). In general, the data can be obtained from experimental methods (see Maroto et al. (2004) and Dilmohamud et al. (2005) for the case of surface tension) or from models as equations of state (Quintales et al., 1988; Pin˜a and de la Selva, 2006). For a scientist it is very important to choose the appropriate model for a given class of fluids or even for a particular fluid at a particular temperature (Kolasinska and Vera, 1986; Joback and Reid, 1987, Ibrahim and Murad, 1989; Hurst and Harrison, 1992; Mulero et al., 2006a, 2006b, 2006c, 2006d, 2006e, 2010a; Mulero and Parra, 2008; Cachadin˜a and Mulero, 2009; Miqueu et al., 2000). The most extensively used correlations are based on the corresponding states principle (Poling, 2001; Xiang, 2005). They commonly use the critical point as a reference and do not always give good results near the triple point. Nevertheless, following the idea of Torquato and coworkers (Torquato and Stell, 1982; Torquato and Smith, 1984), several authors have used the triple point as an additional reference point, finding that it yields good accuracy over the whole temperature range at vapor-liquid equilibrium (Roma´n et al., 2005; Rogdakis and Lolos, 2006; Godavarthy et al., 2006; Velasco et al., 2006; Mulero and Parra, 2008). In particular, Roma´n et al. (2005) proposed a reduced form for a thermodynamic property and temperature that, when applied to certain properties, leads to the corresponding data presenting an almost universal behavior. This behavior can be correlated with a simple analytical expression that interpolates between the forms of the behavior near the triple and the critical points. In a previous work (Mulero et al., 2010b), we studied the applicability and accuracy of the model to correlate data from the NIST data bank (NIST, 2005) for four properties (density, vaporization enthalpy, surface tension, and the inverse of the isobaric heat capacity of a saturated liquid) versus temperature for a set of 22 pure substances (mainly noble gases, alkanes, some refrigerants, and water). We show here a simple, short Mathematica program that straightforwardly permits obtaining accurate correlations for four thermodynamic properties of a saturated fluid versus temperature, i.e., along the whole coexistence curve (Roma´n et al., 2005; Mulero et al., 2010b). These properties are the liquid density, vaporization enthalpy, surface tension, and isobaric heat capacity. We note that in the case of isobaric heat capacity, the property to be fitted has to be its inverse, to avoid the infinity value at the critical temperature. The used algorithm is very simple and finds numerical values of the parameters that give the best fit of the model to the data and provides diagnostics of the validity and accuracy of the fit. Detailed information about the Mathematica functions and procedures used is given so that researchers can easily correlate their own data (for instance, see Maroto et al. (2004) and Dilmohamud et al. (2005)) using the model. The program can

Correlation of Thermodynamics Properties

319

therefore be used as a valuable research and pedagogical tool (Castier, 1999; Sandler, 2006; Castier and Amer, 2011).

Downloaded by [Biblioteca. Universidad de Extremadura], [Maribel Parra] at 03:15 29 November 2012

Model  ) proposed by Roma´n et al. (2005) for a thermodynamic The reduced forms (W property (W) along the vapor-liquid equilibrium curve and the temperature (T), in terms of the critical and triple values, which are represented by the subscripts c and t, respectively, are:  ðT  Þ ¼ WðTÞ  WðTc Þ ; W WðTt Þ  WðTc Þ

ð1Þ

where T¼

T  Tt : Tc  Tt

ð2Þ

As can be seen, the reduced property and temperature are dimensionless. More ¼ 1, and just at the critical point T  ¼ 0 and W  ¼ 1 and over, just at the triple point T  ¼ 0. In order to correlate the reduced property versus the reduced temperature, W the commonly observed behavior of properties near both the triple and the critical points must be taken into account. In particsular, most properties have a singular behavior near the critical point, which can be described through a scaling law, predicted by renormalization group theory, in the form:  / ð1  T Þk ; W

ð3Þ

where critical exponent. Roma´n et al. (2005) showed that the term h k is the so-called i k Ln wð1  TÞ behaves as a regular function, which can be expanded in a Taylor series about T ¼ 0. Then, in order to avoid this singular behavior near the critical point, they proposed the expression:  ¼ exp W

hX1

i  i ð1  T  Þk T a i i¼1

ð4Þ

where ai and=or k are coefficients that must be determined. The practical application of this equation requires it to be truncated at some finite order. In this article, we present a Mathematica program that permits one to use this expression to correlate vapor-liquid equilibrium data and then to obtain different correlations for the chosen properties versus the temperature.

Computer Program We have programmed a very simple algorithm for Mathematica 8.0 that finds numerical values of the parameters (ai, i = 1,. . .,ncf, and=or k) in Equation (4) with which the model gives the best correlation to the data and provides a diagnostic of the fitting procedure and the accuracy of the expression obtained for every correlated property. All used functions are included in older Mathematica versions, except

Downloaded by [Biblioteca. Universidad de Extremadura], [Maribel Parra] at 03:15 29 November 2012

320

M. I. Parra and A´. Mulero

Figure 1. First two cells of the Mathematica program. (Figure provided in color online.)

NonlinearModelFit, which is new in version 7.0. For older versions, one can use the function NonlinearFit. As input, we need the data corresponding to temperature (T) and the thermodynamic property (W), introduced as vectors, and the triple and critical points (Tt, Wt, Tc, Wc) for the fluid which will be analyzed. We have found that the data corresponding to the critical point, i.e., the last data for the property, must not be included in the vectors T and W because it causes problems of convergence. The first two cells of our program are shown in Figure 1 and include the routines to introduce the data (where n is the number of data) and conveniently make them dimensionless (according to Equations (1) and (2)).

Figure 2. Routine to define the model. (Figure provided in color online.)

Correlation of Thermodynamics Properties

321

Downloaded by [Biblioteca. Universidad de Extremadura], [Maribel Parra] at 03:15 29 November 2012

Figure 3. Fit cell. (Figure provided in color online.)

Once the dimensionless properties are defined, Equation (4) is used as a model. Then the program asks for the number of coefficients that will be adjusted, ncf. At this step, one needs to be aware that if the value of k, i.e., of the critical exponent, is known for the chosen property and fluid then it can be used directly. Nevertheless, this exponent is commonly difficult to obtain, and in most cases only theoretical mean values are available (see Table 1 in Roma´n et al. (2005)). Indeed, accurate experimental values are known for only a few properties and=or fluids (Roma´n et al., 2005). For this reason, our program permits a given value of k to be either input directly or to be included as an additional adjustable coefficient. The routine is shown in Figure 2. For instance, if the user chooses to employ ncf ¼ 3 adjustable coefficients, and the value of k is known (e.g., k ¼ 1.2), then one can use a1, a2, and a3 as those adjustable 2 3 coefficients (with as an output model the expression ea1 vta2 vt þa3 vt ð1  vtÞ1:2 , where  from Equation (2)), or a1, a2, and k vt is the dimensionless temperature variable, T k a1 vtþa2 vt2 (with Model[vt] as e ð1  vtÞ Þ. Obviously, this latter choice commonly leads to a model being especially accurate near the critical point, where the behavior of the dimensionless property is approximately modeled by Equation (3).

Figure 4. Accuracy cell. (Figure provided in color online.)

Downloaded by [Biblioteca. Universidad de Extremadura], [Maribel Parra] at 03:15 29 November 2012

322

M. I. Parra and A´. Mulero

In the next cell, the program correlates the data by fitting them to the dimensionless model (with the chosen number of adjustable coefficients). For that, the function NonlinearModelFit [data, expr, pars, vars] is used, which gives a nonlinear model, with structure expr that fits the data, using the parameters pars. Then the model is constructed using the conventional dimensions and is evaluated at the temperatures that were selected in the ‘‘INPUT DATA’’ cell. The routine is very simple, as shown in Figure 3. Once the model has been constructed, the deviations with respect to the fitted data have to be calculated and then an analysis made of the model’s accuracy. In particular, our program displays graphically the absolute or relative errors (one can choose which), together with information about the properties of the error distribution, such as location, dispersion, and shape. To this end, the appropriate Descriptive Statistics functions (the mean, variance, minimum, and maximum, displayed on the graphics) are used. The individual error (absolute or relative) can be obtained by typing lerror. Finally, a plot is displayed of the fitted model and the data. The ‘‘ACCURACY’’ cell in the program is shown in Figure 4.

Example In a previous article (Mulero et al., 2010b), we used the model of Equation (4) to accurately correlate the liquid density, vaporization enthalpy, surface tension, and

Figure 5. Results obtained for water. The points are data from NIST (2005) and the solid line is the fitted model identified at the top. (Figure provided in color online.)

Downloaded by [Biblioteca. Universidad de Extremadura], [Maribel Parra] at 03:15 29 November 2012

Correlation of Thermodynamics Properties

323

the inverse of the isobaric heat capacity of a saturated liquid versus temperature along the entire vapor-liquid coexistence curve. We found that this general expression correlates the data (a set of 22 pure substances including noble and common simple gases, some alkanes, water, NF3, NH3, and R123) with overall deviations smaller than or similar to those of other published models with the same or a greater number of adjustable coefficients. The complete results may be seen in that work (Mulero et al., 2010b). Here, we have described our development of a simple Mathematica program that permits one to make the previous or new calculations for the aforementioned or for new properties. We are therefore interested in showing how the program works and how the results are obtained. Let us therefore consider a clear example. The example we shall present is that of the results for the properties of water. After having selected a property and having introduced the input values and data from NIST (NIST, 2005), we selected the model with three adjustable coefficients, with the critical exponent being one of them (i.e., Model[vt] is e^(a1 vtþa2 vt^2) (1-vt)^k). The program calculates the best fit function and displays the results for the fit and both the percent and absolute errors. These results will then be displayed on the screen for every property, as shown in Figures 5, 6, and 7, respectively. With these basic results, one can evaluate the accuracy and applicability of the model. As shown in Figure 6, the greatest relative errors occur at high temperatures, i.e., near the critical point. This is because the dimensionless data tend to zero near that point. Other models could be constructed for every property and fluid. In any case, the results shown in Figures 6 and 7 indicate that, in agreement with the findings reported in Mulero et al. (2010a), the deviations are very small indeed.

Figure 6. Relative error (%) for every property of water, together with the corresponding descriptive statistics (mean, variance, and minimum and maximum deviations). (Figure provided in color online.)

Downloaded by [Biblioteca. Universidad de Extremadura], [Maribel Parra] at 03:15 29 November 2012

324

M. I. Parra and A´. Mulero

Figure 7. Absolute errors for every property of water, together with the corresponding descriptive statistics (mean, variance, and minimum and maximum deviations). (Figure provided in color online.)

Conclusions We have presented a very simple program written in Mathematica 8.0 that permits one to accurately correlate four different thermodynamic properties—the liquid density, vaporization enthalpy, surface tension, and isobaric heat capacity of saturated liquids—using the same general expression for all four. The reference data employed in the general expression are the triple and the critical points, which are available for a great number of fluids. In the case that one of them is unavailable, that value can be replaced in the model by the closest available value. The possibility of selecting the number of adjustable coefficients, and of deciding whether or not to choose the critical exponent as one of them, permits one to obtain a model that correlates the data with very small deviations. The output of the program clearly identifies the validity and accuracy of the model, so that one can then decide whether a better one is needed. Although we have here illustrated the procedure with only one example for one fluid and one property, the validity of the model for other properties and fluids has been demonstrated in previous work (Roma´n et al., 2005; Mulero et al., 2010b).

Acknowledgments This work was supported by Project FIS2010-16664 from the Ministerio de Economı´a y Competitividad of the Government of Spain, and by project GR10045 from the Junta de Extremadura and FEDER.

Correlation of Thermodynamics Properties

325

Downloaded by [Biblioteca. Universidad de Extremadura], [Maribel Parra] at 03:15 29 November 2012

References Alfradique, M. F., Espo´sito, R. O., and Castier, M. (2002). Automatic generation of procedures for the simulation of multistage separators using computer algebra, Chem. Eng. Commun., 189, 657–674. Cachadin˜a, I., and Mulero, A. (2009). New corresponding states model for the estimation of the vaporization enthalpy of fluids, Fluid Phase Equilib., 287, 33–38. Castier, M. (1999). Automatic implementation of thermodynamic models using computer algebra, Comput. Chem. Eng., 23, 1229–1245. Castier, M., and Amer, M. M. (2011). XSEOS: An evolving tool for teaching chemical engineering thermodynamics, Educ. Chem. Eng., 6, e62–e70. Dilmohamud, B. A., Seeneevassen, J., Rughooputh, S. D. D. V., and Ramasami, P. (2005). Surface tension and related thermodynamic parameters of alcohols using the Traube stalagmometer, Eur. J. Phys., 26, 1079–1084. Domı´nguez, J. T., and Castier, M. (2002). Automatic implementation of thermodynamic models for reliable parameter estimation using computer algebra, Comput. Chem. Eng., 26, 1473–1479. Godavarthy, S. S., Robinson, R. L., and Gasem, K. A. M. (2006). SVRC-QSPR model for predicting vapor pressures of pure fluids, Fluid Phase Equilib., 246, 39–51. Hurst, J. E. Jr., and Harrison, B. K. (1992). Estimation of liquid and solid heat capacities using a modified Kopp’s rule, Chem. Eng. Commun., 112, 21–30. Ibrahim, N., and Murad, S. (1989). Surface tension of polar liquids and mixtures, Chem. Eng. Commun., 79, 165–174. Joback, K. G., and Reid, R. C. (1987). Estimation of pure-component properties from groupcontributions, Chem. Eng. Commun., 57, 233–243. Kolasinska, G., and Vera, J. H. (1986). On the prediction of heats of vaporization of pure compounds, Chem. Eng. Commun., 43, 185–194. Macedo, R. S., Alfradique, M. F., and Castier, M. (2008). Automatic generation of Matlab functions using Mathematica and Thermath, Comput. Sci. Eng., 10, 41–49. Maroto, J. A., de las Nieves, F. J., and Quesada-Pe´rez, M. (2004). The approximate determination of the critical temperature of a liquid by measuring surface tension versus the temperature, Eur. J. Phys., 25, 297–301. Miqueu, C., Broseta, D., Satherley, J., Mendiboure, B., Lachaise, J., and Gracia, A. (2000). An extended scaled equation for the temperature dependence of the surface tension of pure compounds inferred from an analysis of experimental data, Fluid Phase Equilib., 172, 169–182. Mulero, A., and Parra, M. I. (2008). Improving the prediction of liquid saturation densities from models based on the corresponding states principle, Phys. Chem. Liq., 46, 263–277. Mulero, A., Cachadin˜a, I., and Parra, M. I. (2006a). Liquid saturation density from predictive correlations based on the corresponding states principle. Part 1: Results for 30 families of fluids, Fluid Phase Equilib., 45, 1840–1848. Mulero, A., Cachadin˜a, I., and Parra, M. I. (2006b). Liquid saturation density from predictive correlations based on the corresponding states principle. Part 2: Results for 49 families of fluids, Fluid Phase Equilib., 45, 6864–6873. Mulero, A., Cachadin˜a, I., and Parra, M. I. (2006c). Comparison of corresponding-statesbased correlations for the prediction of the vaporization enthalpy of fluids, Ind. Eng. Chem. Res., 47, 7903–7916. Mulero, A., Cachadin˜a, I., and Cuadros, F. (2006d). Calculation of the vaporization enthalpy of nonpolar fluids at the standard temperature, Chem. Eng. Commun., 193, 192–205. Mulero, A., Cachadin˜a, I., and Cuadros, F. (2006e). Comparison of predictive correlations for the normal boiling density of nonpolar fluids, Chem. Eng. Commun., 193, 1445–1456. Mulero, A., Parra, M. I., Roma´n, F. L., and Park, K. K. (2010a). Vaporization enthalpy of pure refrigerants: Comparative study of correlation equations, Ind. Eng. Chem. Res., 49, 5018–5026.

Downloaded by [Biblioteca. Universidad de Extremadura], [Maribel Parra] at 03:15 29 November 2012

326

M. I. Parra and A´. Mulero

Mulero, A., Parra, M. I., Roma´n, F. L., and Velasco, S. (2010b). General correlation model for some physical properties of saturated pure fluids, J. Chem. Thermodyn., 42, 938–946. NIST Chemistry Webbook. (2005). NIST Standard Reference Database Number 69, ed. P. J. Linstrom and W. G. Mallard, National Institute of Standards and Technology, Gaithersburg, MD. Available at http://webbook.nist.gov Pin˜a, E., and de la Selva, M. T. (2006). Coexistence properties of the Redlich–Kwong model for a fluid, Eur. J. Phys., 27, 1169–1178. Poling, B. E., Prausnitz, J. M., and O’Connell, J. P. (2001). The Properties of Gases and Liquids, McGraw-Hill, New York. Polishuk, I., and Yona, Y. (2009). Implementation of Mathematica for development and application of EOS models. I: Derivation of the expressions for hard-chain and hardsphere compressibility factors, Chem. Eng. Commun., 196, 443–447. Polishuk, I., Kapry, I., and Madar, M. (2009a). Implementation of Mathematica for development and application of EOS models. II: Derivation of the generalized expressions for the fugacity coefficients of compounds in a mixture, Chem. Eng. Commun., 196, 448–453. Polishuk, I., Bourgin, I., and Cohen, N. (2009b). Implementation of Mathematica for development and application of EOS models. III: Calculation of heat capacities, enthalpy and entropy of evaporation, and speed of sound, Chem. Eng. Commun., 196, 1291–1299. Quintales, L. M., Alvarin˜o, J. M., and Velasco, S. (1998). Computational derivation of coexistence curves for van-der-Waals-type equations, Eur. J. Phys., 9, 55–60. Rogdakis, E. D., and Lolos, P. A. (2006). Simple generalized vapour pressure and boiling point correlation for refrigerants, Int. J. Refrig., 29, 632–644. Roma´n, F. L., White, J. A., Velasco, S., and Mulero, A. (2005). On the universal behaviour of some thermodynamic properties along the whole liquid-vapor coexistence curve, J. Chem. Phys., 123, 124512–8. Sandler, S. I. (2006). Chemical, Biochemical, and Engineering Thermodynamics, 4th ed., Wiley, New York. Torquato, S., and Smith, P. (1984). Latent heat of vaporization of a widely diverse class of fluids, J. Heat Transfer, 106, 252–254. Torquato, S., and Stell, G. R. (1982). An equation for the latent heat of vaporization, Ind. Eng. Chem. Fundam., 21, 202–205. Velasco, S., Roma´n, F. L., White, J. A., and Mulero, A. (2006). Prediction of the enthalpy of vaporization of metals and metalloids, Fluid Phase Equilib., 244, 11–15. Wolfram, S. (2003). The Mathematica Book, 5th ed., Wolfram Media, Champaign, Ill. Xiang, H. W. (2005). The Corresponding-States Principle and Its Practice, Elsevier, Amsterdam.

Suggest Documents