Phase equilibrium calculations are an essential part of numerical simulations of multi-component multi-phase flow in porous media, accounting for the largest share of the computational time. In this work, we introduce a GPUenabled, fast, and parallel framework, PTFlash, that vectorizes algorithms required for isothermal two-phase flash calculations using PyTorch, and can facilitate a wide range of downstream applications. In addition, to further accelerate PTFlash, we design two task-specific neural networks, one for predicting the stability of given mixtures and the other for providing estimates of the distribution coefficients, which are trained offline and help shorten computation time by sidestepping stability analysis and reducing the number of iterations to reach convergence. The evaluation of PTFlash was conducted on three case studies involving hydrocarbons, CO$_2$ and N$_2$ , for which the phase equilibrium was tested over a large range of temperature, pressure and composition conditions, using the Soave-Redlich-Kwong (SRK) equation of state. We compare PTFlash with an in-house thermodynamic library, Carnot, written in C++ and performing flash calculations one by one on CPU. Results show speed-ups on large scale calculations up to two order of magnitudes, while maintaining perfect precision with the reference solution provided by Carnot.
翻译:阶段平衡计算是多构件多阶段多阶段流动(多孔介质)数字模拟的必要部分,占计算时间的最大比例。在这项工作中,我们引入了一个GPUPU化、快速和平行的框架PTFSlash,即利用PyTorrch对异热双阶段闪烁计算所需的矢量算法,可以促进一系列广泛的下游应用。此外,为了进一步加快PTFlash,我们设计了两个任务特定的神经网络,一个用于预测特定混合物的稳定性,另一个用于提供分配系数的估计数,这些系数是经过培训的离线计算,有助于通过截断稳定性分析来缩短计算时间,并减少迭代数以达到趋同。对PTFLash的评估是在三个案例研究中进行的,分别涉及碳氢化合物,CO$2美元和N$2美元,可以促进一系列广泛的下游应用。此外,我们还设计了两个任务特定的神经网络,一个是预测特定混合物的稳定性,另一个是提供分配系数的估计数。我们将PTFSlash与一个内部热动动力图书馆进行比较,通过绕式分析来缩短计算时间,并用Cnototot,同时用Cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx