Initial commit
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
//! Lattice Boltzmann Method (LBM) solvers
|
||||
//!
|
||||
//! This module implements various LBM models for fluid flow simulation:
|
||||
//! - D2Q9: 2D model with 9 discrete velocities
|
||||
//! - D3Q19: 3D model with 19 discrete velocities
|
||||
//! - Boundary conditions: bounce-back, Zou-He
|
||||
//! - Collision operators: BGK, MRT
|
||||
|
||||
pub mod boundary;
|
||||
pub mod d2q9;
|
||||
/// GPU-accelerated D2Q9 LBM solver
|
||||
#[cfg(feature = "cuda")]
|
||||
pub mod d2q9_gpu;
|
||||
pub mod d3q19;
|
||||
/// GPU-accelerated D3Q19 LBM solver
|
||||
#[cfg(feature = "cuda")]
|
||||
pub mod d3q19_gpu;
|
||||
|
||||
pub use boundary::{
|
||||
BounceBackBc, BoundaryConditionSet, BoundaryOrientation, LbmBoundaryCondition, ZouHeBc,
|
||||
ZouHeBoundaryType,
|
||||
};
|
||||
pub use d2q9::{D2Q9Parameters, D2Q9Solver};
|
||||
#[cfg(feature = "cuda")]
|
||||
pub use d2q9_gpu::D2Q9GpuSolver;
|
||||
pub use d3q19::{D3Q19Parameters, D3Q19Solver, MacroscopicVariables3D};
|
||||
#[cfg(feature = "cuda")]
|
||||
pub use d3q19_gpu::D3Q19GpuSolver;
|
||||
|
||||
/// Common LBM traits and utilities
|
||||
pub mod common {
|
||||
use nalgebra::Vector2;
|
||||
|
||||
/// Macroscopic variables calculated from distribution functions
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct MacroscopicVariables {
|
||||
/// Fluid density
|
||||
pub density: f64,
|
||||
/// Velocity vector
|
||||
pub velocity: Vector2<f64>,
|
||||
}
|
||||
|
||||
impl MacroscopicVariables {
|
||||
/// Create new macroscopic variables
|
||||
#[must_use]
|
||||
pub fn new(density: f64, velocity: Vector2<f64>) -> Self {
|
||||
Self { density, velocity }
|
||||
}
|
||||
|
||||
/// Zero velocity state
|
||||
#[must_use]
|
||||
pub fn at_rest(density: f64) -> Self {
|
||||
Self {
|
||||
density,
|
||||
velocity: Vector2::zeros(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user