Skip to main content

conspire/domain/fem/block/element/cohesive/linear/wedge/
mod.rs

1#[cfg(test)]
2pub mod test;
3
4use crate::{
5    fem::block::element::{
6        ElementNodalCoordinates, ElementNodalEitherCoordinates, ElementNodalReferenceCoordinates,
7        FiniteElement, IntegrationWeights, ParametricCoordinate, ParametricCoordinates,
8        ParametricReference, ShapeFunctions, ShapeFunctionsGradients,
9        cohesive::{
10            CohesiveFiniteElement, M, Separations,
11            linear::{LinearCohesiveElement, LinearCohesiveFiniteElement},
12        },
13        surface::linear::Triangle,
14    },
15    math::ScalarList,
16    mechanics::NormalGradients,
17    units::Area,
18};
19
20// This should share integration_points() and parametric_weights() with Triangle<G=3> when get to it.
21
22const G: usize = 3;
23const N: usize = 6;
24const P: usize = 3;
25
26pub type Wedge = LinearCohesiveElement<G, N>;
27
28impl FiniteElement<G, M, N, P, Area> for Wedge {
29    fn integration_points() -> ParametricCoordinates<G, M> {
30        [
31            [1.0 / 6.0, 1.0 / 6.0],
32            [2.0 / 3.0, 1.0 / 6.0],
33            [1.0 / 6.0, 2.0 / 3.0],
34        ]
35        .into()
36    }
37    fn integration_weights(&self) -> &IntegrationWeights<G, Area> {
38        &self.integration_weights
39    }
40    fn parametric_reference() -> ParametricReference<M, N> {
41        Triangle::parametric_reference()
42            .into_iter()
43            .chain(Triangle::parametric_reference())
44            .collect()
45    }
46    fn parametric_weights() -> ScalarList<G> {
47        [1.0 / 6.0; G].into()
48    }
49    fn shape_functions(parametric_coordinate: ParametricCoordinate<M>) -> ShapeFunctions<P> {
50        Triangle::shape_functions(parametric_coordinate)
51    }
52    fn shape_functions_gradients(
53        parametric_coordinate: ParametricCoordinate<M>,
54    ) -> ShapeFunctionsGradients<M, P> {
55        Triangle::shape_functions_gradients(parametric_coordinate)
56    }
57}
58
59impl From<ElementNodalReferenceCoordinates<N>> for Wedge {
60    fn from(reference_nodal_coordinates: ElementNodalReferenceCoordinates<N>) -> Self {
61        Self::from_linear(reference_nodal_coordinates)
62    }
63}
64
65impl CohesiveFiniteElement<G, N, P> for Wedge {
66    fn nodal_mid_surface<I>(
67        nodal_coordinates: &ElementNodalEitherCoordinates<I, N>,
68    ) -> ElementNodalEitherCoordinates<I, P> {
69        Self::nodal_mid_surface_linear(nodal_coordinates)
70    }
71    fn nodal_separations(nodal_coordinates: &ElementNodalCoordinates<N>) -> Separations<P> {
72        Self::nodal_separations_linear(nodal_coordinates)
73    }
74    fn normal_gradients_full(
75        nodal_mid_surface: &ElementNodalCoordinates<P>,
76    ) -> NormalGradients<N, G> {
77        Self::normal_gradients_full_linear(nodal_mid_surface)
78    }
79    fn signs() -> ScalarList<N> {
80        Self::signs_linear()
81    }
82}
83
84impl LinearCohesiveFiniteElement<G, N, P> for Wedge {}