|

Calculation of Equilibrium Composition of Complex Thermodynamic Systems using Julia Language and Ipopt Library

Authors: Belov G.V. Published: 10.09.2021
Published in issue: #3(136)/2021  
DOI: 10.18698/0236-3933-2021-3-24-45

 
Category: Informatics, Computer Engineering and Control | Chapter: Mathematical Modelling, Numerical Methods, and Program Complexes  
Keywords: thermodynamic equilibrium, Julia programming language, Ipopt package

The article considers the possibility of using the Ipopt optimization package for the calculating the phase and equilibrium compositions of a multicomponent heterogeneous thermodynamic system. Two functions are presented for calculating the equilibrium composition and properties of complex thermodynamic systems, written in the Julia programming language. These functions are the key ones in the program integrated with the IVTANTERMO database on thermodynamic properties of individual substances and used for conducting test calculations. The test calculations showed that Ipopt package allows determining the phase and chemical compositions of simple and complex thermodynamic systems with a fairly high speed. Using the JuMP modeling language significantly simplifies the preparation of the initial data for the Ipopt package, therefore the functions presented in this article are very compact. It is shown how the Ipopt package can be used when the temperature of the thermodynamic system is unknown. The approach proposed in this work is applicable both for analyzing the equilibrium of individual chemical reactions and for calculating the equilibrium composition of complex chemically reacting systems. The simplicity of the proposed functions allows their easy integrating into application programs, embedding them into more complex applications, using them in combination with more complex models (real gas, nonideal solutions, constrained equilibria), and, if necessary, modifying them. It should be noted that the versatility of the JuMP modeling language makes it possible to replace the Ipopt package with another one without significant modification of the program text

References

[1] Brinkley Jr. S.R. Calculation of the equilibrium composition of systems of many constituents. J. Chem. Phys., 1947, vol. 15, no. 2, pp. 107--110. DOI: https://doi.org/10.1063/1.1746420

[2] Kandiner H.J., Brinkley Jr. S.R. Calculation of complex equilibrium relations. Ind. Eng. Chem., 1950, vol. 42, no. 5, pp. 850--855. DOI: https://doi.org/10.1021/ie50485a030

[3] Huff V.N., Gordon S., Morrell V.E. General method and thermodynamic tables for computation of equilibrium composition and temperature of chemical reactions. Report NACA-TR-1037. NASA, 1951.

[4] White W.B., Johnson S.M., Dantzig G.B. Chemical equilibrium in complex mixtures. J. Chem. Phys., 1958, vol. 28, no. 5, pp. 751--755. DOI: https://doi.org/10.1063/1.1744264

[5] Sinyarev G.B. Full thermodynamics functions and using them at the calculation of complex thermodynamic systems. Izv. vuzov. Transp. i energeticheskoe mashinostroenie, 1966, no. 2, pp. 99--110 (in Russ.).

[6] Passy U., Wilde D.J. A geometric programming algorithm for solving chemical equilibrium problems. SIAM J. Appl. Math., 1968, vol. 16, no. 2, pp. 363--373.

[7] Zeleznik F.J., Gordon S. Calculation of complex chemical equilibria. Ind. Eng. Chem., 1968, vol. 60, no. 6, pp. 27--57. DOI: https://doi.org/10.1021/ie50702a006

[8] Alemasov V.E., Tishin A.P., Dregalin A.F. General mathematical method of investigating combustion at high temperatures. Combust. Explos. Shock Waves, 1971, vol. 7, no. 1, pp. 66--71.

[9] Gordon S., McBride B.J. Computer program for calculation of complex chemical equilibrium compositions, rocket performance, incident and reflected shocks, and Chapman --- Jouguet detonations. Report NASA/SP-273. Cleveland, Ohio, Lewis Research Center, 1976.

[10] Karpov I.K., Chudnenko K.V., Kulik D.A., et al. The convex programming minimization of five thermodynamic potentials other than Gibbs energy in geochemical modeling. Am. J. Sc., 2002, vol. 302, no. 4, pp. 281--311. DOI: https://doi.org/10.2475/ajs.302.4.281

