[Gmsh] PostView format and background mesh

Geordie McBain gdmcbain at freeshell.org
Tue Jul 30 08:10:40 CEST 2013


2013/7/30 J S <j.s4403 at gmail.com>:
>>> The missing pieces are:
>>> 4. write out a characteristic length in a format understood by gmsh.
>>
>> Write out the characteristic length in the .msh format.  Then let
>> "gmsh -0" convert that to .pos, as described.
>
> How do you specify the characteristic length in .msh format?  I don't see it
> in the reference manual?

The format is described at
http://geuz.org/gmsh/doc/texinfo/gmsh.html#MSH-ASCII-file-format.  The
characteristic length can be output as either NodeData or ElementData,
depending on how you calculate it (which of course will be very much
dependent on your application).
   As a simple example, you might decide that the magnitude of the
gradient of the solution of your partial differential equation on the
first mesh might be a useful indicator.  This will be P0 if your
solution is P1, so you'd output it as ElementData, or rather its
reciprocal, since you want something that's smaller where the gradient
is steeper to get smaller elements there.
  A more sophisticated tool is Pascal Frey's mshmet
<http://www.ann.jussieu.fr/~frey/software.html>.  There's an interface
to this in FreeFem++.  It computes an indicator field on nodes, so
that should be written as NodeData.

> bgmesh.pos has 3 numbers after the 9 numbers corresponding to triangle
> coordinates.  Which one is the characteristic length?

I don't know.  I haven't investigated the .pos format at all.  I just
let "gmsh -0" do its job and it does appear to.

If I had to guess, I'd say that they might be the values at the
vertices, but really I don't know.

>  How do I specify this in 1d and 3d?

The "gmsh -0" conversion certainly works in three dimensions.  I
haven't tried one dimension, but I would think it would work there
too.