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

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