Voigt Form
Tensorial code usually does not need Voigt or Mandel arrays: tensor operations can be written directly with tensor types. The conversion functions are useful at boundaries, for example when exchanging data with a solver or file format that expects vectors and matrices.
Second-order tensors
tovoigt converts a tensor to its Voigt vector. For symmetric 3D second-order tensors, the default order is (11, 22, 33, 23, 13, 12):
julia> σ = SymmetricSecondOrderTensor{3}((2.0, 0.4, 0.2, 1.2, 0.1, 0.9))3×3 SymmetricSecondOrderTensor{3, Float64, 6}: 2.0 0.4 0.2 0.4 1.2 0.1 0.2 0.1 0.9julia> v = tovoigt(σ)6-element StaticArraysCore.SVector{6, Float64} with indices SOneTo(6): 2.0 1.2 0.9 0.1 0.2 0.4julia> fromvoigt(SymmetricSecondOrderTensor{3}, v) ≈ σtrue
The inverse conversion must use the same order and scaling that were used to create the Voigt vector.
Mandel scaling
For symmetric tensors, Mandel form scales off-diagonal components by √2. This makes the Euclidean dot product of the vector representation match the tensor inner product:
julia> m = tomandel(σ)6-element StaticArraysCore.SVector{6, Float64} with indices SOneTo(6): 2.0 1.2 0.9 0.14142135623730953 0.28284271247461906 0.5656854249492381julia> m ≈ tovoigt(σ; offdiagscale = sqrt(2.0))truejulia> frommandel(SymmetricSecondOrderTensor{3}, m) ≈ σtrue
Use tovoigt(...; offdiagscale = 2) for engineering-strain style scaling, and use the same offdiagscale in fromvoigt to reconstruct the tensor.
Fourth-order tensors
Fourth-order tensors are converted to matrices in Voigt or Mandel form:
julia> I = one(SymmetricFourthOrderTensor{3});julia> M = tomandel(I);julia> size(M)(6, 6)julia> frommandel(SymmetricFourthOrderTensor{3}, M) ≈ Itrue
For Voigt and Mandel conversion docstrings, see Voigt and Mandel API.