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.
翻译:阶段平衡计算是多构件多阶段多级流在多孔介质中的数字模拟的必要部分,占计算时间的最大比例。在这项工作中,我们引入了一个 GPUPUPU化、快速和平行的框架PTFSlash,即使用PyTorrch进行异热双阶段闪烁计算所需的矢量算法,可以促进一系列广泛的下游应用。此外,为了进一步加速PTFlash,我们设计了两个任务特定的神经网络,一个用于预测特定混合物的稳定性,另一个用于提供分配系数的估计数,这些系数经过培训,通过绕开稳定性分析来缩短计算时间,并减少迭代数以达到趋同。对PTFLash的评估是针对三个案例研究进行的,分别涉及碳氢化合物CO 2和N 2, 并可以促进碳氢化合物的两相相位闪烁,为此,我们用Save-Redlich-Kwong(SRK)方程式的方程式来比较PTFSlash和内部热力图书馆的估算,Carnot, 以C++++和快速计算速度一,同时进行快速计算,用CPROxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx