Gradient Physics Informed Single Model Solver#
Module for the gradient physics-informed single-model solver class.
- class GradientPhysicsInformedSingleModelSolver(problem, model, optimizer=None, scheduler=None, weighting=None, loss=None, regularization_weight=1.0, regularized_conditions=None)[source]
Bases:
PhysicsInformedMixin,GradientEnhancedMixin,SingleModelSolverSingle-model solver for gradient-enhanced physics-informed learning problems.
This solver approximates the solution of a differential problem using a single model and augments the standard physics-informed objective with gradient-enhanced residual terms. It can be used for both forward and inverse problems.
Given a model \(\mathcal{M}\), the predicted solution is
\[\hat{\mathbf{u}}(\mathbf{x}) = \mathcal{M}(\mathbf{x}).\]The solver minimizes both the residuals of the differential operators defining the problem and the gradients of those residuals with respect to the input variables. 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) + \frac{1}{N_{\Omega}} \sum_{i=1}^{N_{\Omega}} \mathcal{L} \left( \nabla_{\mathbf{x}} \mathcal{A}[\hat{\mathbf{u}}](\mathbf{x}_i) \right) + \frac{1}{N_{\partial\Omega}} \sum_{i=1}^{N_{\partial\Omega}} \mathcal{L} \left( \nabla_{\mathbf{x}} \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: Yu, J., Lu, L., Meng, X., & Karniadakis, G. E. (2022). Gradient-enhanced physics-informed neural networks for forward and inverse PDE problems. Computer Methods in Applied Mechanics and Engineering, 393, 114823. DOI: 10.1016/j.cma.2022.114823.
Initialization of the
GradientPhysicsInformedSingleModelSolverclass.- 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, thetorch.optim.Adamoptimizer with a learning rate of0.001is used. Default isNone.scheduler (TorchScheduler) – The scheduler used by the solver. If
None, thetorch.optim.lr_scheduler.ConstantLRscheduler with a factor of1.0is used. Default isNone.weighting (BaseWeighting) – The weighting strategy used to combine condition losses. If
None, no weighting is applied. Default isNone.loss – The loss function used to compute residual losses. If
None,torch.nn.MSELossis used. Default isNone.regularization_weight (float | int) – The weight of the gradient regularization term. Default is
1.0.regularized_conditions – The names of the conditions that should receive gradient regularization. If
None, all conditions are regularized. Default isNone.