基于多门控混合专家网络的燃烧热化学流形表征
Representation of combustion thermochemical manifolds via multi-gate mixture of experts
通讯作者:
收稿日期: 2023-04-15
基金资助: |
|
Received: 2023-04-15
Fund supported: | 国家杰出青年科学基金资助项目(51925603);国家自然科学基金资助项目(52236002) |
作者简介 About authors
王意存(1996—),男,博士生,从事喷雾燃烧数值模拟及模型研究.orcid.org/0000-0001-7554-5919.E-mail:
为了更好地在小火焰燃烧模型框架内实施燃烧热化学流形表征,采用多任务学习领域中的多门控混合专家网络(MMoE). 通过对三维层流喷雾射流火焰构型进行详细化学(DC)模拟,构建原始数据集. 原始数据集经过Box-Cox转换和标准化处理,以应对燃烧数据的多尺度分布问题. 对数据集进行Pearson相关系数分析,结果表明部分化学组分之间无明显的相关性. 分别构建同等参数量规模的MMoE和前馈神经网络(FNN)模型,对比分析结果表明,2种模型取得的损失值和决定系数相近,但相比FNN模型,MMoE模型在训练过程中更加稳定,且取得的定量预测结果更加准确.
关键词:
The multi-gate mixture of experts (MMoE) for multi-task learning was applied to better implement the representation of combustion thermochemical manifolds in the framework of flamelet-based combustion models. Detailed chemistry (DC) simulation of a three-dimensional laminar spray jet flame was conducted to generate the original dataset. The original dataset was preprocessed by Box-Cox transformation and Z-score normalization to deal with the multi-scale distributions of combustion data. Correlation analysis was performed on the dataset using the Pearson correlation coefficient, and the results showed that there was no significant correlation between some chemical species. The MMoE and feedforward neural network (FNN) models were constructed respectively, and the comparison and analysis showed that although both models achieved similar loss values and coefficients of determination, the MMoE model was more stable during the training process and achieved more accurate quantitative prediction results than FNN model.
Keywords:
本文引用格式
王意存, 邵长孝, 金台, 邢江宽, 罗坤, 樊建人.
WANG Yi-cun, SHAO Chang-xiao, JIN Tai, XING Jiang-kuan, LUO Kun, FAN Jian-ren.
机器学习(machine learning,ML)方法已经在以计算流体力学(computational fluid dynamics,CFD)为代表的科学计算领域掀起了热潮[1]. 在湍流燃烧数值模拟方面,研究者试图用机器学习方法进行燃烧建模[2-4],建立数据驱动的燃烧模型. 热化学流形(thermochemical manifolds)的参数化和表征是机器学习在燃烧建模中的重要应用. 传统的流形参数化技术包括各种查表(loop-up tables)技术,如原位自适应建表(in situ adaptive tabulation,ISAT)[5]、分段多项式近似(piecewise polynomial approximation)[6]以及小火焰模型(flamelet models)[7]. 人工神经网络模型(artificial neural network,ANN)因更快的计算速度和更小的内存占用,在热化学流形的参数化和表征方面已经得到研究和认可. 因为基于神经网络的模型只需存储网络结构信息、权重和偏置参数[8],所以通常不会占用太多存储空间. 除此之外,与传统的查表方法不同,基于神经网络的模型具有采样点之间平滑插值的优点[2, 3, 9].
基于机器学习已经发展出一些新型的热化学流形表征方法. 在有限速率类燃烧模型方面,求解化学反应刚性常微分方程组(system of ordinary differential equations,SODEs)使用详细化学反应机理直接积分(direct integration,DI)方法的计算量巨大,导致计算效率较低. 为此,研究者利用神经网络模型建立热化学状态作为输入和化学反应源项(或者下一时刻的状态)作为输出的映射关系[2, 10-15]. 为了使神经网络具有良好泛化能力,训练数据集必须覆盖真实模拟中可能遇到的热化学状态,复杂的反应机理会对热化学状态数据集的构建以及神经网络的训练带来困难[2]. 替代方案是在小火焰燃烧模型框架下实施热化学流形表征,这也是本研究的焦点.
在小火焰燃烧模型框架内,通常利用几个控制变量(controlling variable)(如混合分数、过程变量)来参数化低维流形[16],待求解的热化学标量通过预先建立的小火焰库访问而无需求解组分输运方程,因此具有较高的计算效率. 然而,在一些复杂场景中(如考虑辐射和相间换热、多进口构型),必须对小火焰模型进行维度扩展、增加控制变量的数量[16],此时会造成小火焰库的尺寸较大,读取这些小火焰库需要占用较大的内存空间以及复杂的多维插值程序. 为此,研究者利用ANN建立控制变量作为输入、其他热化学标量作为输出的映射关系. CFD程序读取训练好的ANN而非小火焰库,从而缓解内存占用问题. 此类方法已成功应用于值班CH4/air射流火焰[9]、钝体旋流稳定火焰[17]、CH4/H2/N2射流扩散火焰[18]、具有非均匀入口的值班射流火焰[19]、火箭发动机[20]、内燃机工况下的喷雾火焰[8, 21]、超声速燃烧器[22]和超临界CO2燃烧器[23]等.
基于小火焰的燃烧热化学流形表征完成的都是从较少几个控制变量到热化学标量的映射,其中基础的前馈神经网络(feedforward neural network,FNN)得到最多的应用. 从机器学习的角度,该问题可视作多任务学习问题,任务目标是使得各个热化学标量都取得较好的预测精度. Owoyele等[24]采用混合专家网络(mixture of experts,MoE)[25]完成了燃烧流形表征,并取得较好的先验结果. MoE是典型的多任务学习技术,由于只有1个门控网络,在任务相关性不强的问题中可能表现不佳. 对于相关性不强的多个任务,多门控混合专家网络(multi-gate mixture of experts,MMoE)[26]的表现更好. 因此,从理论上讲,MMoE比MoE更加适用于燃烧热化学流形的表征. 本研究采用MMoE模型在小火焰模型框架内实现燃烧热化学流形的表征,获取比FNN模型更高的精度. 本研究模型训练采用的数据集来自三维层流射流喷雾火焰的详细化学(detailed chemistry,DC)模拟,本研究将对该数据集中的组分进行相关性分析,分别搭建MMoE和FNN模型,将2种模型的结果与DC结果对比以进行性能评估.
1. 数学和物理模型
1.1. 详细化学模拟
训练和测试用的数据由DC模拟计算得到. 在喷雾燃烧DC模拟中,通过直接求解质量、动量、能量和组分质量分数的守恒方程建立数据库. 基于低马赫数假设,守恒方程为
式中:ρ为气相密度,基于理想气体状态方程求解;uj为气相速度;p为压力;τij为黏性应力;wk为组分k的质量分数;h为比焓;α为热扩散系数;D为组分扩散系数;
1.2. 小火焰燃烧模型
式中:Z、C和Zcarr分别为混合分数、过程变量以及新定义的载气混合分数(carrier mixture fraction)[31]. 这3个控制变量须在CFD程序中同步求解,守恒方程分别为
1.3. 三维层流喷雾射流火焰数据集
使用OpenFOAM 7.0中的喷雾燃烧求解器sprayFoam,对三维层流喷雾射流火焰进行详细化学模拟,构建DC数据集,以用于神经网络模型的训练和测试. 火焰构型的示意图如图1所示. 中心射流直径D = 1 mm,射流包括空气、甲醇液滴以及预汽化的燃料蒸汽组成的混合物. 射流周围的伴随流由氢气/空气在1 430 K的贫燃平衡产物组成[37]. 射流入口速度为8 m/s,特征长度取中心射流直径,取运动黏度为1.5×10−5 m2/s,计算得到射流入口雷诺数为533,小于圆管流动临界雷诺数为2 300,可以认为当前研究的火焰为层流火焰. 伴随流入口速度为1 m/s,液相质量流量为3.185×10−6 kg/s. 其他的入口参数参见表1. 入流参数的设置参考悉尼抬升甲醇喷雾火焰Mt2A构型[37-38]. 计算域是直径为30D,流向长度为55D的圆柱体,采用的总网格数约为105万. 采用的化学反应机理为甲醇燃烧的18组分55步反应骨架机理[39].
图 1
表 1 喷雾射流火焰的入口参数
Tab.1
类型 | wk | T/K | |||
N2 | O2 | CH3OH | H2O | ||
射流 | 0.754 | 0.228 | 0.018 | 0 | 283 |
伴随流 | 0.758 | 0.142 | 0 | 0.100 | 1 430 |
1.4. 人工神经网络模型
FNN也称多层感知器(multi-layer perceptron,MLP),是应用广泛的基础人工神经网络,如图2(a)所示. FNN中各神经元分别属于不同的层,每一层的神经元可以接收前一层神经元的信号,并产生信号输出到下一层. 第0层称为输入层,最后一层称为输出层,其他中间层称为隐藏层. 每个神经元视为从输入到输出的非线性映射. 输入层神经元接收的输入是整个网络的输入值,在当前问题中也就是控制变量
图 2
式中:
式中:
神经网络模型基于开源PyTorch 1.8.2框架实现. 为了公平比较2种网络模型的性能,保持网络结构具有相近的可训练参数数目. 对于2种网络结构,网络输入包含3个控制变量,即Z,C和Zcarr,网络输出为17变量,即去除N2之后的17个组分. 对于FNN,网络包含7层隐藏层,隐藏层神经元数目为(8, 16, 32, 64, 94, 64, 32),隐藏层激活函数为tanh,总的参数数目为17 663. 对于MMoE,网络结构包含8个专家网络,17个塔网络,17个门控网络. 专家网络和塔网络结构汇总如表2,总的参数数目为17 609. 这2种网络结构都采用均方误差(mean square error,MSE)损失函数. 函数网络权重使用Xavier初始化[41],通过Adam优化器[42]进行优化,采用自定义的指数衰减学习率l/l0=5−n/2 000,其中n为训练周期数,初始学习率l0=1.0×10−3.
表 2 多门控混合专家网络中的专家网络和塔网络结构
Tab.2
层类型 | 专家网络 | 塔网络 | |||
激活函数 | 输出类型 | 激活函数 | 输出类型 | ||
Input | — | (None, 3) | — | (None, 32) | |
Dense | tanh | (None, 8) | tanh | (None, 16) | |
Dense | tanh | (None, 16) | tanh | (None, 8) | |
Output | tanh | (None, 32) | — | (None, 1) |
2. 结果与讨论
2.1. 火焰数据集分析
分析DC模拟生成的火焰数据集,标量的分布云图如图3所示,其中r为径向位置. 由图3(a)可以看出,在上游位置(x<10D),主射流和高温伴流之间由于相互混合,形成剪切层. 剪切层的高温促进该区域液滴的蒸发,剪切层不断发展,随后着火过程发生并形成火焰. 由于液滴蒸发热损失作用导致剪切层温度降低. 由图3(b)可以看出,蒸发过程一直持续到约x=20D位置,同时混合分数达到较大值,此时射流中心位置为主要蒸发区域. 由图3(d)可以看出,与经典的混合分数Z不同,Zcarr从射流核心向外单调变化,这将有利于小火焰模型的建模. 图3(f)中的白色实线代表等值线wOH = 6×10−4,该等值线可以用于判断火焰抬升高度[43]. 结果显示火焰抬升高度为6.8D.
图 3
当前神经网络模型的任务是对除了N2之外的所有组分进行预测,为了挖掘不同组分间的内在相关性,采用Pearson相关系数(Pearson correlation coefficient)[44]分析预处理后的数据集. 2个变量X和Y之间的相关系数计算式为
图 4
图 4 组分相关系数的热力图
Fig.4 Heatmap of correlation coefficients for different species
2.2. 模型训练结果分析
表 3 神经网络模型最终的损失值
Tab.3
网络模型 | L | |
训练集 | 测试集 | |
FNN | 2.694×10−4 | 2.728×10−4 |
MMoE | 2.616×10−4 | 2.634×10−4 |
图 5
图 5 神经网络模型的损失值随迭代步数的变化
Fig.5 Loss values versus iterations for different neural networks
图 6
图 6 FNN模型预测值与真实值的散点图
Fig.6 Scatter plots of true and predicted values using FNN model
图 7
图 7 MMoE模型预测值与真实值的散点图
Fig.7 Scatter plots of true and predicted values using MMoE model
采用决定系数(coefficient of determination)R2来定量评估模型的性能,表达式为
式中:i表示第i个数据样本,
表 4 FNN和MMoE模型的决定系数
Tab.4
组分 | R2 | |||
FNN训练集 | FNN测试集 | MMoE训练集 | MMoE测试集 | |
CH2OH | 0.999 564 | 0.999 562 | 0.999 508 | 0.999 504 |
H2O | 0.999 951 | 0.999 949 | 0.999 983 | 0.999 982 |
O | 0.999 633 | 0.999 631 | 0.999 699 | 0.999 701 |
CH3O | 0.999 608 | 0.999 608 | 0.999 631 | 0.999 631 |
HO2 | 0.999 430 | 0.999 429 | 0.999 470 | 0.999 470 |
CO2 | 0.999 850 | 0.999 846 | 0.999 851 | 0.999 847 |
OH | 0.999 759 | 0.999 758 | 0.999 749 | 0.999 752 |
O2 | 0.999 900 | 0.999 900 | 0.999 925 | 0.999 924 |
HCO | 0.999 664 | 0.999 668 | 0.999 635 | 0.999 635 |
H2O2 | 0.999 481 | 0.999 471 | 0.999 459 | 0.999 444 |
CH4 | 0.999 796 | 0.999 792 | 0.999 826 | 0.999 821 |
CH2O | 0.999 686 | 0.999 681 | 0.999 694 | 0.999 688 |
CH3 | 0.999 744 | 0.999 742 | 0.999 777 | 0.999 776 |
CH3OH | 0.999 872 | 0.999 871 | 0.999 905 | 0.999 905 |
H2 | 0.999 823 | 0.999 820 | 0.999 841 | 0.999 840 |
H | 0.999 834 | 0.999 835 | 0.999 766 | 0.999 767 |
CO | 0.999 805 | 0.999 800 | 0.999 831 | 0.999 825 |
如图8~10所示为不同轴向位置处组分质量分数的径向分布曲线. 其中H2O、CO2和O2代表主要组分,H2、CO和OH为重要的中间产物组分. DC结果作为基准数据,将FNN和MMoE模型的预测结果与DC结果进行定量对比,以对模型进一步评估. 如图8所示,在上游位置(x=15D),2种神经网络模型均取得较好的定量预测结果. 在下游位置(x=25D、30D),如图9、10所示,2种网络模型开始显现出差异. 在下游位置,对于主要组分O2,2种神经网络模型都取得较好的预测结果,对于主要组分H2O和CO2以及中间产物组分H2和CO,MMoE模型预测结果更精确,FNN模型的预测结果出现一定程度的偏差. 总体而言,MMoE模型在上、下游位置,对于各个尺度的组分都有较好的预测精度. MMoE在不同区域均取得较好的预测结果,这得益于MMoE与MoE类似,具备多个专家网络,具有燃烧流形自动分支(autonomously bifurcating combustion manifolds)的能力[24]. 通过门控网络,将不同区域的输入数据分配给不同的专家网络,每个专家网络去处理给定部分的输入,使得MMoE取得比FNN更好的局部预测效果.
图 8
图 8 神经网络结果与详细化学结果对比(x/D = 15位置)
Fig.8 Comparisons of detailed chemistry results and solutions using different neural networks at axial location of x/D = 15
图 9
图 9 神经网络结果与详细化学结果对比(x/D = 25位置)
Fig.9 Comparisons of detailed chemistry results and solutions using different neural networks at axial location of x/D = 25
图 10
图 10 神经网络结果与详细化学结果对比(x/D = 30位置)
Fig.10 Comparisons of detailed chemistry results and solutions using different neural networks at axial location of x/D = 30
图 11
表 5 新工况的神经网络模型最终的损失值
Tab.5
网络模型 | L | |
训练集 | 测试集 | |
FNN | 2.415×10−4 | 2.383×10−4 |
MMoE | 2.279×10−4 | 2.269×10−4 |
图 12
图 12 新工况的神经网络模型的损失值随迭代步数的变化
Fig.12 Loss values versus iterations of different neural networks for new case
3. 结 语
本研究将MMoE模型应用于小火焰燃烧模型框架内的燃烧热化学流形表征. 使用OpenFOAM对三维喷雾射流火焰进行详细化学模拟以生成数据集. 使用开源深度学习框架PyTorch分别搭建FNN和MMoE模型,并进行对比. 结果表明,MMoE在训练过程中具有更好的稳定性,2种神经网络模型取得了相近的损失值和决定系数. 进一步定量结果表明,MMoE模型在上、下游位置对于各个尺度的组分都有较好的预测精度,FNN模型在下游位置出现一定的预测偏差. 基于神经网络模型的燃烧热化学流形表征是有前途的新方法,MMoE模型相较于基础的FNN模型已展现出一定优势,下一步将进行更加全面的性能评估. 此外,作为有效的多任务学习模型,MMoE对于燃烧机器学习领域的其他问题,例如求解燃烧化学微分方程的物理信息神经网络、热解模型构建等,也有重要的参考价值.
致谢 感谢浙江大学计算机科学与技术学院李玺教授、缪佩翰、励雪巍在研究中给予的帮助.
参考文献
Physics-informed machine learning
[J]. ,DOI:10.1038/s42254-021-00314-5 [本文引用: 1]
Machine learning for combustion
[J]. ,DOI:10.1016/j.egyai.2021.100128 [本文引用: 4]
Combustion machine learning: principles, progress and prospects
[J]. ,DOI:10.1016/j.pecs.2022.101010 [本文引用: 1]
Review of machine learning for hydrodynamics, transport, and reactions in multiphase flows and reactors
[J]. ,DOI:10.1021/acs.iecr.2c01036 [本文引用: 1]
Computationally efficient implementation of combustion chemistry using in situ adaptive tabulation
[J]. ,DOI:10.1080/713665229 [本文引用: 1]
PRISM: piecewise reusable implementation of solution mapping. An economical strategy for chemical kinetics
[J]. ,DOI:10.1002/ijch.199900010 [本文引用: 1]
Prediction of autoignition in a lifted methane/air flame using an unsteady flamelet/progress variable model
[J]. ,DOI:10.1016/j.combustflame.2010.07.015 [本文引用: 1]
Large eddy simulation of spray combustion using flamelet generated manifolds combined with artificial neural networks
[J]. ,DOI:10.1016/j.egyai.2020.100021 [本文引用: 2]
Investigation of lengthscales, scalar dissipation, and flame orientation in a piloted diffusion flame by LES
[J]. ,DOI:10.1016/j.proci.2004.08.182 [本文引用: 2]
A chemistry tabulation approach via rate-controlled constrained equilibrium (RCCE) and artificial neural networks (ANNs), with application to turbulent non-premixed CH4/H2/N2 flames
[J]. ,DOI:10.1016/j.proci.2012.06.057 [本文引用: 1]
A multi-scale sampling method for accurate and robust deep neural network to predict combustion chemical kinetics
[J]. ,DOI:10.1016/j.combustflame.2022.112319 [本文引用: 1]
Artificial neural network based chemical mechanisms for computationally efficient modeling of hydrogen/carbon monoxide/kerosene combustion
[J]. ,DOI:10.1016/j.ijhydene.2020.08.081
Machine learning tabulation of thermochemistry in turbulent combustion: an approach based on hybrid flamelet/random data and multiple multilayer perceptrons
[J]. ,DOI:10.1016/j.combustflame.2021.111493
On-the-fly artificial neural network for chemical kinetics in direct numerical simulations of premixed combustion
[J]. ,DOI:10.1016/j.combustflame.2020.12.038
Tabulation of combustion chemistry via artificial neural networks (ANNs): methodology and application to LES-PDF simulation of Sydney flame L
[J]. ,DOI:10.1016/j.combustflame.2017.07.014 [本文引用: 1]
Efficient premixed turbulent combustion simulations using flamelet manifold neural networks: a priori and a posteriori assessment
[J]. ,DOI:10.1016/j.combustflame.2022.112325 [本文引用: 2]
Optimal artificial neural networks and tabulation methods for chemistry representation in LES of a bluff-body swirl-stabilized flame
[J]. ,DOI:10.1016/j.proci.2008.06.100 [本文引用: 1]
Laminar flamelet modeling of a turbulent CH4/H2/N2 jet diffusion flame using artificial neural networks
[J]. ,DOI:10.1016/j.apm.2011.08.012 [本文引用: 1]
Deep residual networks for flamelet/progress variable tabulation with application to a piloted flame with inhomogeneous inlet
[J]. ,DOI:10.1080/00102202.2020.1822826 [本文引用: 1]
Application of deep artificial neural networks to multi-dimensional flamelet libraries and spray flames
[J]. ,DOI:10.1177/1468087419837770 [本文引用: 1]
LES/flamelet/ANN of oxy-fuel combustion for a supercritical CO2 power cycle
[J]. ,DOI:10.1016/j.jaecs.2022.100083 [本文引用: 1]
Efficient bifurcation and tabulation of multi-dimensional combustion manifolds using deep mixture of experts: an a priori study
[J]. ,DOI:10.1016/j.proci.2020.09.006 [本文引用: 2]
Task decomposition through competition in a modular connectionist architecture: the what and where vision tasks
[J]. ,DOI:10.1207/s15516709cog1502_2 [本文引用: 1]
Effects of turbulence-chemistry interactions on auto-ignition and flame structure for n-dodecane spray combustion
[J]. ,DOI:10.1080/13647830.2019.1600722 [本文引用: 1]
Eulerian-lagrangian modelling of detonative combustion in two-phase gas-droplet mixtures with OpenFOAM: validations and verifications
[J]. ,DOI:10.1016/j.fuel.2020.119402
The particle-source-in cell (PSI-CELL) model for gas-droplet flows
[J]. ,
Modeling of turbulent dilute spray combustion
[J]. ,DOI:10.1016/j.pecs.2012.07.001 [本文引用: 1]
A priori and a posteriori studies of a novel spray flamelet tabulation methodology considering evaporation effects
[J]. ,DOI:10.1016/j.fuel.2022.125892 [本文引用: 3]
LES of a turbulent lifted methanol spray flame using a novel spray flamelet/progress variable model
[J]. ,
Large eddy simulation of spray combustion using the spray flamelet/progress variable model: further extension and validation
[J]. ,
A generalised spray-flamelet formulation by means of a monotonic variable
[J]. ,DOI:10.1080/13647830.2020.1866215 [本文引用: 1]
Characteristics of flamelets in spray flames formed in a laminar counterflow
[J]. ,DOI:10.1016/j.combustflame.2006.09.006
On the generalisation of the mixture fraction to a monotonic mixing-describing variable for the flamelet formulation of spray flames
[J]. ,DOI:10.1080/13647830.2015.1099740 [本文引用: 1]
The structure of the auto-ignition region of turbulent dilute methanol sprays issuing in a vitiated co-flow
[J]. ,DOI:10.1007/s10494-012-9388-x [本文引用: 2]
Investigation of auto-ignition in turbulent methanol spray flames using large eddy simulation
[J]. ,DOI:10.1016/j.combustflame.2013.07.004 [本文引用: 1]
Reduced kinetic mechanism for methanol combustion in spark-ignition engines
[J]. ,DOI:10.1021/acs.energyfuels.8b02136 [本文引用: 1]
An analysis of transformations
[J]. ,DOI:10.1111/j.2517-6161.1964.tb00553.x [本文引用: 1]
Numerical analysis of dilute methanol spray flames in vitiated coflow using extended flamelet generated manifold model
[J]. ,DOI:10.1063/5.0098705 [本文引用: 1]
Note on regression and inheritance in the case of two parents
[J]. ,DOI:10.1098/rspl.1895.0041 [本文引用: 1]
/
〈 | 〉 |