conspire/domain/fem/solid/hyperviscoelastic/
mod.rs1use crate::{
2 fem::{
3 Blocks, ElementModelError, Model, NodalCoordinates,
4 solid::elastic_hyperviscous::ElasticHyperviscousElements,
5 },
6 math::Scalar,
7};
8
9pub trait HyperviscoelasticElements<const D: usize>
10where
11 Self: ElasticHyperviscousElements<D>,
12{
13 fn helmholtz_free_energy(
14 &self,
15 nodal_coordinates: &NodalCoordinates<D>,
16 ) -> Result<Scalar, ElementModelError>;
17}
18
19impl<B, const D: usize> HyperviscoelasticElements<D> for Model<B, D>
20where
21 B: HyperviscoelasticElements<D>,
22{
23 fn helmholtz_free_energy(
24 &self,
25 nodal_coordinates: &NodalCoordinates<D>,
26 ) -> Result<Scalar, ElementModelError> {
27 self.blocks.helmholtz_free_energy(nodal_coordinates)
28 }
29}
30
31impl<B1, B2, const D: usize> HyperviscoelasticElements<D> for Blocks<B1, B2>
32where
33 B1: HyperviscoelasticElements<D>,
34 B2: HyperviscoelasticElements<D>,
35{
36 fn helmholtz_free_energy(
37 &self,
38 nodal_coordinates: &NodalCoordinates<D>,
39 ) -> Result<Scalar, ElementModelError> {
40 Ok(self.0.helmholtz_free_energy(nodal_coordinates)?
41 + self.1.helmholtz_free_energy(nodal_coordinates)?)
42 }
43}