Skip to main content

conspire/constitutive/hybrid/elastic/multiplicative/viscoplastic/
mod.rs

1#[cfg(test)]
2mod test;
3
4use crate::{
5    constitutive::{
6        ConstitutiveError,
7        fluid::{
8            plastic::Plastic,
9            viscoplastic::{Viscoplastic, ViscoplasticStateVariables},
10        },
11        hybrid::ElasticMultiplicativeViscoplastic,
12        solid::{
13            Solid,
14            elastic::Elastic,
15            elastic_viscoplastic::{ElasticPlasticOrViscoplastic, ElasticViscoplastic},
16        },
17    },
18    math::{ContractFirstSecondWithSecond, ContractSecondWithFirst, Rank2, Scalar, Tensor},
19    mechanics::{
20        CauchyStress, CauchyTangentStiffness, CauchyTangentStiffnessElastic, DeformationGradient,
21        DeformationGradientPlastic, FirstPiolaKirchhoffStress, FirstPiolaKirchhoffStressElastic,
22        FirstPiolaKirchhoffTangentStiffness, FirstPiolaKirchhoffTangentStiffnessElastic,
23        MandelStressElastic, SecondPiolaKirchhoffStress, SecondPiolaKirchhoffStressElastic,
24        SecondPiolaKirchhoffTangentStiffness, SecondPiolaKirchhoffTangentStiffnessElastic,
25    },
26};
27
28impl<C1, C2, Y2> Solid for ElasticMultiplicativeViscoplastic<C1, C2, Y2>
29where
30    C1: Elastic,
31    C2: Viscoplastic<Y2>,
32    Y2: Tensor,
33{
34    fn bulk_modulus(&self) -> Scalar {
35        self.0.bulk_modulus()
36    }
37    fn shear_modulus(&self) -> Scalar {
38        self.0.shear_modulus()
39    }
40}
41
42impl<C1, C2, Y2> Plastic for ElasticMultiplicativeViscoplastic<C1, C2, Y2>
43where
44    C1: Elastic,
45    C2: Viscoplastic<Y2>,
46    Y2: Tensor,
47{
48    fn initial_yield_stress(&self) -> Scalar {
49        self.1.initial_yield_stress()
50    }
51    fn hardening_slope(&self) -> Scalar {
52        self.1.hardening_slope()
53    }
54}
55
56impl<C1, C2, Y2> Viscoplastic<Y2> for ElasticMultiplicativeViscoplastic<C1, C2, Y2>
57where
58    C1: Elastic,
59    C2: Viscoplastic<Y2>,
60    Y2: Tensor,
61{
62    fn initial_state(&self) -> ViscoplasticStateVariables<Y2> {
63        self.1.initial_state()
64    }
65    fn plastic_evolution(
66        &self,
67        mandel_stress: MandelStressElastic,
68        state_variables: &ViscoplasticStateVariables<Y2>,
69    ) -> Result<ViscoplasticStateVariables<Y2>, ConstitutiveError> {
70        self.1.plastic_evolution(mandel_stress, state_variables)
71    }
72    fn rate_sensitivity(&self) -> Scalar {
73        self.1.rate_sensitivity()
74    }
75    fn reference_flow_rate(&self) -> Scalar {
76        self.1.reference_flow_rate()
77    }
78}
79
80impl<C1, C2, Y2> ElasticPlasticOrViscoplastic for ElasticMultiplicativeViscoplastic<C1, C2, Y2>
81where
82    C1: Elastic,
83    C2: Viscoplastic<Y2>,
84    Y2: Tensor,
85{
86    fn cauchy_stress(
87        &self,
88        deformation_gradient: &DeformationGradient,
89        deformation_gradient_p: &DeformationGradientPlastic,
90    ) -> Result<CauchyStress, ConstitutiveError> {
91        self.0
92            .cauchy_stress(&(deformation_gradient * deformation_gradient_p.inverse()).into())
93    }
94    fn cauchy_tangent_stiffness(
95        &self,
96        deformation_gradient: &DeformationGradient,
97        deformation_gradient_p: &DeformationGradientPlastic,
98    ) -> Result<CauchyTangentStiffness, ConstitutiveError> {
99        let deformation_gradient_p_inverse = deformation_gradient_p.inverse();
100        Ok(
101            CauchyTangentStiffnessElastic::from(self.0.cauchy_tangent_stiffness(
102                &(deformation_gradient * &deformation_gradient_p_inverse).into(),
103            )?) * deformation_gradient_p_inverse.transpose(),
104        )
105    }
106    fn first_piola_kirchhoff_stress(
107        &self,
108        deformation_gradient: &DeformationGradient,
109        deformation_gradient_p: &DeformationGradientPlastic,
110    ) -> Result<FirstPiolaKirchhoffStress, ConstitutiveError> {
111        let deformation_gradient_p_inverse = deformation_gradient_p.inverse();
112        Ok(
113            FirstPiolaKirchhoffStressElastic::from(self.0.first_piola_kirchhoff_stress(
114                &(deformation_gradient * &deformation_gradient_p_inverse).into(),
115            )?) * deformation_gradient_p_inverse.transpose(),
116        )
117    }
118    fn first_piola_kirchhoff_tangent_stiffness(
119        &self,
120        deformation_gradient: &DeformationGradient,
121        deformation_gradient_p: &DeformationGradientPlastic,
122    ) -> Result<FirstPiolaKirchhoffTangentStiffness, ConstitutiveError> {
123        let deformation_gradient_p_inverse = deformation_gradient_p.inverse();
124        let deformation_gradient_p_inverse_transpose = deformation_gradient_p_inverse.transpose();
125        Ok((FirstPiolaKirchhoffTangentStiffnessElastic::from(
126            self.0.first_piola_kirchhoff_tangent_stiffness(
127                &(deformation_gradient * &deformation_gradient_p_inverse).into(),
128            )?,
129        ) * &deformation_gradient_p_inverse_transpose)
130            .contract_second_with_first(&deformation_gradient_p_inverse_transpose))
131    }
132    fn second_piola_kirchhoff_stress(
133        &self,
134        deformation_gradient: &DeformationGradient,
135        deformation_gradient_p: &DeformationGradientPlastic,
136    ) -> Result<SecondPiolaKirchhoffStress, ConstitutiveError> {
137        let deformation_gradient_p_inverse = deformation_gradient_p.inverse();
138        Ok(&deformation_gradient_p_inverse
139            * SecondPiolaKirchhoffStressElastic::from(self.0.second_piola_kirchhoff_stress(
140                &(deformation_gradient * &deformation_gradient_p_inverse).into(),
141            )?)
142            * deformation_gradient_p_inverse.transpose())
143    }
144    fn second_piola_kirchhoff_tangent_stiffness(
145        &self,
146        deformation_gradient: &DeformationGradient,
147        deformation_gradient_p: &DeformationGradientPlastic,
148    ) -> Result<SecondPiolaKirchhoffTangentStiffness, ConstitutiveError> {
149        let deformation_gradient_p_inverse = deformation_gradient_p.inverse();
150        Ok((SecondPiolaKirchhoffTangentStiffnessElastic::from(
151            self.0.second_piola_kirchhoff_tangent_stiffness(
152                &(deformation_gradient * &deformation_gradient_p_inverse).into(),
153            )?,
154        ) * deformation_gradient_p_inverse.transpose())
155        .contract_first_second_with_second(
156            &deformation_gradient_p_inverse,
157            &deformation_gradient_p_inverse,
158        ))
159    }
160}
161
162impl<C1, C2, Y2> ElasticViscoplastic<Y2> for ElasticMultiplicativeViscoplastic<C1, C2, Y2>
163where
164    C1: Elastic,
165    C2: Viscoplastic<Y2>,
166    Y2: Tensor,
167{
168}