next up previous contents
Next: 4.3 Adding diffusion terms Up: 4 Going further Previous: 4.1 More on boundary   Contents

4.2 Adding tracers

In the half cylinder example, it would be nice to be able to visualise the flow using for example a passive tracer injected at the inlet. This is very simple, just modify the half-cylinder.gfs parameter file like this:

4 3 GfsSimulation GfsBox GfsGEdge {} {
  GfsTime { end = 9 }
  GfsRefine 7
  GtsSurfaceFile half-cylinder.gts
  GfsVariableTracer {} T
  ...
  GfsOutputPPM { step = 0.02 } tracer.ppm {
    min = 0 max = 1 v = T
  }
  GfsOutputSimulation { step = 0.1 } half-cylinder-%3.1f.gfs {
    variables = U,V,P,T
  }
  ...
}
GfsBox { left = GfsBoundary {
                  GfsBcDirichlet U 1
                  GfsBcDirichlet V 0
                  GfsBcDirichlet T { return y > 0. ? 1. : 0.; }
                } 
       }
...
which will inject tracer T at the inlet only in the upper half of the channel.

The adaptive refinement algorithm shoud also take your tracer into account. Try this

  ...
  GfsAdaptVorticity { istep = 1 } { maxlevel = 7 cmax = 1e-2 }
  GfsAdaptGradient { istep = 1 } { maxlevel = 7 cmax = 1e-2 } T
  ...
which will adapt using both the gradient of tracer T and the vorticity.

You can have any number of tracers you want, they are dynamically allocated.