Skip to main content

gpu_advect_2d

Function gpu_advect_2d 

Source
pub fn gpu_advect_2d(
    field: &[f64],
    vel: &[[f64; 2]],
    nx: usize,
    ny: usize,
    dx: f64,
    dt: f64,
) -> Vec<f64>
Expand description

GPU semi-Lagrangian scalar field advection on a 2D regular grid.

Each cell is a separate GPU thread: back-traces the characteristic by dt through the supplied velocity field vel (one 2-vector per cell) and samples the field using bilinear interpolation.