PINN#

class PINN(problem, model, optimizer=None, scheduler=None, weighting=None, loss=None)[source]#

Bases: PINNInterface, SingleSolverInterface

Physics-Informed Neural Network (PINN) solver class. This class implements Physics-Informed Neural Network solver, using a user specified model to solve a specific problem. It can be used to solve both forward and inverse problems.

The Physics Informed Neural Network solver aims to find the solution \(\mathbf{u}:\Omega\rightarrow\mathbb{R}^m\) of a differential problem:

\[\begin{split}\begin{cases} \mathcal{A}[\mathbf{u}](\mathbf{x})=0\quad,\mathbf{x}\in\Omega\\ \mathcal{B}[\mathbf{u}](\mathbf{x})=0\quad, \mathbf{x}\in\partial\Omega \end{cases}\end{split}\]

minimizing the loss function:

\[\mathcal{L}_{\rm{problem}} = \frac{1}{N}\sum_{i=1}^N \mathcal{L}(\mathcal{A}[\mathbf{u}](\mathbf{x}_i)) + \frac{1}{N}\sum_{i=1}^N \mathcal{L}(\mathcal{B}[\mathbf{u}](\mathbf{x}_i)),\]

where \(\mathcal{L}\) is a specific loss function, typically the MSE:

\[\mathcal{L}(v) = \| v \|^2_2.\]

See also

Original reference: Karniadakis, G. E., Kevrekidis, I. G., Lu, L., Perdikaris, P., Wang, S., & Yang, L. (2021). Physics-informed machine learning. Nature Reviews Physics, 3, 422-440. DOI: 10.1038.

Initialization of the PINN class.

Parameters:
loss_phys(samples, equation)[source]#

Computes the physics loss for the physics-informed solver based on the provided samples and equation.

Parameters:
Returns:

The computed physics loss.

Return type:

LabelTensor

configure_optimizers()[source]#

Optimizer configuration for the PINN solver.

Returns:

The optimizers and the schedulers

Return type:

tuple[list[Optimizer], list[Scheduler]]