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

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