[Gmsh] gmsh and FreeFem

Geordie McBain gdmcbain at freeshell.org
Thu Sep 23 02:49:47 CEST 2010


2010/5/21 Geordie McBain <gdmcbain at freeshell.org>:
> 2010/5/20 marco restelli <mrestelli at gmail.com>:
>> Hi all,
>>   I would be interested in working with gmsh and FreeFem++
>> (http://www.freefem.org/ff++/), using FreeFem for the finite element
>> computations and gmsh for data visualization and postprocessing. Does
>> anybody have suggestions about the most effective way to get data from
>> FreeFem into gmsh?

> I use Gmsh a lot for FreeFem++ pre- and postprocessing.  The way I get
> the data from FreeFem++ into Gmsh is to write an ASCII .msh file,
> following the format description at
>
> http://geuz.org/gmsh/doc/texinfo/gmsh.html#MSH-ASCII-file-format
>
> using some FreeFem++ macros I've written, exploiting the techniques
> from Section 5.1.4 `Mesh connectivity' of the FreeFem++ manual.  I
> attach a modification of FreeFem++ example 3.1 which uses the macros
> in writemsh.edp to write the result file membrane.msh for Gmsh.

I received a query about this off the list, about whether this can be
extended to transient simulations.  It can, and I reply here, to keep
it on the public record.  Again, I modify a very simple example from
the FreeFem++ manual; in this case the first transient simulation,
which is in Section 3.4 `Thermal conduction'.  This is strictly for
transient simulation on a fixed mesh.  The idea is to write the mesh
to one file at the outset, and then at each time-step save the
instantaneous solution to a new file containing just a MeshFormat
block and a NodeData block.  Finally, open all the output .msh files
simultaneously in Gmsh.  This example is two-dimensional, but that's
just for brevity: it works just as well in three dimensions, even on
big problems (as big as I've tried anyway).  This example produces 52
output files (1 mesh plus 51 snapshots, from t = 0 to t = 5.0, in
steps of 0.1), but I only attach a couple here.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: thermic-g.edp
Type: application/octet-stream
Size: 1029 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20100923/ed0ee021/attachment.edp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: writemsh.edp
Type: application/octet-stream
Size: 4360 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20100923/ed0ee021/attachment-0001.edp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: thermic-g.0.msh
Type: model/mesh
Size: 13051 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20100923/ed0ee021/attachment.msh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: thermic-g.10.msh
Type: model/mesh
Size: 2329 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20100923/ed0ee021/attachment-0001.msh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: thermic-g.20.msh
Type: model/mesh
Size: 2326 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20100923/ed0ee021/attachment-0002.msh>