pub struct GpuLbmGrid {
pub nx: usize,
pub ny: usize,
pub cells: Vec<LbmCell>,
}Expand description
2-D D2Q9 LBM grid (CPU mock of a GPU backend).
Fields§
§nx: usizeNumber of cells in the x-direction.
ny: usizeNumber of cells in the y-direction.
cells: Vec<LbmCell>Flat cell storage: row-major, cells[y * nx + x].
Implementations§
Source§impl GpuLbmGrid
impl GpuLbmGrid
Sourcepub fn new(nx: usize, ny: usize, rho: f64) -> Self
pub fn new(nx: usize, ny: usize, rho: f64) -> Self
Construct a new grid initialised to a uniform equilibrium state.
nx,ny– grid dimensionsrho– initial density (uniform)
Sourcepub fn collision_bgk(&mut self, omega: f64)
pub fn collision_bgk(&mut self, omega: f64)
BGK collision step: compute f_out from current f_in using relaxation
parameter omega.
Sourcepub fn stream_periodic(&mut self)
pub fn stream_periodic(&mut self)
Streaming step with periodic boundary conditions.
Each distribution f_out[i] from cell (x, y) is moved to
f_in[i] of the neighbouring cell in direction D2Q9_DIRS[i].
Trait Implementations§
Source§impl Clone for GpuLbmGrid
impl Clone for GpuLbmGrid
Source§fn clone(&self) -> GpuLbmGrid
fn clone(&self) -> GpuLbmGrid
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GpuLbmGrid
impl RefUnwindSafe for GpuLbmGrid
impl Send for GpuLbmGrid
impl Sync for GpuLbmGrid
impl Unpin for GpuLbmGrid
impl UnsafeUnpin for GpuLbmGrid
impl UnwindSafe for GpuLbmGrid
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<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