#[cfg(test)]
pub mod test;
use super::{super::fluid::viscous::Viscous, *};
pub trait Viscoelastic<'a>
where
Self: Solid<'a> + Viscous<'a>,
{
fn calculate_cauchy_stress(
&self,
deformation_gradient: &DeformationGradient,
deformation_gradient_rate: &DeformationGradientRate,
) -> Result<CauchyStress, ConstitutiveError> {
Ok(deformation_gradient
* self.calculate_second_piola_kirchoff_stress(
deformation_gradient,
deformation_gradient_rate,
)?
* deformation_gradient.transpose()
/ deformation_gradient.determinant())
}
fn calculate_cauchy_rate_tangent_stiffness(
&self,
deformation_gradient: &DeformationGradient,
deformation_gradient_rate: &DeformationGradientRate,
) -> Result<CauchyRateTangentStiffness, ConstitutiveError> {
Ok(self
.calculate_second_piola_kirchoff_rate_tangent_stiffness(
deformation_gradient,
deformation_gradient_rate,
)?
.contract_first_second_indices_with_second_indices_of(
deformation_gradient,
deformation_gradient,
)
/ deformation_gradient.determinant())
}
fn calculate_first_piola_kirchoff_stress(
&self,
deformation_gradient: &DeformationGradient,
deformation_gradient_rate: &DeformationGradientRate,
) -> Result<FirstPiolaKirchoffStress, ConstitutiveError> {
Ok(
self.calculate_cauchy_stress(deformation_gradient, deformation_gradient_rate)?
* deformation_gradient.inverse_transpose()
* deformation_gradient.determinant(),
)
}
fn calculate_first_piola_kirchoff_rate_tangent_stiffness(
&self,
deformation_gradient: &DeformationGradient,
deformation_gradient_rate: &DeformationGradientRate,
) -> Result<FirstPiolaKirchoffRateTangentStiffness, ConstitutiveError> {
Ok(self
.calculate_cauchy_rate_tangent_stiffness(
deformation_gradient,
deformation_gradient_rate,
)?
.contract_second_index_with_first_index_of(&deformation_gradient.inverse_transpose())
* deformation_gradient.determinant())
}
fn calculate_second_piola_kirchoff_stress(
&self,
deformation_gradient: &DeformationGradient,
deformation_gradient_rate: &DeformationGradientRate,
) -> Result<SecondPiolaKirchoffStress, ConstitutiveError> {
Ok(deformation_gradient.inverse()
* self.calculate_cauchy_stress(deformation_gradient, deformation_gradient_rate)?
* deformation_gradient.inverse_transpose()
* deformation_gradient.determinant())
}
fn calculate_second_piola_kirchoff_rate_tangent_stiffness(
&self,
deformation_gradient: &DeformationGradient,
deformation_gradient_rate: &DeformationGradientRate,
) -> Result<SecondPiolaKirchoffRateTangentStiffness, ConstitutiveError> {
let deformation_gradient_inverse = deformation_gradient.inverse();
Ok(self
.calculate_cauchy_rate_tangent_stiffness(
deformation_gradient,
deformation_gradient_rate,
)?
.contract_first_second_indices_with_second_indices_of(
&deformation_gradient_inverse,
&deformation_gradient_inverse,
)
* deformation_gradient.determinant())
}
}