src/tracer.h

Tracer advection event

This event integrates advection equations of the form tfi+u_ffi=0 where u_f is the velocity field and fi are a list of passive tracers.

The tracers list is defined elsewhere (typically by the user), the face vector field uf and the timestep dt are defined by a solver.

extern scalar * tracers;
extern face vector uf;
extern double dt;

On adaptive meshes, tracers need to use linear interpolation (rather than the default bilinear interpolation) to ensure conservation when refining cells.

#if TREE
event defaults (i = 0) {
  for (scalar s in tracers) {
    s.refine  = refine_linear;
    s.restriction = restriction_volume_average;
  }
}
#endif

The integration is performed using the Bell-Collela-Glaz scheme.

#include "bcg.h"

event tracer_advection (i++,last) {
  advection (tracers, uf, dt);
}

Diffusion can be added by overloading this hook.

event tracer_diffusion (i++,last);

Usage

Examples

Tests