[Gmsh] Stuck in infinite loop on BooleanDifference?

Christophe Geuzaine geuzaine at gmail.com
Sat Apr 7 12:31:08 CEST 2018



> On 3 Apr 2018, at 23:22, Gavin Ridley <gavin.keith.ridley at gmail.com> wrote:
> 
> Hi gmsh community,
> 
> I'm trying to make a multi-region mesh that consists of a few concentric spheres, plus what are pipes leading into one of the spheres. This is intended to eventually be a coolant channel. Around some fuel for a space reactor design.
> 
> The CSG functionality is great for this, but seems to get caught in an infinite loop after reading the last line of this input:
> 
> ////////////////////////////
> SetFactory("OpenCASCADE");
> 
> // Dimensions from core optimization
> rfuel = .0505;
> rvess = .0555;
> rcool  = .06135;
> rsteel = .06635;
> rrefl = .19705;
> 
> // These pipes could have their radii varied to get different effects
> rpipetop = 5.229/2.0; 
> rpipebot = 5.229/2.0; 
> pipeWallThick = 0.005;
> 
> // z coordinates of bottom of cylinder to make it match with spherical vessel
> hcyltop = Sqrt(rcool*rcool-rpipetop*rpipetop);

This returns NAN, as rcool*rcool-rpipetop*rpipetop is negative...

Christophe




> hcylbot = Sqrt(rcool*rcool-rpipebot*rpipebot);
> 
> // Length of pipe at top and bottom to capture any recirculations
> topdevelopLength = .03;
> botdevelopLength= .03;
> 
> // "jawbreaker"
> Sphere(1) = {0.0, 0.0, 0.0, rfuel};
> p() = PointsOf{ Volume{1}; };
> Characteristic Length{p()} = rfuel/4.0;
> Physical Volume("fuel") = {1};
> 
> // vessel
> Sphere(2) = {0.0, 0.0, 0.0, rvess};
> BooleanDifference(3) = {Volume{2}; Delete;}{Volume{1};};
> p() = PointsOf{ Volume{3}; };
> Characteristic Length{p()} = (rvess-rfuel)/2.0;
> Physical Volume("tantaloy") = {3};
> 
> // sodium
> Sphere(4) = {0.0, 0.0, 0.0, rcool};
> BooleanDifference(5) = {Volume{4};}{Volume{3,1};};
> Cylinder(6) = {0.0, 0.0, hcyltop, 0.0, 0.0, hcyltop+topdevelopLength, rpipetop};
> BooleanDifference(7) = {Volume{6}; Delete;}{Volume{4}; Delete;};
> //////////////////////////////////////////
> 
> I'm trying to cut a sphere out of the bottom of a cylinder for that (7) entity. If it helps the developers at all, here's what the stack looks like in the infinite loop.
> 
> #0  0x00007fffefdbb8c4 in __memset_avx2_unaligned_erms () from /usr/lib/libc.so.6
> #1  0x00007fffefce711b in calloc () from /usr/lib/libc.so.6
> #2  0x00007ffff120ad31 in Standard_MMgrRaw::Allocate(unsigned long) ()
>    from /opt/opencascade/lib/libTKernel.so.0
> #3  0x00007ffff257ace7 in TopExp_Explorer::TopExp_Explorer() ()
>    from /opt/opencascade/lib/libTKBRep.so.0
> #4  0x00007ffff2f47c2c in BRepClass3d_SolidExplorer::FindAPointInTheFace(TopoDS_Face const&, gp_Pnt&, double&, double&, double&, gp_Vec&, gp_Vec&) ()
>    from /opt/opencascade/lib/libTKTopAlgo.so.0
> #5  0x00007ffff2f48cd6 in BRepClass3d_SolidExplorer::PointInTheFace(TopoDS_Face const&, gp_Pnt&, double&, double&, double&, int&, Handle_BRepAdaptor_HSurface const&, double, double, double, double, gp_Vec&, gp_Vec&) const () from /opt/opencascade/lib/libTKTopAlgo.so.0
> #6  0x00007ffff2f49a3f in BRepClass3d_SolidExplorer::OtherSegment(gp_Pnt const&, gp_Lin&, double&) () from /opt/opencascade/lib/libTKTopAlgo.so.0
> #7  0x00007ffff2f45dbf in BRepClass3d_SClassifier::Perform(BRepClass3d_SolidExplorer&, gp_Pnt const&, double) () from /opt/opencascade/lib/libTKTopAlgo.so.0
> #8  0x00007ffff353b77c in void OSD_Parallel::For<BOPCol_ContextFunctor<BOPAlgo_VertexSolid, BOPCol_NCVector<BOPAlgo_VertexSolid>, Handle_IntTools_Context, IntTools_Context> >(int, int, BOPCol_ContextFunctor<BOPAlgo_VertexSolid, BOPCol_NCVector<BOPAlgo_VertexSolid>, Handle_IntTools_Context, IntTools_Context> const&, unsigned int) () from /opt/opencascade/lib/libTKBO.so.0
> #9  0x00007ffff3539d07 in BOPAlgo_PaveFiller::PerformVZ() ()
>    from /opt/opencascade/lib/libTKBO.so.0
> #10 0x00007ffff3536f20 in BOPAlgo_PaveFiller::PerformInternal() ()
>    from /opt/opencascade/lib/libTKBO.so.0
> #11 0x00007ffff3536cef in BOPAlgo_PaveFiller::Perform() ()
>    from /opt/opencascade/lib/libTKBO.so.0
> #12 0x00007ffff35c37d5 in BRepAlgoAPI_BooleanOperation::Build() ()
>    from /opt/opencascade/lib/libTKBO.so.0
> #13 0x0000555555a5ed08 in OCC_Internals::booleanOperator (this=0x555556ae5330, tag=7, 
>     op=OCC_Internals::Difference, objectDimTags=std::vector of length 1, capacity 1 = {...}, 
>     toolDimTags=std::vector of length 1, capacity 1 = {...}, 
>     outDimTags=std::vector of length 0, capacity 0, 
>     outDimTagsMap=std::vector of length 0, capacity 0, removeObject=true, removeTool=true)
>     at /home/gavin/code/gmsh/Geo/GModelIO_OCC.cpp:2421
> #14 0x0000555555eef8ee in gmsh_yyparse () at Gmsh.y:4081
> #15 0x00005555558c4465 in ParseFile (fileName="pulsr.geo", close=close at entry=true, 
>     warnIfMissing=warnIfMissing at entry=false) at /home/gavin/code/gmsh/Common/OpenFile.cpp:199
> #16 0x0000555555a014fd in GModel::readGEO (name="pulsr.geo")
>     at /home/gavin/code/gmsh/Geo/GModel.cpp:2716
> #17 0x00005555558c42b3 in MergeFile (fileName="pulsr.geo", 
>     warnIfMissing=warnIfMissing at entry=false, setBoundingBox=setBoundingBox at entry=true, 
>     importPhysicalsInOnelab=importPhysicalsInOnelab at entry=true)
>     at /home/gavin/code/gmsh/Common/OpenFile.cpp:508
> #18 0x00005555558c58d7 in OpenProject (fileName="pulsr.geo")
>     at /home/gavin/code/gmsh/Common/OpenFile.cpp:716
> #19 0x000055555586e6eb in GmshBatch () at /home/gavin/code/gmsh/Common/GmshGlobal.cpp:266
> #20 0x0000555555861dc7 in main (argc=7, argv=0x7fffffffda08)
> 
> So, is this user, or code error? Any advice would be greatly appreciated.
> 
> -- 
> Thanks,
> Gavin Ridley
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh




More information about the gmsh mailing list