scimba_torch.numerical_solvers.elliptic_pde.pinns¶
This module defines the PinnsElliptic class.
PinnsElliptic is a subclass of NonlinearGalerkinProjector designed to solve elliptic partial differential equations (PDEs) using physics-informed neural networks (PINNs).
Classes
|
A class extending PinnsElliptic with Anagram preconditioning. |
|
A class extending PinnsElliptic with natural gradient preconditioning. |
|
A class to solve elliptic PDEs using Physics-Informed Neural Networks (PINNs). |
|
A class extending PinnsElliptic with preconditioning. |
- class PinnsElliptic(pde, bc_type='strong', **kwargs)[source]¶
Bases:
CollocationProjectorA class to solve elliptic PDEs using Physics-Informed Neural Networks (PINNs).
- Parameters:
pde (
StrongFormEllipticPDE|LinearOrder2PDE) – The elliptic PDE to be solved, represented as an instance of StrongFormEllipticPDE or LinearOrder2PDE.bc_type (
str) – The type of boundary condition to be applied (“strong” or “weak”). (default: “strong”)**kwargs – Additional keyword arguments for losses and optimizers.
- Raises:
ValueError – when the lengths of in_weights or bc_weights does not match residual_size or bc_residual_size
- get_dof(flag_scope='all', flag_format='list')[source]¶
Gets the parameters of the approximation space in use.
- Parameters:
flag_scope (
str) – Scope of the degrees of freedom to retrieve.flag_format (
str) – Format of the output, either “list” or “tensor”.
- Returns:
Degrees of freedom in the specified format.
- Return type:
torch.Tensor | list
- evaluate(x, mu)[source]¶
Evaluates the approximation at given points.
- Parameters:
x (
LabelTensor) – Input tensor for spatial coordinates.mu (
LabelTensor) – Input tensor for parameters.
- Return type:
- Returns:
The evaluated solution.
- sample_all_vars(**kwargs)[source]¶
Samples collocation points for the PDE and boundary conditions.
- Parameters:
**kwargs (
Any) – Additional keyword arguments for sampling.- Returns:
tuple of sampled tensors.
- Return type:
tuple[LabelTensor, …]
- assembly_post_sampling(data, **kwargs)[source]¶
Assembles the system of equations post-sampling.
- Parameters:
data (
tuple[LabelTensor,...]) – tuple of sampled tensors.**kwargs – Additional keyword arguments.
- Returns:
tuple containing the assembled operator and right-hand side.
- Return type:
tuple
- class PreconditionedPinnsElliptic(**kwargs)[source]¶
Bases:
ABCA class extending PinnsElliptic with preconditioning.
- Parameters:
**kwargs (
Any) – Additional keyword arguments for customization.
- class NaturalGradientPinnsElliptic(pde, bc_type='strong', **kwargs)[source]¶
Bases:
PinnsElliptic,PreconditionedPinnsEllipticA class extending PinnsElliptic with natural gradient preconditioning.
- Parameters:
pde (
StrongFormEllipticPDE|LinearOrder2PDE) – The elliptic PDE to be solved, represented as an instance of StrongFormEllipticPDE or LinearOrder2PDE.bc_type (
str) – The type of boundary condition to be applied (“strong” or “weak”). (default: “strong”)**kwargs – Additional keyword arguments for customization.
- class AnagramPinnsElliptic(pde, bc_type='strong', **kwargs)[source]¶
Bases:
PinnsElliptic,PreconditionedPinnsEllipticA class extending PinnsElliptic with Anagram preconditioning.
- Parameters:
pde (
StrongFormEllipticPDE|LinearOrder2PDE) – The elliptic PDE to be solved, represented as an instance of StrongFormEllipticPDE or LinearOrder2PDE.bc_type (
str) – The type of boundary condition to be applied (“strong” or “weak”). (default: “strong”)**kwargs – Additional keyword arguments for customization.