conspire/constitutive/hybrid/hyperelastic/additive/
mod.rs

1#[cfg(test)]
2mod test;
3
4use crate::{
5    constitutive::{ConstitutiveError, hybrid::ElasticAdditive, solid::hyperelastic::Hyperelastic},
6    mechanics::{DeformationGradient, Scalar},
7};
8
9impl<C1, C2> Hyperelastic for ElasticAdditive<C1, C2>
10where
11    C1: Hyperelastic,
12    C2: Hyperelastic,
13{
14    /// Calculates and returns the Helmholtz free energy density.
15    ///
16    /// ```math
17    /// a(\mathbf{F}) = a_1(\mathbf{F}) + a_2(\mathbf{F})
18    /// ```
19    fn helmholtz_free_energy_density(
20        &self,
21        deformation_gradient: &DeformationGradient,
22    ) -> Result<Scalar, ConstitutiveError> {
23        Ok(self.0.helmholtz_free_energy_density(deformation_gradient)?
24            + self.1.helmholtz_free_energy_density(deformation_gradient)?)
25    }
26}