conspire/constitutive/hybrid/elastic_viscoplastic/additive/viscoplastic/
mod.rs1use crate::{
2 constitutive::{
3 ConstitutiveError,
4 fluid::{
5 plastic::Plastic,
6 viscoplastic::{Viscoplastic, ViscoplasticStateVariables},
7 },
8 hybrid::ElasticViscoplasticAdditiveViscoplastic,
9 solid::elastic_viscoplastic::ElasticViscoplastic,
10 },
11 math::{Rank2, Tensor, TensorTuple},
12 mechanics::{MandelStressElastic, Scalar},
13};
14
15type GroupedViscoplasticStateVariables<Y1, Y2> = TensorTuple<ViscoplasticStateVariables<Y1>, Y2>;
16type NestedViscoplasticStateVariables<Y1, Y2> =
17 ViscoplasticStateVariables<GroupedViscoplasticStateVariables<Y1, Y2>>;
18
19impl<C1, C2, Y1, Y2> Plastic for ElasticViscoplasticAdditiveViscoplastic<C1, C2, Y1, Y2>
20where
21 C1: ElasticViscoplastic<Y1>,
22 C2: Viscoplastic<Y2>,
23 Y1: Tensor,
24 Y2: Tensor,
25{
26 fn initial_yield_stress(&self) -> Scalar {
27 self.1.initial_yield_stress()
28 }
29 fn hardening_slope(&self) -> Scalar {
30 self.1.hardening_slope()
31 }
32}
33
34impl<C1, C2, Y1, Y2> Viscoplastic<GroupedViscoplasticStateVariables<Y1, Y2>>
35 for ElasticViscoplasticAdditiveViscoplastic<C1, C2, Y1, Y2>
36where
37 C1: ElasticViscoplastic<Y1>,
38 C2: Viscoplastic<Y2>,
39 Y1: Tensor,
40 Y2: Tensor,
41{
42 fn initial_state(&self) -> NestedViscoplasticStateVariables<Y1, Y2> {
43 let initial_state_1 = self.0.initial_state();
44 let (deformation_gradient, y_2) = self.1.initial_state().into();
45 (deformation_gradient, (initial_state_1, y_2).into()).into()
46 }
47 fn plastic_evolution(
48 &self,
49 mandel_stress: MandelStressElastic,
50 state_variables: &ViscoplasticStateVariables<GroupedViscoplasticStateVariables<Y1, Y2>>,
51 ) -> Result<NestedViscoplasticStateVariables<Y1, Y2>, ConstitutiveError> {
52 let state_variables_1 = &state_variables.1.0;
53 let state_variables_2 = &(state_variables.0.clone(), state_variables.1.1.clone()).into();
54 let deformation_gradient = (&state_variables.0).into();
55 let deformation_gradient_p = &state_variables_1.0;
56 let jacobian = self.0.jacobian(deformation_gradient)?;
57 let deformation_gradient_e = deformation_gradient * deformation_gradient_p.inverse();
58 let cauchy_stress_1 = self
59 .0
60 .cauchy_stress(deformation_gradient, deformation_gradient_p)?;
61 let mandel_stress_1 = (deformation_gradient_e.transpose()
62 * &cauchy_stress_1
63 * deformation_gradient_e.inverse_transpose())
64 * jacobian;
65 let cauchy_stress_2 = mandel_stress - MandelStressElastic::from(cauchy_stress_1);
66 let evolution_1 = self
67 .0
68 .plastic_evolution(mandel_stress_1, state_variables_1)?;
69 let (deformation_gradient_rate, dydt_2) = self
70 .1
71 .plastic_evolution(cauchy_stress_2, state_variables_2)?
72 .into();
73 Ok((deformation_gradient_rate, (evolution_1, dydt_2).into()).into())
74 }
75 fn rate_sensitivity(&self) -> Scalar {
76 self.1.rate_sensitivity()
77 }
78 fn reference_flow_rate(&self) -> Scalar {
79 self.1.reference_flow_rate()
80 }
81}