src/features/strain.c file

Functions

auto vm_strain_cauchy_green(const matrix3* F) -> matrix3
Right Cauchy–Green tensor $C = F^T F$.
auto vm_strain_green_lagrange(const matrix3* F) -> matrix3
Green–Lagrange strain $E = \tfrac12(C - I)$.
auto vm_strain_almansi(matrix3* e, const matrix3* F) -> bool
Almansi (Eulerian) strain $e = \tfrac12(I - b^{-1})$, $b = F F^T$.
auto vm_strain_logarithmic(matrix3* log_e, const matrix3* U) -> bool
Logarithmic strain $\ln(U)$ from a symmetric positive-definite $U$.
auto vm_strain_logarithmic_from_grad(matrix3* log_e, const matrix3* F) -> bool
Logarithmic strain of the right stretch of $F$.
auto vm_strain_rotation_to_quat(quaternion* q, const matrix3* R) -> bool
Quaternion from a proper rotation matrix.

Function documentation

matrix3 vm_strain_cauchy_green(const matrix3* F)

Right Cauchy–Green tensor $C = F^T F$.

Parameters
F Deformation gradient.
Returns $C$. Identity if F is NULL.

matrix3 vm_strain_green_lagrange(const matrix3* F)

Green–Lagrange strain $E = \tfrac12(C - I)$.

Parameters
F Deformation gradient.
Returns $E$. Zero if F is NULL.

A pure rotation yields the zero tensor.

bool vm_strain_almansi(matrix3* e, const matrix3* F)

Almansi (Eulerian) strain $e = \tfrac12(I - b^{-1})$, $b = F F^T$.

Parameters
e Output strain. Untouched on failure.
F Deformation gradient.
Returns false if F is NULL or $b$ is singular.

bool vm_strain_logarithmic(matrix3* log_e, const matrix3* U)

Logarithmic strain $\ln(U)$ from a symmetric positive-definite $U$.

Parameters
log_e Output logarithmic strain.
U Right stretch (symmetric positive definite).
Returns false if U is NULL or any stretch is non-positive.

Spectral: $U = Q\,\mathrm{diag}(\lambda)\,Q^T$ gives $\ln(U) = Q\,\mathrm{diag}(\ln\lambda)\,Q^T$. For $U = \lambda I$ the result is $\ln(\lambda)\,I$.

bool vm_strain_logarithmic_from_grad(matrix3* log_e, const matrix3* F)

Logarithmic strain of the right stretch of $F$.

Parameters
log_e Output logarithmic strain.
F Deformation gradient.
Returns false on polar failure or non-positive stretches.

Calls mat3_polar. Fails when polar fails (reflection, non-positive stretch).

bool vm_strain_rotation_to_quat(quaternion* q, const matrix3* R)

Quaternion from a proper rotation matrix.

Parameters
q Output quaternion.
R Rotation matrix.
Returns false if R is NULL or improper.

Reuses quat_from_mat3. Rejects improper matrices (det <= 0).