conspire/domain/cbm/block/solid/hyperviscoelastic/
mod.rs1use super::super::{Block, node::solid::hyperviscoelastic::HyperviscoelasticElement};
2use crate::{
3 constitutive::{ConstitutiveError, solid::hyperviscoelastic::Hyperviscoelastic},
4 domain::{ElementModelError, NodalCoordinates},
5 math::Quantity,
6 units::Energy,
7};
8
9pub use crate::domain::solid::hyperviscoelastic::HyperviscoelasticElements;
10
11impl<C> HyperviscoelasticElements<3> for Block<C>
12where
13 C: Hyperviscoelastic,
14{
15 fn helmholtz_free_energy(
16 &self,
17 nodal_coordinates: &NodalCoordinates<3>,
18 ) -> Result<Quantity<Energy>, ElementModelError> {
19 self.nodes
20 .iter()
21 .map(|node| node.helmholtz_free_energy(&self.constitutive_model, nodal_coordinates))
22 .sum::<Result<_, ConstitutiveError>>()
23 .map_err(|error| ElementModelError::upstream(error, self))
24 }
25}