[Gmsh] Gmsh: 3D Volume with a hole (not through-going)

Omid Mahabadi omid.mahabadi at geomechanica.com
Thu Sep 4 22:06:55 CEST 2014


Thank you, Errol. I also tried creating the geometry in BricsCAD and 
their exported iges file was fine. I guess the issue was with FreeCAD 
that I had initially used.

Anyhow, if anybody is interested, attached is the "manual" definition of 
this geometry with a non-through-going hole. As you can see, it's a lot 
of work to get the geometry right!

Down the road, it may be a useful feature to be able to do some basic 3D 
solid editing, such as union, subtract, etc.

Cheers,
Omid


On 14-09-04 02:06 PM, erroll.brady at gmail.com wrote:
> Hi Omid,
> Solidworks found errors when trying to import your original iges file; 
> it did not fix the file. The recent object was newly created in 
> Solidworks and exported to a STEP file. The STEP file was loaded into 
> Gmsh where it was 3D-meshed and saved as a mesh and exported  as a GEO 
> file.
> Erroll
>
> On Wednesday, September 3, 2014 11:31:25 AM UTC-7, Omid Mahabadi wrote:
>
>     Hi Errol,
>     This is exactly what I wanted. Did Solidworks automatically find
>     and correct the errors? Do you have any other suggestions for
>     modifying the iges files?
>
>     Thanks,
>     Omid
>
>     On 14-09-03 01:03 PM, erroll... at gmail.com <javascript:> wrote:
>>     Hi Omid,
>>     Try the attached Block2.zip.
>>
>>     Erroll
>>
>>     <https://lh5.googleusercontent.com/-EkE2FS91LsI/VAdJvqh3QUI/AAAAAAAAAAw/pfpGUvqDVdQ/s1600/Block2.jpg>
>>
>>
>>
>>     On Tuesday, September 2, 2014 9:39:45 PM UTC-7, Omid Mahabadi wrote:
>>
>>         Hi Errol,
>>         In the version you sent me, the hole is through-going, in
>>         other words, it goes through the entire depth of the cube
>>         (along z). However, my desired geometry requires a hole that
>>         doesn't go through the entire depth (say it has half of the
>>         depth of the exterior cube).
>>
>>         Thank you,
>>         Omid
>>
>>
>>         On 14-09-02 06:04 PM, erroll... at gmail.com wrote:
>>>         Hello Omid,
>>>         Solidworks found errors in your IGES file. Try the attached
>>>         STEP, GEO and MSH files.
>>>
>>>         <https://lh4.googleusercontent.com/-nxF0eT1U3qQ/VAY-5mA30KI/AAAAAAAAAAg/aQ6Sqk53Fp8/s1600/Block%2BMesh.jpg>
>>>
>>>
>>>         Erroll
>>>
>>>         On Tuesday, September 2, 2014 1:28:00 PM UTC-7, Omid
>>>         Mahabadi wrote:
>>>
>>>             Hi Oliver,
>>>             Thanks for your response. I had also tried the variation
>>>             that you sent me. The issue is that I don't want to have
>>>             the flat surface that is interfacing the two volumes.
>>>             I'd like the mesh to be continuous across that interface.
>>>
>>>             Also, when following your suggestion, I still cannot get
>>>             the same exact mesh as you did. Please see the attached
>>>             screenshot.
>>>
>>>             Is there any other thoughts on how to get the results
>>>             I'm aiming for?
>>>
>>>             Thank you,
>>>             Omid
>>>
>>>             On 14-08-28 06:34 PM, Oliver Willekens wrote:
>>>>
>>>>             You could delete the volume of the cylinder you’ve
>>>>             created by means of extrusion and then delete one of
>>>>             the cylinder’s flat surfaces using the |Delete|
>>>>             command. However, it won’t give you what you want,
>>>>             because the box “holding the cylinder” will be unaware
>>>>             of the presence of the cylindrical hole.
>>>>
>>>>             I tried this:
>>>>
>>>>             |Plane Surface(1) = {1, 2};  // square minus the circle
>>>>             out1[] = Extrude {0.0, 76.2, 0.0}{Surface{1};};
>>>>             Plane Surface(2) = {1};
>>>>             out2[] = Extrude {0.0, -76.2, 0.0} {Surface{2};};
>>>>             |
>>>>
>>>>             Which results in the 2D mesh you find in the
>>>>             attachment. Perhaps this is what you’re looking for?
>>>>
>>>>             I also tried combining those two volumes using
>>>>             |Compound Volume(4) = {out1[1], out2[1]};|, but like
>>>>             you, I got GRegion Compound errors. Probably some basic
>>>>             restriction from triangulations I’m overlooking. This
>>>>             only means your 3D meshes will be clearly stopped at a
>>>>             flat interface about half-way through those two boxes,
>>>>             but you’ll still have a 3D mesh. I was hoping that the
>>>>             Compound Volume would make some tetras across this
>>>>             boundary though… But with the above lines, you’ll have
>>>>             a working mesh.
>>>>
>>>>>>>>
>>>>
>>>>             2014-08-28 17:08 GMT+02:00 Omid Mahabadi
>>>>             <omid.m... at geomechanica.com>:
>>>>
>>>>                 Hi Christophe and Gmsh team,
>>>>                 I've been trying to model a simple cube with a
>>>>                 cylindrical hole that is NOT through-going (i.e.,
>>>>                 its depth is smaller than the depth of the cube),
>>>>                 as shown in the attached picture. The Extrude
>>>>                 command doesn't seem to work since it will extrude
>>>>                 both surfaces (exterior and interior -- hole) at
>>>>                 the same time. I know I can define all the
>>>>                 surfaces, surface loops, and volumes manually, but
>>>>                 is there a better way of defining something like
>>>>                 this in Gmsh?
>>>>
>>>>                 I also tried to use the Compound Volume command by
>>>>                 first defining two volumes from Extrude and then
>>>>                 trying to combine them but I'm getting errors for
>>>>                 the Compound Volume visualization (Error: Cannot
>>>>                 evaluate bounds on GRegion Compound) and when I
>>>>                 mesh the geometry, the actual shared interfaces are
>>>>                 still existing, although by the notion of compound
>>>>                 from the documentation, the internal interfaces
>>>>                 should be neglected. Here is the geometry file:
>>>>
>>>>                     // Characteristic length (==> element size)
>>>>                     cl_external   = 25;
>>>>                     cl_excavation = 5;
>>>>
>>>>                     // External boundaries
>>>>                     Point(1)      = {-127, 0.0, -127, cl_external};
>>>>                     Point(2)      = {+127, 0.0, -127, cl_external};
>>>>                     Point(3)      = {+127, 0.0, +127, cl_external};
>>>>                     Point(4)      = {-127, 0.0, +127, cl_external};
>>>>                     Line(1)       = {1, 2};
>>>>                     Line(2)       = {2, 3};
>>>>                     Line(3)       = {3, 4};
>>>>                     Line(4)       = {4, 1};
>>>>                     Line Loop(1)  = {1, 2, 3, 4};
>>>>
>>>>                     // Excavation boundaries
>>>>                     Point(5)      = {0.0, 0.0, 0.0, cl_excavation};
>>>>                     Point(6)      = {19.05, 0.0, 0.0, cl_excavation};
>>>>                     Point(7)      = {0.0, 0.0, 19.05, cl_excavation};
>>>>                     Point(8)      = {-19.05, 0.0, 0.0, cl_excavation};
>>>>                     Point(9)      = {0.0, 0.0, -19.05, cl_excavation};
>>>>                     Circle(5)     = {6, 5, 7};
>>>>                     Circle(6)     = {7, 5, 8};
>>>>                     Circle(7)     = {8, 5, 9};
>>>>                     Circle(8)     = {9, 5, 6};
>>>>                     Line Loop(2)  = {5, 6, 7, 8};
>>>>
>>>>                     //Using compound volumes
>>>>                     Plane Surface(1) = {1};
>>>>                     out1[] = Extrude {0.0, 76.2, 0.0}{Surface{1};};
>>>>
>>>>                     Plane Surface(2) = {1};
>>>>                     out2[] = Extrude {0.0, -76.2, 0.0}{Surface{2};};
>>>>
>>>>                     Compound Volume(3) = {1, 2};
>>>>
>>>>
>>>>                 I also tried to create the geometry in CAD software
>>>>                 and imported it as iges, brep or step formats but
>>>>                 for reason the hole is not there completely. See
>>>>                 for instances the iges file attached.
>>>>
>>>>                 Can you kindly shed some light here? Am I doing
>>>>                 something wrong? Or are there Gmsh tricks/commands
>>>>                 that I can use to achieve my goal?
>>>>
>>>>                 Thank you,
>>>>                 Omid
>>>>
>>>>                 -- 
>>>>                 Omid Mahabadi, Ph.D.
>>>>                 Geomechanica, Inc.
>>>>                 http://www.geomechanica.com/
>>>>                 Tel :+1-647-478-9767
>>>>                 Cell:+1-416-824-2408
>>>>
>>>>
>>>>                 _______________________________________________
>>>>                 gmsh mailing list
>>>>                 gm... at geuz.org
>>>>                 http://www.geuz.org/mailman/listinfo/gmsh
>>>>                 <http://www.geuz.org/mailman/listinfo/gmsh>
>>>>
>>>>
>>>>
>>>>
>>>>             -- 
>>>>             Oliver Willekens
>>>>             PhD Student
>>>>             LCP group logo <https://lcp.elis.ugent.be/>
>>>>
>>>>             Liquid Crystals & Photonics Group
>>>>             Sint- Pietersnieuwstraat 41
>>>>             9000 Gent
>>>>             Phone: +32 9 264.89.51
>>>>
>>>
>>>             -- 
>>>             Omid Mahabadi, Ph.D.
>>>             Geomechanica, Inc.
>>>             http://www.geomechanica.com/
>>>             Tel : +1-647-478-9767
>>>             Cell: +1-416-824-2408
>>>
>>
>>         -- 
>>         Omid Mahabadi, Ph.D.
>>         Geomechanica, Inc.
>>         http://www.geomechanica.com/
>>         Tel : +1-647-478-9767
>>         Cell: +1-416-824-2408
>>
>
>     -- 
>     Omid Mahabadi, Ph.D.
>     Geomechanica, Inc.
>     http://www.geomechanica.com/
>     Tel : +1-647-478-9767
>     Cell: +1-416-824-2408
>

