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

AnagramPinnsElliptic(pde[, bc_type])

A class extending PinnsElliptic with Anagram preconditioning.

NaturalGradientPinnsElliptic(pde[, bc_type])

A class extending PinnsElliptic with natural gradient preconditioning.

PinnsElliptic(pde[, bc_type])

A class to solve elliptic PDEs using Physics-Informed Neural Networks (PINNs).

class PinnsElliptic(pde, bc_type='strong', **kwargs)[source]

Bases: CollocationProjector

A 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.

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:
Return type:

MultiLabelTensor

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

assembly(**kwargs)[source]

Assembles the system of equations for the PDE.

Assembles also weak boundary conditions if needed.

Parameters:

**kwargs (Any) – Additional keyword arguments.

Return type:

tuple[Tensor, ...]

Returns:

tuple containing the assembled operator and right-hand side.

class NaturalGradientPinnsElliptic(pde, bc_type='strong', **kwargs)[source]

Bases: PinnsElliptic

A 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

A 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.