TensND.jl performs tensor calculations of any order and dimension in arbitrary coordinate systems (cartesian, polar, cylindrical, spherical, spheroidal or user-defined). It supports both symbolic computation (SymPy through SymPyPythonCall.jl, an optional extension, and Symbolics.jl) and numerical evaluation with automatic differentiation (ForwardDiff.jl). The implementation is inspired by the Maple library Tens3d by Jean Garrigues. Part of the MicroPoroChemoMechanics ecosystem.
Key features
- Basis types — canonical, rotated, orthogonal, and fully general (non-orthogonal, symbolic)
- Tensor algebra — products (
⊗,⊗ˢ,⊠,⊠ˢ,⋅,⊡,⊙), change of basis, variance management - Structured tensors — isotropic (
TensISO), transversely isotropic (TensTI), orthotropic (TensOrtho) and cubic (TensCubic), storing 2 to 12 coefficients instead of 81, staying in their class through products, inversion and changes of basis, and read as Kelvin–Mandel matrices or as the few small blocks each class splits into - Symmetry projection — closest isotropic, transversely isotropic, orthotropic or cubic tensor, with the material frame given or recovered by Newton’s method on the orientation
- Differential operators — gradient, symmetric gradient, divergence, Laplacian and Hessian in curvilinear coordinates, symbolically or numerically
- Generic type system — the same code path runs on
Float64, on symbolic scalars (Sym,Num) and onForwardDiff.Dual, so sensitivities come for free
Installation
TensND.jl is registered in Julia’s General registry:
using Pkg
Pkg.add("TensND")