conspire/constitutive/solid/elastic/bazant_itskov_lagrangian/
mod.rs1#[cfg(test)]
2mod test;
3
4use super::hencky::Hencky;
5use crate::{
6 constitutive::{
7 ConstitutiveError,
8 solid::{Solid, TWO_THIRDS, elastic::Elastic},
9 },
10 math::{
11 ContractThirdFourthWithFirstSecond, IDENTITY_00, Quantity, Rank2, Spectrum, TensorRank4,
12 },
13 mechanics::{
14 Deformation, DeformationGradient, Scalar, SecondPiolaKirchhoffStress,
15 SecondPiolaKirchhoffTangentStiffness,
16 },
17 units::Stress,
18};
19
20#[doc = include_str!("doc.md")]
21#[derive(Clone, Debug)]
22pub struct BazantItskovLagrangian {
23 pub bulk_modulus: Quantity<Stress>,
25 pub shear_modulus: Quantity<Stress>,
27 pub exponent: Scalar,
29}
30
31impl BazantItskovLagrangian {
32 pub fn exponent(&self) -> Scalar {
34 self.exponent
35 }
36 fn hencky(&self) -> Hencky {
37 Hencky {
38 bulk_modulus: self.bulk_modulus,
39 shear_modulus: self.shear_modulus,
40 }
41 }
42}
43
44impl Solid for BazantItskovLagrangian {
45 fn bulk_modulus(&self) -> Quantity<Stress> {
46 self.bulk_modulus
47 }
48 fn shear_modulus(&self) -> Quantity<Stress> {
49 self.shear_modulus
50 }
51}
52
53impl Elastic for BazantItskovLagrangian {
54 #[doc = include_str!("second_piola_kirchhoff_stress.md")]
55 fn second_piola_kirchhoff_stress(
56 &self,
57 deformation_gradient: &DeformationGradient,
58 ) -> Result<SecondPiolaKirchhoffStress, ConstitutiveError> {
59 if self.exponent() == 0.0 {
60 return self
61 .hencky()
62 .second_piola_kirchhoff_stress(deformation_gradient);
63 }
64 let _jacobian = self.jacobian(deformation_gradient)?;
65 let right_cauchy_green = deformation_gradient.right_cauchy_green();
66 let half_exponent = 0.5 * self.exponent();
67 let spectrum = Spectrum::new(&right_cauchy_green)
68 .map_err(|error| ConstitutiveError::upstream(error, self))?;
69 let (deviatoric_strain, strain_trace) = ((spectrum
70 .powm(half_exponent)
71 .map_err(|error| ConstitutiveError::upstream(error, self))?
72 - spectrum
73 .powm(-half_exponent)
74 .map_err(|error| ConstitutiveError::upstream(error, self))?)
75 / (2.0 * self.exponent()))
76 .deviatoric_and_trace();
77 Ok(deviatoric_strain * (2.0 * self.shear_modulus())
78 + IDENTITY_00 * (self.bulk_modulus() * strain_trace))
79 }
80 #[doc = include_str!("second_piola_kirchhoff_tangent_stiffness.md")]
81 fn second_piola_kirchhoff_tangent_stiffness(
82 &self,
83 deformation_gradient: &DeformationGradient,
84 ) -> Result<SecondPiolaKirchhoffTangentStiffness, ConstitutiveError> {
85 if self.exponent() == 0.0 {
86 return self
87 .hencky()
88 .second_piola_kirchhoff_tangent_stiffness(deformation_gradient);
89 }
90 let _jacobian = self.jacobian(deformation_gradient)?;
91 let right_cauchy_green = deformation_gradient.right_cauchy_green();
92 let half_exponent = 0.5 * self.exponent();
93 let spectrum = Spectrum::new(&right_cauchy_green)
94 .map_err(|error| ConstitutiveError::upstream(error, self))?;
95 let deformation_gradient_transpose = deformation_gradient.transpose();
96 let scaled_deformation_gradient_transpose =
97 &deformation_gradient_transpose * (self.shear_modulus() / self.exponent());
98 let trace_term = deformation_gradient
99 * (spectrum
100 .powm(half_exponent - 1.0)
101 .map_err(|error| ConstitutiveError::upstream(error, self))?
102 + spectrum
103 .powm(-half_exponent - 1.0)
104 .map_err(|error| ConstitutiveError::upstream(error, self))?)
105 * 0.5;
106 Ok((spectrum
107 .dpowm(half_exponent)
108 .map_err(|error| ConstitutiveError::upstream(error, self))?
109 - spectrum
110 .dpowm(-half_exponent)
111 .map_err(|error| ConstitutiveError::upstream(error, self))?)
112 .contract_third_fourth_with_first_second(
113 &(TensorRank4::dyad_il_jk(&IDENTITY_00, &scaled_deformation_gradient_transpose)
114 + TensorRank4::dyad_ik_jl(&scaled_deformation_gradient_transpose, &IDENTITY_00)),
115 ) + TensorRank4::dyad_ij_kl(
116 &(IDENTITY_00 * (self.bulk_modulus() - TWO_THIRDS * self.shear_modulus())),
117 &trace_term,
118 ))
119 }
120}