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

1#[cfg(test)]
2mod test;
3
4use super::*;
5
6#[doc = include_str!("model.md")]
7#[derive(Debug)]
8pub struct SaintVenantKirchhoff<P> {
9    parameters: P,
10}
11
12impl<P> Constitutive<P> for SaintVenantKirchhoff<P>
13where
14    P: Parameters,
15{
16    fn new(parameters: P) -> Self {
17        Self { parameters }
18    }
19}
20
21impl<P> Solid for SaintVenantKirchhoff<P>
22where
23    P: Parameters,
24{
25    fn bulk_modulus(&self) -> &Scalar {
26        self.parameters.get(0)
27    }
28    fn shear_modulus(&self) -> &Scalar {
29        self.parameters.get(1)
30    }
31}
32
33impl<P> Elastic for SaintVenantKirchhoff<P>
34where
35    P: Parameters,
36{
37    #[doc = include_str!("second_piola_kirchhoff_stress.md")]
38    fn second_piola_kirchhoff_stress(
39        &self,
40        deformation_gradient: &DeformationGradient,
41    ) -> Result<SecondPiolaKirchhoffStress, ConstitutiveError> {
42        let _jacobian = self.jacobian(deformation_gradient)?;
43        let (deviatoric_strain, strain_trace) =
44            ((deformation_gradient.right_cauchy_green() - IDENTITY_00) * 0.5)
45                .deviatoric_and_trace();
46        Ok(deviatoric_strain * (2.0 * self.shear_modulus())
47            + IDENTITY_00 * (self.bulk_modulus() * strain_trace))
48    }
49    #[doc = include_str!("second_piola_kirchhoff_tangent_stiffness.md")]
50    fn second_piola_kirchhoff_tangent_stiffness(
51        &self,
52        deformation_gradient: &DeformationGradient,
53    ) -> Result<SecondPiolaKirchhoffTangentStiffness, ConstitutiveError> {
54        let _jacobian = self.jacobian(deformation_gradient)?;
55        let scaled_deformation_gradient_transpose =
56            deformation_gradient.transpose() * self.shear_modulus();
57        Ok(SecondPiolaKirchhoffTangentStiffness::dyad_ik_jl(
58            &scaled_deformation_gradient_transpose,
59            &IDENTITY_00,
60        ) + SecondPiolaKirchhoffTangentStiffness::dyad_il_jk(
61            &IDENTITY_00,
62            &scaled_deformation_gradient_transpose,
63        ) + SecondPiolaKirchhoffTangentStiffness::dyad_ij_kl(
64            &(IDENTITY_00 * (self.bulk_modulus() - TWO_THIRDS * self.shear_modulus())),
65            deformation_gradient,
66        ))
67    }
68}
69
70impl<P> Hyperelastic for SaintVenantKirchhoff<P>
71where
72    P: Parameters,
73{
74    #[doc = include_str!("helmholtz_free_energy_density.md")]
75    fn helmholtz_free_energy_density(
76        &self,
77        deformation_gradient: &DeformationGradient,
78    ) -> Result<Scalar, ConstitutiveError> {
79        let _jacobian = self.jacobian(deformation_gradient)?;
80        let strain = (deformation_gradient.right_cauchy_green() - IDENTITY_00) * 0.5;
81        Ok(self.shear_modulus() * strain.squared_trace()
82            + 0.5
83                * (self.bulk_modulus() - TWO_THIRDS * self.shear_modulus())
84                * strain.trace().powi(2))
85    }
86}