conspire 0.7.2

The Rust interface to conspire.
Documentation
use super::super::test::*;
use super::*;
use crate::math::assert::Assert;

use crate::{
    math::Tensor,
    mechanics::{
        CauchyRateTangentStiffness, CauchyTangentStiffness,
        FirstPiolaKirchhoffRateTangentStiffness, FirstPiolaKirchhoffTangentStiffness,
        SecondPiolaKirchhoffTangentStiffness,
    },
};

test_solid_hyperviscoelastic_constitutive_model!(SaintVenantKirchhoff {
    bulk_modulus: BULK_MODULUS,
    shear_modulus: SHEAR_MODULUS,
    bulk_viscosity: BULK_VISCOSITY,
    shear_viscosity: SHEAR_VISCOSITY,
});

mod consistency {
    use super::*;
    use crate::constitutive::solid::{
        elastic::Elastic,
        hyperelastic::{Hyperelastic, SaintVenantKirchhoff as HyperelasticSaintVenantKirchhoff},
    };
    #[test]
    fn helmholtz_free_energy_density() -> Result<(), AssertionError> {
        let model = SaintVenantKirchhoff {
            bulk_modulus: BULK_MODULUS,
            shear_modulus: SHEAR_MODULUS,
            bulk_viscosity: BULK_VISCOSITY,
            shear_viscosity: SHEAR_VISCOSITY,
        };
        let hyperelastic_model = HyperelasticSaintVenantKirchhoff {
            bulk_modulus: BULK_MODULUS,
            shear_modulus: SHEAR_MODULUS,
        };
        Assert::default().eq_within_tols(
            model.helmholtz_free_energy_density(&get_deformation_gradient())?,
            &hyperelastic_model.helmholtz_free_energy_density(&get_deformation_gradient())?,
        )
    }
    #[test]
    fn cauchy_stress() -> Result<(), AssertionError> {
        let model = SaintVenantKirchhoff {
            bulk_modulus: BULK_MODULUS,
            shear_modulus: SHEAR_MODULUS,
            bulk_viscosity: BULK_VISCOSITY,
            shear_viscosity: SHEAR_VISCOSITY,
        };
        let hyperelastic_model = HyperelasticSaintVenantKirchhoff {
            bulk_modulus: BULK_MODULUS,
            shear_modulus: SHEAR_MODULUS,
        };
        Assert::default().eq_within_tols(
            &model.cauchy_stress(
                &get_deformation_gradient(),
                &DeformationGradientRate::zero(),
            )?,
            &hyperelastic_model.cauchy_stress(&get_deformation_gradient())?,
        )
    }
}