[11] Smith W.R., Missen R.W. Chemical reaction equilibrium analysis: theory and algorithms. John Wiley, 1983.

[12] Gurvich L.V., Veyts I.V., Medvedev V.A., et al. Termodinamicheskie svoystva individual’nykh veshchestv. T. 1 [Thermodynamic properties of individual materials. Vol. 1]. Moscow, Nauka Publ., 1978.

[13] Chase Jr. M.W., Davies C. JANAF thermochemical tables. I, Al--Co. II, Cr--Zr. J. Phys. Chem. Ref. Data, 1985, vol. 14. DOI: https://doi.org/10.18434/T42S31

[14] Sinyarev G.B., Vatolin N.A., Trusov B.G., et al. Primenenie EVM dlya termodinamicheskikh raschetov metallurgicheskikh protsessov [Using computer for thermodynamic calculations of metallurgic processes]. Moscow, Nauka Publ., 1982.

[15] Alemasov V.E., Dregalin A.F., Tishin A.P., et al. Termodinamicheskie i teplofizicheskie svoystva produktov sgoraniya. T. 1 [Thermodynamical and thermophysical properties of combustion products. Vol. 1]. Moscow, VINITI Publ., 1971.

[16] McBride B.J., Zehe M.J., Gordon S. NASA Glenn coefficients for calculating thermodynamic properties of individual species. Report NASA/TP-2002-211556. Cleveland, Ohio, Glenn Research Center, 2002.

[17] Agundez M., Martinez J.I., de Andres P.L., et al. Chemical equilibrium in AGB atmospheres: successes, failures, and prospects for small molecules, clusters, and condensates. Astron. Astrophys., 2020, vol. 637, art. A59. DOI: https://doi.org/10.1051/0004-6361/202037496

[18] McBride B.J., Gordon S. Computer program for calculation of complex chemical equilibrium compositions and applications. NASA Reference Publication. Cleveland, Ohio, Lewis Research Center, 1994.

[19] Belov G.V., Trusov B.G. Termodinamicheskoe modelirovanie khimicheski reagiruyushchikh system [Thermodynamic modeling of chemically reacting systems]. Moscow, Bauman MSTU Publ., 2013.

[20] Shobu K., Tabaru T. Development of new equilibrium calculation software: CaTCalc. Mater. Trans., 2004, vol. 68, no. 12, pp. 938--987. DOI: https://doi.org/10.2320/jinstmet.68.983

[21] Belov G.V. Application of linear programming techniques to equilibrium composition calculations for heterogeneous systems with mixtures. Vychislitelʼnye metody i programmirovanie [Num. Meth. Prog.], 2009, vol. 10, no. 1, pp. 56--61 (in Russ.).

[22] Belov G. On linear programming approach for the calculation of chemical equilibrium in complex thermodynamic systems. J. Math. Сhem., 2010, vol. 47, no. 1, art. 446. DOI: https://doi.org/10.1007/s10910-009-9580-y

[23] Piro M.H.A., Simunovic S., Besmann T.M., et al. The thermochemistry library Thermochimica. Comput. Mater. Sc., 2013, vol. 67, pp. 266--272. DOI: https://doi.org/10.1016/j.commatsci.2012.09.011

[24] Ewing M.E., Isaac D.A. Mathematical modeling of multiphase chemical equilibrium. J. Thermophys. Heat Trans., 2015, vol. 29, no. 3, pp. 551--562. DOI: https://doi.org/10.2514/1.T4397

[25] Leal A.M.M., Kulik D.A., Kosakowski G. Computational methods for reactive transport modeling: а Gibbs energy minimization approach for multiphase equilibrium calculations. Adv. Water Resour., 2016, vol. 88, pp. 231--240. DOI: https://doi.org/10.1016/j.advwatres.2015.11.021

[26] Otis R., Liu Z.K. Pycalphad: Calphad-based computational thermodynamics in Python. J. Open Res. Softw., 2017, vol. 5, no. 1. DOI: http://dx.doi.org/10.5334/jors.140

