Skip to main content

conspire/constitutive/multiphysics/solid_thermal/thermoelastic_thermal_conduction/canonical/
mod.rs

1#[cfg(test)]
2pub(crate) mod test;
3
4use crate::{
5    constitutive::{
6        ConstitutiveError,
7        diffusion::Diffusion,
8        multiphysics::{Multiphysics, solid_thermal::SolidThermal},
9        solid::{Solid, thermoelastic::Thermoelastic},
10        thermal::{Thermal, conduction::ThermalConduction},
11    },
12    math::Quantity,
13    mechanics::{
14        CauchyMixedTangentStiffness, CauchyStress, CauchyTangentStiffness, CauchyThermalTangent,
15        CauchyThermalTangentStiffness, DeformationGradient,
16        FirstPiolaKirchhoffMixedTangentStiffness, FirstPiolaKirchhoffStress,
17        FirstPiolaKirchhoffTangentStiffness, FirstPiolaKirchhoffThermalTangent,
18        FirstPiolaKirchhoffThermalTangentStiffness, HeatFlux, HeatFluxTangent,
19        SecondPiolaKirchhoffMixedTangentStiffness, SecondPiolaKirchhoffStress,
20        SecondPiolaKirchhoffTangentStiffness, SecondPiolaKirchhoffThermalTangent,
21        SecondPiolaKirchhoffThermalTangentStiffness, TemperatureGradient,
22    },
23    units::{Power, PowerTemperatureDensity, Stress, Temperature},
24};
25
26/// A thermoelastic-thermal conduction constitutive model.
27#[derive(Clone, Debug)]
28pub struct Canonical<C1, C2>
29where
30    C1: Thermoelastic,
31    C2: ThermalConduction,
32{
33    thermoelastic_constitutive_model: C1,
34    thermal_conduction_constitutive_model: C2,
35}
36
37impl<C1, C2> From<(C1, C2)> for Canonical<C1, C2>
38where
39    C1: Thermoelastic,
40    C2: ThermalConduction,
41{
42    fn from(
43        (thermoelastic_constitutive_model, thermal_conduction_constitutive_model): (C1, C2),
44    ) -> Self {
45        Self {
46            thermoelastic_constitutive_model,
47            thermal_conduction_constitutive_model,
48        }
49    }
50}
51
52impl<C1, C2> Solid for Canonical<C1, C2>
53where
54    C1: Thermoelastic,
55    C2: ThermalConduction,
56{
57    fn bulk_modulus(&self) -> Quantity<Stress> {
58        self.solid_constitutive_model().bulk_modulus()
59    }
60    fn shear_modulus(&self) -> Quantity<Stress> {
61        self.solid_constitutive_model().shear_modulus()
62    }
63}
64
65impl<C1, C2> Thermoelastic for Canonical<C1, C2>
66where
67    C1: Thermoelastic,
68    C2: ThermalConduction,
69{
70    fn cauchy_stress(
71        &self,
72        deformation_gradient: &DeformationGradient,
73        temperature: Quantity<Temperature>,
74    ) -> Result<CauchyStress, ConstitutiveError> {
75        self.solid_constitutive_model()
76            .cauchy_stress(deformation_gradient, temperature)
77    }
78    fn cauchy_tangent_stiffness(
79        &self,
80        deformation_gradient: &DeformationGradient,
81        temperature: Quantity<Temperature>,
82    ) -> Result<CauchyTangentStiffness, ConstitutiveError> {
83        self.solid_constitutive_model()
84            .cauchy_tangent_stiffness(deformation_gradient, temperature)
85    }
86    fn first_piola_kirchhoff_stress(
87        &self,
88        deformation_gradient: &DeformationGradient,
89        temperature: Quantity<Temperature>,
90    ) -> Result<FirstPiolaKirchhoffStress, ConstitutiveError> {
91        self.solid_constitutive_model()
92            .first_piola_kirchhoff_stress(deformation_gradient, temperature)
93    }
94    fn first_piola_kirchhoff_tangent_stiffness(
95        &self,
96        deformation_gradient: &DeformationGradient,
97        temperature: Quantity<Temperature>,
98    ) -> Result<FirstPiolaKirchhoffTangentStiffness, ConstitutiveError> {
99        self.solid_constitutive_model()
100            .first_piola_kirchhoff_tangent_stiffness(deformation_gradient, temperature)
101    }
102    fn second_piola_kirchhoff_stress(
103        &self,
104        deformation_gradient: &DeformationGradient,
105        temperature: Quantity<Temperature>,
106    ) -> Result<SecondPiolaKirchhoffStress, ConstitutiveError> {
107        self.solid_constitutive_model()
108            .second_piola_kirchhoff_stress(deformation_gradient, temperature)
109    }
110    fn second_piola_kirchhoff_tangent_stiffness(
111        &self,
112        deformation_gradient: &DeformationGradient,
113        temperature: Quantity<Temperature>,
114    ) -> Result<SecondPiolaKirchhoffTangentStiffness, ConstitutiveError> {
115        self.solid_constitutive_model()
116            .second_piola_kirchhoff_tangent_stiffness(deformation_gradient, temperature)
117    }
118    fn cauchy_thermal_tangent(
119        &self,
120        deformation_gradient: &DeformationGradient,
121        temperature: Quantity<Temperature>,
122    ) -> Result<CauchyThermalTangent, ConstitutiveError> {
123        self.solid_constitutive_model()
124            .cauchy_thermal_tangent(deformation_gradient, temperature)
125    }
126    fn first_piola_kirchhoff_thermal_tangent(
127        &self,
128        deformation_gradient: &DeformationGradient,
129        temperature: Quantity<Temperature>,
130    ) -> Result<FirstPiolaKirchhoffThermalTangent, ConstitutiveError> {
131        self.solid_constitutive_model()
132            .first_piola_kirchhoff_thermal_tangent(deformation_gradient, temperature)
133    }
134    fn second_piola_kirchhoff_thermal_tangent(
135        &self,
136        deformation_gradient: &DeformationGradient,
137        temperature: Quantity<Temperature>,
138    ) -> Result<SecondPiolaKirchhoffThermalTangent, ConstitutiveError> {
139        self.solid_constitutive_model()
140            .second_piola_kirchhoff_thermal_tangent(deformation_gradient, temperature)
141    }
142    fn cauchy_mixed_tangent_stiffness(
143        &self,
144        deformation_gradient: &DeformationGradient,
145        temperature: Quantity<Temperature>,
146    ) -> Result<CauchyMixedTangentStiffness, ConstitutiveError> {
147        self.solid_constitutive_model()
148            .cauchy_mixed_tangent_stiffness(deformation_gradient, temperature)
149    }
150    fn cauchy_thermal_tangent_stiffness(
151        &self,
152        deformation_gradient: &DeformationGradient,
153        temperature: Quantity<Temperature>,
154    ) -> Result<CauchyThermalTangentStiffness, ConstitutiveError> {
155        self.solid_constitutive_model()
156            .cauchy_thermal_tangent_stiffness(deformation_gradient, temperature)
157    }
158    fn first_piola_kirchhoff_mixed_tangent_stiffness(
159        &self,
160        deformation_gradient: &DeformationGradient,
161        temperature: Quantity<Temperature>,
162    ) -> Result<FirstPiolaKirchhoffMixedTangentStiffness, ConstitutiveError> {
163        self.solid_constitutive_model()
164            .first_piola_kirchhoff_mixed_tangent_stiffness(deformation_gradient, temperature)
165    }
166    fn first_piola_kirchhoff_thermal_tangent_stiffness(
167        &self,
168        deformation_gradient: &DeformationGradient,
169        temperature: Quantity<Temperature>,
170    ) -> Result<FirstPiolaKirchhoffThermalTangentStiffness, ConstitutiveError> {
171        self.solid_constitutive_model()
172            .first_piola_kirchhoff_thermal_tangent_stiffness(deformation_gradient, temperature)
173    }
174    fn second_piola_kirchhoff_mixed_tangent_stiffness(
175        &self,
176        deformation_gradient: &DeformationGradient,
177        temperature: Quantity<Temperature>,
178    ) -> Result<SecondPiolaKirchhoffMixedTangentStiffness, ConstitutiveError> {
179        self.solid_constitutive_model()
180            .second_piola_kirchhoff_mixed_tangent_stiffness(deformation_gradient, temperature)
181    }
182    fn second_piola_kirchhoff_thermal_tangent_stiffness(
183        &self,
184        deformation_gradient: &DeformationGradient,
185        temperature: Quantity<Temperature>,
186    ) -> Result<SecondPiolaKirchhoffThermalTangentStiffness, ConstitutiveError> {
187        self.solid_constitutive_model()
188            .second_piola_kirchhoff_thermal_tangent_stiffness(deformation_gradient, temperature)
189    }
190    fn reference_temperature(&self) -> Quantity<Temperature> {
191        self.solid_constitutive_model().reference_temperature()
192    }
193}
194
195impl<C1, C2> Thermal for Canonical<C1, C2>
196where
197    C1: Thermoelastic,
198    C2: ThermalConduction,
199{
200}
201
202impl<C1, C2> Diffusion for Canonical<C1, C2>
203where
204    C1: Thermoelastic,
205    C2: ThermalConduction,
206{
207    type Balance = Power;
208    fn potential(
209        &self,
210        temperature_gradient: &TemperatureGradient,
211    ) -> Result<Quantity<PowerTemperatureDensity>, ConstitutiveError> {
212        self.thermal_constitutive_model()
213            .potential(temperature_gradient)
214    }
215    fn flux(
216        &self,
217        temperature_gradient: &TemperatureGradient,
218    ) -> Result<HeatFlux, ConstitutiveError> {
219        self.thermal_constitutive_model().flux(temperature_gradient)
220    }
221    fn tangent(
222        &self,
223        temperature_gradient: &TemperatureGradient,
224    ) -> Result<HeatFluxTangent, ConstitutiveError> {
225        self.thermal_constitutive_model()
226            .tangent(temperature_gradient)
227    }
228}
229
230impl<C1, C2> Multiphysics for Canonical<C1, C2>
231where
232    C1: Thermoelastic,
233    C2: ThermalConduction,
234{
235}
236
237impl<C1, C2> SolidThermal for Canonical<C1, C2>
238where
239    C1: Thermoelastic,
240    C2: ThermalConduction,
241{
242    type Solid = C1;
243    type Thermal = C2;
244    fn solid_constitutive_model(&self) -> &C1 {
245        &self.thermoelastic_constitutive_model
246    }
247    fn thermal_constitutive_model(&self) -> &C2 {
248        &self.thermal_conduction_constitutive_model
249    }
250}