Module vector
A module for the common differential operators of vector calculus
- class findiff.vector.Curl(**kwargs)
The curl operator.
\[{\rm \bf rot} = \nabla \times\]Is only defined for 3D.
- Parameters:
kwargs –
exactly one of h and coords must be specified
- h
list with the grid spacings of a 3-dimensional uniform grid
- coords
list of 1D arrays with the coordinate values along the 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.vector.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.vector.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.vector.Laplacian(h=[1.0], acc=2)
The N-dimensional Laplace operator.
\[{\rm \bf \nabla^2} = \sum_{k=0}^{N-1} \frac{\partial^2}{\partial x_k^2}\]- 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
- class findiff.vector.VectorOperator(**kwargs)
Base class for all vector differential operators. Shall not be instantiated directly, but through the child classes.
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.
- findiff.vector.wrap_in_ndarray(value)
Wraps the argument in a numpy.ndarray.
If value is a scalar, it is converted in a list first. If value is array-like, the shape is conserved.