有限差分与人工神经网络方法求解偏微分方程解对比及定性分析
Comparison and Qualitative Analysis of Solutions of Partial Differential Equations by Finite Difference Method and Artificial Neural Network Method
摘要: 本文对人工神经网络方法(ANN)求解偏微分方程进行了研究,选择特定偏微分方程将求解结果与经典有限差分方法(FDM)进行了比对,最后得出在样本与训练次数选择恰当时,ANN方法可以得出相对较精确的数值解,但需要选取恰当权重与激活函数,并对现有激活函数提出了修正。具体通过Lagaris发表文献以复算计结果并进行了分析与探讨,更详细地揭示计算求解注意事项,最后结论得出权重训练次数后每次迭代梯度愈小与解析解越接近,而激活函数改变对计算结果影响较小。此外对双曲二维Burgers方程进行了稳态求解在100次训练过程后,但对非稳态及耗散损失还需后续进一步探讨研究。
Abstract: 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.
文章引用:殷图源, 魏大盛, 王海辉. 有限差分与人工神经网络方法求解偏微分方程解对比及定性分析[J]. 应用数学进展, 2020, 9(12): 2228-2235. https://doi.org/10.12677/AAM.2020.912260

1. 引言

目前偏微分方程数值求解通常采用有限节点差分FDM方法,其可以保持较高精度,但随着智能算法如神经网络、遗传等不断发展,在偏微分方程有所应用 [1]。如Lagaris, Isaac E早期首次将ANN应用在偏微分方程,但由于年份较远,细节论证讨论相对不清晰 [2]。杨云磊对常微分方程进行了数值求解,但仅讨论了常微分方程(ODE),并且为强制边界 [3],康奈尔大学MALLS也将常微分方程进行了数值求解,并讨论了收敛机理 [4],但上述仅讨论ODE,未提及偏微分方程求解计算与权重函数迭代增量收敛性故不具备较深参考性。因此为完善ANN计算应用,本文对Lagaris早期发表的文献进行复算与更详尽说明,并对双曲方程做了求解应用,更好地明晰了求解过程,但对非稳态及耗散与CFD格式精度关联还需后续进一步探讨研究。

2. 分析

目前FDM对求解PDE方法较为成熟,对一般偏微分方程通常采用有点差分法,通过节点加密并迭代求得数值解。而ANN采用改变过程变量权重,并经过训练以达到数值解,具体流程见图1(a)~(d),这里不再系统阐述。

3. 具体案例求解

例1 求解非其次泊松方程(文献 [2] problem7)以计算求解:

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

(a) (b) (c) (d)

Figure 1. (a) Solution flow of FDM method; (b) ANN solution process; (c) ANN process; (d) ANN method weighting process

图1. (a) FDM方法求解流程;(b) ANN方法求解流程;(c) ANN流程;(d) ANN方法加权过程

(a) (b) (c) (d) (e) (f)

Figure 2. (a) FDM method to solve the numerical results; (b) ANN solution results (T = 1); (c) Solution result of ANN method (T = 10); (d) ANN solution results (T = 50); (e) Error of the solution and analytic solution of the e ANN method (T = 10); (f) Error of solving and analytic solution by F ANN method (T = 50)

图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)区间。

Table 1. Description of ANN method parameter setting and solution results

表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

(a) (b) (c) (a) (b) (c)

Figure 3. (a) Analytic solution results; (b) FDM numerical solution results; (c) ANN solution result (T = 10); (d) ANN solution results (T = 50); (e) Error of solution and analytic solution in The METHOD of E ANN (T = 10); (f) Error of solving and analytic solution by F ANN method (T = 50)

图3. (a) 解析解结果;(b) FDM数值解结果;(c) ANN方法求解结果(T = 10);(d) ANN方法求解结果(T = 50);(e) ANN方法求解与解析解求解误差(T = 10);(f) ANN方法求解与解析解求解误差(T = 50)

表2 problem5例求解参数设置与结果说明。

Table 2. Solution parameter setting and solution result description

表2. 求解参数设置与求解结果说明

例3 求解稳态二维Burgers双曲方程根据文献 [5]。

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初始时刻,以求解稳态方程。

(a) (b) (a) (b)

Figure 4. (a) Analytic solution image; (b) ANN solution results (T = 10); (c) ANN solution results (T = 100); (d) ANN solution and analytic solution residue (T = 100)

图4. (a) 解析解图像;(b) ANN方法求解结果(T = 10);(c) ANN方法求解结果(T = 100);(d) ANN方法求解与解析解残差(T = 100)

Burgers双曲方程参数设置与求解结果见表3

Table 3. Parameter setting of the solution method and description of the solution results

表3. 求解方法参数设置与求解结果说明

通过计算可知,ANN同样适用与双曲方程但求解精度有所下降,这与双曲方程不稳定性有关(库朗数CFL < 1)。但由于本案例处理稳态问题,因此得出ANN对稳态双曲同样适用,但处理非稳态问题还需再探讨。图4(c)结果偏小是由于ANN训练结果从下界逼近真实解析解。

4. 讨论

根据上述计算结果可知,对ANN求解偏微分方程精确,需要对权重函数进行约束,即 f = ( w i p i + b ) , w i p i + b 0 0 < | Δ w i | ε t Δ ε t 递减, Δ w i 求解采用最速下降法。

ANN方法可求解出精度较高的数值解。具体流程及求解时间见图5,对于求解步骤见表4

(a) (b) (c)

Figure 5. (a) ANN solution process; (b) Weight function solution process correction; (c) Is the relationship between training times and solution time; (d) Comparison of solution time

图5. (a) ANN求解流程;(b) 权函数求解过程修正;(c) 训练次数与求解时间关系;(d) 求解时间比较

Table 4. ANN solving steps

表4. ANN求解步骤

5. 结语

本文目前论述了人工神经网络ANN与经典有限元FDM求解偏微分方程的区别,得出了以下结论:

1) 采用高斯经典FDM在处理偏微分方程问题时,求解时间较短,但本文只对椭圆型以双曲稳态方程进行了验证,因此FDM方法与ANN方法求解偏微分方程优势较大需要后续更深入研究。

2) ANN方法求解精度取决于权重w设定,变化 Δ w i 愈小求解愈精确,其激活函数修正对计算结果影响较小。

3) 偏微分方程求解精度需要对权重变化率 Δ w i 设定约束条件。

4) 通常求解到 max Δ w i 小于0.1时,求出数值解与解析解误差相对较小。

5) 对二维双曲Burgers方程进行了稳态求解,但对非稳态时变效应及耗散问题还需后续进一步探讨研究。

致谢

在此对本文提出修改意见的专家表示感谢,以及对魏大盛和王海辉两位老师对本文的指导提出由衷地感谢!

NOTES

*通讯作者。

参考文献

[1] 侯媛彬. 神经网络[M]. 西安: 西安电子科技大学出版社, 2007.
[2] Lagarisie, L. (1998) Artificial Neural Networks for Solving Ordinary and Partial Differential Equations. IEEE Transactions on Neural Networks, 9, 987-1000.
https://doi.org/10.1109/72.712178
[3] 杨云磊, 张天乐, 侯木舟, 等. 一类微分方程两点边值问题的神经网络方法应用研究[J]. 徐州工程学院学报(自然科学版), 2018, 33(128): 63-69.
[4] Chakravertys, M. (2016) Application of Legendre Neural Network for Solving Ordinary Differentiate Equations. Applied Computing, 43, 347-356.
https://doi.org/10.1016/j.asoc.2015.10.069
[5] 李荣华. 偏微分方程数值解[M]. 北京: 高等教育出版社, 2007.