pub struct Transport<const N: usize> {
pub plus: [f64; N],
pub minus: [f64; N],
pub source: f64,
}Expand description
Per-dimension transport coefficients for a finite-difference operator.
The operator is decomposed as
L V = sum_i [ plus_i (V_{i,+} - V) + minus_i (V_{i,-} - V) ] + sourceplus_i and minus_i are the forward and backward transport coefficients
documented in docs/src/solver/solver_pde.md. source collects the purely
local terms.
The transport coefficients and the source have clean semantics: transport goes into the operator and the source goes into the right-hand side. There is no hidden cancellation term.
Fields§
§plus: [f64; N]Forward transport coefficient in each dimension.
minus: [f64; N]Backward transport coefficient in each dimension.
source: f64Purely local source term.
Implementations§
Source§impl<const N: usize> Transport<N>
impl<const N: usize> Transport<N>
Sourcepub fn new(plus: [f64; N], minus: [f64; N], source: f64) -> Self
pub fn new(plus: [f64; N], minus: [f64; N], source: f64) -> Self
Builds a transport bundle from raw coefficients.
§Examples
use solver::numeric::finite_difference::discretization::{Transport, DimensionKind};
let t = Transport::<2>::new([0.5, 0.1], [0.25, 0.0], 1.0);
assert_eq!(t.plus, [0.5, 0.1]);
assert_eq!(t.minus, [0.25, 0.0]);
assert_eq!(t.source, 1.0);
let _kind = DimensionKind::Diffusion;Trait Implementations§
Auto Trait Implementations§
impl<const N: usize> Freeze for Transport<N>
impl<const N: usize> RefUnwindSafe for Transport<N>
impl<const N: usize> Send for Transport<N>
impl<const N: usize> Sync for Transport<N>
impl<const N: usize> Unpin for Transport<N>
impl<const N: usize> UnsafeUnpin for Transport<N>
impl<const N: usize> UnwindSafe for Transport<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more