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:
- mesh
discretize.base.BaseTensorMesh
An instance of any of the mesh classes support in discretize; i.e. TensorMesh, CylindricalMesh, TreeMesh or CurvilinearMesh.
- tensor
numpy.ndarray
ora
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.
- mesh
Notes
The relationship between a quantity and its response to external stimuli (e.g. Ohm’s law) can be defined by a scalar quantity:
Or in the case of anisotropy, the relationship is defined generally by a symmetric tensor:
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:
, where a constant. Thus the input argument tensor is a float.Isotropic:
, where varies spatially. Thus the input argument tensor is a 1D array that provides a value for every cell in the mesh.Anisotropic:
, 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 anumpy.ndarray
of shape (nCells, dim).Tensor:
, 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 anumpy.ndarray
of shape (nCells, nParam). In 2D, nParam = 3 and in 3D, nParam = 6.