4.1.1.1.4 pde.backends.jax.operators.spherical_sym module

This module implements differential operators on spherical grids.

make_laplace

Make a discretized laplace operator for a spherical grid.

make_gradient

Make a discretized gradient operator for a spherical grid.

make_gradient_squared

Make a discretized gradient squared operator for a spherical grid.

make_divergence

Make a discretized divergence operator for a spherical grid.

make_vector_gradient

Make a discretized vector gradient operator for a spherical grid.

make_tensor_divergence

Make a discretized tensor divergence operator for a spherical grid.

make_tensor_double_divergence

Make a discretized tensor double divergence operator for a spherical grid.

make_divergence(grid, *, conservative=None, method='central')[source]

Make a discretized divergence operator for a spherical grid.

Warning

This operator ignores the θ-component of the field when calculating the divergence. This is because the resulting scalar field could not be expressed on a SphericalSymGrid.

Parameters:
  • grid (SphericalSymGrid) – The polar grid for which this operator will be defined

  • conservative (bool) – Flag indicating whether the operator should be conservative (which results in slightly slower computations). Conservative operators ensure mass conservation. If None, the value is read from the configuration option operators.conservative_stencil.

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

Returns:

A function that can be applied to an array of values

Return type:

OperatorImplType

make_gradient(grid, *, method='central')[source]

Make a discretized gradient operator for a spherical grid.

Parameters:
  • grid (SphericalSymGrid) – The spherical grid for which this operator will be defined

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

Returns:

A function that can be applied to an array of values

Return type:

OperatorImplType

make_gradient_squared(grid, *, central=True)[source]

Make a discretized gradient squared operator for a spherical grid.

Parameters:
  • grid (SphericalSymGrid) – The spherical grid for which this operator will be defined

  • central (bool) – Whether a central difference approximation is used for the gradient operator. If this is False, the squared gradient is calculated as the mean of the squared values of the forward and backward derivatives.

Returns:

A function that can be applied to an array of values

Return type:

OperatorImplType

make_laplace(grid, *, conservative=None)[source]

Make a discretized laplace operator for a spherical grid.

Parameters:
  • grid (SphericalSymGrid) – The spherical grid for which this operator will be defined

  • conservative (bool) – Flag indicating whether the laplace operator should be conservative (which results in slightly slower computations). Conservative operators ensure mass conservation. If None, the value is read from the configuration option operators.conservative_stencil.

Returns:

A function that can be applied to an array of values

Return type:

OperatorImplType

make_tensor_divergence(grid, *, conservative=False)[source]

Make a discretized tensor divergence operator for a spherical grid.

Parameters:
  • grid (SphericalSymGrid) – The spherical grid for which this operator will be defined

  • conservative (bool) – Flag indicating whether the operator should be conservative (which results in slightly slower computations). Conservative operators ensure mass conservation. If None, the value is read from the configuration option operators.conservative_stencil.

Returns:

A function that can be applied to an array of values

Return type:

OperatorImplType

make_tensor_double_divergence(grid, *, conservative=None)[source]

Make a discretized tensor double divergence operator for a spherical grid.

Parameters:
  • grid (SphericalSymGrid) – The spherical grid for which this operator will be defined

  • conservative (bool) – Flag indicating whether the operator should be conservative (which results in slightly slower computations). Conservative operators ensure mass conservation. If None, the value is read from the configuration option operators.conservative_stencil.

Returns:

A function that can be applied to an array of values

Return type:

OperatorImplType

make_vector_gradient(grid, *, method='central')[source]

Make a discretized vector gradient operator for a spherical grid.

Warning

This operator ignores the two angular components of the field when calculating the gradient. This is because the resulting field could not be expressed on a SphericalSymGrid.

Parameters:
  • grid (SphericalSymGrid) – The spherical grid for which this operator will be defined

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

Returns:

A function that can be applied to an array of values

Return type:

OperatorImplType