适用于深度学习架构的轻水热力性质张量计算库设计与实现

Design and Implementation of Tensor Computation Library of Light Water Thermodynamic Property for Deep Learning Architecture

  • 摘要: 针对能源动力系统大规模仿真及AI for Science对高保真计算的需求,本文基于Libtorch开发了轻水物性张量计算库TensorIF97。通过张量化重构将IAPWS-IF97标准从标量计算转变为并行运算模式,实现了热力学逻辑与底层硬件执行的解耦,并匹配深度学习计算范式。针对偏导项需求,利用Bridgman热力学公式表自定义单相流反向计算逻辑,确保了物理一致性并避免了自动微分失真。实验结果显示,TensorIF97在双精度与单精度模式下计算相对偏差均小于10−4%。在107量级数据规模下,计算效率较传统串行库提升约12 984倍。本文研究不仅大幅提升了大规模热力学仿真物性计算效率,还为深度学习直接耦合高保真物理模型提供了高性能算子支持。

     

    Abstract: Addressing the escalating computational bottlenecks in high-fidelity simulations of energy power systems and the rigorous demands of the AI for Science paradigm, this study aims to revolutionize traditional thermodynamic modeling by establishing a novel high-performance computing framework that seamlessly integrates the IAPWS-IF97 standard with deep learning computational architectures. To achieve this objective, the research team designed and implemented TensorIF97, a specialized light water thermodynamic property computation library engineered on the Libtorch C++ backend, which successfully transformed the legacy scalar calculation paradigm into a highly optimized parallel computing mode through a comprehensive tensorization reconstruction strategy. This methodological innovation specifically involved leveraging advanced broadcasting mechanisms to expand coefficient vectors and eliminate redundant memory access overhead, employing element-wise tensor operations to efficiently map complex high-order polynomial calculations onto modern SIMD (single instruction multiple data) and SIMT (single instruction multiple thread) hardware architectures, and implementing a sophisticated tensor mask mechanism to decouple intricate physical logic branching from the underlying hardware instruction flow, thereby preventing thread divergence on graphics processing unit (GPU) devices. Furthermore, to rigorously address the critical requirement for accurate partial derivatives in Jacobian matrix constructions and backpropagation algorithms without compromising thermodynamic consistency, the study meticulously customized a reverse calculation logic for single-phase flow based on the Bridgman thermodynamic formula table, deliberately bypassing the automatic differentiation (AD) of empirical backward equations to prevent numerical distortion and ensure adherence to Maxwell relations. The comprehensive experimental results demonstrate that TensorIF97 achieves exceptional computational accuracy and efficiency across diverse scenarios, maintaining relative deviations of less than 10−4% for both double precision (kFloat64) and single precision (kFloat32) modes when rigorously benchmarked against SEUIF97 across nine fundamental thermodynamic properties and complex partial derivative terms. Regarding computational efficiency, TensorIF97 exhibits a super-linear speedup over traditional serial libraries, achieving an acceleration ratio of approximately 12 984 times under a massive data scale of 107 while keeping computational time stable and almost constant, effectively masking the linear cost of large-scale data processing with a single constant-level kernel launch overhead. This research concludes that the tensor-based computation paradigm successfully decouples thermodynamic logic from underlying hardware execution, providing a robust and scalable solution for large-scale scientific computing that not only significantly enhances the efficiency of property calculations in thermal-hydraulic simulations but also offers high-performance operator support for the direct coupling of deep learning models with high-fidelity physical equations, thereby establishing a foundational tool for enabling “super-real-time” simulations in full-core nuclear reactor analyses and advancing the frontier of physics-informed neural networks.

     

/

返回文章
返回