pyJac: Analytical Jacobian generator for chemical kinetics

pyJac: Analytical Jacobian generator for chemical kinetics
复制标题

DOI:
10.1016/j.cpc.2017.02.004
复制
发表时间:
2016-05
期刊:
Comput. Phys. Commun.
影响因子:
--
通讯作者:
Kyle E. Niemeyer;Nicholas J. Curtis;C. Sung
Kyle E. Niemeyer;Nicholas J. Curtis;C. Sung
中科院分区:
其他
文献类型:
--
作者:
Kyle E. Niemeyer;Nicholas J. Curtis;C. Sung

文献摘要

被引文献

相似文献

燃烧现象的准确模拟需要使用详细的化学动力学,以捕获点火和熄灭等极限现象,并预测污染物的形成。然而,实际感兴趣的碳氢化合物燃料的化学动力学模型通常具有大量的物质和反应,并且在控制微分方程中表现出高水平的数学刚性,特别是对于较大的燃料分子。为了整合控制化学动力学的刚性方程,反应流模拟通常依赖于需要频繁雅可比矩阵评估的隐式算法。一些原位和后验计算诊断方法也需要精确的雅可比矩阵,包括计算奇异扰动和化学爆炸模式分析。通常,有限差在数值上近似这些,但对于较大的化学动力学模型,这提出了显着的计算需求,因为化学源项评估的数量与物种计数的平方成比例。此外,现有的雅可比分析工具无法优化评估或支持新兴的 SIMD 处理器(例如 GPU)。在这里,我们介绍 pyJac,一个基于 Python 的开源程序,可生成用于化学动力学建模和分析的分析雅可比矩阵。除了生成用于评估反应速率(包括所有现代反应速率公式)、化学源项和雅可比矩阵所需的定制源代码之外,pyJacus 还提供优化的评估顺序以最大程度地减少计算和内存操作。作为演示,我们首先通过自动微分获得的矩阵在 0.001% 范围内显示一致性,从而确定氢、甲烷、乙烯和异戊醇氧化(物种数范围 13-360)动力学模型的雅可比矩阵的正确性。然后,我们使用 pyJacvia 矩阵评估时序比较来演示 CPU 和 GPU 上可实现的性能; pyJacout 生成的例程在单线程基础上将一阶有限差分执行了 3-7.5 倍,而现有的分析雅可比软件 TChemby 执行了 1.1-2.2 倍。值得注意的是,TChem 不是线程安全的,而 pyJacis 很容易并行化,因此可以大大优于 TChemon 多核 CPU。我们在这里描述的雅可比矩阵生成器将有助于降低将化学源项与隐式算法(特别是通常需要精确雅可比矩阵的算法)集成的成本。此外,该程序的开源发布和基于Python的实现将实现广泛采用。 程序摘要程序标题:pyJacProgram Files doi:http://dx.doi.org/10.17632/mmr3z8j2m5.1许可条款:MIT License编程语言:Python外部例程/库:必需:NumPy;可选:Cython、Cantera、PyYAML、Adept 问题性质:自动生成源代码来评估化学动力学模型的雅可比矩阵解决方法:从输入文件解释化学动力学模型,并根据理论推导将偏导数和必要的支持函数写入文件。附加注释:本文描述了 pyJacv1.0.2,可在http://dx.doi.org/10.5281/zenodo.251144。当前版本和支持可在 https://github.com/SLACKHA/pyjac/ 获取
Accurate simulations of combustion phenomena require the use of detailed chemical kinetics in order to capture limit phenomena such as ignition and extinction as well as predict pollutant formation. However, the chemical kinetic models for hydrocarbon fuels of practical interest typically have large numbers of species and reactions and exhibit high levels of mathematical stiffness in the governing differential equations, particularly for larger fuel molecules. In order to integrate the stiff equations governing chemical kinetics, generally reactive-flow simulations rely on implicit algorithms that require frequent Jacobian matrix evaluations. Some in situ and a posteriori computational diagnostics methods also require accurate Jacobian matrices, including computational singular perturbation and chemical explosive mode analysis. Typically, finite differences numerically approximate these, but for larger chemical kinetic models this poses significant computational demands since the number of chemical source term evaluations scales with the square of species count. Furthermore, existing analytical Jacobian tools do not optimize evaluations or support emerging SIMD processors such as GPUs. Here we introducepyJac, a Python-based open-source program that generates analytical Jacobian matrices for use in chemical kinetics modeling and analysis. In addition to producing the necessary customized source code for evaluating reaction rates (including all modern reaction rate formulations), the chemical source terms, and the Jacobian matrix,pyJacuses an optimized evaluation order to minimize computational and memory operations. As a demonstration, we first establish the correctness of the Jacobian matrices for kinetic models of hydrogen, methane, ethylene, and isopentanol oxidation (number of species ranging 13–360) by showing agreement within 0.001% of matrices obtained via automatic differentiation. We then demonstrate the performance achievable on CPUs and GPUs usingpyJacvia matrix evaluation timing comparisons; the routines produced bypyJacoutperformed first-order finite differences by 3–7.5 times and the existing analytical Jacobian softwareTChemby 1.1–2.2 times on a single-threaded basis. It is noted thatTChemis not thread-safe, whilepyJacis easily parallelized, and hence can greatly outperformTChemon multicore CPUs. The Jacobian matrix generator we describe here will be useful for reducing the cost of integrating chemical source terms with implicit algorithms in particular and algorithms that require an accurate Jacobian matrix in general. Furthermore, the open-source release of the program and Python-based implementation will enable wide adoption.Program summaryProgram Title:pyJacProgram Files doi:http://dx.doi.org/10.17632/mmr3z8j2m5.1Licensing provisions:MIT LicenseProgramming language:PythonExternal routines/libraries:required:NumPy; optional:Cython, Cantera,PyYAML, AdeptNature of problem:Automatic generation of source code to evaluate Jacobian matrices for chemical kinetic modelsSolution method:Chemical kinetic model interpreted from input file(s), and partial derivatives and necessary supporting functions are written to file based on a theoretical derivation.Additional comments:This paper describespyJacv1.0.2, available at http://dx.doi.org/10.5281/zenodo.251144. Current version and support available at https://github.com/SLACKHA/pyjac/