conspire/constitutive/solid/elastic/bazant_itskov_eulerian/
mod.rs1#[cfg(test)]
2mod test;
3
4use crate::{
5 constitutive::{
6 ConstitutiveError,
7 solid::{Solid, TWO_THIRDS, elastic::Elastic},
8 },
9 math::{ContractThirdFourthWithFirstSecond, IDENTITY, Quantity, Rank2, Spectrum, TensorRank4},
10 mechanics::{CauchyStress, CauchyTangentStiffness, Deformation, DeformationGradient, Scalar},
11 units::Stress,
12};
13
14#[doc = include_str!("doc.md")]
15#[derive(Clone, Debug)]
16pub struct BazantItskovEulerian {
17 pub bulk_modulus: Quantity<Stress>,
19 pub shear_modulus: Quantity<Stress>,
21 pub exponent: Scalar,
23}
24
25impl BazantItskovEulerian {
26 pub fn exponent(&self) -> Scalar {
28 self.exponent
29 }
30}
31
32impl Solid for BazantItskovEulerian {
33 fn bulk_modulus(&self) -> Quantity<Stress> {
34 self.bulk_modulus
35 }
36 fn shear_modulus(&self) -> Quantity<Stress> {
37 self.shear_modulus
38 }
39}
40
41impl Elastic for BazantItskovEulerian {
42 #[doc = include_str!("cauchy_stress.md")]
43 fn cauchy_stress(
44 &self,
45 deformation_gradient: &DeformationGradient,
46 ) -> Result<CauchyStress, ConstitutiveError> {
47 let jacobian = self.jacobian(deformation_gradient)?;
48 let left_cauchy_green = deformation_gradient.left_cauchy_green();
49 let (deviatoric_strain, strain_trace) = if self.exponent() == 0.0 {
50 (left_cauchy_green
51 .logm()
52 .map_err(|error| ConstitutiveError::upstream(error, self))?
53 * 0.5)
54 .deviatoric_and_trace()
55 } else {
56 let half_exponent = 0.5 * self.exponent();
57 let spectrum = Spectrum::new(&left_cauchy_green)
58 .map_err(|error| ConstitutiveError::upstream(error, self))?;
59 ((spectrum
60 .powm(half_exponent)
61 .map_err(|error| ConstitutiveError::upstream(error, self))?
62 - spectrum
63 .powm(-half_exponent)
64 .map_err(|error| ConstitutiveError::upstream(error, self))?)
65 / (2.0 * self.exponent()))
66 .deviatoric_and_trace()
67 };
68 Ok(deviatoric_strain * (2.0 * self.shear_modulus() / jacobian)
69 + IDENTITY * (self.bulk_modulus() * strain_trace / jacobian))
70 }
71 #[doc = include_str!("cauchy_tangent_stiffness.md")]
72 fn cauchy_tangent_stiffness(
73 &self,
74 deformation_gradient: &DeformationGradient,
75 ) -> Result<CauchyTangentStiffness, ConstitutiveError> {
76 let jacobian = self.jacobian(deformation_gradient)?;
77 let left_cauchy_green = deformation_gradient.left_cauchy_green();
78 let inverse_transpose_deformation_gradient = deformation_gradient.inverse_transpose();
79 if self.exponent() == 0.0 {
80 let (deviatoric_strain, strain_trace) = (left_cauchy_green
81 .logm()
82 .map_err(|error| ConstitutiveError::upstream(error, self))?
83 * 0.5)
84 .deviatoric_and_trace();
85 let scaled_deformation_gradient =
86 deformation_gradient * (self.shear_modulus() / jacobian);
87 return Ok((left_cauchy_green
88 .dlogm()
89 .map_err(|error| ConstitutiveError::upstream(error, self))?
90 .contract_third_fourth_with_first_second(
91 &(TensorRank4::dyad_il_jk(&scaled_deformation_gradient, &IDENTITY)
92 + TensorRank4::dyad_ik_jl(&IDENTITY, &scaled_deformation_gradient)),
93 ))
94 + TensorRank4::dyad_ij_kl(
95 &(IDENTITY
96 * ((self.bulk_modulus() - TWO_THIRDS * self.shear_modulus()) / jacobian)
97 - deviatoric_strain * (2.0 * self.shear_modulus() / jacobian)
98 - IDENTITY * (self.bulk_modulus() * strain_trace / jacobian)),
99 &inverse_transpose_deformation_gradient,
100 ));
101 }
102 let half_exponent = 0.5 * self.exponent();
103 let spectrum = Spectrum::new(&left_cauchy_green)
104 .map_err(|error| ConstitutiveError::upstream(error, self))?;
105 let (deviatoric_strain, strain_trace) = ((spectrum
106 .powm(half_exponent)
107 .map_err(|error| ConstitutiveError::upstream(error, self))?
108 - spectrum
109 .powm(-half_exponent)
110 .map_err(|error| ConstitutiveError::upstream(error, self))?)
111 / (2.0 * self.exponent()))
112 .deviatoric_and_trace();
113 let cauchy_stress = deviatoric_strain * (2.0 * self.shear_modulus() / jacobian)
114 + IDENTITY * (self.bulk_modulus() * strain_trace / jacobian);
115 let scaled_deformation_gradient =
116 deformation_gradient * (self.shear_modulus() / (self.exponent() * jacobian));
117 let trace_term = (spectrum
118 .powm(half_exponent - 1.0)
119 .map_err(|error| ConstitutiveError::upstream(error, self))?
120 + spectrum
121 .powm(-half_exponent - 1.0)
122 .map_err(|error| ConstitutiveError::upstream(error, self))?)
123 * deformation_gradient
124 * 0.5;
125 Ok((spectrum
126 .dpowm(half_exponent)
127 .map_err(|error| ConstitutiveError::upstream(error, self))?
128 - spectrum
129 .dpowm(-half_exponent)
130 .map_err(|error| ConstitutiveError::upstream(error, self))?)
131 .contract_third_fourth_with_first_second(
132 &(TensorRank4::dyad_il_jk(&scaled_deformation_gradient, &IDENTITY)
133 + TensorRank4::dyad_ik_jl(&IDENTITY, &scaled_deformation_gradient)),
134 ) + TensorRank4::dyad_ij_kl(
135 &(IDENTITY * ((self.bulk_modulus() - TWO_THIRDS * self.shear_modulus()) / jacobian)),
136 &trace_term,
137 ) - TensorRank4::dyad_ij_kl(&cauchy_stress, &inverse_transpose_deformation_gradient))
138 }
139}