# Module Scientific.Geometry.TensorAnalysis

## Class TensorField: Tensor field of arbitrary rank

A tensor field is described by a tensor at each point of a three-dimensional rectangular grid. The grid spacing may be non-uniform. Tensor fields are implemented as a subclass of InterpolatingFunction from the module Scientific.Functions.Interpolation and thus share all methods defined in that class.

Constructor: TensorField(rank, axes, values, default=`None`)

rank

  a non-negative integer indicating the tensor rank

axes

  a sequence of three one-dimensional arrays, each of which specifies one coordinate (x, y, z) of the grid points

values

  an array of `rank+3` dimensions. Its first three dimensions correspond to the x, y, z directions and must have lengths compatible with the axis arrays. The remaining dimensions must have length 3.

default

  the value of the field for points outside the grid. A value of `None` means that an exception will be raised for an attempt to evaluate the field outside the grid. Any other value must a tensor of the correct rank.

Evaluation:

- `tensorfield(x, y, z)` (three coordinates)

- `tensorfield(coordinates)` (any sequence containing three coordinates)

Methods:

- zero()

  Returns a tensor of the correct rank with zero elements.

- derivative(variable)

  Returns the derivative with respect to variable, which must be one of 0, 1, or 2.

- allDerivatives()

  Returns all three derivatives (x, y, z).

## Class ScalarField: Scalar field (tensor field of rank 0)

Constructor: ScalarField(axes, values, default=`None`)

A subclass of TensorField.

Methods:

- gradient()

  Returns the gradient (a vector field).

- laplacian()

  Returns the laplacian (a scalar field).

## Class VectorField: Vector field (tensor field of rank 1)

Constructor: VectorField(axes, values, default=`None`)

A subclass of TensorField.

Methods:

- divergence()

  Returns the divergence (a scalar field).

- curl()

  Returns the curl (a vector field).

- strain()

  Returns the strain (a tensor field of rank 2).

- divergenceCurlAndStrain()

  Returns all derivative fields: divergence, curl, and strain.

- laplacian()

  Returns the laplacian (a vector field).

- length()

  Returns a scalar field corresponding to the length (norm) of the vector field.