Define R sqrt(x*x+y*y)
Define R0 0.25
Define GAUSSIAN (exp(-250.*((R-R0)*(R-R0))))
1 0 GfsAdvection GfsBox GfsGEdge {} {
    VariableTracerVOF T
    VariableTracer T1 { scheme = none }
    VariableVOFConcentration C T
    Refine 5
    InitFraction T (-difference(sphere(0,0,0,0.4),sphere(0,0,0,0.1)))
    Init {} {
	C = GAUSSIAN*T
	T1 = C
    }

#    GModule hypre
    SourceDiffusion T1 T/(T+1.e9*(1.-T)*(1.-T)) {beta = 1}
    SourceDiffusionExplicit C T/(T+1.e9*(1.-T)*(1.-T))
#    SourceDiffusion C T/(T+1.e9*(1.-T)*(1.-T))


    Time { end = 0.02 dtmax = 9e-5 }

    OutputSimulation { start = 0.01 } end.gfs
    OutputScalarSum {istep = 10}  T1vol { v = T1 }
    OutputScalarSum {istep = 10}  Cvol { v = C }
    EventScript { start = end } {
	conservation() 
        {
	    if awk -v tolerance=$1 'BEGIN { min = 1.; max = -1.; }{ 
              if ($5 > max) max = $5; 
              if ($5 < min) min = $5; 
            }END{ if (max - min > tolerance) { print max - min > "/dev/stderr"; exit (1); } }'; then
		:
	    else
		exit $GFS_STOP;
	    fi
	}
        conservation 2.1e-7 < T1vol
        conservation 2.1e-7 < Cvol
    }
    OutputSimulation {start = 0.005} {
	awk '{
           if ($1 != "#" && $8 > 0.)
             print sqrt($1*$1+$2*$2),$12,$13;
        }' > prof
    } { format = text}
}
GfsBox {}