conspire/constitutive/solid/
mod.rs1#[cfg(feature = "autodiff")]
4pub mod autodiff;
5
6mod canonical;
7
8pub mod elastic;
9pub mod elastic_hyperviscous;
10pub mod elastic_plastic;
11pub mod elastic_viscoplastic;
12pub mod hyperelastic;
13pub mod hyperelastic_viscoplastic;
14pub mod hyperviscoelastic;
15pub mod thermoelastic;
16pub mod thermohyperelastic;
17pub mod viscoelastic;
18
19const TWO_THIRDS: Scalar = 2.0 / 3.0;
20const FIVE_THIRDS: Scalar = 5.0 / 3.0;
21
22use crate::{
23 constitutive::{Constitutive, ConstitutiveError},
24 math::{
25 ContractFirstSecondWithSecond, ContractSecondWithFirst, IDENTITY, IDENTITY_00, Quantity,
26 Rank2, TensorArray,
27 },
28 mechanics::{
29 CauchyRateTangentStiffness, CauchyStress, CauchyTangentStiffness, Deformation,
30 DeformationError, DeformationGradient, DeformationGradientGeneral, DeformationGradientRate,
31 DeformationGradientRates, DeformationGradients, FirstPiolaKirchhoffRateTangentStiffness,
32 FirstPiolaKirchhoffStress, FirstPiolaKirchhoffTangentStiffness, Scalar,
33 SecondPiolaKirchhoffRateTangentStiffness, SecondPiolaKirchhoffStress,
34 SecondPiolaKirchhoffTangentStiffness, Times,
35 },
36 units::Stress,
37};
38use std::fmt::Debug;
39
40impl<C> Constitutive for C where C: Solid {}
41
42pub trait Solid
44where
45 Self: Constitutive,
46{
47 fn bulk_modulus(&self) -> Quantity<Stress>;
49 fn shear_modulus(&self) -> Quantity<Stress>;
51 fn jacobian<I, J>(
53 &self,
54 deformation_gradient: &DeformationGradientGeneral<I, J>,
55 ) -> Result<Scalar, ConstitutiveError> {
56 match deformation_gradient.jacobian() {
57 Err(DeformationError::InvalidJacobian(jacobian)) => {
58 Err(ConstitutiveError::invalid_jacobian(jacobian, self))
59 }
60 Ok(jacobian) => Ok(jacobian),
61 }
62 }
63}