# discretize.utils.TensorType# class discretize.utils.TensorType(mesh, tensor)[source]#

Class for determining property tensor type.

For a given mesh, the TensorType class examines the numpy.ndarray tensor to determine whether tensor defines a scalar, isotropic, diagonal anisotropic or full tensor anisotropic constitutive relationship for each cell on the mesh. The general theory behind this functionality is explained below.

Parameters
meshdiscretize.base.BaseTensorMesh

An instance of any of the mesh classes support in discretize; i.e. TensorMesh, CylindricalMesh, TreeMesh or CurvilinearMesh.

tensornumpy.ndarray or a float

The shape of the input argument tensor must fall into one of these classifications:

• Scalar: A float is entered.

• Isotropic: A 1D numpy.ndarray with a property value for every cell.

• Anisotropic: A (nCell, dim) numpy.ndarray of shape where each row defines the diagonal-anisotropic property parameters for each cell. nParam = 2 for 2D meshes and nParam = 3 for 3D meshes.

• Tensor: A (nCell, nParam) numpy.ndarray where each row defines the full anisotropic property parameters for each cell. nParam = 3 for 2D meshes and nParam = 6 for 3D meshes.

Notes

The relationship between a quantity and its response to external stimuli (e.g. Ohm’s law) can be defined by a scalar quantity:

$\vec{j} = \sigma \vec{e}$

Or in the case of anisotropy, the relationship is defined generally by a symmetric tensor:

$\begin{split}\vec{j} = \Sigma \vec{e} \;\;\; where \;\;\; \Sigma = \begin{bmatrix} \sigma_{xx} & \sigma_{xy} & \sigma_{xz} \\ \sigma_{xy} & \sigma_{yy} & \sigma_{yz} \\ \sigma_{xz} & \sigma_{yz} & \sigma_{zz} \end{bmatrix}\end{split}$

In 3D, the tensor is defined by 6 independent element (3 independent elements in 2D). When using the input argument tensor to define the consitutive relationship for every cell in the mesh, there are 4 classifications recognized by discretize:

• Scalar: $$\vec{j} = \sigma \vec{e}$$, where $$\sigma$$ a constant. Thus the input argument tensor is a float.

• Isotropic: $$\vec{j} = \sigma \vec{e}$$, where $$\sigma$$ varies spatially. Thus the input argument tensor is a 1D array that provides a $$\sigma$$ value for every cell in the mesh.

• Anisotropic: $$\vec{j} = \Sigma \vec{e}$$, where the off-diagonal elements are zero. That is, $$\Sigma$$ is diagonal. In this case, the input argument tensor defining the physical properties in each cell is a numpy.ndarray of shape (nCells, dim).

• Tensor: $$\vec{j} = \Sigma \vec{e}$$, where off-diagonal elements are non-zero and $$\Sigma$$ is a full tensor. In this case, the input argument tensor defining the physical properties in each cell is a numpy.ndarray of shape (nCells, nParam). In 2D, nParam = 3 and in 3D, nParam = 6.