Personal tools
You are here: Home Forum Use How to group nodes around a hole in a 3D Tet mesh?

How to group nodes around a hole in a 3D Tet mesh?

Up to Use
  • How to group nodes around a hole in a 3D Tet mesh?

    Posted by JMB at December 05. 2006
    Hello All,

    I have a very simple question about trying to define a group of nodes around a hole of a 3D tetrahedral mesh.  I created a block 200x200x200 and made a 30 dia hole in it by boolean subtraction of a cylinder (dimension 60dia x 220 high).  I meshed it using automatic tetrahedral meshing with a fineness setting of approx 0.3.

    Next I want to select all the nodes which lie within a radius of 25 around one end of this hole and group them.  My intent is to simulate the scenario of this block being bolted down, where all the nodes (within 50 dia) are constrained.  In other words the head of the bolt which would be holding this block down is assumed to be 50 dia.  I seem to be stuck at this stage.

    I have created circular Face_1 of 50 dia.  Then I tried creating groups using filters and specified
    1. "Belong to Geometry" = Face_1
    2. "Lying on Geometry" = Face_1

    But neither method gathers any nodes when I click on the "Add" button.  What am I doing fundamentally wrong?  I wish I could attach the files (including an image file) but this website does not seem to have the feature to do so like the Code-Aster forum.  So I am pasting the relevant portion of Python scripts here.  Could somebody please help?

    With many thanks
    JMB

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Code snippet ...

    def RebuildData(theStudy):
            geompy.init_geom(theStudy)
            global Vertex_3, Vector_1, Cylinder_1, Vertex_1, Face_1, Vertex_2, Circle_1, Wire_1, Box_1, Cut_1
            Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
            Vertex_1 = geompy.MakeVertex(100, 100, -10)
            Vertex_2 = geompy.MakeVertex(100, 100, 210)
            Vector_1 = geompy.MakeVector(Vertex_1, Vertex_2)
            Cylinder_1 = geompy.MakeCylinder(Vertex_1, Vector_1, 30, 220)
            Cut_1 = geompy.MakeCut(Box_1, Cylinder_1)
            Vertex_3 = geompy.MakeVertex(100, 100, 0)
            Circle_1 = geompy.MakeCircle(Vertex_3, Vector_1, 50)
            Wire_1 = geompy.MakeWire([Circle_1])
            Face_1 = geompy.MakeFaceWires([Wire_1], 1)
            geompy.addToStudy( Box_1, "Box_1" )
            geompy.addToStudy( Vertex_1, "Vertex_1" )
            geompy.addToStudy( Vertex_2, "Vertex_2" )
            geompy.addToStudy( Vector_1, "Vector_1" )
            geompy.addToStudy( Cylinder_1, "Cylinder_1" )
            geompy.addToStudy( Cut_1, "Cut_1" )
            geompy.addToStudy( Vertex_3, "Vertex_3" )
            geompy.addToStudy( Circle_1, "Circle_1" )
            geompy.addToStudy( Wire_1, "Wire_1" )
            geompy.addToStudy( Face_1, "Face_1" )
            pass
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Code snippet ...

    def RebuildData(theStudy):
            aFilterManager = smesh.smesh.CreateFilterManager()
            smesh.smesh.SetCurrentStudy(theStudy)
            import StdMeshers
            import NETGENPlugin
            Mesh_1 = smesh.Mesh(Cut_1)
            Wire_discretisation = Mesh_1.Segment()
            Automatic_length = Wire_discretisation.AutomaticLength(0.26)
            Triangle_Mefisto = Mesh_1.Triangle()
            Length_From_Edges_2D_Hyp_for_Triangulator = Triangle_Mefisto.LengthFromEdges()
            Tetrahedron_Netgen = Mesh_1.Tetrahedron(algo=smesh.NETGEN)
            isDone = Mesh_1.Compute()
            if not isDone: print 'Mesh Mesh_1.GetMesh() : computation failed'
            aFilter0x11b2c5b8 = aFilterManager.CreateFilter()
            aCriteria = []
            aCriteria.append(SMESH.Filter.Criterion(17,26,0,'Face_1','IOR:010000001900000049444c3a47454f4d2f47454f4d5f4f626a6563743a312e3000000000010000000000000064000000010102000e0000003139322e3136382e312e313030005a800e000000fe44b4744500003cfa0000000b8500000200000000000000080000000100000000545441010000001c00000001000000010001000100000001000105090101000100000009010100',26,26,1e-07,SMESH.NODE,0))
            aLyingOnGeom0x113b61e8 = aFilterManager.CreateLyingOnGeom()
            aLyingOnGeom0x113b61e8.SetElementType(SMESH.NODE)
            aFilter0x11b2c5b8.SetCriteria(aCriteria)
            aFilter0x11b2c5b8.SetPredicate(aLyingOnGeom0x113b61e8)

            ## set object names
            isGUIMode = 1
            if isGUIMode and salome.sg.hasDesktop():
                    smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
                    smesh.SetName(Wire_discretisation.GetAlgorithm(), 'Wire discretisation')
                    smesh.SetName(Automatic_length, 'Automatic length')
                    smesh.SetName(Triangle_Mefisto.GetAlgorithm(), 'Triangle (Mefisto)')
                    smesh.SetName(Length_From_Edges_2D_Hyp_for_Triangulator, 'Length From Edges (2D Hyp. for Triangulator)')
                    smesh.SetName(Tetrahedron_Netgen.GetAlgorithm(), 'Tetrahedron (Netgen)')

                    salome.sg.updateObjBrowser(0)

            pass
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    • Re: How to group nodes around a hole in a 3D Tet mesh?

      Posted by Christophe Bourcier at December 05. 2006
      Hi

      The best way to get what you describe is to follow these steps:

      - make a partition with the two objects Box_1 and Face_1 (or with Box_1 as the object, and Face_1 as the tool)
      - cut the result with Cylinder_1
      - explode the result in faces selecting the one corresponding to Face_1
      - mesh the resulting shape
      - create a group of nodes given the exploded face.

      Here is the corresponding script:



      import geompy
      import smesh, SMESH
      import math

      global Vertex_3, Vector_1, Face_2, Cylinder_1, Partition_1, Cut_2, Vertex_1, Face_1, Vertex_2, Circle_1, Wire_1, Box_1, Cut_1
      Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
      Vertex_1 = geompy.MakeVertex(100, 100, -10)
      Vertex_2 = geompy.MakeVertex(100, 100, 210)
      Vector_1 = geompy.MakeVector(Vertex_1, Vertex_2)
      Cylinder_1 = geompy.MakeCylinder(Vertex_1, Vector_1, 30, 220)
      Cut_1 = geompy.MakeCut(Box_1, Cylinder_1)
      Vertex_3 = geompy.MakeVertex(100, 100, 0)
      Circle_1 = geompy.MakeCircle(Vertex_3, Vector_1, 50)
      Wire_1 = geompy.MakeWire([Circle_1])
      Face_1 = geompy.MakeFaceWires([Wire_1], 1)
      Partition_1 = geompy.MakePartition([Box_1, Face_1], [], [], [], 2, 0, [])
      Cut_2 = geompy.MakeCut(Partition_1, Cylinder_1)
      [geomObj_1,geomObj_2,geomObj_3,geomObj_4,geomObj_5,geomObj_6,geomObj_7,Face_2] = geompy.SubShapeAll(Cut_2, geompy.ShapeType["FACE"])
      geompy.addToStudy( Box_1, "Box_1" )
      geompy.addToStudy( Vertex_1, "Vertex_1" )
      geompy.addToStudy( Vertex_2, "Vertex_2" )
      geompy.addToStudy( Vector_1, "Vector_1" )
      geompy.addToStudy( Cylinder_1, "Cylinder_1" )
      geompy.addToStudy( Cut_1, "Cut_1" )
      geompy.addToStudy( Vertex_3, "Vertex_3" )
      geompy.addToStudy( Circle_1, "Circle_1" )
      geompy.addToStudy( Wire_1, "Wire_1" )
      geompy.addToStudy( Face_1, "Face_1" )
      geompy.addToStudy( Partition_1, "Partition_1" )
      geompy.addToStudy( Cut_2, "Cut_2" )
      geompy.addToStudyInFather( Cut_2, Face_2, "Face_2" )

      aFilterManager = smesh.smesh.CreateFilterManager()
      import StdMeshers
      import NETGENPlugin
      Mesh_1 = smesh.Mesh(Cut_1)
      Wire_discretisation = Mesh_1.Segment()
      Automatic_length = Wire_discretisation.AutomaticLength(0.26)
      Triangle_Mefisto = Mesh_1.Triangle()
      Length_From_Edges_2D_Hyp_for_Triangulator = Triangle_Mefisto.LengthFromEdges()
      Tetrahedron_Netgen = Mesh_1.Tetrahedron(algo=smesh.NETGEN)
      isDone = Mesh_1.Compute()
      if not isDone: print 'Mesh Mesh_1.GetMesh() : computation failed'
      aFilter0x8e93718 = aFilterManager.CreateFilter()
      aLyingOnGeom0x8e9a100 = aFilterManager.CreateLyingOnGeom()
      aLyingOnGeom0x8e9a100.SetElementType(SMESH.NODE)
      aCriteria = []
      aCriteria.append(SMESH.Filter.Criterion(17,26,0,'Face_1','IOR:010000001900000049444c3a47454f4d2f47454f4d5f4f626a6563743a312e3000000000010000000000000064000000010102000e0000003139322e3136382e312e313030005a800e000000fe44b4744500003cfa0000000b8500000200000000000000080000000100000000545441010000001c00000001000000010001000100000001000105090101000100000009010100',26,26,1e-07,SMESH.NODE,0))
      aLyingOnGeom0x8ddee50 = aFilterManager.CreateLyingOnGeom()
      aLyingOnGeom0x8ddee50.SetElementType(SMESH.NODE)
      aFilter0x8e93718.SetCriteria(aCriteria)
      aFilter0x8e93718.SetPredicate(aLyingOnGeom0x8ddee50)
      aFilter0x8e93718.SetPredicate(aLyingOnGeom0x8e9a100)
      pattern = smesh.smesh.GetPattern()
      Mesh_2 = smesh.Mesh(Cut_2)
      status = Mesh_2.GetMesh().AddHypothesis( Cut_2, Automatic_length )
      status = Mesh_2.GetMesh().AddHypothesis( Cut_2, Wire_discretisation.GetAlgorithm() )
      status = Mesh_2.GetMesh().AddHypothesis( Cut_2, Length_From_Edges_2D_Hyp_for_Triangulator )
      status = Mesh_2.GetMesh().AddHypothesis( Cut_2, Triangle_Mefisto.GetAlgorithm() )
      status = Mesh_2.GetMesh().AddHypothesis( Cut_2, Tetrahedron_Netgen.GetAlgorithm() )
      isDone = Mesh_2.Compute()
      if not isDone: print 'Mesh Mesh_2.GetMesh() : computation failed'
      Face_2_1 = Mesh_2.GetMesh().CreateGroupFromGEOM(SMESH.NODE, 'Face_2', Face_2 )

      ## set object names 
      isGUIMode = 1
      if isGUIMode and salome.sg.hasDesktop():
              smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
              smesh.SetName(Wire_discretisation.GetAlgorithm(), 'Wire discretisation')
              smesh.SetName(Automatic_length, 'Automatic length')
              smesh.SetName(Triangle_Mefisto.GetAlgorithm(), 'Triangle (Mefisto)')
              smesh.SetName(Length_From_Edges_2D_Hyp_for_Triangulator, 'Length From Edges (2D Hyp. for Triangulator)')
              smesh.SetName(Tetrahedron_Netgen.GetAlgorithm(), 'Tetrahedron (Netgen)')
              smesh.SetName(Mesh_2.GetMesh(), 'Mesh_2')
              smesh.SetName(Face_2_1, 'Face_2')

              salome.sg.updateObjBrowser(0)
      • Re: How to group nodes around a hole in a 3D Tet mesh?

        Posted by JMB at December 05. 2006
        Christophe Bourcier wrote:
        Hi

        The best way to get what you describe is to follow these steps:

        - make a partition with the two objects Box_1 and Face_1 (or with Box_1 as the object, and Face_1 as the tool)
        - cut the result with Cylinder_1
        - explode the result in faces selecting the one corresponding to Face_1
        - mesh the resulting shape
        - create a group of nodes given the exploded face.

        Here is the corresponding script:



        import geompy
        import smesh, SMESH
        import math

        global Vertex_3, Vector_1, Face_2, Cylinder_1, Partition_1, Cut_2, Vertex_1, Face_1, Vertex_2, Circle_1, Wire_1, Box_1, Cut_1
        Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
        Vertex_1 = geompy.MakeVertex(100, 100, -10)
        Vertex_2 = geompy.MakeVertex(100, 100, 210)
        Vector_1 = geompy.MakeVector(Vertex_1, Vertex_2)
        Cylinder_1 = geompy.MakeCylinder(Vertex_1, Vector_1, 30, 220)
        Cut_1 = geompy.MakeCut(Box_1, Cylinder_1)
        Vertex_3 = geompy.MakeVertex(100, 100, 0)
        Circle_1 = geompy.MakeCircle(Vertex_3, Vector_1, 50)
        Wire_1 = geompy.MakeWire([Circle_1])
        Face_1 = geompy.MakeFaceWires([Wire_1], 1)
        Partition_1 = geompy.MakePartition([Box_1, Face_1], [], [], [], 2, 0, [])


        Hello Christophe BOURCIER,

        Thank you for your help.  I am a little confused.  My questions are:

        1. Should I not be partitioning "Cut_1" which has the hole using "Face_1", rather than "Box_1" as you suggest in your script?
        2. I am trying to better understand the "Partition" command itself in your script.  I am a complete beginner to Python.  So please bear with me.  Could you please tell me the one-to-one correspondence between the command you suggest and the description of the TUI command (which I extracted from the documentation), reproduced below:

        TUI Command: geompy.MakePartition(ListOfShapes, ListOfTools, ListOfKeepInside, ListOfRemoveInside, Limit, RemoveWebs, ListOfMaterials), where ListOfShapes is a list of shapes to be intersected, ListOfTools is a list of shapes to intersect the shapes from ListOfShapes, ListOfKeepInside is a list of shapes outside which the results will be deleted, ListOfRemoveInside is a list of shapes inside which the results will be deleted, Limit is a type of the result shapes, if RemoveWebs is True the Glue 3D algorithm will be performed on the results, ListOfMaterials is a list of materials indices for each shape, it makes sense only if RemoveWebs is True.

        Arguments: Name + 2 shapes (the first shape will be intersected by the second shape) + reconstruction limit.

        I counted the number of variables declared in your "Partition" command versus the docs and there are more in your command than the documentation describes.  So I am confused.  I might understand better this as well as other commands when I have to use them in the future; if you could please describe it as follows:

        1. ListOfShapes = Box_1
        2. ListOfTools = Face_1
        3. ListOfKeepinside = ?? (I presume [], means none)
        4. ListOfRemoveInside = ?? (I presume [], means none)
        5. Limit = ?? (Is this the Solid/Shell/Face/Wire/Edge/Vertex set of choices shown in the GUI?)
        6. RemoveWebs = ??
        7. ListOfMaterials = ??

        Your command has 8 variables, whereas the documentation lists only 7, thus I am confused.  Does the doc need to catch up with the code?

        Thank you for your help, once again.
        JMB

        PS: I may have more questions after I have digested this part.  So I hope you do not mind my bothering you again.
        • Re: How to group nodes around a hole in a 3D Tet mesh?

          Posted by Christophe Bourcier at December 05. 2006
          1. You are right. You can partition the object Cut_1 with the tool Face_1. My first idea was to make a partition with two objects instead of one object and one tool. That's why I told you to make a partition with the two objects Box_1 and Face_1.

          2. [Box_1, Face_1] is a list. It corresponds to ListOfShapes in the documentation. In the GUI, you can select several shapes in the "Objects" field and several shapes in the "Tools" field.  You can set these several shapes in the TUI using a list of shapes. In python, an "a,b,c" list is described by [a, b, c].

          You're welcome.
        • Re: How to group nodes around a hole in a 3D Tet mesh?

          Posted by JMB at December 05. 2006
          Hello Christophe BOURCIER,

          Could you please tell me how I should use the GUI equivalent of the Python command reproduced below you have used:

          [geomObj_1,geomObj_2,geomObj_3,geomObj_4,geomObj_5,geomObj_6,geomObj_7,Face_2] = geompy.SubShapeAll(Cut_2, geompy.ShapeType["FACE"])

          I have got as far as:

          New Entity -> Group -> Create;

          In the resulting dialog window, do I select:
          1. Shape Type = "The icon for face"
          2. Group Name = "Face_2"
          3. Main Shape = "Cut_2"
          4. Select Subshapes  and  Select All?

          Am I correct?

          Thank you
          JMB
          • Re: How to group nodes around a hole in a 3D Tet mesh?

            Posted by Christophe Bourcier at December 05. 2006
            SubShapeAll corresponds to New Entity> Explode> Faces. This explodes the shape into all its sub faces.

            But in your case, you just want to explode the face corresponding to Face_1. Thus, you check "Select Sub Shapes" in the dialog box, select the face corresponding to Face_1 in the 3D view and click on Apply.

            You don't need to create a group, since your face corresponds to exactly one sub-face.

            Cheers.

            Christophe
            • Re: How to group nodes around a hole in a 3D Tet mesh?

              Posted by JMB at December 06. 2006
              Hello Cristophe (or others)

              I am trying to model the contact of a plastic block, bolted onto a flat steel plate, without the bolt being modeled.  In place of the bolt, I intend constraining all the nodes that fall in the "shadow" of the bolt head.

              I have made wonderful progress in the meshing of the Block and the flat plate thanks to your assistance Cristophe!  I decided to incorporate a flat surface on the opposite side of the "BoltHead" face, that will serve as the Master contact surface called "ContactM".  The flat surface "ContactS" on the block (to be in contact with "ContactM";) is the face opposite "BoltHead".

              I used the method of creating a compound and meshing both the "Block" and the flat surface using automatic Tetrahedral meshing.  I would like to declare the "Block" as being made of plastic, while the opposite surface is of steel.  So I thought I should create a volume group called "Block" for all the tetrahedral elements of the plastic block and another called "Steel" for all the flat surface's triangular elements.  I am trying create these groups so that assigning 2 different material properties would be possible later on when I use Code-Aster.  But I am encountering a "SIGSEGV" fault in Salome 3.2.2.

              Here is the sequence:

              1. I created a group "Block" consisting of all the volume nodes of the plastic block.
              2. I created a group "ContactS" consisting of all the faces "Belonging to Geom" face: "ContactS"  (I even tried "Lying on Geom";)
              3. I try to save the model HoleBlock5.hdf and I get "SIGSEGV" or even if I try "Dump Study" to HoleBlock5.py"

              Is this a Salome bug?  Or am I doing something wrong?  How can I attach (or send) my Python scripts with this message without making this a mile-long message?.  Could you or somebody help please?

              Regards
              JMB
              • Re: How to group nodes around a hole in a 3D Tet mesh?

                Posted by Christophe Bourcier at December 07. 2006
                Hi

                You can upload files on the web using this tool: http://dl.free.fr/

                Go to the bottom of the page, click on "Parcourir...", select your file on your hard drive (a tar-ball with your python scipts and the hdf study). Enter your e-mail address in the field "Me notifier du lien par email". Then click on "Envoyer". Copy and paste on this forum the link given in the next page.

                Christophe
                • Re: How to group nodes around a hole in a 3D Tet mesh?

                  Posted by JMB at December 08. 2006
                  Christophe Bourcier wrote:
                  Hi

                  You can upload files on the web using this tool: http://dl.free.fr/

                  Go to the bottom of the page, click on "Parcourir...", select your file on your hard drive (a tar-ball with your python scipts and the hdf study). Enter your e-mail address in the field "Me notifier du lien par email". Then click on "Envoyer". Copy and paste on this forum the link given in the next page.

                  Christophe


                  Hello Christophe!

                  I have transferred the file.  It is at "http://dl-1.free.fr/52616e646f6d49564a02f55748813c5dcd0429becf19daa6fc426dc0697ac623/HoleBlock5.tar.gz"

                  Thank you for your help!
                  JMB

                  • Re: How to group nodes around a hole in a 3D Tet mesh?

                    Posted by Christophe Bourcier at December 11. 2006
                    Hi

                    I have the same SIGSEGV fault on the to be released SALOME V3.2.3. Here is the scenario to reproduce the bug if someone from the maintainance team can give a look at it:

                    - import the study from the files in the previous post.
                    - save the hdf study

                    => SIGSEGV

                    It seems that it is related to the creation of your group of volumes "Block". If you display only this group, you will see that some tetrahedrons from the cube are missing. The array of tetrahedron ids on the script may be wrong.

                    To go on with your study, you have to delete the lines 25 to 34 on your SMESH script and create a group by checking "volume", "group on geometry" and setting Compound_1 or Block.

                    Christophe
                    • Re: How to group nodes around a hole in a 3D Tet mesh?

                      Posted by JMB at December 11. 2006
                      Christophe Bourcier wrote:
                      Hi

                      I have the same SIGSEGV fault on the to be released SALOME V3.2.3. Here is the scenario to reproduce the bug if someone from the maintainance team can give a look at it:

                      - import the study from the files in the previous post.
                      - save the hdf study

                      => SIGSEGV

                      It seems that it is related to the creation of your group of volumes "Block". If you display only this group, you will see that some tetrahedrons from the cube are missing. The array of tetrahedron ids on the script may be wrong.

                      To go on with your study, you have to delete the lines 25 to 34 on your SMESH script and create a group by checking "volume", "group on geometry" and setting Compound_1 or Block.

                      Christophe

                      Hello Christophe,

                      Thank you for the trouble you have taken to isolate the cause of the problem and advise me.  I will take a look at my model and try to learn from my mistakes.

                      Regards
                      JMB
Powered by Ploneboard
Document Actions