conspire/constitutive/solid/elastic_hyperviscous/almansi_hamel/
mod.rs#[cfg(test)]
mod test;
use super::*;
#[derive(Debug)]
pub struct AlmansiHamel<'a> {
parameters: Parameters<'a>,
}
impl<'a> Constitutive<'a> for AlmansiHamel<'a> {
fn new(parameters: Parameters<'a>) -> Self {
Self { parameters }
}
}
impl<'a> Solid<'a> for AlmansiHamel<'a> {
fn bulk_modulus(&self) -> &Scalar {
&self.parameters[0]
}
fn shear_modulus(&self) -> &Scalar {
&self.parameters[1]
}
}
impl<'a> Viscous<'a> for AlmansiHamel<'a> {
fn bulk_viscosity(&self) -> &Scalar {
&self.parameters[2]
}
fn shear_viscosity(&self) -> &Scalar {
&self.parameters[3]
}
}
impl<'a> Viscoelastic<'a> for AlmansiHamel<'a> {
fn cauchy_stress(
&self,
deformation_gradient: &DeformationGradient,
deformation_gradient_rate: &DeformationGradientRate,
) -> Result<CauchyStress, ConstitutiveError> {
let jacobian = self.jacobian(deformation_gradient)?;
let inverse_deformation_gradient = deformation_gradient.inverse();
let strain = (IDENTITY
- inverse_deformation_gradient.transpose() * &inverse_deformation_gradient)
* 0.5;
let (deviatoric_strain, strain_trace) = strain.deviatoric_and_trace();
let velocity_gradient = deformation_gradient_rate * inverse_deformation_gradient;
let strain_rate = (&velocity_gradient + velocity_gradient.transpose()) * 0.5;
let (deviatoric_strain_rate, strain_rate_trace) = strain_rate.deviatoric_and_trace();
Ok(deviatoric_strain * (2.0 * self.shear_modulus() / jacobian)
+ deviatoric_strain_rate * (2.0 * self.shear_viscosity() / jacobian)
+ IDENTITY
* ((self.bulk_modulus() * strain_trace
+ self.bulk_viscosity() * strain_rate_trace)
/ jacobian))
}
fn cauchy_rate_tangent_stiffness(
&self,
deformation_gradient: &DeformationGradient,
_: &DeformationGradientRate,
) -> Result<CauchyRateTangentStiffness, ConstitutiveError> {
let jacobian = self.jacobian(deformation_gradient)?;
let deformation_gradient_inverse_transpose = deformation_gradient.inverse_transpose();
let scaled_deformation_gradient_inverse_transpose =
&deformation_gradient_inverse_transpose * self.shear_viscosity() / jacobian;
Ok(CauchyRateTangentStiffness::dyad_ik_jl(
&IDENTITY,
&scaled_deformation_gradient_inverse_transpose,
) + CauchyRateTangentStiffness::dyad_il_jk(
&scaled_deformation_gradient_inverse_transpose,
&IDENTITY,
) + CauchyRateTangentStiffness::dyad_ij_kl(
&(IDENTITY
* ((self.bulk_viscosity() - TWO_THIRDS * self.shear_viscosity()) / jacobian)),
&deformation_gradient_inverse_transpose,
))
}
}
impl<'a> ElasticHyperviscous<'a> for AlmansiHamel<'a> {
fn viscous_dissipation(
&self,
deformation_gradient: &DeformationGradient,
deformation_gradient_rate: &DeformationGradientRate,
) -> Result<Scalar, ConstitutiveError> {
let _jacobian = self.jacobian(deformation_gradient)?;
let velocity_gradient = deformation_gradient_rate * deformation_gradient.inverse();
let strain_rate = (&velocity_gradient + velocity_gradient.transpose()) * 0.5;
Ok(self.shear_viscosity() * strain_rate.squared_trace()
+ 0.5
* (self.bulk_viscosity() - TWO_THIRDS * self.shear_viscosity())
* strain_rate.trace().powi(2))
}
}