Tips and tricks

From Gerris

Revision as of 04:59, 5 February 2008; view current revision
←Older revision | Newer revision→
Jump to: navigation, search

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 and the tee utility 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:


movies="wide closeup overview"
rm -f $movies
mkfifo $movies

gerris3D mysimulation.gfs | tee $movies > /dev/null &
for movie in $movies; do
    gfsview-batch3D $movie.gfv < $movie | ppm2mpeg > $movie.mpg &
sleep 10
rm -f $movies

of course the simulation file mysimulation.gfs should contain lines looking like:

OutputSimulation { istep = 10 } stdout
EventScript { istep = 10 } { echo "Save stdout { width = 1024 height = 768 }" }

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.

Personal tools