[27] Keck J.C. Rate-controlled constrained-equilibrium theory of chemical reactions in complex systems. Prog. Energy Combust. Sc., 1990, vol. 16, no. 2, pp. 125--154.DOI: https://doi.org/10.1016/0360-1285(90)90046-6

[28] Koukkari P., Pajarre R. Calculation of constrained equilibria by Gibbs energy minimization. Calphad, 2006, vol. 30, no. 1, pp. 18--26. DOI: https://doi.org/10.1016/j.calphad.2005.11.007

[29] Koukkari P. Introduction to constrained Gibbs energy methods in process and materials research. VTT Technical Research Centre of Finland, 2014.

[30] Pajarre R., Koukkari P., Kangas P. Constrained and extended free energy minimization for modelling of processes and materials. Chem. Eng. Sc., 2016, vol. 146, pp. 244--258. DOI: https://doi.org/10.1016/j.ces.2016.02.033

[31] Ren Z., Lu Z., Gao Y., et al. A kinetics-based method for constraint selection in rate-controlled constrained equilibrium. Combust. Theory Model., 2017, vol. 21, no. 2, pp. 159--182. DOI: https://doi.org/10.1080/13647830.2016.1201596

[32] Belov G.V. Determining the phase composition of complex thermodynamic systems. Russ. J. Phys. Chem., 2019, vol. 93, no. 9, pp. 1017--1023. DOI: https://doi.org/10.1134/S0036024419060074

[33] Dorn W.S. Variational principles for chemical equilibrium. J. Chem. Phys., 1960, vol. 32, no. 5, pp. 1490--1492. DOI: https://doi.org/10.1063/1.1730947

[34] Prigozhin I., Defey R. Khimicheskaya termodinamika [Chemical thermodynamics]. Novosibirsk, Nauka Publ., 1966.

[35] Belov G.V., Dyachkov S.A., Levashov P.R., et al. The IVTANTHERMO --- оnline database for thermodynamic properties of individual substances with web interface. J. Phys.: Conf. Ser., 2018, vol. 946, art. 012120. DOI: https://doi.org/10.1088/1742-6596/946/1/012120

[36] Bezanson J., Edelman A., Karpinsky S., et al. Julia: a fresh approach to numerical computing. SIAM Rev., 2017, vol. 59, no. 1, pp. 65--98. DOI: https://doi.org/10.1137/141000671

[37] Dunning I., Huchette J., Lubin M. JuMP: a modeling language for mathematical optimization. SIAM Rev., 2017, vol. 59, no. 2, pp. 295--320. DOI: https://doi.org/10.1137/15M1020575

[38] Legat B., Dowson O., Garcia J.D., et al. MathOptInterface: a data structure for mathematical optimization problems. arxiv.org: website. Available at: https://arxiv.org/abs/2002.03447 (accessed: 15.04.2021).

[39] Brooke A., Kendrick D., Meeraus A., et al. GAMS: a user’s guide. Scientific Press, 1999.

[40] Fourer R., Gay D.M., Kernighan B.W. AMPL: a modeling language for mathematical programming. Thomson/Brooks/Cole, 2003.

[41] Lofberg J. YALMIP: a toolbox for modeling and optimization in MATLAB. Proc. 2004 IEEE Int. Symp. Comp. Aided Control Syst. Des., 2004, pp. 284--289. DOI: https://doi.org/10.1109/CACSD.2004.1393890

[42] Grant M., Boyd S. CVX: MATLAB software for disciplined convex programming. cvxr.com: website. Available at: http://cvxr.com/cvx (accessed: 15.04.2021).

[43] Hart W.E., Laird C., Watson J.P., et al. Pyomo-optimization modeling in Python. Springer, 2017.

[44] Wachter A., Biegler L.T. On the implementation of an interior-point filter line-search algorithm for large-scale nonlinear programming. Math. Program., 2006, vol. 106, no. 1, pp. 25--57. DOI: https://doi.org/10.1007/s10107-004-0559-y