Vector Calculus

class findiff.Gradient(**kwargs)

The N-dimensional gradient.

\[\nabla = \left(\frac{\partial}{\partial x_0}, \frac{\partial}{\partial x_1}, ... , \frac{\partial}{\partial x_{N-1}}\right)\]
Parameters:

kwargs

exactly one of h and coords must be specified

h

list with the grid spacings of an N-dimensional uniform grid

coords

list of 1D arrays with the coordinate values along the N axes. This is used for non-uniform grids.

acc

accuracy order, must be positive integer, default is 2

Constructor for the VectorOperator base class.

kwargs:

h list with the grid spacings of an N-dimensional uniform grid

coords list of 1D arrays with the coordinate values along the N axes.

This is used for non-uniform grids.

Either specify “h” or “coords”, not both.

class findiff.Divergence(**kwargs)

The N-dimensional divergence.

\[{\rm \bf div} = \nabla \cdot\]
Parameters:

kwargs

exactly one of h and coords must be specified

h

list with the grid spacings of an N-dimensional uniform grid

coords

list of 1D arrays with the coordinate values along the N axes. This is used for non-uniform grids.

acc

accuracy order, must be positive integer, default is 2

Constructor for the VectorOperator base class.

kwargs:

h list with the grid spacings of an N-dimensional uniform grid

coords list of 1D arrays with the coordinate values along the N axes.

This is used for non-uniform grids.

Either specify “h” or “coords”, not both.

class findiff.Curl(**kwargs)

The curl operator.

\[{\rm \bf rot} = \nabla \times\]

In 3D, maps a vector field to a vector field. In 2D, maps a vector field to a scalar (the z-component of the curl).

Parameters:

kwargs

exactly one of h and coords must be specified

h

list with the grid spacings of a 2- or 3-dimensional uniform grid

coords

list of 1D arrays with the coordinate values along the 2 or 3 axes. This is used for non-uniform grids.

acc

accuracy order, must be positive integer, default is 2

Constructor for the VectorOperator base class.

kwargs:

h list with the grid spacings of an N-dimensional uniform grid

coords list of 1D arrays with the coordinate values along the N axes.

This is used for non-uniform grids.

Either specify “h” or “coords”, not both.

class findiff.Laplacian(h=None, acc=2, coords=None)

The N-dimensional Laplace operator.

\[{\rm \bf \nabla^2} = \sum_{k=0}^{N-1} \frac{\partial^2}{\partial x_k^2}\]
Parameters:
  • h – list of grid spacings for a uniform grid

  • coords – list of 1D coordinate arrays for a non-uniform grid

  • acc – accuracy order, must be positive integer, default is 2

Exactly one of h and coords must be specified.