conspire/constitutive/solid/
mod.rs1pub mod elastic;
4pub mod elastic_hyperviscous;
5pub mod elastic_plastic;
6pub mod elastic_viscoplastic;
7pub mod hyperelastic;
8pub mod hyperelastic_viscoplastic;
9pub mod hyperviscoelastic;
10pub mod thermoelastic;
11pub mod thermohyperelastic;
12pub mod viscoelastic;
13
14const TWO_THIRDS: Scalar = 2.0 / 3.0;
15const FIVE_THIRDS: Scalar = 5.0 / 3.0;
16
17use crate::{
18 constitutive::{Constitutive, ConstitutiveError},
19 math::{
20 ContractFirstSecondIndicesWithSecondIndicesOf, ContractSecondIndexWithFirstIndexOf,
21 IDENTITY, IDENTITY_00, Rank2, Tensor, TensorArray, ZERO_10,
22 },
23 mechanics::{
24 CauchyRateTangentStiffness, CauchyStress, CauchyTangentStiffness, Deformation,
25 DeformationError, DeformationGradient, DeformationGradientGeneral, DeformationGradientRate,
26 DeformationGradientRates, DeformationGradients, FirstPiolaKirchhoffRateTangentStiffness,
27 FirstPiolaKirchhoffStress, FirstPiolaKirchhoffTangentStiffness, Scalar,
28 SecondPiolaKirchhoffRateTangentStiffness, SecondPiolaKirchhoffStress,
29 SecondPiolaKirchhoffTangentStiffness, Times,
30 },
31};
32use std::fmt::Debug;
33
34impl<C> Constitutive for C where C: Solid {}
35
36pub trait Solid
38where
39 Self: Constitutive,
40{
41 fn bulk_modulus(&self) -> Scalar;
43 fn shear_modulus(&self) -> Scalar;
45 fn jacobian<const I: usize, const J: usize>(
47 &self,
48 deformation_gradient: &DeformationGradientGeneral<I, J>,
49 ) -> Result<Scalar, ConstitutiveError> {
50 match deformation_gradient.jacobian() {
51 Err(DeformationError::InvalidJacobian(jacobian)) => Err(
52 ConstitutiveError::InvalidJacobian(jacobian, format!("{self:?}")),
53 ),
54 Ok(jacobian) => Ok(jacobian),
55 }
56 }
57}