discretize.utils.TensorType#

Inheritance diagram of 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:

j=σe

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

j=ΣewhereΣ=[σxxσxyσxzσxyσyyσyzσxzσyzσzz]

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: j=σe, where σ a constant. Thus the input argument tensor is a float.

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

  • Anisotropic: j=Σe, where the off-diagonal elements are zero. That is, Σ 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: j=Σe, where off-diagonal elements are non-zero and Σ 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.