TensorFunction
TensorFunction(self, *args, **kwargs)
Tensor valued Function represented as a Matrix. Each component is a Function or TimeFunction.
A TensorFunction and the classes that inherit from it takes the same parameters as a DiscreteFunction and additionally:
Parameters
Name  Type  Description  Default 

name 
str  Name of the symbol.  required 
grid 
Grid  Carries shape, dimensions, and dtype of the TensorFunction. When grid is not provided, shape and dimensions must be given. For MPI execution, a Grid is compulsory.  required 
space_order 
int or 3tuple of ints  Discretisation order for space derivatives. space_order also impacts the number of points available around a generic point of interest. By default, space_order points are available on both sides of a generic point of interest, including those nearby the grid boundary. Sometimes, fewer points suffice; in other scenarios, more points are necessary. In such cases, instead of an integer, one can pass a 3tuple (o, lp, rp) indicating the discretization order (o ) as well as the number of points on the left (lp ) and right (rp ) sides of a generic point of interest. 
1 
shape 
tuple of ints  Shape of the domain region in grid points. Only necessary if grid isn’t given. 
required 
dimensions 
tuple of Dimension  Dimensions associated with the object. Only necessary if grid isn’t given. 
required 
dtype 
data  type  Any object that can be interpreted as a numpy data type.  np.float32 
staggered 
Dimension or tuple of Dimension or Stagger  Staggering of each component, needs to have the size of the tensor. Defaults to the Dimensions.  required 
initializer 
callable or any object exposing the buffer interface  Data initializer. If a callable is provided, data is allocated lazily.  required 
allocator 
MemoryAllocator  Controller for memory allocation. To be used, for example, when one wants to take advantage of the memory hierarchy in a NUMA architecture. Refer to default_allocator.__doc__ for more information. 
required 
padding 
int or tuple of ints  Allocate extra grid points to maximize data access alignment. When a tuple of ints, one int per Dimension should be provided.  required 
symmetric 
bool  Whether the tensor is symmetric or not.  True 
diagonal 
Bool  Whether the tensor is diagonal or not.  False 
Attributes
Name  Description 

is_diagonal  Whether the tensor is diagonal. 
laplace  Laplacian of the TensorFunction. 
space_dimensions  Spatial dimensions. 
space_order  The space order for all components. 
Methods
Name  Description 

div  Divergence of the TensorFunction (is a VectorFunction). 
laplacian  Laplacian of the TensorFunction with shifted derivatives and custom 
div
div(shift=None, order=None, method='FD')
Divergence of the TensorFunction (is a VectorFunction).
Parameters
Name  Type  Description  Default 

shift 
Shift for the center point of the derivative in number of gridpoints  None 

order 
Discretization order for the finite differences. Uses func.space_order when not specified 
None 

method 
Discretization method. Options are ‘FD’ (default) and ‘RSFD’ (rotated staggered grid finitedifference).  'FD' 
laplacian
laplacian(shift=None, order=None)
Laplacian of the TensorFunction with shifted derivatives and custom FD order.
Each second derivative is leftright (i.e D^T D with D the first derivative ): (self.dx(x0=dim+shift*dim.spacing, fd_order=order)).dx(x0=dimshift*dim.spacing, fd_order=order)
Parameters
Name  Type  Description  Default 

shift 
Shift for the center point of the derivative in number of gridpoints  None 

order 
Discretization order for the finite differences. Uses func.space_order when not specified 
None 