Skip to main content

Module sph

Module sph 

Source
Expand description

SPH (Smoothed Particle Hydrodynamics) compute kernels.

Structs§

NeighborList
A simple grid-based neighbor list for SPH.
SphBufferLayout
Describes the buffer layout for SPH simulation data.
SphDensityKernel
Kernel that computes SPH particle densities.
SphDispatchConfig
Configuration for dispatching SPH compute kernels.
SphForceKernel
Kernel that computes SPH pressure and viscosity forces.
SphKernelParams
Pre-computed parameters for a smoothing kernel with smoothing length h.
SphNeighborListKernel
Kernel that constructs a neighbor list on the CPU.

Enums§

SphKernel
Selects the smoothing kernel function to use for SPH computations.

Functions§

artificial_viscosity_force
Artificial viscosity for SPH (Monaghan 1992 formulation).
build_neighbor_list_explicit
Build an explicit neighbour list: for each particle, store all particle indices within distance h.
cfl_timestep
Compute the CFL-limited time step for a particle system.
density_accumulation
Accumulate density contributions from a neighbour list.
density_summation
Compute per-particle densities using SPH summation.
density_summation_kernel
Compute per-particle densities with a specified kernel type.
integrate_kernel_sphere
Numerically integrate the kernel over a sphere of radius h using Monte Carlo.
kernel_gradient
Evaluate the gradient nabla W(r_vec, h) of the smoothing kernel.
kernel_value
Evaluate the smoothing kernel W(r, h) for a given kernel type.
mean_neighbor_count
Compute average number of neighbours per particle.
normalize_normal
Normalize a surface normal vector. Returns zero vector if magnitude is too small.
pressure_force
Compute pressure forces using the SPH symmetric pressure gradient formulation.
pressure_force_kernel
Symmetric SPH pressure force kernel using neighbour lists.
radix_sort_by_density
Sort particle indices in ascending order of density using a reference sort.
surface_normal_kernel
Compute approximate surface normals using the color function gradient method.
surface_tension_force
Compute surface tension forces using the color function gradient (CSF) method.
viscosity_force
Compute viscosity forces using the SPH viscosity formulation.
wcsph_euler_step
Apply one explicit WCSPH Euler step.
wcsph_leapfrog_velocity_half
Apply one leap-frog WCSPH half-step (velocity update only).
wcsph_pressure
Equation of state for WCSPH: p = B * ((rho/rho0)^gamma - 1).