conspire/constitutive/thermal/conduction/fourier/
mod.rs

1#[cfg(test)]
2mod test;
3
4use crate::{
5    constitutive::{
6        ConstitutiveError,
7        thermal::{Thermal, conduction::ThermalConduction},
8    },
9    math::IDENTITY_00,
10    mechanics::{HeatFlux, HeatFluxTangent, Scalar, TemperatureGradient},
11};
12
13/// The Fourier thermal conduction constitutive model.
14///
15/// **Parameters**
16/// - The thermal conductivity $`k`$.
17///
18/// **External variables**
19/// - The temperature gradient $`\nabla T`$.
20///
21/// **Internal variables**
22/// - None.
23#[derive(Clone, Debug)]
24pub struct Fourier {
25    /// The thermal conductivity $`k`$.
26    pub thermal_conductivity: Scalar,
27}
28
29impl Fourier {
30    fn thermal_conductivity(&self) -> Scalar {
31        self.thermal_conductivity
32    }
33}
34
35impl Thermal for Fourier {}
36
37impl ThermalConduction for Fourier {
38    /// Calculates and returns the potential.
39    ///
40    /// ```math
41    /// u(\nabla T) = \frac{1}{2}k\nabla T\cdot\nabla T
42    /// ```
43    fn potential(
44        &self,
45        temperature_gradient: &TemperatureGradient,
46    ) -> Result<Scalar, ConstitutiveError> {
47        Ok(0.5 * self.thermal_conductivity() * (temperature_gradient * temperature_gradient))
48    }
49    /// Calculates and returns the heat flux.
50    ///
51    /// ```math
52    /// \mathbf{q}(\nabla T) = -k\nabla T
53    /// ```
54    fn heat_flux(
55        &self,
56        temperature_gradient: &TemperatureGradient,
57    ) -> Result<HeatFlux, ConstitutiveError> {
58        Ok(temperature_gradient * -self.thermal_conductivity())
59    }
60    /// Calculates and returns the tangent to the heat flux.
61    ///
62    /// ```math
63    /// \frac{\partial\mathbf{q}}{\partial\nabla T} = -k\mathbf{I}
64    /// ```
65    fn heat_flux_tangent(
66        &self,
67        _temperature_gradient: &TemperatureGradient,
68    ) -> Result<HeatFluxTangent, ConstitutiveError> {
69        Ok(IDENTITY_00 * -self.thermal_conductivity())
70    }
71}