[Gmsh] pointsources and Nodes and Elements lists

Geordie McBain gdmcbain at freeshell.org
Thu Oct 14 23:45:04 CEST 2010

2010/10/14 Bart Vandewoestyne <Bart.Vandewoestyne at telenet.be>:
> On Wed, Oct 13, 2010 at 09:28:06AM +0200, Francisco Gilabert Villegas wrote:
>> Hello,
>> You can insert points or lines in any surface. Please see the example
>> below.
>> I hope this help you.
>> Regards,
>> Francisco
> Hello Francisco,
> I assume your answer is more of an answer to jordi's problem than
> it is to mine, right?  I have checked your example and for as far
> as I can see, the point at (0.34, 0.45) is still a node in the
> resulting mesh, so it still appears in the $Nodes section.
> What I need is to be able to specify a point (the location of my
> pointsource) but this point should *not* appear in the $Nodes
> section.  Somehow, i would like to read the coordinates of my
> pointsource from the .msh file, without having to remove it from
> the $Nodes section and without having to fix all the indices in
> the $Elements section.
> But for as far as I can see now, there is no real solution from
> within gmsh, and for now I will have to remove the node and fix
> the indices in my Matlab code that reads the .msh file and sets
> up the data structures for my solver.

This fix is probably the way to go, since I wouldn't have thought that
the $Nodes section was designed to be in one-to-one correspondence
with the degrees-of-freedom.  In the finite element method degrees of
freedom really come from the finite elements and so in .msh the
$Elements section; this does refer back to $Nodes as required, but
with no necessity of referring to every node in $Nodes.  This
distinction might become clearer if later you need to introduce
subdomains and then formulate operators specific to them (e.g. you
might choose to ignore fluid regions when computing elastic
deformation in the solids, but include them for heat transfer): these
subdomains are specified in Gmsh as physical entities and apply to
elements rather than nodes.

But having said that, you're free to add another section to your .msh
files, e.g. $Points, and train your code to read source location from
it.  See the note:

    Any section with an unrecognized header is simply ignored:
    you can thus add comments in a .msh file by putting them
    e.g. inside a $Comments/$EndComments section.

in Section 9.1 of the Gmsh reference manual.  I don't think such
sections can be generated in Gmsh, either via script or GUI, though a
feature-request for such a facility was discussed recently at