1 0 GfsRiver GfsBox GfsGEdge {} {
PhysicalParams { L = 8. }
RefineSolid 9
Solid (y - 3.9999)
Init {} {
Zb = x*x/8.+cos(M_PI*x)/2.
P = {
double p = x > 0. ? 0.35 : x < -2. ? 1.9 : -1.;
return MAX (0., p - Zb);
}
}
PhysicalParams { g = 1. }
AdvectionParams {
gradient = none
}
Time { end = 40 }
OutputProgress { istep = 10 } stderr
OutputScalarSum { istep = 10 } ke { v = (P > 0. ? U*U/P : 0.) }
OutputScalarSum { istep = 10 } vol { v = P }
OutputScalarNorm { istep = 10 } u { v = (P > 0. ? U/P : 0.) }
OutputSimulation { step = 0.5 } sim-%g.txt { format = text }
EventScript { step = 0.5 } {
time=`echo $GfsTime | awk '{printf("%4.1f\n", $1);}'`
cat <<EOF | gnuplot
load 'dam.plot'
set title "t = $time"
set term postscript eps color 14
set output "sim.eps"
plot [-4.:4.]'sim-$GfsTime.txt' u 1:7:8 w filledcu lc 3, 'sim-0.txt' u 1:7 w l lw 4 lc 1 lt 1
EOF
time=`echo $GfsTime | awk '{printf("%04.1f\n", $1);}'`
convert -density 300 sim.eps -trim +repage -bordercolor white -border 10 -resize 640x282! sim-$time.gif
rm -f sim.eps
}
EventScript { start = end } {
gifsicle --colors 256 --optimize --delay 25 --loopcount=0 sim-*.gif > dam.gif
rm -f sim-*.gif sim-*.txt
}
}
GfsBox {
left = Boundary
right = Boundary
}