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

1#[cfg(test)]
2mod test;
3
4use crate::{
5    constitutive::{
6        Constitutive, ConstitutiveError,
7        solid::{FIVE_THIRDS, Solid, TWO_THIRDS, elastic::Elastic, hyperelastic::Hyperelastic},
8    },
9    math::{
10        IDENTITY, Rank2,
11        special::{inverse_langevin, langevin_derivative},
12    },
13    mechanics::{CauchyStress, CauchyTangentStiffness, Deformation, DeformationGradient, Scalar},
14};
15
16#[doc = include_str!("doc.md")]
17#[derive(Debug)]
18pub struct ArrudaBoyce {
19    /// The bulk modulus $`\kappa`$.
20    pub bulk_modulus: Scalar,
21    /// The shear modulus $`\mu`$.
22    pub shear_modulus: Scalar,
23    /// The number of links $`N_b`$.
24    pub number_of_links: Scalar,
25}
26
27impl ArrudaBoyce {
28    /// Returns the number of links.
29    pub fn number_of_links(&self) -> &Scalar {
30        &self.number_of_links
31    }
32}
33
34impl Solid for ArrudaBoyce {
35    fn bulk_modulus(&self) -> &Scalar {
36        &self.bulk_modulus
37    }
38    fn shear_modulus(&self) -> &Scalar {
39        &self.shear_modulus
40    }
41}
42
43impl Elastic for ArrudaBoyce {
44    #[doc = include_str!("cauchy_stress.md")]
45    fn cauchy_stress(
46        &self,
47        deformation_gradient: &DeformationGradient,
48    ) -> Result<CauchyStress, ConstitutiveError> {
49        let jacobian = self.jacobian(deformation_gradient)?;
50        let (
51            deviatoric_isochoric_left_cauchy_green_deformation,
52            isochoric_left_cauchy_green_deformation_trace,
53        ) = (deformation_gradient.left_cauchy_green() / jacobian.powf(TWO_THIRDS))
54            .deviatoric_and_trace();
55        let gamma =
56            (isochoric_left_cauchy_green_deformation_trace / 3.0 / self.number_of_links()).sqrt();
57        if gamma >= 1.0 {
58            Err(ConstitutiveError::Custom(
59                "Maximum extensibility reached.".to_string(),
60                format!("{:?}", &self),
61            ))
62        } else {
63            let gamma_0 = (1.0 / self.number_of_links()).sqrt();
64            Ok(deviatoric_isochoric_left_cauchy_green_deformation
65                * (self.shear_modulus() * inverse_langevin(gamma) / inverse_langevin(gamma_0)
66                    * gamma_0
67                    / gamma
68                    / jacobian)
69                + IDENTITY * self.bulk_modulus() * 0.5 * (jacobian - 1.0 / jacobian))
70        }
71    }
72    #[doc = include_str!("cauchy_tangent_stiffness.md")]
73    fn cauchy_tangent_stiffness(
74        &self,
75        deformation_gradient: &DeformationGradient,
76    ) -> Result<CauchyTangentStiffness, ConstitutiveError> {
77        let jacobian = self.jacobian(deformation_gradient)?;
78        let inverse_transpose_deformation_gradient = deformation_gradient.inverse_transpose();
79        let left_cauchy_green_deformation = deformation_gradient.left_cauchy_green();
80        let deviatoric_left_cauchy_green_deformation = left_cauchy_green_deformation.deviatoric();
81        let (
82            deviatoric_isochoric_left_cauchy_green_deformation,
83            isochoric_left_cauchy_green_deformation_trace,
84        ) = (left_cauchy_green_deformation / jacobian.powf(TWO_THIRDS)).deviatoric_and_trace();
85        let gamma =
86            (isochoric_left_cauchy_green_deformation_trace / 3.0 / self.number_of_links()).sqrt();
87        if gamma >= 1.0 {
88            Err(ConstitutiveError::Custom(
89                "Maximum extensibility reached.".to_string(),
90                format!("{:?}", &self),
91            ))
92        } else {
93            let gamma_0 = (1.0 / self.number_of_links()).sqrt();
94            let eta = inverse_langevin(gamma);
95            let scaled_shear_modulus =
96                gamma_0 / inverse_langevin(gamma_0) * self.shear_modulus() * eta
97                    / gamma
98                    / jacobian.powf(FIVE_THIRDS);
99            let scaled_deviatoric_isochoric_left_cauchy_green_deformation =
100                deviatoric_left_cauchy_green_deformation * scaled_shear_modulus;
101            let term = CauchyTangentStiffness::dyad_ij_kl(
102                &scaled_deviatoric_isochoric_left_cauchy_green_deformation,
103                &(deviatoric_isochoric_left_cauchy_green_deformation
104                    * &inverse_transpose_deformation_gradient
105                    * ((1.0 / eta / langevin_derivative(eta) - 1.0 / gamma)
106                        / 3.0
107                        / self.number_of_links()
108                        / gamma)),
109            );
110            Ok(
111                (CauchyTangentStiffness::dyad_ik_jl(&IDENTITY, deformation_gradient)
112                    + CauchyTangentStiffness::dyad_il_jk(deformation_gradient, &IDENTITY)
113                    - CauchyTangentStiffness::dyad_ij_kl(&IDENTITY, deformation_gradient)
114                        * (TWO_THIRDS))
115                    * scaled_shear_modulus
116                    + CauchyTangentStiffness::dyad_ij_kl(
117                        &(IDENTITY * (0.5 * self.bulk_modulus() * (jacobian + 1.0 / jacobian))
118                            - scaled_deviatoric_isochoric_left_cauchy_green_deformation
119                                * (FIVE_THIRDS)),
120                        &inverse_transpose_deformation_gradient,
121                    )
122                    + term,
123            )
124        }
125    }
126}
127
128impl Hyperelastic for ArrudaBoyce {
129    #[doc = include_str!("helmholtz_free_energy_density.md")]
130    fn helmholtz_free_energy_density(
131        &self,
132        deformation_gradient: &DeformationGradient,
133    ) -> Result<Scalar, ConstitutiveError> {
134        let jacobian = self.jacobian(deformation_gradient)?;
135        let isochoric_left_cauchy_green_deformation =
136            deformation_gradient.left_cauchy_green() / jacobian.powf(TWO_THIRDS);
137        let gamma =
138            (isochoric_left_cauchy_green_deformation.trace() / 3.0 / self.number_of_links()).sqrt();
139        if gamma >= 1.0 {
140            Err(ConstitutiveError::Custom(
141                "Maximum extensibility reached.".to_string(),
142                format!("{:?}", &self),
143            ))
144        } else {
145            let eta = inverse_langevin(gamma);
146            let gamma_0 = (1.0 / self.number_of_links()).sqrt();
147            let eta_0 = inverse_langevin(gamma_0);
148            Ok(3.0 * gamma_0 / eta_0
149                * self.shear_modulus()
150                * self.number_of_links()
151                * (gamma * eta
152                    - gamma_0 * eta_0
153                    - (eta_0 * eta.sinh() / (eta * eta_0.sinh())).ln())
154                + 0.5 * self.bulk_modulus() * (0.5 * (jacobian.powi(2) - 1.0) - jacobian.ln()))
155        }
156    }
157}