conspire/domain/fem/block/solid/hyperviscoelastic/
mod.rs1use crate::{
2 constitutive::solid::hyperviscoelastic::Hyperviscoelastic,
3 fem::{
4 ElementModelError, NodalCoordinates,
5 block::{Block, element::solid::hyperviscoelastic::HyperviscoelasticFiniteElement},
6 solid::{
7 elastic_hyperviscous::ElasticHyperviscousElements,
8 hyperviscoelastic::HyperviscoelasticElements,
9 },
10 },
11 math::Scalar,
12};
13
14impl<C, F, const G: usize, const M: usize, const N: usize, const P: usize>
15 HyperviscoelasticElements<3> for Block<C, F, G, M, N, P>
16where
17 C: Hyperviscoelastic,
18 F: HyperviscoelasticFiniteElement<C, G, M, N, P>,
19 Self: ElasticHyperviscousElements<3>,
20{
21 fn helmholtz_free_energy(
22 &self,
23 nodal_coordinates: &NodalCoordinates<3>,
24 ) -> Result<Scalar, ElementModelError> {
25 match self
26 .elements()
27 .iter()
28 .zip(self.connectivity())
29 .map(|(element, nodes)| {
30 element.helmholtz_free_energy(
31 self.constitutive_model(),
32 &Self::element_coordinates(nodal_coordinates, nodes),
33 )
34 })
35 .sum()
36 {
37 Ok(helmholtz_free_energy) => Ok(helmholtz_free_energy),
38 Err(error) => Err(ElementModelError::Upstream(
39 format!("{error}"),
40 format!("{self:?}"),
41 )),
42 }
43 }
44}