#[cfg(test)]
pub mod test;
mod almansi_hamel;
pub use almansi_hamel::AlmansiHamel;
use super::*;
pub trait Thermoelastic<'a>
where
Self: Solid<'a>,
{
fn calculate_cauchy_stress(
&self,
deformation_gradient: &DeformationGradient,
temperature: &Scalar,
) -> Result<CauchyStress, ConstitutiveError> {
Ok(deformation_gradient
* self.calculate_second_piola_kirchoff_stress(deformation_gradient, temperature)?
* deformation_gradient.transpose()
/ deformation_gradient.determinant())
}
fn calculate_cauchy_tangent_stiffness(
&self,
deformation_gradient: &DeformationGradient,
temperature: &Scalar,
) -> Result<CauchyTangentStiffness, ConstitutiveError> {
let deformation_gradient_inverse_transpose = deformation_gradient.inverse_transpose();
let cauchy_stress = self.calculate_cauchy_stress(deformation_gradient, temperature)?;
let some_stress = &cauchy_stress * &deformation_gradient_inverse_transpose;
Ok(self
.calculate_second_piola_kirchoff_tangent_stiffness(deformation_gradient, temperature)?
.contract_first_second_indices_with_second_indices_of(
deformation_gradient,
deformation_gradient,
)
/ deformation_gradient.determinant()
- CauchyTangentStiffness::dyad_ij_kl(
&cauchy_stress,
&deformation_gradient_inverse_transpose,
)
+ CauchyTangentStiffness::dyad_il_kj(&some_stress, &IDENTITY)
+ CauchyTangentStiffness::dyad_ik_jl(&IDENTITY, &some_stress))
}
fn calculate_first_piola_kirchoff_stress(
&self,
deformation_gradient: &DeformationGradient,
temperature: &Scalar,
) -> Result<FirstPiolaKirchoffStress, ConstitutiveError> {
Ok(
self.calculate_cauchy_stress(deformation_gradient, temperature)?
* deformation_gradient.inverse_transpose()
* deformation_gradient.determinant(),
)
}
fn calculate_first_piola_kirchoff_tangent_stiffness(
&self,
deformation_gradient: &DeformationGradient,
temperature: &Scalar,
) -> Result<FirstPiolaKirchoffTangentStiffness, ConstitutiveError> {
let deformation_gradient_inverse_transpose = deformation_gradient.inverse_transpose();
let first_piola_kirchoff_stress =
self.calculate_first_piola_kirchoff_stress(deformation_gradient, temperature)?;
Ok(self
.calculate_cauchy_tangent_stiffness(deformation_gradient, temperature)?
.contract_second_index_with_first_index_of(&deformation_gradient_inverse_transpose)
* deformation_gradient.determinant()
+ FirstPiolaKirchoffTangentStiffness::dyad_ij_kl(
&first_piola_kirchoff_stress,
&deformation_gradient_inverse_transpose,
)
- FirstPiolaKirchoffTangentStiffness::dyad_il_kj(
&first_piola_kirchoff_stress,
&deformation_gradient_inverse_transpose,
))
}
fn calculate_second_piola_kirchoff_stress(
&self,
deformation_gradient: &DeformationGradient,
temperature: &Scalar,
) -> Result<SecondPiolaKirchoffStress, ConstitutiveError> {
Ok(deformation_gradient.inverse()
* self.calculate_cauchy_stress(deformation_gradient, temperature)?
* deformation_gradient.inverse_transpose()
* deformation_gradient.determinant())
}
fn calculate_second_piola_kirchoff_tangent_stiffness(
&self,
deformation_gradient: &DeformationGradient,
temperature: &Scalar,
) -> Result<SecondPiolaKirchoffTangentStiffness, ConstitutiveError> {
let deformation_gradient_inverse_transpose = deformation_gradient.inverse_transpose();
let deformation_gradient_inverse = deformation_gradient_inverse_transpose.transpose();
let second_piola_kirchoff_stress =
self.calculate_second_piola_kirchoff_stress(deformation_gradient, temperature)?;
Ok(self
.calculate_cauchy_tangent_stiffness(deformation_gradient, temperature)?
.contract_first_second_indices_with_second_indices_of(
&deformation_gradient_inverse,
&deformation_gradient_inverse,
)
* deformation_gradient.determinant()
+ SecondPiolaKirchoffTangentStiffness::dyad_ij_kl(
&second_piola_kirchoff_stress,
&deformation_gradient_inverse_transpose,
)
- SecondPiolaKirchoffTangentStiffness::dyad_il_kj(
&second_piola_kirchoff_stress,
&deformation_gradient_inverse_transpose,
)
- SecondPiolaKirchoffTangentStiffness::dyad_ik_jl(
&deformation_gradient_inverse,
&second_piola_kirchoff_stress,
))
}
fn get_coefficient_of_thermal_expansion(&self) -> &Scalar;
fn get_reference_temperature(&self) -> &Scalar;
}