4.1.5.1.1 pde.backends.torch.operators.cartesian module

This module implements differential operators on Cartesian grids.

CartesianLaplacian

Cartesian Laplace using torch.

CartesianGradient

Cartesian gradient operator using torch.

CartesianGradientSquared

Cartesian gradient squared operator using torch.

CartesianDivergence

Cartesian divergence operator using torch.

CartesianVectorGradient

Cartesian vector gradient operator using torch.

CartesianVectorLaplacian

Cartesian vector Laplacian operator using torch.

CartesianTensorDivergence

Cartesian tensor divergence operator using torch.

class CartesianDivergence(grid, bcs, *, dtype=<class 'numpy.float64'>)[source]

Bases: TorchOperator

Cartesian divergence operator using torch.

Initialize the Cartesian divergence operator.

Parameters:
  • grid (GridBase) – The grid on which the operator acts

  • bcs (BoundariesList or None) – The boundary conditions applied to the field. If None, no boundary conditions are enforced.

  • dtype (AnyDType) – The data type of the field

forward(arr, args=None)[source]

Fill internal data array, apply operator, and return valid data.

Parameters:

arr (Tensor)

Return type:

Tensor

rank_in = 1

The rank of the input tensor

Type:

int

class CartesianGradient(grid, bcs, *, dtype=<class 'numpy.float64'>)[source]

Bases: TorchOperator

Cartesian gradient operator using torch.

Initialize the Cartesian gradient operator.

Parameters:
  • grid (GridBase) – The grid on which the operator acts

  • bcs (BoundariesList or None) – The boundary conditions applied to the field. If None, no boundary conditions are enforced.

  • dtype (AnyDType) – The data type of the field

forward(arr, args=None)[source]

Fill internal data array, apply operator, and return valid data.

Parameters:

arr (Tensor)

Return type:

Tensor

rank_in = 0

The rank of the input tensor

Type:

int

class CartesianGradientSquared(grid, bcs, *, central=True, dtype=<class 'numpy.float64'>)[source]

Bases: TorchOperator

Cartesian gradient squared operator using torch.

Initialize the Cartesian gradient squared operator.

Parameters:
  • grid (GridBase) – The grid on which the operator acts

  • bcs (BoundariesList or None) – The boundary conditions applied to the field. If None, no boundary conditions are enforced.

  • central (bool) – Whether to use central differences. If False, forward and backward differences are used.

  • dtype (AnyDType) – The data type of the field

forward(arr, args=None)[source]

Fill internal data array, apply operator, and return valid data.

Parameters:

arr (Tensor)

Return type:

Tensor

rank_in = 0

The rank of the input tensor

Type:

int

class CartesianLaplacian(grid, bcs, *, dtype=<class 'numpy.float64'>)[source]

Bases: TorchOperator

Cartesian Laplace using torch.

Initialize the Cartesian Laplacian operator.

Parameters:
  • grid (GridBase) – The grid on which the operator acts

  • bcs (BoundariesList or None) – The boundary conditions applied to the field. If None, no boundary conditions are enforced.

  • dtype (AnyDType) – The data type of the field

forward(arr, args=None)[source]

Fill internal data array, apply operator, and return valid data.

Parameters:

arr (Tensor)

Return type:

Tensor

rank_in = 0

The rank of the input tensor

Type:

int

class CartesianTensorDivergence(grid, bcs, *, dtype=<class 'numpy.float64'>)[source]

Bases: TorchOperator

Cartesian tensor divergence operator using torch.

Initialize the Cartesian tensor divergence operator.

Parameters:
  • grid (GridBase) – The grid on which the operator acts

  • bcs (BoundariesList or None) – The boundary conditions applied to the field. If None, no boundary conditions are enforced.

  • dtype (AnyDType) – The data type of the field

forward(arr, args=None)[source]

Fill internal data array, apply operator, and return valid data.

Parameters:

arr (Tensor)

Return type:

Tensor

rank_in = 2

The rank of the input tensor

Type:

int

class CartesianVectorGradient(grid, bcs, *, dtype=<class 'numpy.float64'>)[source]

Bases: TorchOperator

Cartesian vector gradient operator using torch.

Initialize the Cartesian vector gradient operator.

Parameters:
  • grid (GridBase) – The grid on which the operator acts

  • bcs (BoundariesList or None) – The boundary conditions applied to the field. If None, no boundary conditions are enforced.

  • dtype (AnyDType) – The data type of the field

forward(arr, args=None)[source]

Fill internal data array, apply operator, and return valid data.

Parameters:

arr (Tensor)

Return type:

Tensor

rank_in = 1

The rank of the input tensor

Type:

int

class CartesianVectorLaplacian(grid, bcs, *, dtype=<class 'numpy.float64'>)[source]

Bases: TorchOperator

Cartesian vector Laplacian operator using torch.

Initialize the Cartesian vector Laplacian operator.

Parameters:
  • grid (GridBase) – The grid on which the operator acts

  • bcs (BoundariesList or None) – The boundary conditions applied to the field. If None, no boundary conditions are enforced.

  • dtype (AnyDType) – The data type of the field

forward(arr, args=None)[source]

Fill internal data array, apply operator, and return valid data.

Parameters:

arr (Tensor)

Return type:

Tensor

rank_in = 1

The rank of the input tensor

Type:

int