fn advect(&mut self, delta_t: f64) {
        // Here, we take a semi-Lagrangian approach. We run time
        // "backwards" to find the start point of a particle that
        // ends up at each grid cell. We do this as follows:
        //
        //              x_p = x_g - delta_t * u(x_g)
        //
        // which gives us `x_p`, the previous position of the
        // hypothetical particle. Because this point will not be
        // on the grid, we simply interpolate the old value of `q`
        // from the old values on the grid around `x_p`.
        //
        // Note that we need to use the appropriate averaged
        // velocity to estimate particle trajectories.
        //
        // This semi-Lagrangian approach is unconditionally
        // stable: we can't create larger or smaller values of `q`
        // than were already present in the previous time step
        // since we are performing linear/bilinear/trilinear
        // interpolations.
        //
        // Advection cannot happen in-place: we need to create new
        // buffers and swap them.
        self.u = self.advect_quantity(delta_t, &self.u);
        self.v = self.advect_quantity(delta_t, &self.v);
        self.dye = self.advect_quantity(delta_t, &self.dye);
    }
/// Advect all of the relevant fluid quantities.
Advect all of the relevant fluid quantities.
Advect all of the relevant fluid quantities .
fn advect(&mut self, delta_t: f64) {
        // Here, we take a semi-Lagrangian approach. We run time
        // "backwards" to find the start point of a particle that
        // ends up at each grid cell. We do this as follows:
        //
        //              x_p = x_g - delta_t * u(x_g)
        //
        // which gives us `x_p`, the previous position of the
        // hypothetical particle. Because this point will not be
        // on the grid, we simply interpolate the old value of `q`
        // from the old values on the grid around `x_p`.
        //
        // Note that we need to use the appropriate averaged
        // velocity to estimate particle trajectories.
        //
        // This semi-Lagrangian approach is unconditionally
        // stable: we can't create larger or smaller values of `q`
        // than were already present in the previous time step
        // since we are performing linear/bilinear/trilinear
        // interpolations.
        //
        // Advection cannot happen in-place: we need to create new
        // buffers and swap them.
        self.u = self.advect_quantity(delta_t, &self.u);
        self.v = self.advect_quantity(delta_t, &self.v);
        self.dye = self.advect_quantity(delta_t, &self.dye);
    }
fn advect ( & mut self , delta_t : f64 ) { // Here, we take a semi-Lagrangian approach. We run time // "backwards" to find the start point of a particle that // ends up at each grid cell. We do this as follows: // //              x_p = x_g - delta_t * u(x_g) // // which gives us `x_p`, the previous position of the // hypothetical particle. Because this point will not be // on the grid, we simply interpolate the old value of `q` // from the old values on the grid around `x_p`. // // Note that we need to use the appropriate averaged // velocity to estimate particle trajectories. // // This semi-Lagrangian approach is unconditionally // stable: we can't create larger or smaller values of `q` // than were already present in the previous time step // since we are performing linear/bilinear/trilinear // interpolations. // // Advection cannot happen in-place: we need to create new // buffers and swap them. self . u = self . advect_quantity ( delta_t , & self . u ) ; self . v = self . advect_quantity ( delta_t , & self . v ) ; self . dye = self . advect_quantity ( delta_t , & self . dye ) ; }
Advect all of the relevant fluid quantities.
Advect all of the relevant fluid quantities .
&mut self
delta_t
f64
&mut self
delta_t
f64