Skip to main content

conspire/constitutive/solid/elastic/saint_venant_kirchhoff/
mod.rs

1#[cfg(test)]
2mod test;
3
4use crate::{
5    constitutive::{
6        ConstitutiveError,
7        solid::{Solid, TWO_THIRDS, elastic::Elastic},
8    },
9    math::{IDENTITY, Quantity, Rank2, TensorRank4},
10    mechanics::{CauchyStress, CauchyTangentStiffness, Deformation, DeformationGradient},
11    units::Stress,
12};
13
14#[doc = include_str!("doc.md")]
15#[derive(Clone, Debug)]
16pub struct SaintVenantKirchhoff {
17    /// The bulk modulus $`\kappa`$.
18    pub bulk_modulus: Quantity<Stress>,
19    /// The shear modulus $`\mu`$.
20    pub shear_modulus: Quantity<Stress>,
21}
22
23impl Solid for SaintVenantKirchhoff {
24    fn bulk_modulus(&self) -> Quantity<Stress> {
25        self.bulk_modulus
26    }
27    fn shear_modulus(&self) -> Quantity<Stress> {
28        self.shear_modulus
29    }
30}
31
32impl Elastic for SaintVenantKirchhoff {
33    #[doc = include_str!("cauchy_stress.md")]
34    fn cauchy_stress(
35        &self,
36        deformation_gradient: &DeformationGradient,
37    ) -> Result<CauchyStress, ConstitutiveError> {
38        let jacobian = self.jacobian(deformation_gradient)?;
39        let (deviatoric_strain, strain_trace) =
40            ((deformation_gradient.left_cauchy_green() - IDENTITY) * 0.5).deviatoric_and_trace();
41        Ok(deviatoric_strain * (2.0 * self.shear_modulus() / jacobian)
42            + IDENTITY * (self.bulk_modulus() * strain_trace / jacobian))
43    }
44    #[doc = include_str!("cauchy_tangent_stiffness.md")]
45    fn cauchy_tangent_stiffness(
46        &self,
47        deformation_gradient: &DeformationGradient,
48    ) -> Result<CauchyTangentStiffness, ConstitutiveError> {
49        let jacobian = self.jacobian(deformation_gradient)?;
50        let inverse_transpose_deformation_gradient = deformation_gradient.inverse_transpose();
51        let scaled_deformation_gradient = deformation_gradient * (self.shear_modulus() / jacobian);
52        let (deviatoric_strain, strain_trace) =
53            ((deformation_gradient.left_cauchy_green() - IDENTITY) * 0.5).deviatoric_and_trace();
54        Ok(
55            (TensorRank4::dyad_il_jk(&scaled_deformation_gradient, &IDENTITY)
56                + TensorRank4::dyad_ik_jl(&IDENTITY, &scaled_deformation_gradient))
57                + TensorRank4::dyad_ij_kl(
58                    &IDENTITY,
59                    &(deformation_gradient
60                        * ((self.bulk_modulus() - self.shear_modulus() * TWO_THIRDS) / jacobian)),
61                )
62                - TensorRank4::dyad_ij_kl(
63                    &(deviatoric_strain * (2.0 * self.shear_modulus() / jacobian)
64                        + IDENTITY * (self.bulk_modulus() * strain_trace / jacobian)),
65                    &inverse_transpose_deformation_gradient,
66                ),
67        )
68    }
69}