4.1.6.1.4 pde.backends.torch.operators.polar_sym module

This module implements differential operators on polar grids.

PolarLaplacian

Polar Laplace using torch.

PolarGradient

Polar gradient operator using torch.

PolarGradientSquared

Polar gradient squared operator using torch.

PolarDivergence

Polar divergence operator using torch.

PolarVectorGradient

Polar vector gradient operator using torch.

PolarTensorDivergence

Polar tensor divergence operator using torch.

class PolarDivergence(grid, bcs, *, dtype)[source]

Bases: TorchDifferentialOperator

Polar divergence operator using torch.

The polar grid assumes polar symmetry, so that fields only depend on the radial coordinate r. The radial discretization is defined as \(r_i = r_\mathrm{min} + (i + \frac12) \Delta r\) for \(i=0, \ldots, N_r-1\), where \(r_\mathrm{min}\) is the radius of the inner boundary, which is zero by default. Note that the radius of the outer boundary is given by \(r_\mathrm{max} = r_\mathrm{min} + N_r \Delta r\).

Initialize the Polar 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 PolarGradient(grid, bcs, *, dtype, method='central')[source]

Bases: TorchDifferentialOperator

Polar gradient operator using torch.

The polar grid assumes polar symmetry, so that fields only depend on the radial coordinate r. The radial discretization is defined as \(r_i = r_\mathrm{min} + (i + \frac12) \Delta r\) for \(i=0, \ldots, N_r-1\), where \(r_\mathrm{min}\) is the radius of the inner boundary, which is zero by default. Note that the radius of the outer boundary is given by \(r_\mathrm{max} = r_\mathrm{min} + N_r \Delta r\).

Initialize the Polar 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

  • method (str) – The method for calculating the derivative. Possible values are ‘central’, ‘forward’, and ‘backward’.

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 PolarGradientSquared(grid, bcs, *, central=True, dtype)[source]

Bases: TorchDifferentialOperator

Polar gradient squared operator using torch.

The polar grid assumes polar symmetry, so that fields only depend on the radial coordinate r. The radial discretization is defined as \(r_i = r_\mathrm{min} + (i + \frac12) \Delta r\) for \(i=0, \ldots, N_r-1\), where \(r_\mathrm{min}\) is the radius of the inner boundary, which is zero by default. Note that the radius of the outer boundary is given by \(r_\mathrm{max} = r_\mathrm{min} + N_r \Delta r\).

Initialize the Polar 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 PolarLaplacian(grid, bcs, *, dtype)[source]

Bases: TorchDifferentialOperator

Polar Laplace using torch.

The polar grid assumes polar symmetry, so that fields only depend on the radial coordinate r. The radial discretization is defined as \(r_i = r_\mathrm{min} + (i + \frac12) \Delta r\) for \(i=0, \ldots, N_r-1\), where \(r_\mathrm{min}\) is the radius of the inner boundary, which is zero by default. Note that the radius of the outer boundary is given by \(r_\mathrm{max} = r_\mathrm{min} + N_r \Delta r\).

Initialize the Polar 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 PolarTensorDivergence(grid, bcs, *, dtype)[source]

Bases: TorchDifferentialOperator

Polar tensor divergence operator using torch.

The polar grid assumes polar symmetry, so that fields only depend on the radial coordinate r. The radial discretization is defined as \(r_i = r_\mathrm{min} + (i + \frac12) \Delta r\) for \(i=0, \ldots, N_r-1\), where \(r_\mathrm{min}\) is the radius of the inner boundary, which is zero by default. Note that the radius of the outer boundary is given by \(r_\mathrm{max} = r_\mathrm{min} + N_r \Delta r\).

Initialize the Polar 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 PolarVectorGradient(grid, bcs, *, dtype)[source]

Bases: TorchDifferentialOperator

Polar vector gradient operator using torch.

The polar grid assumes polar symmetry, so that fields only depend on the radial coordinate r. The radial discretization is defined as \(r_i = r_\mathrm{min} + (i + \frac12) \Delta r\) for \(i=0, \ldots, N_r-1\), where \(r_\mathrm{min}\) is the radius of the inner boundary, which is zero by default. Note that the radius of the outer boundary is given by \(r_\mathrm{max} = r_\mathrm{min} + N_r \Delta r\).

Initialize the Polar 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