©PaperWeekly 原创 · 作者 | zwqwo

Kansa 法直接假设有以下的形式：

Wang, Nanzhe, Haibin Chang, and Dongxiao Zhang. “Theory-guided auto-encoder for surrogate construction and inverse modeling.” Computer Methods in Applied Mechanics and Engineering 385 (2021): 114037.

Dissanayake, M. W. M. G., and Nhan Phan‐Thien. “Neural‐network‐based approximations for solving partial differential equations.” communications in Numerical Methods in Engineering 10.3 (1994): 195-201.

#### Lu, Lu, et al. “DeepXDE: A deep learning library for solving differential equations.” SIAM Review 63.1 (2021): 208-228.

PINN 算法本质上是一种无网格技术，通过将直接求解控制方程的问题转换为损失函数的优化问题来找到偏微分方程解。

```import torch
# 定义区域及其上的采样
def interior(n=1000):
x = torch.rand(n, 1)
y = torch.rand(n, 1)
cond = (2 - x ** 2) * torch.exp(-y)
# 定义内部损失
loss = torch.nn.MSELoss()
if order == 1:
create_graph=True,
only_inputs=True, )[0]
else:
order=order - 1)
def l_interior(u):
x, y, cond = interior()
uxy = u(torch.cat([x, y], dim=1))

`l_down_yy`

`l_interior`

`l_down_yy`

`l_up_yy`

`l_down`

`l_up`

```u = MLP()
# neuron number 2, 32, 32, 32, 32, 1
# with tanh()
for i in range(10000):
l = l_interior(u) \
+ l_up_yy(u) \
+ l_down_yy(u) \
+ l_up(u) \
+ l_down(u) \
+ l_left(u) \
+ l_right(u)
l.backward()
opt.step()```

```xc = torch.linspace(0, 1, 100)
xx, yy = torch.meshgrid(xc, xc)
xx = xx.reshape(-1, 1)
yy = yy.reshape(-1, 1)
xy = torch.cat([xx, yy], dim=1)
u_pred = u(xy)
print("Max abs error is: "), print(float(torch.max(torch.abs(u_pred - xx * xx * torch.exp(-yy)))))```

https://github.com/zwqwo/PINN_scratch/blob/main/PINN.py

Wang, Sifan, Yujun Teng, and Paris Perdikaris. “Understanding and mitigating gradient flow pathologies in physics-informed neural networks.” SIAM Journal on Scientific Computing 43.5 (2021): A3055-A3081.（参数梯度流的角度）

Liu, Dehao, and Yan Wang. “A Dual-Dimer method for training physics-constrained neural networks with minimax architecture.” Neural Networks 136 (2021): 112-125.（建模为极小极大问题，不断对大损失项进行惩罚）

Xiang, Zixue, et al. “Self-adaptive loss balanced Physics-informed neural networks for the incompressible Navier-Stokes equations.” arXiv preprint arXiv:2104.06217 (2021).（将权重与损失的方差关联，建模为概率模型）

CFD 与其说是计算科学，更像是一门实验科学，需要物理实验数据来对解算的模型进行验证，还面临诸多困难。比如目前已有的各类 CFD 方法并不能很好地融合各类保真数据。在工程模型中，可能还涉及逆问题的求解，也就是边界条件和流体的各种参数未知的情形下，如何通过部分测量数据得到精确的模型参数和流场的重构。再者，CFD 网格质量对结果的影响比较大，计算中网格划分本身也是非常耗时的。最后，目前的 CFD 软件都非常庞大，比如 OpenFoam，对每一类问题都有专门的求解模块，拥有超过 10 万行的科学计算代码，其更新与维护也是一件难事。

#### Wang, Hongping, Yi Liu, and Shizhao Wang. “Dense velocity reconstruction from particle image velocimetry/particle tracking velocimetry using a physics-informed neural network.” Physics of Fluids 34.1 (2022): 017116.

Raissi, Maziar, Alireza Yazdani, and George Em Karniadakis. “Hidden fluid mechanics: Learning velocity and pressure fields from flow visualizations.” Science 367.6481 (2020): 1026-1030.

Meng, Xuhui, et al. “PPINN: Parareal physics-informed neural network for time-dependent PDEs.” Computer Methods in Applied Mechanics and Engineering 370 (2020): 113250.

Moseley, Ben, Andrew Markham, and Tarje Nissen-Meyer. “Finite Basis Physics-Informed Neural Networks (FBPINNs): a scalable domain decomposition approach for solving differential equations.” arXiv preprint arXiv:2107.07871 (2021).

Lyu, Liyao, et al. “MIM: A deep mixed residual method for solving high-order partial differential equations.” Journal of Computational Physics (2022): 110930.

Chen, Yuntian, et al. “Theory-guided hard constraint projection (HCP): A knowledge-based data-driven scientific machine learning method.” Journal of Computational Physics 445 (2021): 110624.

Wen, P. H., and M. H. Aliabadi. “A hybrid finite difference and moving least square method for elasticity problems.” Engineering analysis with boundary elements 36.4 (2012): 600-605.

Dwivedi, V., & Srinivasan, B. (2020). Physics informed extreme learning machine (pielm)–a rapid method for the numerical solution of partial differential equations. Neurocomputing, 391, 96-118.

#### Schiassi, Enrico, et al. “Physics-Informed Neural Networks for Optimal Planar Orbit Transfers.” Journal of Spacecraft and Rockets (2022): 1-16.

Treibert, Sarah, and Matthias Ehrhardt. “An Unsupervised Physics-Informed Neural Network to Model COVID-19 Infection and Hospitalization Scenarios.” (2021).

Barreau, Matthieu, et al. “Physics-informed learning for identification and state reconstruction of traffic density.” arXiv preprint arXiv:2103.13852 (2021).

PINN的求解库

PINN 作为一种发展了近五年的方法，算法本身也非常容易实现。因此基于各种语言或者框架，PINN 也有了若干个求解库了。

DeepXDE，布朗大学 Lu 博士开发的，就是 DeepONet 那位 Lu 博士。他们组是本次 PINN 潮流的先驱，应该算是第一款也是“官方”的 PINN 求解器。集成了基于残差的自适应细化（RAR），这是一种在训练阶段优化残差点分布的策略，即在偏微分方程残差较大的位置添加更多点。还支持基于构造实体几何 （CSG） 技术的复杂几何区域定义。

NeuroDiffEq，基于 PyTorch。NeuroDiffEq 通过硬约束来构造 NN 满足初始/边界条件，细分下来叫 PCNN（Physics Constrained Neural Network），由于要设计特定的边界，这种方式会受限于对边界的具体形式。

Modulus，Nvidia 公司发布的，之前叫做 SimNet，既然是显卡公司开发的，那幺或许可以期待有比较好的硬件性能优化大型工业算例。

SciANN，基于 Keras 包封装的实现的。SciANN 里面有比较丰富的应用示例，包括弹性、结构力学和振动应用等。基于这个库有了不少文章。

NeuralPDE.jl，看名字就知道是基于 Julia 语言开发的，是 SciML 大项目的一部分。

ADCME，基于 TensorFlow 开发的，有一些非线性方程的例子，比如非线性弹性、NS 问题和 Burgers 方程。

TensorDiffEq，看名字就知道是基于 Tensorflow，特点是做分布式计算。主旨是通过可伸缩（scalable）计算框架来求解 PINN，明显是为大规模工业应用做铺垫。

IDRLnet，国内团队发布的基于 Pytorch 和 sympy 的开源求解器，包含了鲁棒参数估计、变分极小化问题（比如极小曲面计算）、积分方程求解、参数化代理模型等基础算例。

Elvet，可以求解 PDE 和变分极小化问题（如悬链线计算）的 Python 库。

Nangs，Python 框架，貌似没有更新了。

PyDEns，一个小型框架，貌似没有更新了。

#### 参考文献

[1] Thuerey, Nils, et al. “Physics-based Deep Learning.” arXiv preprint arXiv:2109.05237 (2021).

[2] Cai, Shengze, et al. “Physics-informed neural networks (PINNs) for fluid mechanics: A review.” Acta Mechanica Sinica(2022): 1-12.

[3] Karniadakis, George Em, et al. “Physics-informed machine learning.” Nature Reviews Physics 3.6 (2021): 422-440.

[4] Lu, Lu, et al. “DeepXDE: A deep learning library for solving differential equations.” SIAM Review 63.1 (2021): 208-228.

[5] Cuomo, Salvatore, et al. “Scientific Machine Learning through Physics-Informed Neural Networks: Where we are and What’s next.” arXiv preprint arXiv:2201.05624 (2022).