Source code for skel.Mandel

# SPDX-License-Identifier: AGPL-3.0-or-later
r"""
Compressed notation of symmetric tensors using convention attributed to J. Mandel.

Notes
-----
The following convention is used to store the unique elements of a
2nd order tensor t (3x3 matrix) as a vector t' of length 6.

.. math::

    \vb{t}'_\text{Mandel} = (t_{xx}, t_{yy}, t_{zz}, w t_{yz}, w t_{xz}, w t_{xy})


The same weight (:math:`w = \sqrt{2}`) is used for the representation
of stress and strain.

References
----------
P. Helnwein, Computer methods in applied mechanics and engineering 190:2753-2770, 2001
https://doi.org/10.1016/s0045-7825(00)00263-2

T. Mánik, European Journal of Mechanics - A/Solids 90:104357, 2021
https://doi.org/10.1016/j.euromechsol.2021.104357

J. Mandel, International Journal of Solids and Structures 1(3):273-295, 1965
https://doi.org/10.1016/0020-7683(65)90034-X

W. Voigt, Nachrichten von der Gesellschaft der Wissenschaften zu Göttingen. Mathematisch-Physikalische Klasse (2):117–176, 1900
https://gdz.sub.uni-goettingen.de/id/PPN252457811_1900
"""

import numpy as _np

from . import _transforms


# Orthonormal basis of the Mandel notation.
BASIS = _np.zeros((6,3,3))
BASIS[0,0,0] = BASIS[1,1,1] = BASIS[2,2,2] = 1.0
BASIS[3,1,2] = BASIS[3,2,1] = 1.0/_np.sqrt(2.0)
BASIS[4,0,2] = BASIS[4,2,0] = 1.0/_np.sqrt(2.0)
BASIS[5,0,1] = BASIS[5,1,0] = 1.0/_np.sqrt(2.0)


