# [Gmsh] pointsources and Nodes and Elements lists

Francisco Gilabert Villegas francisco.gilabert at itc.uji.es
Wed Oct 13 09:28:06 CEST 2010

```Hello,

You can insert points or lines in any surface. Please see the example
below.

Regards,

Francisco

//****************************************************************

len=0.1;

Point(1) = {0, 0, 0, len};

ext1[]=Extrude {1, 0, 0} {

Point{1};

};

ext2[]=Extrude {0, 1, 0} {

Line{ext1[1]};

};

my_point = newp;

Point(my_point) = {0.34, 0.45, 0, len};

// Inserting a point in a surface:

Point{my_point} In Surface{ext2[1]};

my_p1=newp; Point(my_p1) = {0.2, 0.78, 0, len};

my_p2=newp; Point(my_p2) = {0.6, 0.67, 0, len};

my_line=newl;

Line(my_line)={my_p1,my_p2};

// Inserting a line in surface

Line{my_line} In Surface{ext2[1]};

//****************************************************************

________________________________

De: gmsh-bounces at ace20.montefiore.ulg.ac.be
[mailto:gmsh-bounces at ace20.montefiore.ulg.ac.be] En nombre de jordi
poblet
Enviado el: lunes, 11 de octubre de 2010 14:10
Para: Bart Vandewoestyne
CC: gmsh at geuz.org
Asunto: Re: [Gmsh] pointsources and Nodes and Elements lists

Hello Bart,

I also need so often points in an specific position of the mesh. What I
so is to construct the mesh by parts in order to be sure that there will
be a node in the desired position (I copy an example for a single
rectangle with a node in X=0.49; Y = 0.48).
I suppose that this is not the answer that you were expecting...
sometimes it is hard to build the meshes. In any case, I would also be
interested in a better procedure to specify a priori the positions of
some nodes of the mesh. But I guess that this is not natural for most of
the meshing algorithms.

Best regards,

JORDI

------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------

lc = 0.13 ;

//Coords
x0 = 0.0 ;
y0 = 0.0 ;
xs = 0.49 ; //X Point source
ys = 0.48 ;  //Y Point source
x1 = 2.0 ;
y1 = 3.0 ;

//Points:
Point(1) = {x0, y0, 0, lc};
Point(2) = {xs, y0, 0, lc} ;
Point(3) = {x1, y0, 0, lc} ;
Point(4) = {x0, ys, 0, lc} ;
Point(5) = {xs, ys, 0, lc};
Point(6) = {x1, ys, 0, lc} ;
Point(7) = {x0, y1, 0, lc} ;
Point(8) = {xs, y1, 0, lc} ;
Point(9) = {x1, y1, 0, lc};

//Lines:
Line(1) = {1,2} ;
Line(2) = {2,3} ;

Line(3) = {4,5} ;
Line(4) = {5,6} ;

Line(5) = {7,8} ;
Line(6) = {8,9} ;

Line(7) = {1,4} ;
Line(8) = {4,7} ;

Line(9) = {2,5} ;
Line(10) = {5,8} ;

Line(11) = {3,6} ;
Line(12) = {6,9} ;

//Loops:
Line Loop(10) = {1,9,-3,-7} ;
Line Loop(11) = {2,11,-4,-9} ;
Line Loop(12) = {3,10,-5,-8} ;
Line Loop(13) = {4,12,-6,-10} ;

// Surfaces
Plane Surface(10) = {10} ;
Plane Surface(11) = {11} ;
Plane Surface(12) = {12} ;
Plane Surface(13) = {13} ;

//Physical properties (final physical surface):
Physical Surface(100) = {10,11,12,13} ;

//----------------------------------------------------------------------
---------------------------------------------------------------

On Mon, Oct 11, 2010 at 10:40 AM, Bart Vandewoestyne
<Bart.Vandewoestyne at telenet.be> wrote:

Hello list,

For an application I'm working on, we use gmsh as our mesher, we parse
the .msh
file and then run our solver in Matlab.  From the .msh file, we extract
the X
and Y coordinates of the nodes (from \$Nodes) in the mesh.  We also have
a
matrix representing the triangular elements in the mesh (extracted from
\$Elements).

We would like our users to be able to specify pointsources in our
computational
domain.  The location of the pointsource is an arbitrary point that a
user
specifies and has nothing to do with the mesh.  In gmsh, we currently
specify
it as follows:

----------------------- small example ------------------
lc = 0.6;

// Corner points.
Point(1) = {0, 0, 0, lc};
Point(2) = {0, 1, 0, lc};
Point(3) = {1, 1, 0, lc};
Point(4) = {1, 0, 0, lc};

// Point sources.
Point(5) = {0.6, 0.6, 0, lc};
Point(6) = {0.7, 0.7, 0, lc};

Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};

Line Loop(5) = {1, 2, 3, 4};
Plane Surface(6) = {5};

Physical Point("Pointsource") = {5, 6};
Physical Surface("My Surface") = {6};
----------------------- end small example ------------------

And now here is the problem: if I mesh this .geo file with

gmsh -2 pointsource_test.geo

then this is the result:

------------------ small example mesh ---------------------

\$MeshFormat
2.1 0 8
\$EndMeshFormat
\$PhysicalNames
2
0 1 "Pointsource"
2 2 "My Surface"
\$EndPhysicalNames
\$Nodes
7
1 0 0 0
2 0 1 0
3 1 1 0
4 1 0 0
5 0.6 0.6 0
6 0.7 0.7 0
7 0.5 0.5 0
\$EndNodes
\$Elements
6
1 15 3 1 5 0 5
2 15 3 1 6 0 6
3 2 3 2 6 0 1 7 4
4 2 3 2 6 0 3 7 2
5 2 3 2 6 0 7 3 4
6 2 3 2 6 0 7 1 2
\$EndElements

----------------------- end small example mesh ---------

The 'problem' is that the coordinates of the pointsource appear in the
list
of nodal coordinates.  This has two consequences:

1) Our solver cannot have the pointsource coordinates in its list of x
and y
coordinates.  It should only have the x and y coordinates of the
*real*
nodes in our mesh.

2) Using the tags in the \$Elements section, i can of course detect which
nodes are pointsources, and remove them from the \$Nodes section in my
Matlab parser, but removing nodes from the \$Nodes section also means
that
a lot of indices in the \$Elements section need to change!  For
example,
if I remove nodes 5 and 6, then every 7 in the \$Elements section has
to be
replaced by a 5 (because node 5 and 6 were removed, and node 7 has
become
node 5).

Is there a way to circumvent this troublesome bookkeeping?  Maybe
somehow
prevent gmsh from putting our pointsources in the list of nodes, and
returning
the coordinates of our pointsources in another section somehow? (I'm
just
guessing here...)

Kind regards,
Bart

--
"Share what you know.  Learn what you don't."

_______________________________________________
gmsh mailing list
gmsh at geuz.org
http://www.geuz.org/mailman/listinfo/gmsh

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20101013/f929d002/attachment.html>
```