Skip to main content

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::{ContractWith, IDENTITY_00, Quantity},
10    mechanics::{HeatFlux, HeatFluxTangent, TemperatureGradient},
11    units::{PowerPerLengthTemperature, PowerTemperatureDensity},
12};
13
14#[doc = include_str!("doc.md")]
15#[derive(Clone, Debug)]
16pub struct Fourier {
17    /// The thermal conductivity $`k`$.
18    pub thermal_conductivity: Quantity<PowerPerLengthTemperature>,
19}
20
21impl Fourier {
22    fn thermal_conductivity(&self) -> Quantity<PowerPerLengthTemperature> {
23        self.thermal_conductivity
24    }
25}
26
27impl Thermal for Fourier {}
28
29impl ThermalConduction for Fourier {
30    #[doc = include_str!("potential.md")]
31    fn potential(
32        &self,
33        temperature_gradient: &TemperatureGradient,
34    ) -> Result<Quantity<PowerTemperatureDensity>, ConstitutiveError> {
35        // A temperature gradient squared names nothing, so the potential is
36        // stated as the flux it gives contracted with the gradient.
37        Ok(
38            (temperature_gradient * self.thermal_conductivity())
39                .contract_with(temperature_gradient)
40                * 0.5,
41        )
42    }
43    #[doc = include_str!("heat_flux.md")]
44    fn heat_flux(
45        &self,
46        temperature_gradient: &TemperatureGradient,
47    ) -> Result<HeatFlux, ConstitutiveError> {
48        Ok(temperature_gradient * -self.thermal_conductivity())
49    }
50    #[doc = include_str!("heat_flux_tangent.md")]
51    fn heat_flux_tangent(
52        &self,
53        _temperature_gradient: &TemperatureGradient,
54    ) -> Result<HeatFluxTangent, ConstitutiveError> {
55        Ok(IDENTITY_00 * -self.thermal_conductivity())
56    }
57}