conspire/constitutive/solid/elastic/hencky/
mod.rs1#[cfg(test)]
2mod test;
3
4use crate::{
5 constitutive::{
6 Constitutive, ConstitutiveError,
7 solid::{Solid, TWO_THIRDS, elastic::Elastic},
8 },
9 math::{ContractThirdFourthIndicesWithFirstSecondIndicesOf, IDENTITY_00, Rank2},
10 mechanics::{
11 Deformation, DeformationGradient, Scalar, SecondPiolaKirchhoffStress,
12 SecondPiolaKirchhoffTangentStiffness,
13 },
14};
15
16#[doc = include_str!("doc.md")]
17#[derive(Clone, Debug)]
18pub struct Hencky {
19 pub bulk_modulus: Scalar,
21 pub shear_modulus: Scalar,
23}
24
25impl Solid for Hencky {
26 fn bulk_modulus(&self) -> Scalar {
27 self.bulk_modulus
28 }
29 fn shear_modulus(&self) -> Scalar {
30 self.shear_modulus
31 }
32}
33
34impl Elastic for Hencky {
35 #[doc = include_str!("second_piola_kirchhoff_stress.md")]
36 fn second_piola_kirchhoff_stress(
37 &self,
38 deformation_gradient: &DeformationGradient,
39 ) -> Result<SecondPiolaKirchhoffStress, ConstitutiveError> {
40 let _jacobian = self.jacobian(deformation_gradient)?;
41 let (deviatoric_strain, strain_trace) =
42 (deformation_gradient.right_cauchy_green().logm()? * 0.5).deviatoric_and_trace();
43 Ok(deviatoric_strain * (2.0 * self.shear_modulus())
44 + IDENTITY_00 * (self.bulk_modulus() * strain_trace))
45 }
46 #[doc = include_str!("second_piola_kirchhoff_tangent_stiffness.md")]
47 fn second_piola_kirchhoff_tangent_stiffness(
48 &self,
49 deformation_gradient: &DeformationGradient,
50 ) -> Result<SecondPiolaKirchhoffTangentStiffness, ConstitutiveError> {
51 let _jacobian = self.jacobian(deformation_gradient)?;
52 let right_cauchy_green = deformation_gradient.right_cauchy_green();
53 let deformation_gradient_transpose = deformation_gradient.transpose();
54 let scaled_deformation_gradient_transpose =
55 &deformation_gradient_transpose * self.shear_modulus();
56 Ok((right_cauchy_green
57 .dlogm()?
58 .contract_third_fourth_indices_with_first_second_indices_of(
59 &(SecondPiolaKirchhoffTangentStiffness::dyad_il_jk(
60 &IDENTITY_00,
61 &scaled_deformation_gradient_transpose,
62 ) + SecondPiolaKirchhoffTangentStiffness::dyad_ik_jl(
63 &scaled_deformation_gradient_transpose,
64 &IDENTITY_00,
65 )),
66 ))
67 + (SecondPiolaKirchhoffTangentStiffness::dyad_ij_kl(
68 &(IDENTITY_00 * (self.bulk_modulus() - TWO_THIRDS * self.shear_modulus())),
69 &deformation_gradient_transpose.inverse(),
70 )))
71 }
72}