[Gmsh] Removing a volume from an ambient volume

Travis Thompson travis.brandon at gmail.com
Wed Oct 29 20:52:59 CET 2008

```Dave and Christophe (and gmsh list readers)

I have modified my geometry and removed the coplanar pieces;
Everything worked.

If there is another way to accomplish the results that are in the file
i have attached I would very much like to know as it would allow me to
not modify my geometry creation code (there is another object in the
box whose output is suppressed which I also do not want to mesh the
interior of and is more complicated)

I have attached the file for future reference and perusal.

If there is no other way to accomplish this task that you gentleman
can think of then i would consider this a closed case :)

Thanks dave for the tip about the coplanar piece, it ended up pointing
out to me my misunderstanding of how the volume elements were working.
Thanks to you too Christophe for taking the time to answer my
inquiries and for coding up such a great generator.

-Travis

On Wed, Oct 29, 2008 at 2:32 PM, Travis Thompson
<travis.brandon at gmail.com> wrote:
> Christophe,
>
>
> You are correct; the two surfaces do indeed overlap.  In the file you
> sent me with the two volumes I get a 3d grid inside the box and one
> inside the Interior object.
>
> However the end goal is that I am seeking is  to mesh the complement
> of the interior object in the surrounding box.  Dave suggested to me
> that I make the top plane the 'hold' in the interior object
> (henceforth to be called: Obj A) since it was coplanar with the
> bounding box.
>
> I went through my code that generates the geometry and found that the
> top plane has surface number 11.  I then edited the .geo file
> (attached) by hand and modified the last 3 lines to read:
>
> Surface Loop(29) = {5, 4, 3, 6, 1, 2};
> Surface Loop(30) = {11};
> Volume(31) = {29, 30};
>
>
> The first surface loop is the loop for the bounding box.  The second
> surface loop denotes the surfaces to be deleted and is a 1 element
> loop (which may possibly not be allowed)  Then the idea was that the
> last line implements the bounding box with the coplanar portion
> declared as 'the hole'.
>
> This was implicitly suggested by Dave in his last email to me.
> However the .geo file seems to crash gmsh when i run it in Tet +
> Delaunay and it complains about overlaps when i run it with Netgen.
>
> Any other ideas?  I suppose i could manually add a 'Hole' in the top
> box by splitting it into 6 quadrilaterals that meet at the vertices of
> the plane I am trying to remove if all else fails?
>
> I hope that was clear; I do appreciate all of your time and effort.
>
> -Travis
>
>
>
> On Wed, Oct 29, 2008 at 1:23 PM, Christophe Geuzaine
> <cgeuzaine at ulg.ac.be> wrote:
>> Travis Thompson wrote:
>>>
>>> Dave,
>>>
>>> I certainly will.  I checked the options for the 3d algorithm; they
>>> have been set to Tetgen + Delauney, so this has been the one that was
>>> crashing all along.  I tried changing it to Netgen for grins - Gmsh
>>> did not crash but the message console complained with about 200 lines
>>> of:
>>> "Info    : WARNING:  Intersecting elements<Number> and <Number>"
>>>
>>> The files that are attached:
>>>
>>> plainGeom.geo : The naked geometry
>>>
>>> GeomWithVolumeElement.geo:  The geometry where the ambient box has
>>> been selected as the 'volume' and the interior object has been
>>> selected as the 'hole'
>>
>> Surfaces 3 and 11 overlap in your model. So there should in fact be no hole
>> in your volume, but 2 separate volumes: see attached file.
>>
>>>
>>>
>>> Note: it is a bit difficult to see that the interior object is closed
>>> as the top surface of the interior object is coplanar with the
>>> bounding box.. but if you click around you can see that the top plane
>>> 'closing off' the interior object is indeed there :)
>>>
>>>
>>> -Travis Thompson
>>> Dept. of Mathematics, Texas A&M University
>>>
>>>
>>> On Wed, Oct 29, 2008 at 8:37 AM, David Colignon
>>> <David.Colignon at ulg.ac.be> wrote:
>>>>
>>>> Hi Travis,
>>>>
>>>> solution a) should have worked. Can you send us your .geo file to check ?
>>>> And can you try with with the Tetgen 3D meshing algorithm instead of
>>>> netgen
>>>> ?
>>>>
>>>> Cheers,
>>>>
>>>> Dave
>>>>
>>>> --
>>>> David Colignon, Ph.D.
>>>> Collaborateur Logistique du F.R.S.-FNRS
>>>> CÉCI - Consortium des Équipements de Calcul Intensif
>>>> ACE - Applied & Computational Electromagnetics
>>>> Sart-Tilman B28
>>>> Université de Liège
>>>> 4000 Liège - BELGIQUE
>>>> Tél: +32 (0)4 366 37 32
>>>> Fax: +32 (0)4 366 29 10
>>>> WWW:    http://hpc.montefiore.ulg.ac.be/
>>>> Agenda:
>>>>
>>>>
>>>>
>>>> Travis Thompson wrote:
>>>>>
>>>>> Hello.  I have been working with Gmsh for a finite elements project at
>>>>> Texas A&M university in college station, tx.
>>>>>
>>>>> I am new to Gmsh and have been stuck on a particular problem for a
>>>>> while now; I was hoping maybe someone could shed some light on it.
>>>>> The setup is fairly simple.  I have a 3 dimensional rectangle which
>>>>> completely contains another 3 dimensional object.
>>>>>
>>>>> The object inside the box is completely closed; i will refer to this
>>>>> object as Object A.  If I attach a volume element to object A and mesh
>>>>> the box + object A everything works wonderfully.  I get a nice 2d mesh
>>>>> on the bounding box and a nice 3d mesh inside object A.
>>>>>
>>>>> The problem is that I need a 3d mesh inside the bounding box and i
>>>>> want *no mesh* in the interior of object A (that is, I want to mesh
>>>>> the complement of Object A with respect to the bounding box).
>>>>>
>>>>> What I have tried:
>>>>> a) I have tried attaching a volume element to the ambient bounding box
>>>>> and selecting Object A as 'a hole'
>>>>> b) I have tried attaching a volume element to the bounding box and a
>>>>> volume element to Object A with the intention of Deleting the volume
>>>>> element attached to object A *after* computing the mesh.
>>>>>
>>>>> However both (a) and (b) lead to gmsh crashing (same error on both
>>>>> windows and Linux versions)
>>>>> The error is:
>>>>>
>>>>> ----------------------------
>>>>> Assertion Failed!
>>>>>
>>>>> Program: c:\program files\gmsh-2.2.4-Windows\gmsh.exe
>>>>> File: tetgen.cxx
>>>>> Line: 22506
>>>>>
>>>>> Expression: matchflag == true
>>>>> ---------------------------
>>>>>
>>>>> I would imagine that what I am trying to do is quite basic; ie:
>>>>> meshing the complement of an object inside an ambient object.  I have
>>>>> been through the documentation but due to my lack of familiarity with
>>>>> Gmsh I have failed to figure out a method.
>>>>>
>>>>> If anyone can shed any light on this I would greatly appreciate it!
>>>>>
>>>>>
>>>>> -Travis Thompson
>>>>> Dept of Mathematics, Texas A&M University
>>>>>
>>>>> _______________________________________________
>>>>> gmsh mailing list
>>>>> gmsh at geuz.org
>>>>> http://www.geuz.org/mailman/listinfo/gmsh
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> gmsh mailing list
>>>> gmsh at geuz.org
>>>> http://www.geuz.org/mailman/listinfo/gmsh
>>
>>
>> --
>> Prof. Christophe Geuzaine
>> University of Liege, Electrical Engineering and Computer Science
>> http://www.montefiore.ulg.ac.be/~geuzaine
>>
>> Point(1) = {-20, 20, 0, 1};
>> Point(2) = {20, 20, 0, 1};
>> Point(3) = {20, -20, 0, 1};
>> Point(4) = {-20, -20, 0, 1};
>> Point(5) = {-20, 20, 10, 1};
>> Point(6) = {20, 20, 10, 1};
>> Point(7) = {20, -20, 10, 1};
>> Point(8) = {-20, -20, 10, 1};
>> Point(9) = {10, 10, 10, 1};
>> Point(10) = {-10, 10, 10, 1};
>> Point(11) = {10, -10, 10, 1};
>> Point(12) = {-10, -10, 10, 1};
>> Point(13) = {3, 3, 5.5, 1};
>> Point(14) = {-4.071067812, 3, 5.5, 1};
>> Point(15) = {3, -4.071067812, 5.5, 1};
>> Point(16) = {-4.071067812, -4.071067812, 5.5, 1};
>> Point(17) = {-0.535533906, -0.535533906, 5.5, 1};
>> Point(18) = {-0.535533906, -0.535533906, 0.5, 1};
>> Line(1) = {1, 2};
>> Line(2) = {2, 3};
>> Line(3) = {3, 4};
>> Line(4) = {4, 1};
>> Line(5) = {2, 6};
>> Line(6) = {6, 5};
>> Line(7) = {5, 1};
>> Line(8) = {7, 6};
>> Line(9) = {5, 8};
>> Line(10) = {8, 7};
>> Line(11) = {7, 3};
>> Line(12) = {4, 8};
>> Line(13) = {9, 10};
>> Line(14) = {10, 12};
>> Line(15) = {12, 11};
>> Line(16) = {11, 9};
>> Line(17) = {13, 14};
>> Line(18) = {14, 16};
>> Line(19) = {16, 15};
>> Line(20) = {15, 13};
>> Line(21) = {13, 9};
>> Line(22) = {14, 10};
>> Line(23) = {16, 12};
>> Line(24) = {15, 11};
>> Circle(25) = {15, 17, 18};
>> Circle(26) = {18, 17, 14};
>> Circle(27) = {16, 17, 18};
>> Circle(28) = {18, 17, 13};
>> Line Loop(1) = {1, 2, 3, 4};
>> Plane Surface(1) = {1};
>> Line Loop(2) = {1, 5, 6, 7};
>> Plane Surface(2) = {2};
>> Line Loop(3) = {8, 6, 9, 10};
>> Plane Surface(3) = {3};
>> Line Loop(4) = {10, 11, 3, 12};
>> Plane Surface(4) = {4};
>> Line Loop(5) = {12, -9, 7, -4};
>> Plane Surface(5) = {5};
>> Line Loop(6) = {11, -2, 5, -8};
>> Plane Surface(6) = {6};
>> Line Loop(7) = {-21, 17, 22, -13};
>> Plane Surface(7) = {7};
>> Line Loop(8) = {22, 14, -23, -18};
>> Plane Surface(8) = {8};
>> Line Loop(9) = {23, 15, -24, -19};
>> Plane Surface(9) = {9};
>> Line Loop(10) = {24, 16, -21, -20};
>> Plane Surface(10) = {10};
>> Line Loop(11) = {13, 14, 15, 16};
>> Plane Surface(11) = {11};
>> Line Loop(12) = {25, -27, 19};
>> Ruled Surface(12) = {12};
>> Line Loop(13) = {25, 28, -20};
>> Ruled Surface(13) = {13};
>> Line Loop(14) = {28, 17, -26};
>> Ruled Surface(14) = {14};
>> Line Loop(15) = {26, 18, 27};
>> Ruled Surface(15) = {15};
>> Delete {
>>  Surface{3};
>> }
>> Plane Surface(29) = {3, 11};
>> Surface Loop(30) = {1, 2, 6, 4, 29, 5, 8, 7, 10, 9, 12, 13, 14, 15};
>> Volume(31) = {30};
>> Surface Loop(32) = {11, 9, 8, 7, 10, 13, 12, 15, 14};
>> Volume(33) = {32};
>>
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: noInterior.geo
Type: application/octet-stream
Size: 2370 bytes
Desc: not available
Url : http://www.geuz.org/pipermail/gmsh/attachments/20081029/14aa7545/attachment-0001.geo
```