conspire/constitutive/hybrid/elastic/additive/
mod.rs1#[cfg(test)]
2mod test;
3
4use crate::{
5 constitutive::{
6 ConstitutiveError,
7 hybrid::{Additive, Hybrid},
8 solid::{Solid, elastic::Elastic},
9 },
10 mechanics::{
11 CauchyStress, CauchyTangentStiffness, DeformationGradient, FirstPiolaKirchhoffStress,
12 FirstPiolaKirchhoffTangentStiffness, Scalar, SecondPiolaKirchhoffStress,
13 SecondPiolaKirchhoffTangentStiffness,
14 },
15};
16
17impl<C1, C2> Solid for Additive<C1, C2> {
18 fn bulk_modulus(&self) -> &Scalar {
20 panic!()
21 }
22 fn shear_modulus(&self) -> &Scalar {
24 panic!()
25 }
26}
27
28impl<C1, C2> Elastic for Additive<C1, C2>
29where
30 C1: Elastic,
31 C2: Elastic,
32{
33 fn cauchy_stress(
39 &self,
40 deformation_gradient: &DeformationGradient,
41 ) -> Result<CauchyStress, ConstitutiveError> {
42 Ok(self
43 .constitutive_model_1()
44 .cauchy_stress(deformation_gradient)?
45 + self
46 .constitutive_model_2()
47 .cauchy_stress(deformation_gradient)?)
48 }
49 fn cauchy_tangent_stiffness(
55 &self,
56 deformation_gradient: &DeformationGradient,
57 ) -> Result<CauchyTangentStiffness, ConstitutiveError> {
58 Ok(self
59 .constitutive_model_1()
60 .cauchy_tangent_stiffness(deformation_gradient)?
61 + self
62 .constitutive_model_2()
63 .cauchy_tangent_stiffness(deformation_gradient)?)
64 }
65 fn first_piola_kirchhoff_stress(
71 &self,
72 deformation_gradient: &DeformationGradient,
73 ) -> Result<FirstPiolaKirchhoffStress, ConstitutiveError> {
74 Ok(self
75 .constitutive_model_1()
76 .first_piola_kirchhoff_stress(deformation_gradient)?
77 + self
78 .constitutive_model_2()
79 .first_piola_kirchhoff_stress(deformation_gradient)?)
80 }
81 fn first_piola_kirchhoff_tangent_stiffness(
87 &self,
88 deformation_gradient: &DeformationGradient,
89 ) -> Result<FirstPiolaKirchhoffTangentStiffness, ConstitutiveError> {
90 Ok(self
91 .constitutive_model_1()
92 .first_piola_kirchhoff_tangent_stiffness(deformation_gradient)?
93 + self
94 .constitutive_model_2()
95 .first_piola_kirchhoff_tangent_stiffness(deformation_gradient)?)
96 }
97 fn second_piola_kirchhoff_stress(
103 &self,
104 deformation_gradient: &DeformationGradient,
105 ) -> Result<SecondPiolaKirchhoffStress, ConstitutiveError> {
106 Ok(self
107 .constitutive_model_1()
108 .second_piola_kirchhoff_stress(deformation_gradient)?
109 + self
110 .constitutive_model_2()
111 .second_piola_kirchhoff_stress(deformation_gradient)?)
112 }
113 fn second_piola_kirchhoff_tangent_stiffness(
119 &self,
120 deformation_gradient: &DeformationGradient,
121 ) -> Result<SecondPiolaKirchhoffTangentStiffness, ConstitutiveError> {
122 Ok(self
123 .constitutive_model_1()
124 .second_piola_kirchhoff_tangent_stiffness(deformation_gradient)?
125 + self
126 .constitutive_model_2()
127 .second_piola_kirchhoff_tangent_stiffness(deformation_gradient)?)
128 }
129}