sym3.h file
Voigt-6 algebra for symmetric 3x3 tensors.
Order is (xx, yy, zz, xy, yz, zx). Shear components are the tensor components (not engineering shear). Double contraction therefore includes a factor of 2 on the shear products and equals the matrix Frobenius inner product.
Classes
- struct vm_sym3
- Symmetric 3×3 tensor in Voigt order.
Functions
-
auto vm_sym3_from_mat3(const matrix3* m) -> vm_
sym3 - Pack a symmetric matrix3 into Voigt-6.
-
auto vm_sym3_to_mat3(const vm_
sym3* s) -> matrix3 - Unpack Voigt-6 into a symmetric matrix3.
-
auto vm_sym3_add(const vm_
sym3* a, const vm_ sym3* b) -> vm_ sym3 - Component-wise sum.
-
auto vm_sym3_scale(const vm_
sym3* a, vm_ float_ t s) -> vm_ sym3 - Component-wise scale.
-
auto vm_sym3_deviator(const vm_
sym3* a) -> vm_ sym3 - Deviatoric part: s = σ − (tr σ / 3) I.
-
auto vm_sym3_hydrostatic(const vm_
sym3* a) -> vm_ float_ t - Hydrostatic (mean) scalar: tr(σ) / 3.
-
auto vm_sym3_trace(const vm_
sym3* a) -> vm_ float_ t - Trace: xx + yy + zz.
-
void vm_sym3_invariants(const vm_
sym3* a, vm_ float_ t* I1, vm_ float_ t* J2, vm_ float_ t* J3) - Principal invariants of the stress (or strain) tensor.
-
auto vm_sym3_push_forward(const matrix3* F,
const vm_
sym3* sigma) -> vm_ sym3 - Push-forward σ' = F σ Fᵀ, result in Voigt.
-
void vm_sym3_dw_split(const matrix3* L,
vm_
sym3* D, matrix3* W) - Symmetric / skew split of a velocity gradient.
-
auto vm_sym3_ddot(const vm_
sym3* a, const vm_ sym3* b) -> vm_ float_ t - Double contraction A : B.
Function documentation
vm_ sym3 vm_sym3_from_mat3(const matrix3* m)
Pack a symmetric matrix3 into Voigt-6.
| Parameters | |
|---|---|
| m | Input matrix3. |
| Returns | Voigt representation. |
Off-diagonal tensor components are taken from the upper triangle (m12, m23, m31). Non-symmetric input is accepted; only the upper triangle is used for shears.
matrix3 vm_sym3_to_mat3(const vm_ sym3* s)
Unpack Voigt-6 into a symmetric matrix3.
| Parameters | |
|---|---|
| s | Input Voigt tensor. |
| Returns | Symmetric matrix3. |
void vm_sym3_invariants(const vm_ sym3* a,
vm_ float_ t* I1,
vm_ float_ t* J2,
vm_ float_ t* J3)
Principal invariants of the stress (or strain) tensor.
| Parameters | |
|---|---|
| a | Input tensor. |
| I1 | Optional first invariant. |
| J2 | Optional second deviatoric invariant. |
| J3 | Optional third deviatoric invariant. |
I1 = tr(σ). J2 = (1/2) s : s where s is the deviator (von Mises related). J3 = det(s). Any of the output pointers may be NULL.
vm_ sym3 vm_sym3_push_forward(const matrix3* F,
const vm_ sym3* sigma)
Push-forward σ' = F σ Fᵀ, result in Voigt.
| Parameters | |
|---|---|
| F | Deformation gradient (or any matrix3). |
| sigma | Input Cauchy (or other) stress in Voigt. |
| Returns | Pushed-forward tensor in Voigt. |
void vm_sym3_dw_split(const matrix3* L,
vm_ sym3* D,
matrix3* W)
Symmetric / skew split of a velocity gradient.
| Parameters | |
|---|---|
| L | Velocity gradient (matrix3). |
| D | Optional symmetric rate-of-deformation (Voigt). |
| W | Optional skew spin tensor (matrix3). |
D = (L + Lᵀ)/2 packed as Voigt; W = (L − Lᵀ)/2 as matrix3. Either output pointer may be NULL.
vm_ float_ t vm_sym3_ddot(const vm_ sym3* a,
const vm_ sym3* b)
Double contraction A : B.
| Returns | A : B. |
|---|
Equals the Frobenius inner product of the corresponding matrices. For tensor-shear Voigt storage this is xx_a*xx_b + yy_a*yy_b + zz_a*zz_b + 2*(xy_a*xy_b + yz_a*yz_b + zx_a*zx_b).