Skip to main content

conspire/constitutive/hybrid/elastic_viscoplastic/additive/elastic/
mod.rs

1#[cfg(test)]
2mod test;
3
4use crate::{
5    constitutive::{
6        ConstitutiveError,
7        fluid::{
8            plastic::Plastic,
9            viscoplastic::{Viscoplastic, ViscoplasticEvolution, ViscoplasticStateVariables},
10        },
11        hybrid::ElasticViscoplasticAdditiveElastic,
12        solid::{
13            Solid, elastic::Elastic, elastic_plastic::ElasticPlasticOrViscoplastic,
14            elastic_viscoplastic::ElasticViscoplastic,
15        },
16    },
17    math::{Differentiable, Quantity, Tensor},
18    mechanics::{
19        CauchyStress, CauchyTangentStiffness, DeformationGradient, DeformationGradientPlastic,
20        FirstPiolaKirchhoffStress, FirstPiolaKirchhoffTangentStiffness, MandelStressElastic,
21        Scalar, SecondPiolaKirchhoffStress, SecondPiolaKirchhoffTangentStiffness,
22        StretchingRatePlastic,
23    },
24    units::{Dissipation, Rate, Stress},
25};
26
27impl<C1, C2, Y1> Solid for ElasticViscoplasticAdditiveElastic<C1, C2, Y1>
28where
29    C1: ElasticViscoplastic<Y1>,
30    C2: Elastic,
31    Y1: Differentiable + Tensor,
32{
33    fn bulk_modulus(&self) -> Quantity<Stress> {
34        self.0.bulk_modulus() + self.1.bulk_modulus()
35    }
36    fn shear_modulus(&self) -> Quantity<Stress> {
37        self.0.shear_modulus() + self.1.shear_modulus()
38    }
39}
40
41impl<C1, C2, Y1> Plastic for ElasticViscoplasticAdditiveElastic<C1, C2, Y1>
42where
43    C1: ElasticViscoplastic<Y1>,
44    C2: Elastic,
45    Y1: Differentiable + Tensor,
46{
47    fn initial_yield_stress(&self) -> Quantity<Stress> {
48        self.0.initial_yield_stress()
49    }
50    fn hardening_slope(&self) -> Quantity<Stress> {
51        self.0.hardening_slope()
52    }
53}
54
55impl<C1, C2, Y1> Viscoplastic<Y1> for ElasticViscoplasticAdditiveElastic<C1, C2, Y1>
56where
57    C1: ElasticViscoplastic<Y1>,
58    C2: Elastic,
59    Y1: Differentiable + Tensor,
60{
61    fn initial_state(&self) -> ViscoplasticStateVariables<Y1> {
62        self.0.initial_state()
63    }
64    fn plastic_evolution(
65        &self,
66        mandel_stress: MandelStressElastic,
67        state_variables: &ViscoplasticStateVariables<Y1>,
68    ) -> Result<ViscoplasticEvolution<Y1>, ConstitutiveError> {
69        self.0.plastic_evolution(mandel_stress, state_variables)
70    }
71    fn plastic_stretching_rate(
72        &self,
73        deviatoric_mandel_stress: MandelStressElastic,
74        yield_stress: Quantity<Stress>,
75    ) -> Result<StretchingRatePlastic, ConstitutiveError> {
76        self.0
77            .plastic_stretching_rate(deviatoric_mandel_stress, yield_stress)
78    }
79    fn dissipation_potential(
80        &self,
81        plastic_stretching_rate: StretchingRatePlastic,
82        yield_stress: Quantity<Stress>,
83    ) -> Result<Quantity<Dissipation>, ConstitutiveError> {
84        self.0
85            .dissipation_potential(plastic_stretching_rate, yield_stress)
86    }
87    fn dual_dissipation_potential(
88        &self,
89        deviatoric_mandel_stress: MandelStressElastic,
90        yield_stress: Quantity<Stress>,
91    ) -> Result<Quantity<Dissipation>, ConstitutiveError> {
92        self.0
93            .dual_dissipation_potential(deviatoric_mandel_stress, yield_stress)
94    }
95    fn rate_sensitivity(&self) -> Scalar {
96        self.0.rate_sensitivity()
97    }
98    fn reference_flow_rate(&self) -> Quantity<Rate> {
99        self.0.reference_flow_rate()
100    }
101}
102
103impl<C1, C2, Y1> ElasticPlasticOrViscoplastic for ElasticViscoplasticAdditiveElastic<C1, C2, Y1>
104where
105    C1: ElasticViscoplastic<Y1>,
106    C2: Elastic,
107    Y1: Differentiable + Tensor,
108{
109    /// Calculates and returns the Cauchy stress.
110    ///
111    /// ```math
112    /// \boldsymbol{\sigma}(\mathbf{F},\mathbf{F}_\mathrm{p}) = \boldsymbol{\sigma}_1(\mathbf{F},\mathbf{F}_\mathrm{p}) + \boldsymbol{\sigma}_2(\mathbf{F})
113    /// ```
114    fn cauchy_stress(
115        &self,
116        deformation_gradient: &DeformationGradient,
117        deformation_gradient_p: &DeformationGradientPlastic,
118    ) -> Result<CauchyStress, ConstitutiveError> {
119        Ok(self
120            .0
121            .cauchy_stress(deformation_gradient, deformation_gradient_p)?
122            + self.1.cauchy_stress(deformation_gradient)?)
123    }
124    /// Calculates and returns the tangent stiffness associated with the Cauchy stress.
125    ///
126    /// ```math
127    /// \mathcal{T}(\mathbf{F},\mathbf{F}_\mathrm{p}) = \mathcal{T}_1(\mathbf{F},\mathbf{F}_\mathrm{p}) + \mathcal{T}_2(\mathbf{F})
128    /// ```
129    fn cauchy_tangent_stiffness(
130        &self,
131        deformation_gradient: &DeformationGradient,
132        deformation_gradient_p: &DeformationGradientPlastic,
133    ) -> Result<CauchyTangentStiffness, ConstitutiveError> {
134        Ok(self
135            .0
136            .cauchy_tangent_stiffness(deformation_gradient, deformation_gradient_p)?
137            + self.1.cauchy_tangent_stiffness(deformation_gradient)?)
138    }
139    /// Calculates and returns the first Piola-Kirchhoff stress.
140    ///
141    /// ```math
142    /// \mathbf{P}(\mathbf{F},\mathbf{F}_\mathrm{p}) = \mathbf{P}_1(\mathbf{F},\mathbf{F}_\mathrm{p}) + \mathbf{P}_2(\mathbf{F})
143    /// ```
144    fn first_piola_kirchhoff_stress(
145        &self,
146        deformation_gradient: &DeformationGradient,
147        deformation_gradient_p: &DeformationGradientPlastic,
148    ) -> Result<FirstPiolaKirchhoffStress, ConstitutiveError> {
149        Ok(self
150            .0
151            .first_piola_kirchhoff_stress(deformation_gradient, deformation_gradient_p)?
152            + self.1.first_piola_kirchhoff_stress(deformation_gradient)?)
153    }
154    /// Calculates and returns the tangent stiffness associated with the first Piola-Kirchhoff stress.
155    ///
156    /// ```math
157    /// \mathcal{C}(\mathbf{F},\mathbf{F}_\mathrm{p}) = \mathcal{C}_1(\mathbf{F},\mathbf{F}_\mathrm{p}) + \mathcal{C}_2(\mathbf{F})
158    /// ```
159    fn first_piola_kirchhoff_tangent_stiffness(
160        &self,
161        deformation_gradient: &DeformationGradient,
162        deformation_gradient_p: &DeformationGradientPlastic,
163    ) -> Result<FirstPiolaKirchhoffTangentStiffness, ConstitutiveError> {
164        Ok(self.0.first_piola_kirchhoff_tangent_stiffness(
165            deformation_gradient,
166            deformation_gradient_p,
167        )? + self
168            .1
169            .first_piola_kirchhoff_tangent_stiffness(deformation_gradient)?)
170    }
171    /// Calculates and returns the second Piola-Kirchhoff stress.
172    ///
173    /// ```math
174    /// \mathbf{S}(\mathbf{F},\mathbf{F}_\mathrm{p}) = \mathbf{S}_1(\mathbf{F},\mathbf{F}_\mathrm{p}) + \mathbf{S}_2(\mathbf{F})
175    /// ```
176    fn second_piola_kirchhoff_stress(
177        &self,
178        deformation_gradient: &DeformationGradient,
179        deformation_gradient_p: &DeformationGradientPlastic,
180    ) -> Result<SecondPiolaKirchhoffStress, ConstitutiveError> {
181        Ok(self
182            .0
183            .second_piola_kirchhoff_stress(deformation_gradient, deformation_gradient_p)?
184            + self.1.second_piola_kirchhoff_stress(deformation_gradient)?)
185    }
186    /// Calculates and returns the tangent stiffness associated with the second Piola-Kirchhoff stress.
187    ///
188    /// ```math
189    /// \mathcal{G}(\mathbf{F},\mathbf{F}_\mathrm{p}) = \mathcal{G}_1(\mathbf{F},\mathbf{F}_\mathrm{p}) + \mathcal{G}_2(\mathbf{F})
190    /// ```
191    fn second_piola_kirchhoff_tangent_stiffness(
192        &self,
193        deformation_gradient: &DeformationGradient,
194        deformation_gradient_p: &DeformationGradientPlastic,
195    ) -> Result<SecondPiolaKirchhoffTangentStiffness, ConstitutiveError> {
196        Ok(self.0.second_piola_kirchhoff_tangent_stiffness(
197            deformation_gradient,
198            deformation_gradient_p,
199        )? + self
200            .1
201            .second_piola_kirchhoff_tangent_stiffness(deformation_gradient)?)
202    }
203}
204
205impl<C1, C2, Y1> ElasticViscoplastic<Y1> for ElasticViscoplasticAdditiveElastic<C1, C2, Y1>
206where
207    C1: ElasticViscoplastic<Y1>,
208    C2: Elastic,
209    Y1: Differentiable + Tensor,
210{
211    fn state_variables_evolution(
212        &self,
213        deformation_gradient: &DeformationGradient,
214        state_variables: &ViscoplasticStateVariables<Y1>,
215    ) -> Result<ViscoplasticEvolution<Y1>, ConstitutiveError> {
216        self.0
217            .state_variables_evolution(deformation_gradient, state_variables)
218    }
219}