Tips and tricks
From Gerris
Emacs mode for Gerris files
Well, not really but something approaching. Add the following to your .emacs
(setq auto-mode-alist (cons '("\\.gfs\\'" . shell-script-mode) auto-mode-alist))
Generating several movies on-the-fly
While it is fairly simple to use the scripting mode of gfsview and unix pipes to generate a movie on the fly from a running simulation, how does one generate several movies simultaneously?
Using named unix fifos it is fairly easy too. For example if one has three gfsview files called wide.gfv, closeup.gfv and overview.gfv and want to generate the three corresponding movies wide.mpg, closeup.mpg and overview.mpg in one go, one could use the following script:
#!/bin/sh
movies="wide closeup overview"
rm -f $movies
mkfifo $movies
gerris3D mysimulation.gfs | gfsview-batch3D &
for movie in $movies; do
ppm2mpeg < $movie > $movie.mpg &
done
the simulation file mysimulation.gfs should also contain lines looking like:
OutputSimulation { step = 0.01 } stdout
EventScript { step = 0.01 } {
movies="wide closeup overview"
for movie in $movies; do
echo "Clear"
cat $movie.gfv
echo "Append $movie { width = 1024 height = 768 }"
done
}
Compressing simulation files
When it is useful to save simulation results at regular intervals, the size of the files can be reduced by using on-the-fly compression. This can be done like this:
OutputSimulation { istep = 100 } sim-%ld.gfs
EventScript { istep = 100 } { gzip -f -q sim-*.gfs }
GfsView can read compressed GFS files directly.

