phyz-lbm 0.1.0

Lattice Boltzmann Method for emergent fluid dynamics in phyz
Documentation
  • Coverage
  • 98.28%
    57 out of 58 items documented1 out of 33 items with examples
  • Size
  • Source code size: 33.87 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.2 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 1s Average build duration of successful builds.
  • all releases: 1m 1s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • ecto/phyz
    18 3 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ecto

Lattice Boltzmann Method (LBM) for emergent fluid dynamics.

Implements D2Q9 (2D) and D3Q19 (3D) lattice Boltzmann models with BGK collision operator. At macroscopic scales, LBM recovers incompressible Navier-Stokes equations.

Example

use phyz_lbm::LatticeBoltzmann2D;
use phyz_math::Vec3;

// Lid-driven cavity flow
let mut lbm = LatticeBoltzmann2D::new(64, 64, 0.1);  // 64x64 grid, nu=0.1
lbm.initialize_uniform(1.0, [0.0, 0.0]);

// Set boundary conditions
for x in 0..64 {
    lbm.set_velocity_bc(x, 63, [0.1, 0.0]);  // lid velocity
    lbm.set_no_slip_bc(x, 0);                 // bottom wall
}

// Simulate
for _ in 0..1000 {
    lbm.collide_and_stream();
}

let u = lbm.velocity(32, 32);
println!("Center velocity: [{:.4}, {:.4}]", u[0], u[1]);