物理信息神经网络 (PINNs) 简介

物理信息神经网络(Physics-Informed Neural Networks, PINNs)是将物理约束嵌入深度学习的创新方法。

核心思想

PINNs 通过在损失函数中加入物理方程的残差项,实现数据驱动与物理约束的融合。

对于偏微分方程(PDE)问题,我们考虑如下一般形式:

N[u(x,t)]=f(x,t),xΩ,t[0,T]\mathcal{N}[u(x,t)] = f(x,t), \quad x \in \Omega, \, t \in [0, T]

其中 N\mathcal{N} 是微分算子,uu 是待求解函数,Ω\Omega 是计算域。

损失函数设计

PINNs 的总损失函数由三部分组成:

L=Ldata数据拟合+LPDE物理约束+LBC/IC边界/初始条件\mathcal{L} = \underbrace{\mathcal{L}_{\text{data}}}_{\text{数据拟合}} + \underbrace{\mathcal{L}_{\text{PDE}}}_{\text{物理约束}} + \underbrace{\mathcal{L}_{\text{BC/IC}}}_{\text{边界/初始条件}}

其中,物理约束损失(Residual Loss)定义为:

LPDE=1Nri=1NrN[uθ(xi,ti)]f(xi,ti)2\mathcal{L}_{\text{PDE}} = \frac{1}{N_r} \sum_{i=1}^{N_r} |\mathcal{N}[u_\theta(x_i, t_i)] - f(x_i, t_i)|^2

实现示例

1
2
3
4
5
6
7
8
import torch
import torch.nn as nn

class PINN(nn.Module):
def __init__(self):
super(PINN, self).__init__()
# 网络结构定义
...