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

1#[cfg(test)]
2mod test;
3
4use crate::{
5    constitutive::{
6        ConstitutiveError,
7        hybrid::{Hybrid, Multiplicative, MultiplicativeTrait},
8        solid::hyperelastic::Hyperelastic,
9    },
10    mechanics::{DeformationGradient, Scalar},
11};
12
13impl<C1, C2> Hyperelastic for Multiplicative<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}_1) + a_2(\mathbf{F}_2)
22    /// ```
23    fn helmholtz_free_energy_density(
24        &self,
25        deformation_gradient: &DeformationGradient,
26    ) -> Result<Scalar, ConstitutiveError> {
27        let (deformation_gradient_1, deformation_gradient_2) =
28            self.deformation_gradients(deformation_gradient)?;
29        Ok(self
30            .constitutive_model_1()
31            .helmholtz_free_energy_density(&deformation_gradient_1)?
32            + self
33                .constitutive_model_2()
34                .helmholtz_free_energy_density(&deformation_gradient_2)?)
35    }
36}