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

1#[cfg(test)]
2mod test;
3
4use crate::{
5    constitutive::{
6        ConstitutiveError,
7        fluid::{plastic::Plastic, viscoplastic::Viscoplastic},
8        solid::{
9            Solid, TWO_THIRDS, elastic_viscoplastic::ElasticViscoplastic,
10            hyperelastic_viscoplastic::HyperelasticViscoplastic,
11        },
12    },
13    math::{IDENTITY_22, Rank2},
14    mechanics::{
15        Deformation, DeformationGradient, DeformationGradientPlastic, Scalar,
16        SecondPiolaKirchhoffStress, SecondPiolaKirchhoffTangentStiffness,
17    },
18};
19
20#[doc = include_str!("doc.md")]
21#[derive(Clone, Debug)]
22pub struct SaintVenantKirchhoff {
23    /// The bulk modulus $`\kappa`$.
24    pub bulk_modulus: Scalar,
25    /// The shear modulus $`\mu`$.
26    pub shear_modulus: Scalar,
27    /// The initial yield stress $`Y_0`$.
28    pub initial_yield_stress: Scalar,
29    /// The isotropic hardening slope $`H`$.
30    pub hardening_slope: Scalar,
31    /// The rate sensitivity parameter $`m`$.
32    pub rate_sensitivity: Scalar,
33    /// The reference flow rate $`d_0`$.
34    pub reference_flow_rate: Scalar,
35}
36
37impl Solid for SaintVenantKirchhoff {
38    fn bulk_modulus(&self) -> Scalar {
39        self.bulk_modulus
40    }
41    fn shear_modulus(&self) -> Scalar {
42        self.shear_modulus
43    }
44}
45
46impl Plastic for SaintVenantKirchhoff {
47    fn initial_yield_stress(&self) -> Scalar {
48        self.initial_yield_stress
49    }
50    fn hardening_slope(&self) -> Scalar {
51        self.hardening_slope
52    }
53}
54
55impl Viscoplastic for SaintVenantKirchhoff {
56    fn rate_sensitivity(&self) -> Scalar {
57        self.rate_sensitivity
58    }
59    fn reference_flow_rate(&self) -> Scalar {
60        self.reference_flow_rate
61    }
62}
63
64impl ElasticViscoplastic for SaintVenantKirchhoff {
65    #[doc = include_str!("second_piola_kirchhoff_stress.md")]
66    fn second_piola_kirchhoff_stress(
67        &self,
68        deformation_gradient: &DeformationGradient,
69        deformation_gradient_p: &DeformationGradientPlastic,
70    ) -> Result<SecondPiolaKirchhoffStress, ConstitutiveError> {
71        let _jacobian = self.jacobian(deformation_gradient)?;
72        let deformation_gradient_inverse_p = deformation_gradient_p.inverse();
73        let deformation_gradient_e = deformation_gradient * &deformation_gradient_inverse_p;
74        let left_cauchy_green_inverse_p = deformation_gradient_inverse_p.left_cauchy_green();
75        let (deviatoric_strain, strain_trace) =
76            ((deformation_gradient_e.right_cauchy_green() - IDENTITY_22) * 0.5)
77                .deviatoric_and_trace();
78        Ok(&deformation_gradient_inverse_p
79            * deviatoric_strain
80            * deformation_gradient_inverse_p.transpose()
81            * (2.0 * self.shear_modulus())
82            + left_cauchy_green_inverse_p * (self.bulk_modulus() * strain_trace))
83    }
84    #[doc = include_str!("second_piola_kirchhoff_tangent_stiffness.md")]
85    fn second_piola_kirchhoff_tangent_stiffness(
86        &self,
87        deformation_gradient: &DeformationGradient,
88        deformation_gradient_p: &DeformationGradientPlastic,
89    ) -> Result<SecondPiolaKirchhoffTangentStiffness, ConstitutiveError> {
90        let _jacobian = self.jacobian(deformation_gradient)?;
91        let deformation_gradient_inverse_p = deformation_gradient_p.inverse();
92        let deformation_gradient_e = deformation_gradient * &deformation_gradient_inverse_p;
93        let quantity_1 = deformation_gradient_inverse_p.left_cauchy_green();
94        let quantity_2 = deformation_gradient_inverse_p * deformation_gradient_e.transpose();
95        let scaled_quantity_1 = &quantity_1 * self.shear_modulus();
96        Ok(
97            (SecondPiolaKirchhoffTangentStiffness::dyad_ik_jl(&quantity_2, &scaled_quantity_1)
98                + SecondPiolaKirchhoffTangentStiffness::dyad_il_jk(
99                    &scaled_quantity_1,
100                    &quantity_2,
101                ))
102                + SecondPiolaKirchhoffTangentStiffness::dyad_ij_kl(
103                    &(quantity_1 * (self.bulk_modulus() - TWO_THIRDS * self.shear_modulus())),
104                    &quantity_2.transpose(),
105                ),
106        )
107    }
108}
109
110impl HyperelasticViscoplastic for SaintVenantKirchhoff {
111    #[doc = include_str!("helmholtz_free_energy_density.md")]
112    fn helmholtz_free_energy_density(
113        &self,
114        deformation_gradient: &DeformationGradient,
115        deformation_gradient_p: &DeformationGradientPlastic,
116    ) -> Result<Scalar, ConstitutiveError> {
117        let _jacobian = self.jacobian(deformation_gradient)?;
118        let deformation_gradient_e = deformation_gradient * deformation_gradient_p.inverse();
119        let strain = (deformation_gradient_e.right_cauchy_green() - IDENTITY_22) * 0.5;
120        Ok(self.shear_modulus() * strain.squared_trace()
121            + 0.5
122                * (self.bulk_modulus() - TWO_THIRDS * self.shear_modulus())
123                * strain.trace().powi(2))
124    }
125}