Skip to main content

State

Struct State 

Source
pub struct State<Fluid> {
    pub temperature: ThermodynamicTemperature,
    pub density: MassDensity,
    pub fluid: Fluid,
}
Expand description

The thermodynamic state of a fluid.

A State<Fluid> captures the thermodynamic state of a specific fluid, including its temperature, density, and any fluid-specific data.

The Fluid type parameter can be a simple marker type, such as Air or Water, or a structured type containing additional data, such as mixture composition or particle concentration.

State is the primary input to capability-based thermodynamic models for calculating pressure, enthalpy, entropy, and related quantities.

§Example

use twine_models::support::thermo::{State, fluid::Air};
use uom::si::{
    f64::{ThermodynamicTemperature, MassDensity},
    thermodynamic_temperature::kelvin,
    mass_density::kilogram_per_cubic_meter,
};

let state = State {
    temperature: ThermodynamicTemperature::new::<kelvin>(300.0),
    density: MassDensity::new::<kilogram_per_cubic_meter>(1.0),
    fluid: Air,
};

Fields§

§temperature: ThermodynamicTemperature§density: MassDensity§fluid: Fluid

Implementations§

Source§

impl<Fluid> State<Fluid>

Source

pub fn new( temperature: ThermodynamicTemperature, density: MassDensity, fluid: Fluid, ) -> Self

Creates a new state with the given temperature, density, and fluid.

Source

pub fn with_temperature(self, temperature: ThermodynamicTemperature) -> Self

Returns a new state with the given temperature, keeping other fields unchanged.

Source

pub fn with_density(self, density: MassDensity) -> Self

Returns a new state with the given density, keeping other fields unchanged.

Source

pub fn with_fluid(self, fluid: Fluid) -> Self

Returns a new state with the given fluid, keeping other fields unchanged.

Trait Implementations§

Source§

impl<Fluid: Clone> Clone for State<Fluid>

Source§

fn clone(&self) -> State<Fluid>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Fluid: Debug> Debug for State<Fluid>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Fluid: PartialEq> PartialEq for State<Fluid>

Source§

fn eq(&self, other: &State<Fluid>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Fluid> StepIntegrable<Quantity<dyn Dimension<T = PInt<UInt<UTerm, B1>>, Kind = dyn Kind, M = Z0, J = Z0, L = Z0, N = Z0, I = Z0, Th = Z0>, dyn Units<f64, amount_of_substance = mole, mass = kilogram, time = second, electric_current = ampere, length = meter, thermodynamic_temperature = kelvin, luminous_intensity = candela>, f64>> for State<Fluid>
where Fluid: StepIntegrable<Time>,

Source§

type Derivative = StateDerivative<<Fluid as StepIntegrable<Quantity<dyn Dimension<T = PInt<UInt<UTerm, B1>>, Kind = dyn Kind, M = Z0, J = Z0, L = Z0, N = Z0, I = Z0, Th = Z0>, dyn Units<f64, amount_of_substance = mole, mass = kilogram, time = second, electric_current = ampere, length = meter, thermodynamic_temperature = kelvin, luminous_intensity = candela>, f64>>>::Derivative>

The derivative of the type with respect to Delta.
Source§

fn step(&self, derivative: Self::Derivative, delta: Time) -> Self

Returns the value after stepping with a derivative and step size.
Source§

impl<Fluid: Copy> Copy for State<Fluid>

Source§

impl<Fluid> StructuralPartialEq for State<Fluid>

Auto Trait Implementations§

§

impl<Fluid> Freeze for State<Fluid>
where Fluid: Freeze,

§

impl<Fluid> RefUnwindSafe for State<Fluid>
where Fluid: RefUnwindSafe,

§

impl<Fluid> Send for State<Fluid>
where Fluid: Send,

§

impl<Fluid> Sync for State<Fluid>
where Fluid: Sync,

§

impl<Fluid> Unpin for State<Fluid>
where Fluid: Unpin,

§

impl<Fluid> UnsafeUnpin for State<Fluid>
where Fluid: UnsafeUnpin,

§

impl<Fluid> UnwindSafe for State<Fluid>
where Fluid: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.