Physics Informed Single Model Solver#

Module for the physics-informed single-model solver class.

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

Bases: PhysicsInformedMixin, SingleModelSolver

Single-model solver for physics-informed learning problems.

This solver approximates the solution of a differential problem using a single model. It is intended for problems whose conditions may include supervised data, equation residuals evaluated on input points, and equation residuals sampled from domains.

Given a model \(\mathcal{M}\), the predicted solution is

\[\hat{\mathbf{u}}(\mathbf{x}) = \mathcal{M}(\mathbf{x}).\]

The solver minimizes the residuals of the differential operators defining the problem. For a problem with governing equation operator \(\mathcal{A}\) in the domain \(\Omega\) and boundary operator \(\mathcal{B}\) on the boundary \(\partial\Omega\), the objective can be written as

\[\mathcal{L}_{\mathrm{problem}} = \frac{1}{N_{\Omega}} \sum_{i=1}^{N_{\Omega}} \mathcal{L} \left( \mathcal{A}[\hat{\mathbf{u}}](\mathbf{x}_i) \right) + \frac{1}{N_{\partial\Omega}} \sum_{i=1}^{N_{\partial\Omega}} \mathcal{L} \left( \mathcal{B}[\hat{\mathbf{u}}](\mathbf{x}_i) \right),\]

where \(\mathcal{L}\) is the selected loss function, typically the mean squared error.

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/s42254-021-00314-5.

Initialization of the PhysicsInformedSingleModelSolver class.

Parameters:
  • problem (BaseProblem) – The problem to be solved.

  • model (torch.nn.Module) – The model used by the solver.

  • optimizer (TorchOptimizer) – The optimizer used by the solver. If None, the torch.optim.Adam optimizer with a learning rate of 0.001 is used. Default is None.

  • scheduler (TorchScheduler) – The scheduler used by the solver. If None, the torch.optim.lr_scheduler.ConstantLR scheduler with a factor of 1.0 is used. Default is None.

  • weighting (BaseWeighting) – The weighting strategy used to combine condition losses. If None, no weighting is applied. Default is None.

  • loss – The loss function used to compute residual losses. If None, torch.nn.MSELoss is used. Default is None.