<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3562" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=160244511-30072009><FONT face=Arial
color=#0000ff size=2>Hi Pierre</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=160244511-30072009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=160244511-30072009><FONT face=Arial
color=#0000ff size=2>Yes, you do need to smooth the elements after you've
snapped the nodes to interfaces. This is quite easy to do, you just regard the
lattice as a balls-and-springs network with the nodes as balls and the element
edges as springs of natural length that of the original cubic mesh. You then
relax according Newton's laws with friction. The nodes will move to the lowest
energy configuration. When relaxing, the nodes which have been snapped are
constrained to stay on the surface they were snapped to. This can be done using
the Lagrangian formulation with Lagrange multipliers for constraints. I would
not use the finite element solver to do this, just implement Newton's laws
directly on the particles.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=160244511-30072009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=160244511-30072009><FONT face=Arial
color=#0000ff size=2>The hardest part is, in my opinion, snapping the nodes to
interfaces. I think I could write the whole code quite easily but interfacing
into Gmsh (200,000 lines of c++) would be beyond me. One, not-so-elegant
solution would be for me to write my mesh algorithm as a "solver" in Gmsh. This
would read in the .geo file and output the .msh file.</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=160244511-30072009>John<SPAN class=748515411-30072009>
Blackburn </SPAN>.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><BR></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Pierre JUILLARD
[mailto:pierre.juillard@gmail.com] <BR><B>Sent:</B> 30 July 2009
06:15<BR><B>To:</B> John Blackburn<BR><B>Cc:</B>
gmsh@geuz.org<BR><B>Subject:</B> Re: [Gmsh] suggested new meshing algorithm in
Gmsh: hex gridding<BR></FONT><BR></DIV>
<DIV></DIV>Hi John,<BR><BR>Just out of curiosity:<BR>Don't you need to "smooth"
the elements close to the "snapped" boundary nodes?<BR>If yes, doesn't it mean
that you also need to reposition the nodes not only close to the interfaces, but
also those which are in the geometry?<BR>Finally, isn't this algorithm like a
morphing algorithm?<BR><BR>I actually sent a mail to the mailing list to know
what are GMSH' capabilities regarding morphing, but there were not much answer.
<BR><BR>Regarding this smoothing function, it would make use of the GMSH finite
element solver part, and deal with the existing mesh, make it deformed linearly
with a given E modulus to make it fit a new shape.<BR>You would then have all
the nodes positioned accordingly their distance from the originally "snapped"
nodes.<BR><BR>Regards,<BR><BR>Pierre<BR><BR><BR><BR>
<DIV class=gmail_quote>2009/7/29 John Blackburn <SPAN dir=ltr><<A
href="mailto:John.Blackburn@npl.co.uk">John.Blackburn@npl.co.uk</A>></SPAN><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV><FONT face=Arial size=2><SPAN>Dear Sir,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN>I have recently been trying out Gmsh and am
most impressed with its capabilities. I am writing an FE code of my own which
uses hexahedrons. I've noticed that, while Gmsh does generate hex's this is
quite a painful process and involves splitting the geometry into many more
parts than would be the case for tets. Hex meshes can only be generated for
transfinite volumes or ones which can be made from extrusions. I would like to
suggest another method to generate (structured) hex meshes which is to have a
"logical mesh", which is just a cubic grid of nodes, and then "snap" the nodes
onto nearby interface points. You then end up with a mesh with the same
topology as the original but distored to fit the required shapes.
</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN>I would like to add this functionality to
Gmsh as I think it would greatly improve the program. However, I am mainly a
Fortran programmer. I can code in C with some difficulty but full OO C++ is
beyond me! I was wondering, if I send you a detailed write up of the algorithm
I have in mind (with all the maths/geometry written out explicitly), could you
code it in for me? I suspect this simple algorithm would be easy to implement
given Gmsh's existing capablities. Basically two things are
needed:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN>* a function to decide whether an
arbitrary point (x,y,z) is inside a given volume (defined, as usual by plane
or ruled surfaces themselves defeined by curves: just the way Gmsh works now).
I'm sure Gmsh already has a function like this?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN>* a funciton to "snap" a point to the
nearest point on the volume surface. Note that only points at the interface
between two regions are candidates for snapping.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN>I've written a little program to implement
this algorithm as I see (in 2-D for the moment but 3-D would not be much more
difficult). The program outputs a .MSH file which I've plotted using Gmsh and
attached. Notice how the algorithm involves INSERTING shapes into each other:
the orange square was defined first, then the green circle, blue circle, and
finally, yellow polygon. This is very different from Gmsh's current approach
but its a very powerful technique.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN>I also intend to write a final "relaxation"
part to the meshing so the unecessarily distorted nodes in the blue circle
would return to their original positions.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN>What do you think about incorporating this
functionality? Basically, the user would do everything he normally does to
prepare the GEO file. Then there would be an extra button on the Mesh menu,
"Grid" for example.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN>Best Regards,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN>John Blackburn</SPAN></FONT></DIV><BR><PRE>-------------------------------------------------------------------
This e-mail and any attachments may contain confidential and/or
privileged material; it is for the intended addressee(s) only.
If you are not a named addressee, you must not use, retain or
disclose such information.
NPL Management Ltd cannot guarantee that the e-mail or any
attachments are free from viruses.
NPL Management Ltd. Registered in England and Wales. No: 2937881
Registered Office: Serco House, 16 Bartley Wood Business Park,
Hook, Hampshire, United Kingdom RG27 9UY
-------------------------------------------------------------------
</PRE><BR></DIV><BR>_______________________________________________<BR>gmsh
mailing list<BR><A href="mailto:gmsh@geuz.org">gmsh@geuz.org</A><BR><A
href="http://www.geuz.org/mailman/listinfo/gmsh"
target=_blank>http://www.geuz.org/mailman/listinfo/gmsh</A><BR><BR></BLOCKQUOTE></DIV><BR>
<br><pre>
-------------------------------------------------------------------
This e-mail and any attachments may contain confidential and/or
privileged material; it is for the intended addressee(s) only.
If you are not a named addressee, you must not use, retain or
disclose such information.
NPL Management Ltd cannot guarantee that the e-mail or any
attachments are free from viruses.
NPL Management Ltd. Registered in England and Wales. No: 2937881
Registered Office: Serco House, 16 Bartley Wood Business Park,
Hook, Hampshire, United Kingdom RG27 9UY
-------------------------------------------------------------------
</pre>
<br></BODY></HTML>