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

1//! Thermoelastic-thermal conduction constitutive models.
2
3#[cfg(test)]
4pub mod test;
5
6use crate::{
7    constitutive::{
8        ConstitutiveError,
9        multiphysics::{Multiphysics, solid_thermal::SolidThermal},
10        solid::{Solid, thermoelastic::Thermoelastic},
11        thermal::{Thermal, conduction::ThermalConduction},
12    },
13    mechanics::{
14        CauchyStress, CauchyTangentStiffness, DeformationGradient, FirstPiolaKirchhoffStress,
15        FirstPiolaKirchhoffTangentStiffness, HeatFlux, HeatFluxTangent, Scalar,
16        SecondPiolaKirchhoffStress, SecondPiolaKirchhoffTangentStiffness, TemperatureGradient,
17    },
18};
19
20/// A thermoelastic-thermal conduction constitutive model.
21#[derive(Clone, Debug)]
22pub struct ThermoelasticThermalConduction<C1, C2>
23where
24    C1: Thermoelastic,
25    C2: ThermalConduction,
26    Self: SolidThermal<C1, C2>,
27{
28    thermoelastic_constitutive_model: C1,
29    thermal_conduction_constitutive_model: C2,
30}
31
32impl<C1, C2> From<(C1, C2)> for ThermoelasticThermalConduction<C1, C2>
33where
34    C1: Thermoelastic,
35    C2: ThermalConduction,
36    Self: SolidThermal<C1, C2>,
37{
38    fn from(
39        (thermoelastic_constitutive_model, thermal_conduction_constitutive_model): (C1, C2),
40    ) -> Self {
41        Self {
42            thermoelastic_constitutive_model,
43            thermal_conduction_constitutive_model,
44        }
45    }
46}
47
48impl<C1, C2> Solid for ThermoelasticThermalConduction<C1, C2>
49where
50    C1: Thermoelastic,
51    C2: ThermalConduction,
52    Self: SolidThermal<C1, C2>,
53{
54    fn bulk_modulus(&self) -> Scalar {
55        self.solid_constitutive_model().bulk_modulus()
56    }
57    fn shear_modulus(&self) -> Scalar {
58        self.solid_constitutive_model().shear_modulus()
59    }
60}
61
62impl<C1, C2> Thermoelastic for ThermoelasticThermalConduction<C1, C2>
63where
64    C1: Thermoelastic,
65    C2: ThermalConduction,
66    Self: SolidThermal<C1, C2>,
67{
68    fn cauchy_stress(
69        &self,
70        deformation_gradient: &DeformationGradient,
71        temperature: Scalar,
72    ) -> Result<CauchyStress, ConstitutiveError> {
73        self.solid_constitutive_model()
74            .cauchy_stress(deformation_gradient, temperature)
75    }
76    fn cauchy_tangent_stiffness(
77        &self,
78        deformation_gradient: &DeformationGradient,
79        temperature: Scalar,
80    ) -> Result<CauchyTangentStiffness, ConstitutiveError> {
81        self.solid_constitutive_model()
82            .cauchy_tangent_stiffness(deformation_gradient, temperature)
83    }
84    fn first_piola_kirchhoff_stress(
85        &self,
86        deformation_gradient: &DeformationGradient,
87        temperature: Scalar,
88    ) -> Result<FirstPiolaKirchhoffStress, ConstitutiveError> {
89        self.solid_constitutive_model()
90            .first_piola_kirchhoff_stress(deformation_gradient, temperature)
91    }
92    fn first_piola_kirchhoff_tangent_stiffness(
93        &self,
94        deformation_gradient: &DeformationGradient,
95        temperature: Scalar,
96    ) -> Result<FirstPiolaKirchhoffTangentStiffness, ConstitutiveError> {
97        self.solid_constitutive_model()
98            .first_piola_kirchhoff_tangent_stiffness(deformation_gradient, temperature)
99    }
100    fn second_piola_kirchhoff_stress(
101        &self,
102        deformation_gradient: &DeformationGradient,
103        temperature: Scalar,
104    ) -> Result<SecondPiolaKirchhoffStress, ConstitutiveError> {
105        self.solid_constitutive_model()
106            .second_piola_kirchhoff_stress(deformation_gradient, temperature)
107    }
108    fn second_piola_kirchhoff_tangent_stiffness(
109        &self,
110        deformation_gradient: &DeformationGradient,
111        temperature: Scalar,
112    ) -> Result<SecondPiolaKirchhoffTangentStiffness, ConstitutiveError> {
113        self.solid_constitutive_model()
114            .second_piola_kirchhoff_tangent_stiffness(deformation_gradient, temperature)
115    }
116    fn coefficient_of_thermal_expansion(&self) -> Scalar {
117        self.solid_constitutive_model()
118            .coefficient_of_thermal_expansion()
119    }
120    fn reference_temperature(&self) -> Scalar {
121        self.solid_constitutive_model().reference_temperature()
122    }
123}
124
125impl<C1, C2> Thermal for ThermoelasticThermalConduction<C1, C2>
126where
127    C1: Thermoelastic,
128    C2: ThermalConduction,
129    Self: SolidThermal<C1, C2>,
130{
131}
132
133impl<C1, C2> ThermalConduction for ThermoelasticThermalConduction<C1, C2>
134where
135    C1: Thermoelastic,
136    C2: ThermalConduction,
137    Self: SolidThermal<C1, C2>,
138{
139    fn potential(
140        &self,
141        temperature_gradient: &TemperatureGradient,
142    ) -> Result<Scalar, ConstitutiveError> {
143        self.thermal_constitutive_model()
144            .potential(temperature_gradient)
145    }
146    fn heat_flux(
147        &self,
148        temperature_gradient: &TemperatureGradient,
149    ) -> Result<HeatFlux, ConstitutiveError> {
150        self.thermal_constitutive_model()
151            .heat_flux(temperature_gradient)
152    }
153    fn heat_flux_tangent(
154        &self,
155        temperature_gradient: &TemperatureGradient,
156    ) -> Result<HeatFluxTangent, ConstitutiveError> {
157        self.thermal_constitutive_model()
158            .heat_flux_tangent(temperature_gradient)
159    }
160}
161
162impl<C1, C2> Multiphysics for ThermoelasticThermalConduction<C1, C2>
163where
164    C1: Thermoelastic,
165    C2: ThermalConduction,
166    Self: SolidThermal<C1, C2>,
167{
168}
169
170impl<C1, C2> SolidThermal<C1, C2> for ThermoelasticThermalConduction<C1, C2>
171where
172    C1: Thermoelastic,
173    C2: ThermalConduction,
174{
175    fn solid_constitutive_model(&self) -> &C1 {
176        &self.thermoelastic_constitutive_model
177    }
178    fn thermal_constitutive_model(&self) -> &C2 {
179        &self.thermal_conduction_constitutive_model
180    }
181}