Accurate modeling of high-concentration brine systems is essential for desalination and resource recovery, yet remains a significant challenge due to the lack of accessible, general-purpose tools for implementing complex thermodynamic models like r-eNRTL [1]. While models like the electrolyte non-random two-liquid model (eNRTL [2]), and the refined eNRTL (r-eNRTL [1]) offer excellent predictive accuracy, their mathematical complexity poses major barriers for implementation. Deriving and coding the numerous thermodynamic property expressions by hand becomes impractical as model complexity scales. Although some academic groups have developed open-source implementations of these state-of-the-art models, such efforts are often system-specific and difficult to generalize or reuse. Recent developments--such as our integration of r-eNRTL [1] into the IDAES [3] platform--reflect a growing need for more transparent, extensible, and reusable thermodynamic modeling frameworks. Our work addresses this need along two closely connected directions: implementing complex models like r-eNRTL at the code level and enabling their seamless reuse across platforms beyond IDAES [3].
In our prior work [4], we developed and demonstrated a symbolic computation framework to automate the implementation of complex electrolyte thermodynamic models, focusing on the r-eNRTL [1] model. By leveraging symbolic algebra and source-code transformation packages Symbolics.jl [5] and SymbolicUtils.jl [6] in the Julia programming language [7], the framework removed the need to manually derive and code activity coefficient expressions. In turn, this enabled reliable and scalable expression generation for global parameter estimation. One shortcoming is that this approach is limited to single-electrolyte systems. However, it serves as a foundation for extensions to more complex models, including multi-electrolyte and temperature-dependent systems.
In this work, we extend our previous framework [4] to enable symbolic derivation of a wide range of thermodynamic properties beyond activity coefficients. From a user-defined activity coefficient model, closed-form symbolic expressions for enthalpy, heat capacity, osmotic coefficients, and partial molar properties can now be automatically generated. These expressions are obtained through automatic differentiation (AD [8]) within a symbolic computing context and compiled into efficient numerical functions. This enhancement improves modeling flexibility and enables streamlined integration of accurate property models into process simulations. It significantly reduces the manual effort in building thermodynamic models for desalination and other applications.
With a symbolic representation of thermodynamic properties established, we next address the challenge of global parameter estimation for the r-eNRTL model. We fit multiple single-electrolyte datasets within a unified optimization framework, which leads to a nonlinear, high dimensional parameter estimation problem. To ensure that we identify parameter values corresponding to the best-possible fit of the model to the experimental data, we require deterministic global optimization (DGO). However, DGO is often computationally prohibitive due to the curse of dimensionality, which is compounded by the need to evaluate and relax computationally expensive symbolic expressions and their derivatives. The complexity of these symbolic expressions further increases when including more datasets, resulting in significantly longer function (and corresponding relaxations) evaluation times. The high computational burden is further exacerbated by the large symbolic expression generated by this AD approach [9]. To address this, we introduce an auxiliary variable substitution scheme that dramatically and automatically reduces the size and complexity of the symbolic expressions enabling faster overall computational efficiency---particularly for DGO solvers such as EAGO.jl [10–12].
We validate our framework through case studies on binary electrolyte mixture systems relevant to brine desalination, implemented using the Julia-based equation-oriented/acausal modeling platform ModelingToolkit.jl [13]. Symbolic expressions for thermodynamic properties are derived from user-defined activity coefficient models and seamlessly integrated into process modeling and optimization workflows. These examples demonstrate the feasibility of using symbolic tools to automate the implementation of complex models. In addition, to further demonstrate the cross-platform applicability of our symbolic framework, we will show how we have successfully migrated the generated r-eNRTL activity coefficient expressions into the Python-based IDAES-PSE [3] modeling platform. This enables direct integration of complex thermodynamic models into established process systems engineering workflows built on Pyomo [14], broadening the accessibility and utility of our approach for the energy and desalination modeling communities. These efforts serve the broader purpose of reducing the community’s dependence on inaccessible commercial software by enabling reusable, open-source model implementations across platforms.
References
[1] Bollas, G. M., Chau-Chyun Chen, and P. I. Barton. "Refined electrolyte‐NRTL model: Activity coefficient expressions for application to multi‐electrolyte systems." AIChE Journal 54, no. 6 (2008): 1608-1624.
[2] Song, Yuhua, and Chau-Chyun Chen. "Symmetric electrolyte nonrandom two-liquid activity coefficient model." Industrial & Engineering Chemistry Research 48, no. 16 (2009): 7788-7797.
[3] Lee, Andrew, Jaffer H. Ghouse, Qi Chen, John C. Eslick, John D. Siirola, Ignacio E. Grossman, and David C. Miller. "A flexible framework and model library for process simulation, optimization and control." In Computer Aided Chemical Engineering, vol. 44, pp. 937-942. Elsevier, 2018.
[4] Xu, Pengfei, Robert Gottlieb, and Matthew Stuber. "Parameter Estimation of Complicated Thermodynamic Models for Accurate Brine Separation." In 2023 AIChE Annual Meeting. AIChE, 2023.
[5] Gowda, Shashi, Yingbo Ma, Alessandro Cheli, Maja Gwóźzdź, Viral B. Shah, Alan Edelman, and Christopher Rackauckas. "High-performance symbolic-numerics via multiple dispatch." ACM Communications in Computer Algebra 55, no. 3 (2022): 92-96.
[6] Shashi Gowda, Yingbo Ma, Mason Protter, Julia Computing, JuliaSymbolics/SymbolicUtils.jl, (2020). URL: https://github.com/JuliaSymbolics/SymbolicUtils.jl
[7] Bezanson, Jeff, Alan Edelman, Stefan Karpinski, and Viral B. Shah. "Julia: A fresh approach to numerical computing." SIAM review 59, no. 1 (2017): 65-98.
[8] Corliss, George, Christele Faure, Andreas Griewank, Laurent Hascoet, and Uwe Naumann, eds. Automatic differentiation of algorithms: from simulation to optimization. Springer Science & Business Media (2002).
[9] Laue, Soeren. "On the equivalence of automatic and symbolic differentiation." arXiv preprint arXiv:1904.02990 (2019).
[10] Wilhelm, Matthew E., and Matthew D. Stuber. "EAGO.jl: easy advanced global optimization in Julia." Optimization Methods and Software 37, no. 2 (2022): 425-450.
[11] Matthew E. Wilhelm, Robert X. Gottlieb, and Matthew D. Stuber. PSORLab/McCormick.jl, (2020). URL: https://github.com/PSORLab/McCormick.jl.
[12] Matthew E. Wilhelm and Matthew D. Stuber. Easy advanced global optimization (EAGO): An open-source platform for robust and global optimization in Julia. In AIChE Annual Meeting. AIChE (2017).
[13] Ma, Yingbo, Shashi Gowda, Ranjan Anantharaman, Chris Laughman, Viral Shah, and Chris Rackauckas. "ModelingToolkit: A composable graph transformation system for equation-based modeling." arXiv preprint arXiv:2103.05244 (2021).
[14] Hart, William E., Carl D. Laird, Jean-Paul Watson, David L. Woodruff, Gabriel A. Hackebeil, Bethany L. Nicholson, and John D. Siirola. Pyomo-optimization modeling in python. Vol. 67. Berlin: Springer, 2017.