Define CIRCLE (ellipse (0, -.236338, 0.2, 0.2))
Define GAUSSIAN (exp(-100.*((x + 0.2)*(x + 0.2) + (y + .236338)*(y + .236338))))
1 0 GfsAdvection GfsBox GfsGEdge {} {
Time { end = 5 }
Refine LEVEL
VariableTracerVOFHeight T
VariableVOFConcentration C T
VariableTracer G
InitFraction T CIRCLE
Init {} {
C = GAUSSIAN*T
G = GAUSSIAN
}
VariableStreamFunction {
step = 2.5
} Psi (t < 2.5 ? 1. : -1.)*sin((x + 0.5)*M_PI)*sin((y + 0.5)*M_PI)/M_PI
AdaptGradient { istart = 1 istep = 1 } { cmax = 0 maxlevel = LEVEL } T
AdaptError { istart = 1 istep = 1 } { cmax = 1e-3 maxlevel = LEVEL } C
AdaptError { istart = 1 istep = 1 } { cmax = 1e-3 maxlevel = LEVEL } G
OutputScalarSum { istep = 1 } t { v = T }
OutputScalarSum { istep = 1 } t1 { v = C }
OutputScalarSum { istep = 1 } t2 { v = G }
OutputSimulation { start = 2.5 } half-LEVEL.gfs
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 1e-4 < t
conservation 2e-5 < t1
conservation 0. < t2
}
VariableTracer Tref
InitFraction { start = end } Tref CIRCLE
OutputErrorNorm { start = end } dt-LEVEL { v = T } {
s = Tref
v = DT
}
OutputErrorNorm { start = end } dt1-LEVEL { v = C } {
s = Tref*GAUSSIAN
v = DC
}
OutputErrorNorm { start = end } dt2-LEVEL { v = G } {
s = GAUSSIAN
v = DG
}
OutputSimulation { start = end } end-LEVEL.gfs
}
GfsBox {}