本文对人工神经网络方法(ANN)求解偏微分方程进行了研究,选择特定偏微分方程将求解结果与经典有限差分方法(FDM)进行了比对,最后得出在样本与训练次数选择恰当时,ANN方法可以得出相对较精确的数值解,但需要选取恰当权重与激活函数,并对现有激活函数提出了修正。具体通过Lagaris发表文献以复算计结果并进行了分析与探讨,更详细地揭示计算求解注意事项,最后结论得出权重训练次数后每次迭代梯度愈小与解析解越接近,而激活函数改变对计算结果影响较小。此外对双曲二维Burgers方程进行了稳态求解在100次训练过程后,但对非稳态及耗散损失还需后续进一步探讨研究。 In this paper, the artificial neural network (ANN) method for solving partial differential equations is studied. The specific equation is selected and the solution accuracy is compared with the classical finite element FDM method. Finally, when the sample and training times are selected properly, the ANN method can get relatively high numerical solution, but it needs to select the appropriate weight and activation function, and modify the existing activation function. The specific implementation is to analyze and discuss the numerical solution of partial differential equation by using ANN through the early lagaris published literature recalculation calculation, and reveal more detailed calculation and solution precautions. Finally, it is concluded that the smaller the iteration gradient after weight training times is, the closer it is to the finite element result, and the change of activation function has little influence on the calculation result. In addition, the two-dimensional hyperbolic Burgers equation is solved in steady state, but the unsteady state and dissipation need further study.
本文对人工神经网络方法(ANN)求解偏微分方程进行了研究,选择特定偏微分方程将求解结果与经典有限差分方法(FDM)进行了比对,最后得出在样本与训练次数选择恰当时,ANN方法可以得出相对较精确的数值解,但需要选取恰当权重与激活函数,并对现有激活函数提出了修正。具体通过Lagaris发表文献以复算计结果并进行了分析与探讨,更详细地揭示计算求解注意事项,最后结论得出权重训练次数后每次迭代梯度愈小与解析解越接近,而激活函数改变对计算结果影响较小。此外对双曲二维Burgers方程进行了稳态求解在100次训练过程后,但对非稳态及耗散损失还需后续进一步探讨研究。
人工神经网络算法,偏微分方程数值解,数值求解精度,激活函数,权函数
Tuyuan Yin1, Dasheng Wei1, Haihui Wang2*
1School of Energy and Power Engineering, Beihang University, Beijing
2School of Mathematics, Beihang University, Beijing
Received: Nov. 21st, 2020; accepted: Dec. 20th, 2020; published: Dec. 28th, 2020
In this paper, the artificial neural network (ANN) method for solving partial differential equations is studied. The specific equation is selected and the solution accuracy is compared with the classical finite element FDM method. Finally, when the sample and training times are selected properly, the ANN method can get relatively high numerical solution, but it needs to select the appropriate weight and activation function, and modify the existing activation function. The specific implementation is to analyze and discuss the numerical solution of partial differential equation by using ANN through the early lagaris published literature recalculation calculation, and reveal more detailed calculation and solution precautions. Finally, it is concluded that the smaller the iteration gradient after weight training times is, the closer it is to the finite element result, and the change of activation function has little influence on the calculation result. In addition, the two-dimensional hyperbolic Burgers equation is solved in steady state, but the unsteady state and dissipation need further study.
Keywords:Artificial Neural Network Algorithm, Numerical Solution of Differential Equation, Numerical Solution Accuracy, Activation Function, Finite Element Numerical Solution
Copyright © 2020 by author(s) and Hans Publishers Inc.
This work is licensed under the Creative Commons Attribution International License (CC BY 4.0).
http://creativecommons.org/licenses/by/4.0/
目前偏微分方程数值求解通常采用有限节点差分FDM方法,其可以保持较高精度,但随着智能算法如神经网络、遗传等不断发展,在偏微分方程有所应用 [
目前FDM对求解PDE方法较为成熟,对一般偏微分方程通常采用有点差分法,通过节点加密并迭代求得数值解。而ANN采用改变过程变量权重,并经过训练以达到数值解,具体流程见图1(a)~(d),这里不再系统阐述。
例1 求解非其次泊松方程(文献 [
∇ 2 Ψ ( x , y ) + Ψ ( x , y ) ∂ ∂ y Ψ ( x , y ) = sin ( π x ) ( 2 − π 2 y 2 + 2 y 3 sin ( π x ) )
x , y ∈ [ 0 , 1 ]
Ψ ( 0 , y ) = 0 , Ψ ( 1 , y ) = 0
Ψ ( x , 0 ) = 0 , ( ∂ / ∂ y ) Ψ ( x , 1 ) = 2 sin ( π x )
Ψ a ( x , y ) = y 2 sin ( π x )
其中FDM方法采用五点差分方法Gauss迭代与神经网络结果见图2(b),其中训练次数T = 1,T = 10,T = 50三种,其中激活函数采用 1 1 + e − a x ,其中 a = 1 。
图1. (a) FDM方法求解流程;(b) ANN方法求解流程;(c) ANN流程;(d) ANN方法加权过程
图2. (a) FDM方法求解数值结果;(b) ANN方法求解结果(T = 1);(c) ANN方法求解结果(T = 10);(d) ANN方法求解结果(T = 50);(e) ANN方法求解与解析解求解误差(T = 10,ANN方法求解值偏小);(f) ANN方法求解与解析解求解误差(T = 50)
具体测试参数设置见表1,从表1得出,影响计算关键精度主要在于权重w, Δ w ˙ i 为每次权重变化率即( w i − w i − 1 ),当权重变化量。最右侧表示:最大权重增量梯度,以表征权重变化梯度,并且介于(0-1)区间。
序号 | 类别 | 参数说明 | 节点数/求解时间 | 求解误差 | max ( Δ w i ) |
---|---|---|---|---|---|
1 | FDM | − | 0.05 s | 0.001 | − |
2 | ANN(T = 1) | 初始值 w 1 = 1 , w i ≠ 1 = 0 w i p i + b > 0 , Δ w ˙ i ≤ ε t 0 < ε t < 1 ,递减 | 0.03 s | 0.2~0.3 | 0.87 |
3 | ANN(T = 10) | 0.5 s | 0.01~0.1 | 0.23 | |
4 | ANN(T = 50) | 4 s | 0.001~0.005 | 0.02 | |
5 | ANN(T = 50) | a = 0.80 − 1.2, Δa = 0.05,修正激活函数 | 4 s | 0.001~0.005 (结果无明显变化) | 0.02 |
表1. ANN方法参数设置与求解结果说明
例2 选定文献problem5。
∇ 2 Ψ ( x , y ) = e − x ( x − 2 + y 3 + 6 y )
x , y ∈ [ 0 , 1 ] , Ψ ( 0 , y ) = y 3 , Ψ ( 1 , y ) = ( 1 + y 3 ) e − 1 , Ψ ( x , 0 ) = x e − x , Ψ ( x , 1 ) = e − x ( x + 1 )
Ψ a ( x , y ) = e − x ( x + y 3 )
求解过程与例1相同,结果见图3。
图3. (a) 解析解结果;(b) FDM数值解结果;(c) ANN方法求解结果(T = 10);(d) ANN方法求解结果(T = 50);(e) ANN方法求解与解析解求解误差(T = 10);(f) ANN方法求解与解析解求解误差(T = 50)
表2 problem5例求解参数设置与结果说明。
序号 | 类别 | 参数说明 | 节点数/求解时间 | 求解误差 | max ( Δ w i ) |
---|---|---|---|---|---|
1 | FDM | − | 0.03 s | 1e−3 | − |
2 | ANN(T = 1) | 初始值 w 1 = 1 , w i ≠ 1 = 0 w i p i + b > 0 , Δ w ˙ i ≤ ε t 0 < ε t < 1 ,递减 | 0.03 s | 0.2~0.3 | 0.87 |
3 | ANN(T = 10) | 0.5 s | 0.05~0.2 | 0.23 | |
4 | ANN(T = 50) | 3 s | 0.001~0.005 | 0.02 | |
5 | ANN(T = 50) | a = 0.80 − 1.2, Δa = 0.05,修正激活函数 | 3 s | 0.001~0.005 (结果无明显变化) | 0.02 |
6 | ANN(T = 100) | 同上 | 6 s | 0.001~0.005 | 0.02 |
表2. 求解参数设置与求解结果说明
例3 求解稳态二维Burgers双曲方程根据文献 [
u ∂ u ∂ x + v ∂ v ∂ y = μ ∂ 2 u ∂ x 2 + μ ∂ 2 v ∂ y 2 ,边界 u ( 0 ) = u ( 2 π ) , v ( 0 ) = v ( 2 π )
其解析解为: ϕ = exp ( − ( x − 4 t ) 2 4 μ ( t + 1 ) ) + exp ( − ( x − 4 t − 2 π ) 2 4 μ ( t + 1 ) ) + exp ( − ( y − 4 t ) 2 4 μ ( t + 1 ) ) + exp ( − ( y − 4 t − 2 π ) 2 4 μ ( t + 1 ) )
由于是稳态求解,另时间t=0,需要说明由于边界与文献边界不同,因此公式需要修正。
结果如下: Ψ t ( x , y ) = A ( x , y ) + x ( 2 π − x ) y ( 2 π − y ) N ( x , y , p → )
A ( x , y ) = ( 2 π − x ) f 0 ( y ) + x f 1 ( y ) + ( 2 π − y ) { g 0 ( x ) − [ ( 2 π − x ) g 0 ( 0 ) + x g 0 ( 1 ) ] } + y { g 1 ( x ) − [ ( 2 π − x ) g 1 ( 0 ) + x g 1 ( 1 ) ] }
化简后:
同时,为了简化问题取t = 0初始时刻,以求解稳态方程。
图4. (a) 解析解图像;(b) ANN方法求解结果(T = 10);(c) ANN方法求解结果(T = 100);(d) ANN方法求解与解析解残差(T = 100)
Burgers双曲方程参数设置与求解结果见表3。
序号 | 类别 | 参数说明 | 节点数/求解时间 | 求解误差 | max ( Δ w i ) |
---|---|---|---|---|---|
1 | ANN(T = 1) | 初始值 w 1 = 1 , w i ≠ 1 = 0 Math_61# 0 < ε t < 1 ,递减 | 0.03 s | 0.3~0.6 | 0.9 |
2 | ANN(T = 50) | 0.5 s | 0.05~0.2 | 0.23 | |
3 | ANN(T = 100) | 3 s | 0.01~0.08 | 0.05 |
表3. 求解方法参数设置与求解结果说明
通过计算可知,ANN同样适用与双曲方程但求解精度有所下降,这与双曲方程不稳定性有关(库朗数CFL < 1)。但由于本案例处理稳态问题,因此得出ANN对稳态双曲同样适用,但处理非稳态问题还需再探讨。图4(c)结果偏小是由于ANN训练结果从下界逼近真实解析解。
根据上述计算结果可知,对ANN求解偏微分方程精确,需要对权重函数进行约束,即 f = ( ∑ w i ∗ p i + b ) , w i ∗ p i + b ≥ 0 , 0 < | Δ w i | ≤ ε t , Δ ε t 递减, Δ w i 求解采用最速下降法。
ANN方法可求解出精度较高的数值解。具体流程及求解时间见图5,对于求解步骤见表4。
图5. (a) ANN求解流程;(b) 权函数求解过程修正;(c) 训练次数与求解时间关系;(d) 求解时间比较
步骤 | 类别 | 说明 |
---|---|---|
1 | 确定偏微分方程类型,边界 | ∇ 2 Ψ = f ( x , y ) Ψ ( x , y ) = C |
2 | 修正试函数 | 根据边界以修正,但对于双曲尽量选择较小时刻,避免震荡耗散。 |
3 | 设置初始权重wi,bi满足 w i ∗ p i + b > 0 (1) | 满足式(1)即可,但由于解无解因此需要增加 | Δ w i | 约束 |
4 | 如果 | Δ w i | < ε t Goto w(n)+Δwi/2; (2)否则停止训练 | 约束以对权重变化量进行修正,采用最速下降法并修正,防止训练结果发散。 |
5 | 输出训练后数值解并与解析解或FDM比对 |
表4. ANN求解步骤
本文目前论述了人工神经网络ANN与经典有限元FDM求解偏微分方程的区别,得出了以下结论:
1) 采用高斯经典FDM在处理偏微分方程问题时,求解时间较短,但本文只对椭圆型以双曲稳态方程进行了验证,因此FDM方法与ANN方法求解偏微分方程优势较大需要后续更深入研究。
2) ANN方法求解精度取决于权重w设定,变化 Δ w i 愈小求解愈精确,其激活函数修正对计算结果影响较小。
3) 偏微分方程求解精度需要对权重变化率 Δ w i 设定约束条件。
4) 通常求解到 max Δ w i 小于0.1时,求出数值解与解析解误差相对较小。
5) 对二维双曲Burgers方程进行了稳态求解,但对非稳态时变效应及耗散问题还需后续进一步探讨研究。
在此对本文提出修改意见的专家表示感谢,以及对魏大盛和王海辉两位老师对本文的指导提出由衷地感谢!
殷图源,魏大盛,王海辉. 有限差分与人工神经网络方法求解偏微分方程解对比及定性分析Comparison and Qualitative Analysis of Solutions of Partial Differential Equations by Finite Difference Method and Artificial Neural Network Method[J]. 应用数学进展, 2020, 09(12): 2228-2235. https://doi.org/10.12677/AAM.2020.912260