-- 
Omid Mahabadi, Ph.D.
Geomechanica, Inc.
http://www.geomechanica.com/
Tel : +1-647-478-9767
Cell: +1-416-824-2408

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20140904/4572b875/attachment.html>
-------------- next part --------------
// Characteristic length (==> element size)
cl_external   = 25;
cl_excavation = 5;

a = 127;
// External boundaries -- Cube
pe1 = newp; Point(pe1)      = {-a, 0, -a, cl_external};
pe2 = newp; Point(pe2)      = {+a, 0, -a, cl_external};
pe3 = newp; Point(pe3)      = {+a, 0, +a, cl_external};
pe4 = newp; Point(pe4)      = {-a, 0, +a, cl_external};
le1 = newreg; Line(le1)       = {pe1, pe2};
le2 = newreg; Line(le2)       = {pe2, pe3};
le3 = newreg; Line(le3)       = {pe3, pe4};
le4 = newreg; Line(le4)       = {pe4, pe1};
//lle1 = newreg; Line Loop(lle1)  = {le1, le2, le3, le4};

ext_points[] = Translate {0, -a*2, 0} { Duplicata{ Point{pe1, pe2, pe3, pe4}; } };

le5 = newreg; Line(le5) = {ext_points[0], ext_points[1]};
le6 = newreg; Line(le6) = {ext_points[1], ext_points[2]};
le7 = newreg; Line(le7) = {ext_points[2], ext_points[3]};
le8 = newreg; Line(le8) = {ext_points[3], ext_points[0]};

