pub struct PyLbmGrid { /* private fields */ }Expand description
D2Q9 Lattice-Boltzmann grid simulation.
Stores distribution functions for all 9 velocity directions at every cell. Uses the BGK collision operator with a single relaxation time.
Implementations§
Source§impl PyLbmGrid
impl PyLbmGrid
Sourcepub fn new(config: &PyLbmConfig) -> Self
pub fn new(config: &PyLbmConfig) -> Self
Create a new LBM grid from configuration. All cells initialised to equilibrium with unit density and zero velocity.
Sourcepub fn step_count(&self) -> u64
pub fn step_count(&self) -> u64
Return the number of completed steps.
Sourcepub fn step(&mut self)
pub fn step(&mut self)
Advance the simulation by one LBM time step.
Performs: collision (BGK) + streaming + periodic bounce-back walls.
Sourcepub fn velocity_at(&self, x: usize, y: usize) -> [f64; 2]
pub fn velocity_at(&self, x: usize, y: usize) -> [f64; 2]
Get the macroscopic velocity [ux, uy] at cell (x, y).
Returns [0.0, 0.0] if coordinates are out of bounds.
Sourcepub fn density_at(&self, x: usize, y: usize) -> f64
pub fn density_at(&self, x: usize, y: usize) -> f64
Get the macroscopic density at cell (x, y).
Sourcepub fn velocity_field(&self) -> Vec<f64>
pub fn velocity_field(&self) -> Vec<f64>
Return the entire velocity field as a flat Vecf64of[ux, uy]` pairs,
row-major order (x-major).
Sourcepub fn density_field(&self) -> Vec<f64>
pub fn density_field(&self) -> Vec<f64>
Return the entire density field as a flat Vecf64`, row-major.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PyLbmGrid
impl RefUnwindSafe for PyLbmGrid
impl Send for PyLbmGrid
impl Sync for PyLbmGrid
impl Unpin for PyLbmGrid
impl UnsafeUnpin for PyLbmGrid
impl UnwindSafe for PyLbmGrid
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.