Computer Realization of Thermodynamic Models Using Algebraic Objects
MetadataShow full item record
The main focus of this thesis is to make thermodynamic models available for different computer programs on Windows, Linux and Unix computer platforms. In thermodynamic calculations, like phase or reaction equilibrium, the first and maybe higher order gradients of the thermodynamic functions are needed. The major challenge has been to enable higher order gradients (>2) of such functions, with symbolic precision, and without loosing the structure of the thermodynamic model equations. The solution to the problem lies in the novel RGrad language which enables commutative multidimensional array operations. The RGrad language introduced in this thesis is algebraically closed with respect to differentiation, which means that gradient calculations of arbitrary order are possible. The results are translated into ANSI C-code, interfaced with the user code by using a small and well defined C-interface. This interface has been demonstrated for Ruby and Matlab, but can easily be extended to other languages. The RGrad language has also been used to provide automatically generated Legendre transforms, with gradients. A few thermodynamic models generated with this methodology have been used to develop a new method for checking phase stabilities in multiphase, near-critical, phase equilibria. The method makes use of Legendre transforms to formulate the problem such that the same equations can be used for any number of phases, with any number of components. The phase stability test traverses the extensive thermodynamic space in the search for the most stable phase while keeping the chemical potentials the same as in the test phase. The final application discussed in this thesis deals with critical and tri-critical points. Legendre transforms are used to formulate stability criteria which are the same regardless of the number of components in the system. Furthermore, a Taylor expansion at the critical point has been developed to approximate the two-phase boundary of a system. The success of these calculations demonstrates that the gradient calculations are correct, and also that the automatic Legendre transform is implemented correctly.