This package provides an easy-to-use API to represent symbolic second-order and fourth-order tensors. Various representations frequently used in physics are provided and conversion between them can be obtained.
Compared to mechkit, the scope of this package is not limited to continuum mechanics since these representations can be used for other domains.
The API is inspired from scipy.spatial.transform.Rotation:
- Representing an existing tensor is performed by
as_...
methods. - Initializing from a representation uses
from_...
methods.
Thanks to the Fluent API, as_...
methods can be applied directly after from_...
methods. For example, to convert a fourth-order tensor represented by Mandel notation to Voigt notation, we can do
FourthOrderTensor(...).from_mandel(...).to_voigt()
sympy is a strong dependency of this package since all tensor representations are sympy
objects.
The package is still being developed. You can use pip
to install the current main
version.
pip install -U git+https://github.com/tianyikillua/tensorconvert.git@main
Refer to the documentation for the API and the examples using tensorconvert
.