pub struct SPHGpuKernels {
pub positions: Vec<[f64; 3]>,
pub velocities: Vec<[f64; 3]>,
pub densities: Vec<f64>,
pub pressures: Vec<f64>,
pub smoothing_length: f64,
pub rest_density: f64,
pub stiffness: f64,
pub viscosity: f64,
pub mass: f64,
}Expand description
GPU SPH particle data for density/pressure/viscosity kernels.
Fields§
§positions: Vec<[f64; 3]>Particle positions [x, y, z].
velocities: Vec<[f64; 3]>Particle velocities [vx, vy, vz].
densities: Vec<f64>Per-particle density (kg/m³).
pressures: Vec<f64>Per-particle pressure (Pa).
smoothing_length: f64Smoothing length h (m).
rest_density: f64Rest density ρ₀ (kg/m³).
stiffness: f64Pressure stiffness constant k.
viscosity: f64Kinematic viscosity μ (Pa·s).
mass: f64Particle mass (kg).
Implementations§
Source§impl SPHGpuKernels
impl SPHGpuKernels
Sourcepub fn new(
positions: Vec<[f64; 3]>,
smoothing_length: f64,
rest_density: f64,
stiffness: f64,
viscosity: f64,
mass: f64,
) -> Self
pub fn new( positions: Vec<[f64; 3]>, smoothing_length: f64, rest_density: f64, stiffness: f64, viscosity: f64, mass: f64, ) -> Self
Create a new SPH kernel manager with n particles.
Sourcepub fn n_particles(&self) -> usize
pub fn n_particles(&self) -> usize
Number of particles.
Sourcepub fn kernel_grad_w(&self, rij: [f64; 3], r: f64) -> [f64; 3]
pub fn kernel_grad_w(&self, rij: [f64; 3], r: f64) -> [f64; 3]
Gradient of cubic spline kernel ∇W(r⃗, h).
Sourcepub fn compute_density(&mut self)
pub fn compute_density(&mut self)
Density kernel: compute per-particle density from neighbour contributions.
Sourcepub fn compute_pressure(&mut self)
pub fn compute_pressure(&mut self)
Pressure kernel: compute per-particle pressure (equation of state).
Sourcepub fn pressure_force(&self) -> Vec<[f64; 3]>
pub fn pressure_force(&self) -> Vec<[f64; 3]>
Pressure force kernel: compute pressure force on each particle.
Returns acceleration vectors [ax, ay, az] per particle.
Sourcepub fn viscosity_force(&self) -> Vec<[f64; 3]>
pub fn viscosity_force(&self) -> Vec<[f64; 3]>
Viscosity kernel: compute viscosity force on each particle.
Returns acceleration vectors [ax, ay, az] per particle.
Trait Implementations§
Source§impl Clone for SPHGpuKernels
impl Clone for SPHGpuKernels
Source§fn clone(&self) -> SPHGpuKernels
fn clone(&self) -> SPHGpuKernels
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SPHGpuKernels
impl RefUnwindSafe for SPHGpuKernels
impl Send for SPHGpuKernels
impl Sync for SPHGpuKernels
impl Unpin for SPHGpuKernels
impl UnsafeUnpin for SPHGpuKernels
impl UnwindSafe for SPHGpuKernels
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
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>
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>
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