le9 = newreg; Line(le9) = {ext_points[0], pe1};
le10 = newreg; Line(le10) = {ext_points[1], pe2};
le11 = newreg; Line(le11) = {ext_points[2], pe3};
le12 = newreg; Line(le12) = {ext_points[3], pe4};

lle2 = newreg; Line Loop(lle2) = {le5, le6, le7, le8};
lle3 = newreg; Line Loop(lle3) = {le6, le11, -le2, -le10};
lle4 = newreg; Line Loop(lle4) = {-le7, le11, le3, -le12};
lle5 = newreg; Line Loop(lle5) = {-le8, le12, le4, -le9};
lle6 = newreg; Line Loop(lle6) = {le5, le10, -le1, -le9};

//sce1 = newreg; Plane Surface(sce1) = {lle1};
sce2 = newreg; Plane Surface(sce2) = {lle2};
sce3 = newreg; Plane Surface(sce3) = {lle3};
sce4 = newreg; Plane Surface(sce4) = {lle4};
sce5 = newreg; Plane Surface(sce5) = {lle5};
sce6 = newreg; Plane Surface(sce6) = {lle6};



// Cylinder boundaries
r = 19.05;
d = 38.1;
pc1 = newp; Point(pc1) = {0, 0, 0, cl_excavation};
pc2 = newp; Point(pc2) = {r, 0, 0, cl_excavation};
pc3 = newp; Point(pc3) = {0, 0, -r, cl_excavation};
pc4 = newp; Point(pc4) = {-r, 0, 0, cl_excavation};
pc5 = newp; Point(pc5) = {0, 0, r, cl_excavation};
c1 = newreg; Circle(c1) = {pc2, pc1, pc3};
c2 = newreg; Circle(c2) = {pc3, pc1, pc4};
c3 = newreg; Circle(c3) = {pc4, pc1, pc5};
c4 = newreg; Circle(c4) = {pc5, pc1, pc2};
//ll1 = newreg; Line Loop(ll1)  = {c1, c2, c3, c4};

