conspire/constitutive/hybrid/elastic_viscoplastic/additive/
mod.rs

1mod elastic;
2mod viscoplastic;
3
4use crate::{
5    constitutive::{
6        fluid::viscoplastic::Viscoplastic,
7        hybrid::Additive,
8        solid::{elastic::Elastic, elastic_viscoplastic::ElasticViscoplastic},
9    },
10    math::Tensor,
11};
12use std::{marker::PhantomData, ops::Deref};
13
14/// A hybrid elastic-viscoplastic constitutive model based on the additive decomposition.
15#[derive(Clone, Debug)]
16pub struct ElasticViscoplasticAdditiveElastic<C1, C2, Y1>
17where
18    C1: ElasticViscoplastic<Y1>,
19    C2: Elastic,
20    Y1: Tensor,
21{
22    inner: Additive<C1, C2>,
23    dummy: PhantomData<Y1>,
24}
25
26impl<C1, C2, Y1> Deref for ElasticViscoplasticAdditiveElastic<C1, C2, Y1>
27where
28    C1: ElasticViscoplastic<Y1>,
29    C2: Elastic,
30    Y1: Tensor,
31{
32    type Target = Additive<C1, C2>;
33    fn deref(&self) -> &Self::Target {
34        &self.inner
35    }
36}
37
38impl<C1, C2, Y1> From<(C1, C2)> for ElasticViscoplasticAdditiveElastic<C1, C2, Y1>
39where
40    C1: ElasticViscoplastic<Y1>,
41    C2: Elastic,
42    Y1: Tensor,
43{
44    fn from((constitutive_model_1, constitutive_model_2): (C1, C2)) -> Self {
45        Self {
46            inner: Additive(constitutive_model_1, constitutive_model_2),
47            dummy: PhantomData,
48        }
49    }
50}
51
52/// A hybrid viscoplastic constitutive model based on the additive decomposition.
53#[derive(Clone, Debug)]
54pub struct ElasticViscoplasticAdditiveViscoplastic<C1, C2, Y1, Y2>
55where
56    C1: ElasticViscoplastic<Y1>,
57    C2: Viscoplastic<Y2>,
58    Y1: Tensor,
59    Y2: Tensor,
60{
61    inner: Additive<C1, C2>,
62    dum_1: PhantomData<Y1>,
63    dum_2: PhantomData<Y2>,
64}
65
66impl<C1, C2, Y1, Y2> Deref for ElasticViscoplasticAdditiveViscoplastic<C1, C2, Y1, Y2>
67where
68    C1: ElasticViscoplastic<Y1>,
69    C2: Viscoplastic<Y2>,
70    Y1: Tensor,
71    Y2: Tensor,
72{
73    type Target = Additive<C1, C2>;
74    fn deref(&self) -> &Self::Target {
75        &self.inner
76    }
77}
78
79impl<C1, C2, Y1, Y2> From<(C1, C2)> for ElasticViscoplasticAdditiveViscoplastic<C1, C2, Y1, Y2>
80where
81    C1: ElasticViscoplastic<Y1>,
82    C2: Viscoplastic<Y2>,
83    Y1: Tensor,
84    Y2: Tensor,
85{
86    fn from((constitutive_model_1, constitutive_model_2): (C1, C2)) -> Self {
87        Self {
88            inner: Additive(constitutive_model_1, constitutive_model_2),
89            dum_1: PhantomData,
90            dum_2: PhantomData,
91        }
92    }
93}