Пример #1
0
 def drawDisplacements(self, figDisplacements):
     """Draw displacements in provided figure"""
     cfv.figure(figDisplacements.nr)
     cfv.clf()
     cfv.draw_displacements(self.results.a,
                            self.mesh.coords,
                            self.mesh.edof,
                            self.rect.dofsPerNode,
                            self.rect.elementType,
                            draw_undisplaced_mesh=False,
                            title="Displacements",
                            magnfac=1)
Пример #2
0
    def drawDisplacements(self, figDisplacements):
        """Draws displacements in specified figure"""
        cfv.figure(figDisplacements.nr)
        cfv.clf()
        cfv.draw_displacements(self.a,
                               self.coords,
                               self.edof,
                               self.mesh.dofs_per_node,
                               self.mesh.el_type,
                               draw_undisplaced_mesh=True,
                               title="Example 06")

        # Make use of attribute 'nodesOnCurve' in GmshMesher to draw some arrows on
        # the right hand side of the mesh:

        rightSideNodes = set()

        # 4 and 5 are the IDs of the curves where we applied the forces.

        for curveID in [4, 5]:

            # Get the nodes, without duplicates.

            rightSideNodes = rightSideNodes.union(
                set(self.mesh.nodesOnCurve[curveID]))

        for i in rightSideNodes:

            # Position of the node with displacements.

            x = self.coords[i, 0] + self.a[i * 2, 0]
            y = self.coords[i, 1] + self.a[i * 2 + 1, 0]

            # A poor man's force indicator. Could also use vv.plot()

            cfv.addText("\rightarrow", (x, y), font_size=20, color='g')
Пример #3
0
cfv.figure()
cfv.draw_geometry(rect.geometry(), title="Geometry")

cfv.figure()
cfv.draw_mesh(mesh.coords,
              mesh.edof,
              rect.dofsPerNode,
              rect.elementType,
              filled=True,
              title="Mesh")  #Draws the mesh.

cfv.figure()
cfv.draw_displacements(results.a,
                       mesh.coords,
                       mesh.edof,
                       rect.dofsPerNode,
                       rect.elementType,
                       doDrawUndisplacedMesh=False,
                       title="Displacements",
                       magnfac=1)

cfv.figure()
cfv.draw_elementValues(results.elForces,
                       mesh.coords,
                       mesh.edof,
                       rect.dofsPerNode,
                       rect.elementType,
                       results.a,
                       doDrawMesh=True,
                       doDrawUndisplacedMesh=False,
                       title="Effective Stress",
                       magnfac=1)
Пример #4
0
solver.addBC(rect.left_id, 0.0)
solver.addForceTotal(rect.top_id, -10e5, dimension=2)

results = solver.execute()       
       
# ---- Visualise results ----------------------------------------------------

cfu.info("Drawing results...")

cfv.figure() 
cfv.draw_geometry(rect.geometry(), title="Geometry")

cfv.figure() 
cfv.draw_mesh(mesh.coords, mesh.edof, rect.dofs_per_node, rect.element_type, 
             filled=True, title="Mesh") #Draws the mesh.

cfv.figure()
cfv.draw_displacements(results.a, mesh.coords, mesh.edof, rect.dofs_per_node, rect.element_type, 
                      draw_undisplaced_mesh=False, title="Displacements", 
                      magnfac=1)

cfv.figure()
cfv.draw_element_values(results.el_forces, mesh.coords, mesh.edof, rect.dofs_per_node, rect.element_type, results.a, 
                      draw_elements=True, draw_undisplaced_mesh=False, 
                      title="Effective Stress", magnfac=1)
                      
#cfv.colorBar().SetLabel("Effective stress")

cfu.info("Done drawing...")

cfv.show_and_wait()
Пример #5
0
    
    vonMises.append( sqrt( pow(es[0],2) - es[0]*es[1] + pow(es[1],2) + 3*es[2] ) ) 

    ## es: [sigx sigy tauxy]

# ---- Visualise results ----------------------------------------------------

cfu.info("Visualising...")

cfv.drawGeometry(g, draw_points=False, label_curves=True)

cfv.figure()
cfv.draw_element_values(vonMises, coords, edof, mesh.dofs_per_node, mesh.el_type, a, draw_elements=True, draw_undisplaced_mesh=False, title="Example 06 effective stress")

cfv.figure()
cfv.draw_displacements(a, coords, edof, mesh.dofs_per_node, mesh.el_type, draw_undisplaced_mesh=True, title="Example 06")

# Make use of attribute 'nodesOnCurve' in GmshMesher to draw some arrows on 
# the right hand side of the mesh:

rightSideNodes = set()

# 4 and 5 are the IDs of the curves where we applied the forces.

for curveID in [4,5]: 

    # Get the nodes, without duplicates.

    rightSideNodes = rightSideNodes.union(set(mesh.nodesOnCurve[curveID])) 
    
for i in rightSideNodes:
Пример #6
0
cfv.figure()
cfv.draw_geometry(g, title="Geometry")

cfv.figure()
cfv.draw_mesh(coords=coords,
              edof=edof,
              dofs_per_node=dofs_per_node,
              el_type=el_type,
              filled=True,
              title="Mesh")  #Draws the mesh.

cfv.figure()
cfv.draw_displacements(a,
                       coords,
                       edof,
                       dofs_per_node,
                       el_type,
                       draw_undisplaced_mesh=False,
                       title="Displacements",
                       magnfac=25.0)

cfv.figure()
cfv.draw_element_values(von_mises,
                        coords,
                        edof,
                        dofs_per_node,
                        el_type,
                        a,
                        draw_elements=True,
                        draw_undisplaced_mesh=False,
                        title="Effective Stress",
                        magnfac=25.0)