Personal tools
You are here: Home Forum How to use Salome? Mesh on 5 Edges ?

Mesh on 5 Edges ?

Up to How to use Salome?
  • Mesh on 5 Edges ?

    Posted by eXav at August 03. 2009

    Hello...

    I have a problem... Is there possibility building 2D tetrahedral mesh on 5 edges? I tryed to union 2 edges in 1, but I can not do it. (I use Opencascade and salome )

    Thank for attention...

    • Re: Mesh on 5 Edges ?

      Posted by Erwan ADAM at August 03. 2009
      eXav wrote:

      Hello...

      I have a problem... Is there possibility building 2D tetrahedral mesh on 5 edges? I tryed to union 2 edges in 1, but I can not do it. (I use Opencascade and salome )

      Thank for attention...


      Hi,

      Could you describe more precisely the geometry you are trying to mesh ?

      Regards,

               E.A.
      • Re: Mesh on 5 Edges ?

        Posted by eXav at August 03. 2009
        We work with hexahedral and tetrahedral meshes. For example, what do I do for create tetrahedral mesh on next wire: 1 ______ | | | | 2| |5 | | \ / 3\ /4 \/ I can not do it, because Quadrangle Algo need in 4 edge. I want represent edges 3 and 4 as ine edge.
        • Re: Mesh on 5 Edges ?

          Posted by eXav at August 03. 2009
          Sorry... Figure: Point1 (0,0); Point2 (2,0); Point3 (2,1); Point4 (1,2); Point5 (0,2); Point5 (0,0); Like a house:)
          • Re: Mesh on 5 Edges ?

            Posted by Erwan ADAM at August 03. 2009
            eXav wrote:
            Sorry...
            Figure:
            Point1 (0,0);
            Point2 (2,0);
            Point3 (2,1);
            Point4 (1,2);
            Point5 (0,2);
            Point5 (0,0);
            Like a house:)


            Something like that ?

            http://erwan.adam.free.fr/salome/scripts/Mesh_on_5_edges_00.png


            • Re: Mesh on 5 Edges ?

              Posted by eXav at August 05. 2009
              ADAM Erwan wrote:
              eXav wrote:
              Sorry...
              Figure:
              Point1 (0,0);
              Point2 (2,0);
              Point3 (2,1);
              Point4 (1,2);
              Point5 (0,2);
              Point5 (0,0);
              Like a house:)

              Something like that ?

              http://erwan.adam.free.fr/salome/scripts/Mesh_on_5_edges_00.png



              Yes... And how it made???...
              • Re: Mesh on 5 Edges ?

                Posted by Erwan ADAM at August 05. 2009
                eXav wrote:
                ADAM Erwan wrote:
                eXav wrote:
                Sorry...
                Figure:
                Point1 (0,0);
                Point2 (2,0);
                Point3 (2,1);
                Point4 (1,2);
                Point5 (0,2);
                Point5 (0,0);
                Like a house:)


                Something like that ?

                http://erwan.adam.free.fr/salome/scripts/Mesh_on_5_edges_00.png



                Yes... And how it made???...


                Save the following :

                # -----------

                # --
                # Geom part ...
                # --

                import geompy

                p1 = geompy.MakeVertex(0.0, 0.0, 0.0)
                p2 = geompy.MakeVertex(2.0, 0.0, 0.0)
                p3 = geompy.MakeVertex(2.0, 1.0, 0.0)
                p4 = geompy.MakeVertex(1.0, 2.0, 0.0)
                p5 = geompy.MakeVertex(0.0, 2.0, 0.0)

                points = [p1, p2, p3, p4, p5]
                edges = [geompy.MakeEdge(points[i], points[(i+1)%len(points)]) for i in range(len(points))]
                wire = geompy.MakeWire(edges)
                face = geompy.MakeFace(wire, 1)

                shape = face

                p12 = geompy.MakeVertex(1.0, 0.0, 0.0)

                tools = [
                    geompy.MakeEdge(p12, p4),
                    ]

                shape = geompy.MakePartition([shape], tools)

                tool_p1 = geompy.MakeVertex(0.0, 1.0, 0.0)
                tool_p2 = geompy.MakeVertex(1.0, 1.0, 0.0)
                tool_p3 = geompy.MakeVertex(2.0, 0.5, 0.0)

                tools = [
                    geompy.MakeEdge(tool_p1, tool_p2),
                    geompy.MakeEdge(tool_p2, tool_p3),
                    ]

                shape = geompy.MakePartition([shape], tools)
                geompy.addToStudy(shape, "shape";)

                salome.sg.updateObjBrowser(0)

                # --
                # Mesh part ...
                # CAUTION : I use here the corba API of SMESH
                # which is not the "official" API ... I've got my own reasons !
                # --

                import salome
                import SMESH
                import StdMeshers

                smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH";)
                smesh.SetCurrentStudy(salome.myStudy)
                mesh = smesh.CreateMesh(shape)

                mesh.AddHypothesis(shape, smesh.CreateHypothesis("Regular_1D", "StdMeshersEngine";))

                hypo = smesh.CreateHypothesis("NumberOfSegments", "StdMeshersEngine";)
                hypo.SetNumberOfSegments(10)
                mesh.AddHypothesis(shape, hypo)

                mesh.AddHypothesis(shape, smesh.CreateHypothesis("Quadrangle_2D", "StdMeshersEngine";))

                smesh.Compute(mesh, shape)

                salome.sg.updateObjBrowser(0)

                # -----------

                in foo.py and launch :

                runSalome --execute=foo.py

                it should do the job

                E.A.
                • Re: Mesh on 5 Edges ?

                  Posted by eXav at August 10. 2009
                  Thank ypu for help...
        • Re: Mesh on 5 Edges ?

          Posted by Erwan ADAM at August 03. 2009
          eXav wrote:
          We work with hexahedral and tetrahedral meshes.
          For example, what do I do for create tetrahedral mesh on next wire:

          1 ______
          | |
          | |
          2| |5
          | |
          \ /
          3\ /4
          \/
          I can not do it, because Quadrangle Algo need in 4 edge. I want represent edges 3 and 4 as ine edge.



          I'm sorry ... but I don't understand you drawing.
          • Re: Mesh on 5 Edges ?

            Posted by Erwan ADAM at August 03. 2009
            ADAM Erwan wrote:
            eXav wrote:
            We work with hexahedral and tetrahedral meshes.
            For example, what do I do for create tetrahedral mesh on next wire:

            1 ______
            | |
            | |
            2| |5
            | |
            \ /
            3\ /4
            \/
            I can not do it, because Quadrangle Algo need in 4 edge. I want represent edges 3 and 4 as ine edge.



            I'm sorry ... but I don't understand you drawing.


            Ooops ...
    • Re: Mesh on 5 Edges ?

      Posted by Nathalie Gore at August 04. 2009
      eXav wrote:

      Hello...

      I have a problem... Is there possibility building 2D tetrahedral mesh on 5 edges? I tryed to union 2 edges in 1, but I can not do it. (I use Opencascade and salome )

      Thank for attention...


      This solution corresponds to your wanted meshing?

      import geompy
      import smesh

      # Geom Creation
      Vertex_1 = geompy.MakeVertex(0, 0, 0)
      Vertex_2 = geompy.MakeVertex(2, 0, 0)
      Vertex_3 = geompy.MakeVertex(2, 1, 0)
      Vertex_4 = geompy.MakeVertex(1, 2, 0)
      Vertex_5 = geompy.MakeVertex(0, 2, 0)
      Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_2)
      Line_2 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_3)
      Line_3 = geompy.MakeLineTwoPnt(Vertex_3, Vertex_4)
      Line_4 = geompy.MakeLineTwoPnt(Vertex_4, Vertex_5)
      Line_5 = geompy.MakeLineTwoPnt(Vertex_5, Vertex_1)
      Face_2 = geompy.MakeFaceWires([Line_1, Line_2, Line_3, Line_4, Line_5], 1)
      [Edge_1,Edge_2,Edge_3,Edge_4,Edge_5] = geompy.SubShapeAllSorted(Face_2, geompy.ShapeType["EDGE"])
      geomObj_1 = geompy.GetSubShape(Edge_2, [3])
      Line_6 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_5)
      Vertex_6 = geompy.MakeVertexOnCurve(Line_6, 0.5)
      Vertex_7 = geompy.MakeVertexOnCurve(Edge_4, 0.5)
      Line_7 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_6)
      Line_8 = geompy.MakeLineTwoPnt(Vertex_6, Vertex_7)
      Partition_1 = geompy.MakePartition([Face_2], [Line_6, Line_8], [], [], geompy.ShapeType["FACE"], 0, [], 0)
      geompy.addToStudy( Vertex_1, "Vertex_1" )
      geompy.addToStudy( Vertex_2, "Vertex_2" )
      geompy.addToStudy( Vertex_3, "Vertex_3" )
      geompy.addToStudy( Vertex_4, "Vertex_4" )
      geompy.addToStudy( Vertex_5, "Vertex_5" )
      geompy.addToStudy( Line_1, "Line_1" )
      geompy.addToStudy( Line_2, "Line_2" )
      geompy.addToStudy( Line_3, "Line_3" )
      geompy.addToStudy( Line_4, "Line_4" )
      geompy.addToStudy( Line_5, "Line_5" )
      geompy.addToStudyInFather( Face_2, Edge_1, "Edge_1" )
      geompy.addToStudyInFather( Face_2, Edge_2, "Edge_2" )
      geompy.addToStudy( Face_2, "Face_2" )
      geompy.addToStudyInFather( Face_2, Edge_3, "Edge_3" )
      geompy.addToStudyInFather( Face_2, Edge_4, "Edge_4" )
      geompy.addToStudyInFather( Face_2, Edge_5, "Edge_5" )
      geompy.addToStudyInFather( Vertex_2, Line_6, "Line_6" )
      geompy.addToStudy( Line_7, "Line_7" )
      geompy.addToStudy( Line_8, "Line_8" )
      geompy.addToStudy( Vertex_6, "Vertex_6" )
      geompy.addToStudy( Partition_1, "Partition_1" )

      [Edge_6,Edge_7,Edge_8,Edge_9,Edge_10,Edge_11,Edge_12,Edge_13,Edge_14] = geompy.SubShapeAllSorted(Partition_1, geompy.ShapeType["EDGE"])
      geompy.addToStudyInFather( Partition_1, Edge_6, "Edge_6" )
      geompy.addToStudyInFather( Partition_1, Edge_7, "Edge_7" )
      geompy.addToStudyInFather( Partition_1, Edge_8, "Edge_8" )
      geompy.addToStudy( Vertex_7, "Vertex_7" )
      geompy.addToStudyInFather( Partition_1, Edge_9, "Edge_9" )
      geompy.addToStudyInFather( Partition_1, Edge_10, "Edge_10" )
      geompy.addToStudyInFather( Partition_1, Edge_11, "Edge_11" )
      geompy.addToStudyInFather( Partition_1, Edge_12, "Edge_12" )
      geompy.addToStudyInFather( Partition_1, Edge_13, "Edge_13" )
      geompy.addToStudyInFather( Partition_1, Edge_14, "Edge_14" )

      # Mesh creation
      smeshGlobal = smesh.Mesh(Partition_1, "GlobalMesh";)
      smeshGlobal.Quadrangle()

      A0_1_2_2_2_1 = smeshGlobal.Segment(Edge_7)
      A0_1_2_2_2_1.NumberOfSegments(15)
      A0_1_2_2_2_2 = smeshGlobal.Segment(Edge_8)
      A0_1_2_2_2_2.NumberOfSegments(15)
      A0_1_2_2_2_3 = smeshGlobal.Segment(Edge_9)
      A0_1_2_2_2_3.NumberOfSegments(15)
      A0_1_2_2_2_4 = smeshGlobal.Segment(Edge_10)
      A0_1_2_2_2_4.NumberOfSegments(15)
      A0_1_2_2_2_5 = smeshGlobal.Segment(Edge_11)
      A0_1_2_2_2_5.NumberOfSegments(15)
      A0_1_2_2_2_6 = smeshGlobal.Segment(Edge_12)
      A0_1_2_2_2_6.NumberOfSegments(15)
      A0_1_2_2_2_7 = smeshGlobal.Segment(Edge_13)
      A0_1_2_2_2_7.NumberOfSegments(15)
      A0_1_2_2_2_8 = smeshGlobal.Segment(Edge_14)
      A0_1_2_2_2_8.NumberOfSegments(15)
      A0_1_2_2_2_9 = smeshGlobal.Segment(Edge_6)
      A0_1_2_2_2_9.NumberOfSegments(15)
      smeshGlobal.Compute()

Powered by Ploneboard
Document Actions