4.1.5.1.2 pde.backends.torch.operators.common module
This module implements infrastructure for differential operators using torch.
Base class for operators implemented in torch. |
- class IntegralOperator(grid, *, dtype=<class 'numpy.float64'>)[source]
Bases:
ModuleOperator integrating a field implemented in torch.
Initialize the torch operator.
- Parameters:
grid (
GridBase) – The grid on which the operator actsdtype – The data type of the field
- class TorchOperator(grid, bcs, *, dtype=<class 'numpy.float64'>)[source]
Bases:
ModuleBase class for operators implemented in torch.
Initialize the torch operator.
- Parameters:
grid (
GridBase) – The grid on which the operator actsbcs (
BoundariesListor None) – The boundary conditions applied to the field. If None, no boundary conditions are enforced and it is assumed that the operator is applied to the full field.dtype – The data type of the field
- data_full: Tensor
- get_full_data(arr, args=None)[source]
Get full data array including ghost cells.
- Parameters:
arr (
torch.Tensor) – The input data. If boundary conditions are applied, this should contain only the valid grid points. Otherwise, it should already include ghost cells.- Returns:
The full data array including ghost cells with boundary conditions applied if necessary.
- Return type:
- set_ghost_cells(args=None)[source]
Return function that sets the ghost cells on a full array.
- Parameters:
boundaries (
BoundariesBase) – Defines the boundary conditions for a particular grid, for which the setter should be defined.- Returns:
Callable with signature
(data_full: NumericArray, args=None), which sets the ghost cells of the full data, potentially using additional information in args (e.g., the time t during solving a PDE)
- set_valid(arr)[source]
Set valid data in the internal full array.
- Parameters:
arr (
torch.Tensor) – The data of the valid grid points- Return type:
None