Well, not really but something approaching. Add the following to your <code>.emacs</code>

+

The default Gerris installation comes with an emacs [http://www.gnu.org/software/emacs/manual/html_node/emacs/Major-Modes.html major mode] to edit Gerris simulation files. To enable it, you need to find where Gerris is installed. For example do:

This will setup emacs so that opening files with the ".gfs" extension automatically uses the "gfs-mode" major mode. Alternatively you can manually enable this mode on any file using (within emacs):

+

+

M-x gfs-mode

+

+

where M- stands for the "emacs Meta key" (usually mapped to "esc" on your keyboard).

+

+

If you now restart emacs and open a .gfs file, you will see that emacs highlights Gerris keywords. These keywords are also "clickable". Clicking on a keyword will open the corresponding documentation in your web browser. If you want, you can customize the way links are opened by configuring the 'browse-url' emacs function which is used by gfs-mode.

+

+

===Indentation===

+

+

The gfs-mode also knows how to properly indent Gerris simulation files. A line can easily be indented by pressing the 'Tab' key with the cursor positioned anywhere on the line.

+

+

To automatically indent a block of text, use Ctrl-space (or the mouse) to select the block and type:

+

+

M-x indent-region

+

+

(note that you can use the Tab key to autocomplete command names).

+

+

===Keyword auto-completion===

+

+

gfs-mode configures [http://www.gnu.org/software/emacs/manual/html_node/emacs/Dynamic-Abbrevs.html dynamic abbrevs] to provide auto-completion for Gerris keywords. Dynamic abbrevs are usually enabled by default in emacs. They work with any buffer. To use auto-completion, type the beginning of the Gerris keyword (e.g. "Out") and type

+

+

M-/

+

+

repeatedly. This will cycle through all the Gerris keywords starting with "Out".

+

+

===Comments===

+

+

You can comment out (resp. uncomment) selected blocks of text using

+

+

M-x comment-region (resp. M-x uncomment-region)

== Generating several movies on-the-fly ==

== Generating several movies on-the-fly ==

+

+

''Note that using [[GfsOutputView]] is simpler and more efficient than the technique described in this section.''

While it is fairly simple to use the scripting mode of gfsview and unix pipes to [http://gfs.sourceforge.net/examples/examples/boussinesq.html generate a movie] on the fly from a running simulation, how does one generate several movies simultaneously?

While it is fairly simple to use the scripting mode of gfsview and unix pipes to [http://gfs.sourceforge.net/examples/examples/boussinesq.html generate a movie] on the fly from a running simulation, how does one generate several movies simultaneously?

-

Using named unix fifos and the <code>tee</code> utility it is fairly easy too. For example if one has three gfsview files called <code>wide.gfv</code>, <code>closeup.gfv</code> and <code>overview.gfv</code> and want to generate the three corresponding movies <code>wide.mpg</code>, <code>closeup.mpg</code> and <code>overview.mpg</code> in one go, one could use the following script:

+

Using named unix fifos it is fairly easy too. For example if one has three gfsview files called <code>wide.gfv</code>, <code>closeup.gfv</code> and <code>overview.gfv</code> and want to generate the three corresponding movies <code>wide.mpg</code>, <code>closeup.mpg</code> and <code>overview.mpg</code> in one go, one could use the following command:

Another example would be computing a distance function (i.e. a levelset function) from a VOF interface description for visualisation using isosurfaces in GfsView. This is easily done using something like:

and then to map this function with some sequence of letters (in my case y use \w )

+

+

map <Leader>w :call OnlineDoc()<CR>

+

+

Remember that you can create your own vim plugin for gfs files as

+

+

au! BufNewFile,BufRead *.gfs set filetype=gfs

+

+

and to place all this stuff in .vim/after/ftplugin/gfs.vim (you can also to load the color scheme of c.vim!!!)

+

+

== Restarting parallel simulations ==

+

+

Starting from version 2010-07-10 it should be possible to restart large parallel simulations. Just add the standard line:

+

+

[[GfsOutputSimulation|OutputSimulation]] { step = 1 } sim-%g.gfs

+

+

and do e.g.

+

+

mpirun -np 8 gerris3D sim-10.gfs

+

+

with the same number of processors you initially used to create <code>sim-10.gfs</code>.

+

+

Note that if you use this (simple) method each processor will need to read the entire simulation file. If you notice that this phase takes a significant amount of time (e.g. due to filesystem performance when being accessed simultaneously by many processes), you can optimise things using:

+

+

[[GfsOutputSimulation|OutputSimulation]] { step = 1 } sim-%d-%g.gfs

+

+

which will generate a separate file for each process. You can then restart the simulation using e.g.

-

== Writing generic or customized gerris output ==

+

mpirun -np 8 gerris3D sim-%d-10.gfs

+

Note that this requires a version of Gerris later than 2010-07-20.

-

Since most of visualization package on the market (or as open-source) do not support quadtree/octree data format, to use benefits of third party visualization packages rather than GFSView we should convert Gerris results to a general unstructured data.

If you have a multi-core system (let's say 4), you can compile Gerris (and other sources) 4 times faster using:

-

This function could write output data in Tecplot or [http://www.cacr.caltech.edu/~slombey/asci/vtk/vtk_formats.simple.html VTK format]. I mean generic output because Tecplot format is almost a general unstructured data type and you could easily modify its (code or resulted file) for your own need. Alternatively you could contact me and I could do its for you (just describe your format). All data are written in ASCII format.

+

% make -j4

-

Tecplot format is briefly as follows:

+

== Visualizing VTK parallel files using Visit ==

-

1) Header (include list of field variables, number of vertexes, number of elements and elements type)

+

[https://wci.llnl.gov/codes/visit/ Visit] is a nice visualization tool that allows us to visualize, among many other formats, VTK files. For parallel runs, one can generate one vtk file per processor. Then, in order to visualize all the simulation domain, we need to generate a text file with extension .visit that gathers the names of the different vtk files at a given timestep. For example, if we have generated file-0-0.vtk and file-0-1.vtk at t=0, we just need to create the following text file:

This will setup emacs so that opening files with the ".gfs" extension automatically uses the "gfs-mode" major mode. Alternatively you can manually enable this mode on any file using (within emacs):

M-x gfs-mode

where M- stands for the "emacs Meta key" (usually mapped to "esc" on your keyboard).

If you now restart emacs and open a .gfs file, you will see that emacs highlights Gerris keywords. These keywords are also "clickable". Clicking on a keyword will open the corresponding documentation in your web browser. If you want, you can customize the way links are opened by configuring the 'browse-url' emacs function which is used by gfs-mode.

Keyword auto-completion

gfs-mode configures dynamic abbrevs to provide auto-completion for Gerris keywords. Dynamic abbrevs are usually enabled by default in emacs. They work with any buffer. To use auto-completion, type the beginning of the Gerris keyword (e.g. "Out") and type

M-/

repeatedly. This will cycle through all the Gerris keywords starting with "Out".

Comments

Generating several movies on-the-fly

Note that using GfsOutputView is simpler and more efficient than the technique described in this section.

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 command:

Adding objects after a simulation has completed

Another example would be computing a distance function (i.e. a levelset function) from a VOF interface description for visualisation using isosurfaces in GfsView. This is easily done using something like:

with the same number of processors you initially used to create sim-10.gfs.

Note that if you use this (simple) method each processor will need to read the entire simulation file. If you notice that this phase takes a significant amount of time (e.g. due to filesystem performance when being accessed simultaneously by many processes), you can optimise things using:

Parallel compilation

Visualizing VTK parallel files using Visit

Visit is a nice visualization tool that allows us to visualize, among many other formats, VTK files. For parallel runs, one can generate one vtk file per processor. Then, in order to visualize all the simulation domain, we need to generate a text file with extension .visit that gathers the names of the different vtk files at a given timestep. For example, if we have generated file-0-0.vtk and file-0-1.vtk at t=0, we just need to create the following text file:

!NBLOCKS 2
file-0-0.vtk
file-0-1.vtk

If you have solutions at different time steps and you want to load them at once, then you will need to do something as follows: