Skip to main content

Tensor4

Struct Tensor4 

Source
pub struct Tensor4 {
    pub data: [[[[f64; 3]; 3]; 3]; 3],
}
Expand description

Fourth-order tensor with 81 components stored as [i][j][k][l].

Fields§

§data: [[[[f64; 3]; 3]; 3]; 3]

Component array indexed as data[i][j][k][l].

Implementations§

Source§

impl Tensor4

Source

pub fn zero() -> Self

Zero fourth-order tensor.

Source

pub fn identity_sym() -> Self

Symmetric fourth-order identity: I_sym_ijkl = 0.5 * (δ_ik δ_jl + δ_il δ_jk).

Source

pub fn isotropic(lambda: f64, mu: f64) -> Self

Isotropic linear elasticity tensor: C_ijkl = λ δ_ij δ_kl + μ (δ_ik δ_jl + δ_il δ_jk).

Source

pub fn double_contract_2(&self, t: &Tensor2) -> Tensor2

Double contraction with a second-order tensor: result_ij = Σ_kl C_ijkl A_kl.

Source§

impl Tensor4

Source

pub fn deviatoric_projector() -> Self

Deviatoric projector: P_dev_ijkl = I_sym_ijkl - (1/3) delta_ij delta_kl.

Source

pub fn to_voigt_matrix(&self) -> [[f64; 6]; 6]

Convert isotropic elasticity tensor to Voigt matrix (6x6).

Returns [6][6] matrix.

Source

pub fn scale(&self, s: f64) -> Self

Scale all components by a scalar.

Source

pub fn add(&self, other: &Tensor4) -> Self

Add two fourth-order tensors.

Source§

impl Tensor4

Source

pub fn double_contract_4(&self, other: &Tensor4) -> Tensor4

Double contraction of two fourth-order tensors: (C::D)_ijmn = Σ_kl C_ijkl D_klmn.

Source

pub fn single_contract_right(&self, a: &Tensor2) -> Tensor4

Single contraction of C with a second-order tensor on the last two indices: (C · A)_ijkl = Σ_m C_ijkm A_ml.

Result is a fourth-order tensor.

Source

pub fn has_minor_symmetry(&self, tol: f64) -> bool

Check minor symmetry: C_ijkl = C_jikl = C_ijlk.

Returns true if both left-minor and right-minor symmetries hold within tol.

Source

pub fn has_major_symmetry(&self, tol: f64) -> bool

Check major symmetry: C_ijkl = C_klij.

Returns true if major symmetry holds within tol.

Source

pub fn symmetrize_minor(&self) -> Tensor4

Enforce minor symmetry by symmetrizing: C_sym_ijkl = 0.25 * (C_ijkl + C_jikl + C_ijlk + C_jilk).

Source

pub fn symmetrize_major(&self) -> Tensor4

Enforce major symmetry by averaging: C_sym_ijkl = 0.5*(C_ijkl + C_klij).

Source

pub fn rotate(&self, r: &Tensor2) -> Tensor4

Rotate a fourth-order tensor: C’_ijkl = R_ia R_jb R_kc R_ld C_abcd.

Source

pub fn volumetric_projector() -> Self

Build the isotropic volumetric projector: P_vol_ijkl = (1/3) * delta_ij * delta_kl.

Source

pub fn identity() -> Self

The fourth-order identity: I_ijkl = delta_ik * delta_jl.

Source

pub fn sub(&self, other: &Tensor4) -> Self

Subtract two fourth-order tensors.

Source

pub fn norm(&self) -> f64

Frobenius norm of the fourth-order tensor: sqrt(Σ C_ijkl^2).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.