Skip to main content

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

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