Skip to main content

Module shaders

Module shaders 

Source
Expand description

WGSL kernel specs mirroring the CPU reference solvers.

These are the GPU dispatch kernels for the physics in this module. They are provided as the authoritative description of the per-cell update; the CPU solvers in the sibling files are the verifiable reference (analytic-solution tested) and are what runs when no GPU is present. A GPU run routes through the core engine’s shared wgpu device rather than a second device here.

Constants§

HEAT_DIFFUSION_2D
2D heat diffusion — explicit forward-Euler 5-point Laplacian.
MAXWELL_FDTD_1D
1D electromagnetics — the Yee FDTD leap-frog (Ey/Hz). One workgroup pass advances Hz, the next advances Ey; the host alternates them per step.
NAVIER_STOKES_2D
2D incompressible Navier–Stokes — advection + viscous diffusion + pressure gradient (the projection/Poisson pass runs as a separate Jacobi kernel). Stencils use the true grid spacing dx/dy (1/h²), unlike the old mock.
WAVE_EQUATION_2D
2D wave equation — explicit leap-frog (u_old / u / u_new triple buffer).