[docs] def to_6(t): """ Convert symmetric 2nd order tensor in matrix notation to Mandel notation. Parameters ---------- t : numpy.ndarray of shape (...,3,3) Symmetric 2nd order tensor in matrix notation. Returns ------- t_Mandel: numpy.ndarray of shape (...,6) Symmetric 2nd order tensor in Mandel notation. Notes ----- Due to the definition of the Mandel notation, this function can be used to convert strain and stress tensors. """ return _transforms.to_6(t,BASIS)
[docs] def to_6_strain(epsilon): """ Convert symmetric 2nd order strain tensor in matrix notation to Mandel notation. Parameters ---------- epsilon : numpy.ndarray of shape (...,3,3) Symmetric 2nd order strain tensor in matrix notation. Returns ------- epsilon_Mandel: numpy.ndarray of shape (...,6) Symmetric 2nd order strain tensor in Mandel notation. """ return to_6(epsilon)
[docs] def to_6_stress(sigma): """ Convert symmetric 2nd order stress tensor in matrix notation to Mandel notation. Parameters ---------- sigma : numpy.ndarray of shape (...,3,3) Symmetric 2nd order stress tensor in matrix notation. Returns ------- sigma_Mandel: numpy.ndarray of shape (...,6) Symmetric 2nd order stress tensor in Mandel notation. """ return to_6(sigma)
[docs] def to_6x6(T): """ Convert symmetric 4th order tensor in matrix notation to Mandel notation. Parameters ---------- T : numpy.ndarray of shape (...,3,3,3,3) Symmetric 4th order tensor in matrix notation. Returns ------- T_Mandel: numpy.ndarray of shape (...,6,6) Symmetric 4th order tensor in Mandel notation. Notes ----- Due to the definition of the Mandel notation, this function can be used to convert compliance and stiffness tensors. """ return _transforms.to_6x6(T,BASIS)
[docs] def to_6x6_compliance(S): """ Convert symmetric 4th order compliance tensor in matrix notation to Mandel notation. Parameters ---------- S : numpy.ndarray of shape (...,3,3,3,3) Symmetric 4th order compliance tensor in matrix notation. Returns ------- S_Mandel: numpy.ndarray of shape (...,6,6) Symmetric 4th order compliance tensor in Mandel notation. """ return to_6x6(S)
[docs] def to_6x6_stiffness(C): """ Convert symmetric 4th order stiffness tensor in matrix notation to Mandel notation. Parameters ---------- C : numpy.ndarray of shape (...,3,3,3,3) Symmetric 4th order stiffness tensor in matrix notation. Returns ------- C_Mandel: numpy.ndarray of shape (...,6,6) Symmetric 4th order stiffness tensor in Mandel notation. """ return to_6x6(C)
[docs] def to_3x3(t_Mandel): """ Convert symmetric 2nd order tensor in Mandel notation to matrix notation. Parameters ---------- t_Mandel: numpy.ndarray of shape (...,6) Symmetric 2nd order tensor in Mandel notation. Returns ------- t : numpy.ndarray of shape (...,3,3) Symmetric 2nd order tensor in matrix notation. Notes ----- Due to the definition of the Mandel notation, this function can be used to convert strain and stress tensors. """ return _transforms.to_3x3(t_Mandel,BASIS)
[docs] def to_3x3_strain(epsilon_Mandel): """ Convert symmetric 2nd order strain tensor in Mandel notation to matrix notation. Parameters ---------- epsilon_Mandel: numpy.ndarray of shape (...,6) Symmetric 2nd order strain tensor in Mandel notation. Returns ------- epsilon : numpy.ndarray of shape (...,3,3) Symmetric 2nd order strain tensor in matrix notation. """ return to_3x3(epsilon_Mandel)
[docs] def to_3x3_stress(sigma_Mandel): """ Convert symmetric 2nd order stress tensor in Mandel notation to matrix notation. Parameters ---------- sigma_Mandel: numpy.ndarray of shape (...,6) Symmetric 2nd order stress tensor in Mandel notation. Returns ------- sigma : numpy.ndarray of shape (...,3,3) Symmetric 2nd order stress tensor in matrix notation. """ return to_3x3(sigma_Mandel)
[docs] def to_3x3x3x3(T_Mandel): """ Convert symmetric 4th order tensor in Mandel notation to matrix notation. Parameters ---------- T_Mandel: numpy.ndarray of shape (...,6,6) Symmetric 4th order tensor in Mandel notation. Returns ------- T : numpy.ndarray of shape (...,3,3,3,3) Symmetric 4th order tensor in matrix notation. Notes ----- Due to the definition of the Mandel notation, this function can be used to convert compliance and stiffness tensors. """ return _transforms.to_3x3x3x3(T_Mandel,BASIS)
[docs] def to_3x3x3x3_compliance(S_Mandel): """ Convert symmetric 4th order compliance tensor in Mandel notation to matrix notation. Parameters ---------- S_Mandel: numpy.ndarray of shape (...,6,6) Symmetric 4th order tensor in Mandel notation. Returns ------- S : numpy.ndarray of shape (...,3,3,3,3) Symmetric 4th order compliance tensor in matrix notation. """ return to_3x3x3x3(S_Mandel)
[docs] def to_3x3x3x3_stiffness(C_Mandel): """ Convert symmetric 4th order stiffness tensor in Mandel notation to matrix notation. Parameters ---------- C_Mandel: numpy.ndarray of shape (...,6,6) Symmetric 4th order stiffness tensor in Mandel notation. Returns ------- C : numpy.ndarray of shape (...,3,3,3,3) Symmetric 4th order stiffness tensor in matrix notation. """ return to_3x3x3x3(C_Mandel)
[docs] def rotate_2nd(r,t_Mandel): """ Rotate symmetric 2nd order tensor in Mandel notation. Parameters ---------- r: damask.Rotation of shape (...) Rotations to apply. Must be broadcastable. t_Mandel: numpy.ndarray of shape (...,6) Symmetric 2nd order tensor in Mandel notation. Returns ------- t_Mandel : numpy.ndarray of shape (...,6) Rotated 2nd order tensor in Mandel notation. Notes ----- Due to the definition of the Mandel notation, this function can be used to rotate strain and stress tensors. """ return _transforms.rotate(r,t_Mandel,BASIS,BASIS,2)
[docs] def rotate_strain(r,epsilon_Mandel): """ Rotate symmetric 2nd order strain tensor in Mandel notation. Parameters ---------- r: damask.Rotation of shape (...) Rotations to apply. Must be broadcastable. epsilon_Mandel: numpy.ndarray of shape (...,6) Symmetric 2nd order strain tensor in Mandel notation. Returns ------- epsilon_Mandel : numpy.ndarray of shape (...,6) Rotated 2nd order strain tensor in Mandel notation. """ return rotate_2nd(r,epsilon_Mandel)
[docs] def rotate_stress(r,sigma_Mandel): """ Rotate symmetric 2nd order stress tensor in Mandel notation. Parameters ---------- r: damask.Rotation of shape (...) Rotations to apply. Must be broadcastable. sigma_Mandel: numpy.ndarray of shape (...,6) Symmetric 2nd order stress tensor in Mandel notation. Returns ------- sigma_Mandel : numpy.ndarray of shape (...,6) Rotated 2nd order stress tensor in Mandel notation. """ return rotate_2nd(r,sigma_Mandel)
[docs] def rotate_4th(r,T_Mandel): """ Rotate symmetric 4th order tensor in Mandel notation. Parameters ---------- r: damask.Rotation of shape (...) Rotations to apply. Must be broadcastable. T_Mandel: numpy.ndarray of shape (...,6,6) Symmetric 4th order tensor in Mandel notation. Returns ------- T_Mandel : numpy.ndarray of shape (...,6,6) Rotated 4th order tensor in Mandel notation. Notes ----- Due to the definition of the Mandel notation, this function can be used to rotate compliance and stiffness tensors. """ return _transforms.rotate(r,T_Mandel,BASIS,BASIS,4)
[docs] def rotate_compliance(r,S_Mandel): """ Rotate symmetric 4th order compliance tensor in Mandel notation. Parameters ---------- r: damask.Rotation of shape (...) Rotations to apply. Must be broadcastable. S_Mandel: numpy.ndarray of shape (...,6,6) Symmetric 4th order compliance tensor in Mandel notation. Returns ------- S_Mandel : numpy.ndarray of shape (...,6,6) Rotated 4th order compliance tensor in Mandel notation. """ return rotate_4th(r,S_Mandel)
[docs] def rotate_stiffness(r,C_Mandel): """ Rotate symmetric 4th order stiffness tensor in Mandel notation. Parameters ---------- r: damask.Rotation of shape (...) Rotations to apply. Must be broadcastable. C_Mandel: numpy.ndarray of shape (...,6,6) Symmetric 4th order stiffness tensor in Mandel notation. Returns ------- C_Mandel : numpy.ndarray of shape (...,6,6) Rotated 4th order stiffness tensor in Mandel notation. """ return rotate_4th(r,C_Mandel)