new_points[] = Translate {0, -d, 0} { Duplicata{ Point{pc1, pc2, pc3, pc4, pc5}; } };

//Printf("New points '%g', '%g','%g','%g','%g',", new_points[0], new_points[1], new_points[2], new_points[3], new_points[4]);

c5 = newreg; Circle(c5) = {new_points[1], new_points[0], new_points[2]};
c6 = newreg; Circle(c6) = {new_points[2], new_points[0], new_points[3]};
c7 = newreg; Circle(c7) = {new_points[3], new_points[0], new_points[4]};
c8 = newreg; Circle(c8) = {new_points[4], new_points[0], new_points[1]};
ll2 = newreg; Line Loop(ll2)  = {c5, c6, c7, c8};

lc1 = newl; Line(lc1) = {new_points[1], pc2};
lc2 = newl; Line(lc2) = {new_points[2], pc3};
lc3 = newl; Line(lc3) = {new_points[3], pc4};
lc4 = newl; Line(lc4) = {new_points[4], pc5};

// Cylinder sides
ll3 = newreg; Line Loop(ll3) = {-c2, -lc2, c6, lc3};
ll4 = newreg; Line Loop(ll4) = {-c3, -lc3, c7, lc4};
ll5 = newreg; Line Loop(ll5) = {-c4, -lc4, c8, lc1};
ll6 = newreg; Line Loop(ll6) = {-c1, -lc1, c5, lc2};

//Top line loop containing the hole
lle1 = newreg; Line Loop(lle1) = {le1, le2, le3, le4, c1, c2, c3, c4};

//Define all remaining surfaces
sce1 = newreg; Plane Surface(sce1) = {lle1};
sc2 = newreg; Plane Surface(sc2) = {ll2};
sc3 = newreg; Ruled Surface(sc3) = {ll3};
sc4 = newreg; Ruled Surface(sc4) = {ll4};
sc5 = newreg; Ruled Surface(sc5) = {ll5};
sc6 = newreg; Ruled Surface(sc6) = {ll6};


//Define surface loop and volume
sl1 = newreg; Surface Loop(sl1) = {sce1, sce3, sce4, sce5, sce6, sce2, sc3, sc4, sc5, sc6, sc2};
vol1 = newreg; Volume(vol1) = {sl1};


//Plane Surface(1) = {1};
//Plane Surface(2) = {2};
//
//// Extrude to create the volumes
//out1[] = Extrude {0.0, 254, 0.0}{Surface{1};};
//out2[] = Extrude {0.0, 76.2, 0.0}{Surface{2};};
//
//Printf("top = %g", out2[0]);
//Printf("surface2 = %g", out2[1]);
//Printf("sides = %g, %g, %g, %g", out2[2], out2[3], out2[4], out2[5] );
//
//Printf("top1 = %g", out1[0]);
//Printf("surface1 = %g", out1[1]);
//Printf("sides1 = %g, %g, %g, %g", out1[2], out1[3], out1[4], out1[5]);
//
//Delete {
//  Volume{2, 1};
//}
//
//Surface Loop(1) = {30, 17, 21, 25, 29, 1};
//Surface Loop(2) = {52, 39, 43, 47, 51, 2};
//
//Volume(3) = {1, 2};

// Define Physical entities
//Physical Volume(1) = {1};
//Physical Surface("front_n_back__xz") = {out[0], out[1]};
//Physical Surface("top_n_bottom__xy") = {out[2],out[4]}; 
//Physical Surface("sides__yz") = {out[3], out[5]}; 
//Physical Surface("excavation_faces") = {out[6], out[7], out[8], out[9]}; 




// Save Abaqus Node Sets (NSETs)
Mesh.SaveGroupsOfNodes = 1;

// Mesh smoothing
Mesh.Smoothing = 10;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: indiana_block_manual.msh
Type: model/mesh
Size: 667420 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20140904/4572b875/attachment.msh>