Skip to main content

conspire/constitutive/solid/thermoelastic/almansi_hamel/
mod.rs

1#[cfg(test)]
2mod test;
3
4use super::*;
5use crate::{
6    math::{Quantity, TensorRank4},
7    units::{ReciprocalTemperature, Stress, Temperature},
8};
9
10#[doc = include_str!("doc.md")]
11#[derive(Clone, Debug)]
12pub struct AlmansiHamel {
13    /// The bulk modulus $`\kappa`$.
14    pub bulk_modulus: Quantity<Stress>,
15    /// The shear modulus $`\mu`$.
16    pub shear_modulus: Quantity<Stress>,
17    /// The coefficient of thermal expansion $`\alpha`$.
18    pub coefficient_of_thermal_expansion: Quantity<ReciprocalTemperature>,
19    /// The reference temperature $`T_\mathrm{ref}`$.
20    pub reference_temperature: Quantity<Temperature>,
21}
22
23impl Solid for AlmansiHamel {
24    fn bulk_modulus(&self) -> Quantity<Stress> {
25        self.bulk_modulus
26    }
27    fn shear_modulus(&self) -> Quantity<Stress> {
28        self.shear_modulus
29    }
30}
31
32impl Thermoelastic for AlmansiHamel {
33    #[doc = include_str!("cauchy_stress.md")]
34    fn cauchy_stress(
35        &self,
36        deformation_gradient: &DeformationGradient,
37        temperature: Quantity<Temperature>,
38    ) -> Result<CauchyStress, ConstitutiveError> {
39        let jacobian = self.jacobian(deformation_gradient)?;
40        let inverse_deformation_gradient = deformation_gradient.inverse();
41        let strain = (IDENTITY
42            - inverse_deformation_gradient.transpose() * &inverse_deformation_gradient)
43            * 0.5;
44        let (deviatoric_strain, strain_trace) = strain.deviatoric_and_trace();
45        Ok(deviatoric_strain * (2.0 * self.shear_modulus() / jacobian)
46            + IDENTITY
47                * (self.bulk_modulus() / jacobian
48                    * (strain_trace
49                        - 3.0
50                            * self.coefficient_of_thermal_expansion()
51                            * (temperature - self.reference_temperature()))))
52    }
53    #[doc = include_str!("cauchy_tangent_stiffness.md")]
54    fn cauchy_tangent_stiffness(
55        &self,
56        deformation_gradient: &DeformationGradient,
57        temperature: Quantity<Temperature>,
58    ) -> Result<CauchyTangentStiffness, ConstitutiveError> {
59        let jacobian = self.jacobian(deformation_gradient)?;
60        let inverse_transpose_deformation_gradient = deformation_gradient.inverse_transpose();
61        let inverse_left_cauchy_green_deformation = &inverse_transpose_deformation_gradient
62            * inverse_transpose_deformation_gradient.transpose();
63        let strain = (IDENTITY - &inverse_left_cauchy_green_deformation) * 0.5;
64        let (deviatoric_strain, strain_trace) = strain.deviatoric_and_trace();
65        Ok((TensorRank4::dyad_il_jk(
66            &inverse_transpose_deformation_gradient,
67            &inverse_left_cauchy_green_deformation,
68        ) + TensorRank4::dyad_ik_jl(
69            &inverse_left_cauchy_green_deformation,
70            &inverse_transpose_deformation_gradient,
71        )) * (self.shear_modulus() / jacobian)
72            + TensorRank4::dyad_ij_kl(
73                &IDENTITY,
74                &(inverse_left_cauchy_green_deformation
75                    * &inverse_transpose_deformation_gradient
76                    * ((self.bulk_modulus() - self.shear_modulus() * TWO_THIRDS) / jacobian)),
77            )
78            - TensorRank4::dyad_ij_kl(
79                &(deviatoric_strain * (2.0 * self.shear_modulus() / jacobian)
80                    + IDENTITY
81                        * (self.bulk_modulus() / jacobian
82                            * (strain_trace
83                                - 3.0
84                                    * self.coefficient_of_thermal_expansion()
85                                    * (temperature - self.reference_temperature())))),
86                &inverse_transpose_deformation_gradient,
87            ))
88    }
89    fn coefficient_of_thermal_expansion(&self) -> Quantity<ReciprocalTemperature> {
90        self.coefficient_of_thermal_expansion
91    }
92    fn reference_temperature(&self) -> Quantity<Temperature> {
93        self.reference_temperature
94    }
95}