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};
16use std::fmt::Debug;
17
18impl<C1, C2> Solid for Additive<C1, C2>
19where
20 C1: Debug,
21 C2: Debug,
22{
23 fn bulk_modulus(&self) -> &Scalar {
25 panic!()
26 }
27 fn shear_modulus(&self) -> &Scalar {
29 panic!()
30 }
31}
32
33impl<C1, C2> Elastic for Additive<C1, C2>
34where
35 C1: Elastic,
36 C2: Elastic,
37{
38 fn cauchy_stress(
44 &self,
45 deformation_gradient: &DeformationGradient,
46 ) -> Result<CauchyStress, ConstitutiveError> {
47 Ok(self
48 .constitutive_model_1()
49 .cauchy_stress(deformation_gradient)?
50 + self
51 .constitutive_model_2()
52 .cauchy_stress(deformation_gradient)?)
53 }
54 fn cauchy_tangent_stiffness(
60 &self,
61 deformation_gradient: &DeformationGradient,
62 ) -> Result<CauchyTangentStiffness, ConstitutiveError> {
63 Ok(self
64 .constitutive_model_1()
65 .cauchy_tangent_stiffness(deformation_gradient)?
66 + self
67 .constitutive_model_2()
68 .cauchy_tangent_stiffness(deformation_gradient)?)
69 }
70 fn first_piola_kirchhoff_stress(
76 &self,
77 deformation_gradient: &DeformationGradient,
78 ) -> Result<FirstPiolaKirchhoffStress, ConstitutiveError> {
79 Ok(self
80 .constitutive_model_1()
81 .first_piola_kirchhoff_stress(deformation_gradient)?
82 + self
83 .constitutive_model_2()
84 .first_piola_kirchhoff_stress(deformation_gradient)?)
85 }
86 fn first_piola_kirchhoff_tangent_stiffness(
92 &self,
93 deformation_gradient: &DeformationGradient,
94 ) -> Result<FirstPiolaKirchhoffTangentStiffness, ConstitutiveError> {
95 Ok(self
96 .constitutive_model_1()
97 .first_piola_kirchhoff_tangent_stiffness(deformation_gradient)?
98 + self
99 .constitutive_model_2()
100 .first_piola_kirchhoff_tangent_stiffness(deformation_gradient)?)
101 }
102 fn second_piola_kirchhoff_stress(
108 &self,
109 deformation_gradient: &DeformationGradient,
110 ) -> Result<SecondPiolaKirchhoffStress, ConstitutiveError> {
111 Ok(self
112 .constitutive_model_1()
113 .second_piola_kirchhoff_stress(deformation_gradient)?
114 + self
115 .constitutive_model_2()
116 .second_piola_kirchhoff_stress(deformation_gradient)?)
117 }
118 fn second_piola_kirchhoff_tangent_stiffness(
124 &self,
125 deformation_gradient: &DeformationGradient,
126 ) -> Result<SecondPiolaKirchhoffTangentStiffness, ConstitutiveError> {
127 Ok(self
128 .constitutive_model_1()
129 .second_piola_kirchhoff_tangent_stiffness(deformation_gradient)?
130 + self
131 .constitutive_model_2()
132 .second_piola_kirchhoff_tangent_stiffness(deformation_gradient)?)
133 }
134}