Skip to main content

HeatConduction1D

Struct HeatConduction1D 

Source
pub struct HeatConduction1D {
    pub n_nodes: usize,
    pub length: f64,
    pub temperature: Vec<f64>,
    pub material: ThermalMaterial,
}
Expand description

Fourier heat conduction in 1D via explicit finite differences.

Fields§

§n_nodes: usize

Number of nodes (including boundary nodes).

§length: f64

Domain length [m].

§temperature: Vec<f64>

Current nodal temperatures [K].

§material: ThermalMaterial

Material properties.

Implementations§

Source§

impl HeatConduction1D

Source

pub fn new( n_nodes: usize, length: f64, t_init: f64, material: ThermalMaterial, ) -> Self

Construct a uniform-temperature rod.

Source

pub fn set_temperature_bc(&mut self, t_left: f64, t_right: f64)

Set Dirichlet BCs at both ends.

Source

pub fn step_explicit(&mut self, dt: f64) -> bool

Explicit (forward-Euler) time step.

Source

pub fn step_explicit_with_source(&mut self, dt: f64, source: f64) -> bool

Explicit step with volumetric heat source Q (W/m^3).

Source

pub fn critical_dt(&self) -> f64

Maximum stable time step: dx^2 / (2 * alpha).

Source

pub fn steady_state_temperature(&self, t_left: f64, t_right: f64) -> Vec<f64>

Exact steady-state temperature profile (linear between BCs).

Source

pub fn heat_flux(&self) -> Vec<f64>

Heat flux at each interior node via central finite differences.

Source

pub fn total_heat_content(&self) -> f64

Total heat stored in the rod (integral of rhocpT*dx).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.