4.1.6.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)[source]

Bases: TorchDifferentialOperator

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 (np.dtype) – 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)[source]

Bases: TorchDifferentialOperator

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 (np.dtype) – 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)[source]

Bases: TorchDifferentialOperator

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 (np.dtype) – 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)[source]

Bases: TorchDifferentialOperator

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 (np.dtype) – 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)[source]

Bases: TorchDifferentialOperator

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 (np.dtype) – 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)[source]

Bases: TorchDifferentialOperator

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 (np.dtype) – 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)[source]

Bases: TorchDifferentialOperator

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 (np.dtype) – 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