4.1.6.1.2 pde.backends.torch.operators.common module
This module implements infrastructure for differential operators using torch.
Base class for differential operators implemented in torch. |
- class TorchDifferentialOperator(grid, bcs, *, dtype)[source]
Bases:
TorchOperatorBaseBase class for differential 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 (DTypeLike) – The data type of the field using the numpy convention
- 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.args – Additional arguments passed to ghost cell setters, e.g., the time t.
- Returns:
The full data array including ghost cells with boundary conditions applied if necessary.
- Return type:
- 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
- class TorchIntegralOperator(grid, *, dtype)[source]
Bases:
TorchOperatorBaseOperator integrating a field implemented in torch.
Initialize the torch operator.
- Parameters:
grid (
GridBase) – The grid on which the operator actsdtype (DTypeLike) – The data type of the field