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