transfer.hpp

Overview

Functions for transferring quantities between Voigt notation (6-vectors) and full tensor form (3x3 matrices), as well as fourth-order tensor conversions.

API Reference

arma::mat v2t_strain(const arma::vec &v)

Provides the matrix (3x3 arma::mat) version of a strain tensor initially written with Voigt notation (arma::vec size=6).

Example:

vec v = randu(6);
mat m = v2t_strain(v);

Parameters:

v – (arma::vec size=6) the strain tensor written in with Voigt notation

Returns:

(3x3 arma::mat) the strain tensor written as a 3x3 matrix

arma::vec t2v_strain(const arma::mat &m)

Provides the Voigt notation (arma::vec size=6) version of a strain tensor initially written using a matrix format (3x3 arma::mat).

Example:

mat m = randu(3,3);
vec v = t2v_strain(m);

Parameters:

m – (3x3 arma::mat) the strain tensor written as a 3x3 matrix

Returns:

(arma::vec size=6) the strain tensor written in with Voigt notation

arma::mat v2t_stress(const arma::vec &v)

Provides the matrix (3x3 arma::mat) version of a stress tensor initially written with Voigt notation (arma::vec size=6).

Example:

vec v = randu(6);
mat m = v2t_stress(v);

Parameters:

v – (arma::vec size=6) the stress tensor written in with Voigt notation

Returns:

(3x3 arma::mat) the stress tensor written as a 3x3 matrix

arma::vec t2v_stress(const arma::mat &m)

Provides the Voigt notation (arma::vec size=6) version of a stress tensor initially written using a matrix format (3x3 arma::mat).

Example:

mat m = randu(3,3);
vec v = t2v_stress(m);

Parameters:

m – (3x3 arma::mat) the stress tensor written as a 3x3 matrix

Returns:

(arma::vec size=6) the stress tensor written in with Voigt notation

arma::vec t2v_sym(const arma::mat &m)

Provides the Voigt notation (arma::vec size=6) version of a symmetric tensor initially written using a matrix format (3x3 arma::mat).

Note that the 6 components are organized as the following (it is a column vector) : \( \mathbf{v} \equiv \left( m_{11},m_{22},m_{33},m_{12},m_{13},m_{23} \right) \)

Example:

mat m = randu(3,3);
vec v = t2v_sym(m);

Parameters:

m – (3x3 arma::mat) the symmetric tensor written as a 3x3 matrix

Returns:

(arma::vec size=6) the symmetric tensor written in with Voigt notation

arma::mat v2t_sym(const arma::vec &v)

Provides the matrix (3x3 arma::mat) version of a symmetric tensor initially written with Voigt notation (arma::vec size=6).

Note that the 6 components are organized as the following (it is a column vector) : \( \mathbf{v} \equiv \left( m_{11},m_{22},m_{33},m_{12},m_{13},m_{23} \right) \)

Example:

vec v = randu(6);
mat m = v2t_sym(v);

Parameters:

v – (arma::vec size=6) the symmetric tensor written in with Voigt notation

Returns:

(3x3 arma::mat) the symmetric tensor written as a 3x3 matrix

arma::mat v2t_skewsym(const arma::vec &v)

Provides the matrix (3x3 arma::mat) version of a skew-symmetric tensor initially written with Voigt notation (arma::vec size=6).

Note that the 6 components are organized as the following (it is a column vector) : \( \mathbf{v} \equiv \left( m_{11},m_{22},m_{33},m_{12},m_{13},m_{23} \right) \)

so that the components \( m_{21} = -m_{12}, \quad m_{31} = -m_{13}, \quad m_{32} = -m_{23} \) so that:

\[\begin{split} m = \left( \begin{array}{ccc} v_1 & v_4 & v_5 \\ -v_4 & v_2 & v_6 \\ v_5 & -v_6 & v_3 \end{array} \right) \end{split}\]

Example:

vec v = randu(6);
mat m = v2t_skewsym(v);

Parameters:

v – (arma::vec size=6) the skew-symmetric tensor written in with Voigt notation

Returns:

(3x3 arma::mat) the skew-symmetric tensor written as a 3x3 matrix

arma::mat v2t(const arma::vec &v)

Provides the matrix (3x3 arma::mat) version of a tensor initially written with Voigt notation (arma::vec size=9).

Note that the 9 components are organized as the following (it is a column vector) : \( \mathbf{v} \equiv \left( m_{11},m_{12},m_{13},m_{21},m_{22},m_{23},m_{31},m_{32},m_{33} \right) \) So that this operation is the opposite of a flatten (.as_col() for armadillo matrix to column vectors)

Example:

vec v = randu(9);
mat m = v2t(v);

Parameters:

v – (arma::vec size=9) the flatten tensor written in with Voigt notation

Returns:

(3x3 arma::mat) the tensor written as a 3x3 matrix