''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?

Line 146:

Line 148:

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

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.

+

+

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

+

+

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

== Parallel compilation ==

== Parallel compilation ==

Line 152:

Line 176:

% make -j4

% make -j4

+

+

== Visualizing VTK parallel files using Visit ==

+

+

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

+

+

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

+

+

!NBLOCKS 2

+

file-0-0.vtk

+

file-0-1.vtk

+

file-1-0.vtk

+

file-1-1.vtk

+

+

Further information can be found [https://wci.llnl.gov/codes/visit/2.0.0/GettingDataIntoVisIt2.0.0.pdf here].

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

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:

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

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

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

Parallel compilation

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

% make -j4

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: