def drawElementValues(self, figElementValues): """Draw element values in provided figure""" cfv.figure(figElementValues.nr) cfv.clf() cfv.drawElementValues(self.results.elForces, self.mesh.coords, self.mesh.edof, self.rect.dofsPerNode, self.rect.elementType, self.results.a, doDrawMesh=True, doDrawUndisplacedMesh=False, title="Effective Stress", magnfac=1)
def drawDisplacements(self, figDisplacements): """Draw displacements in provided figure""" cfv.figure(figDisplacements.nr) cfv.clf() cfv.drawDisplacements(self.results.a, self.mesh.coords, self.mesh.edof, self.rect.dofsPerNode, self.rect.elementType, doDrawUndisplacedMesh=False, title="Displacements", magnfac=1)
def closeAll(self): self.geomFig = None self.meshFig = None self.elValueFig = None self.nodeValueFig = None cfv.clf() cfv.close_all()
def drawMesh(self, figMesh): """Draw mesh in provided figure""" cfv.figure(figMesh.nr) cfv.clf() cfv.draw_mesh(self.mesh.coords, self.mesh.edof, self.rect.dofsPerNode, self.rect.elementType, filled=True, title="Mesh") #Draws the mesh.
def showGeometry(self): if self.calcDone == True: """Visa geometri visualisering""" geometry = self.outputData.geometry self.geomFig = cfv.figure(self.geomFig) cfv.clf() cfv.drawGeometry(geometry, title="Geometry")
def drawElementValues(self, figElementValues): """Draws element values in specified figure""" cfv.figure(figElementValues.nr) cfv.clf() cfv.drawElementValues(self.vonMises, self.coords, self.edof, self.mesh.dofsPerNode, self.mesh.elType, self.a, doDrawMesh=True, doDrawUndisplacedMesh=False, title="Example 06 effective stress")
def drawElementValues(self, figElementValues): """Draws element values in specified figure""" cfv.figure(figElementValues.nr) cfv.clf() cfv.draw_element_values(self.vonMises, self.coords, self.edof, self.mesh.dofs_per_node, self.mesh.el_type, self.a, draw_elements=True, draw_undisplaced_mesh=False, title="Example 06 effective stress")
def drawMesh(self): cfv.figure(self.fig2.nr) cfv.clf() cfv.drawMesh(coords=self.coords, edof=self.edof, dofsPerNode=self.meshGen.dofsPerNode, elType=self.meshGen.elType, filled=True, title="Example 01") cfv.addText("This is a Text", pos=(1, -0.3), angle=45) #Adds a text in world space ourLabel = cfv.label("This is a Label", pos=(100, 200), angle=-45) #Adds a label in the screen space ourLabel.text = "Label, changed." #We can change the attributes of labels and texts, such as color, text, and position. ourLabel.textColor = 'r' #Make it red. (1,0,0) would also have worked. ourLabel.position = (20, 30)
def drawDisplacements(self, figDisplacements): """Draws displacements in specified figure""" cfv.figure(figDisplacements.nr) cfv.clf() cfv.drawDisplacements(self.a, self.coords, self.edof, self.mesh.dofsPerNode, self.mesh.elType, doDrawUndisplacedMesh=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), fontSize=20, color='g')
def drawGeometry(self, figGeometry): """Draws geometry in specified figure""" cfv.figure(figGeometry.nr) cfv.clf() cfv.drawGeometry(self.g, drawPoints=False, labelCurves=True)
def show(self): coords = self.outputData.coords edof = self.outputData.edof dofsPerNode = self.outputData.dofsPerNode elType = self.outputData.elType avec = self.outputData.avec plotnr = self.inputData.Tv #Plot excess pore water pressure 2D cfv.figure(self.figPress.nr) cfv.clf() cfv.drawNodalValues(avec[:,plotnr], coords, edof, dofsPerNode, elType, clim=(0,self.inputData.q), doDrawMesh = False, title = "Excess porewater pressure") xudict = self.outputData.xudict yudict = self.outputData.yudict comboindex = self.inputData.comboindex PP = np.shape(avec)[1] #If vertical 1 D plot if comboindex == 0: Xv = self.inputData.Xv coordvec = xudict[Xv][0] uvec = xudict[Xv][1] cfv.figure(self.figuvec.nr) cfv.clf() for i in range(PP): vv.plot(uvec[:, i], coordvec, ls = ":", lc = "c") vv.plot(uvec[:,plotnr], coordvec, ls = "-", lc = "b") vv.title("u_e - Excess porewater pressure 1D") cfv.figure(self.figsigvec.nr) cfv.clf() for i in range(PP): vv.plot(uvec[:,0]-uvec[:, i], coordvec, ls = ":", lc = "c") vv.plot(uvec[:,0]-uvec[:,plotnr], coordvec, ls = "-", lc = "b") vv.title("\Delta\sigma' - Effective stress 1D") else: Yv = self.inputData.Yv coordvec = yudict[Yv][0] uvec = yudict[Yv][1] cfv.figure(self.figuvec.nr) cfv.clf() for i in range(PP): vv.plot(coordvec, uvec[:, i], ls=":", lc = "c") vv.plot(coordvec, uvec[:, plotnr], ls="-", lc = "b") vv.title("u_e - Excess porewater pressure 1D") cfv.figure(self.figsigvec.nr) cfv.clf() for i in range(PP): vv.plot(coordvec, uvec[:, 0]-uvec[:, i], ls = ":", lc = "c") vv.plot(coordvec, uvec[:, 0]-uvec[:, plotnr], ls = "-", lc = "b") vv.title("\Delta\sigma' - Effective stress 1D")
def drawGeometry(self): cfv.figure(self.fig1.nr) cfv.clf() cfv.drawGeometry(self.g)
def clearfig(self): cfv.figure(self.figPress.nr) cfv.clf() cfv.figure(self.figuvec.nr) cfv.clf() cfv.figure(self.figsigvec.nr) cfv.clf() cfv.figure(self.figGeometry.nr) cfv.clf() cfv.figure(self.figMesh.nr) cfv.clf() cfv.figure(self.figInitial.nr) cfv.clf()
def drawGeometry(self, figGeometry): """Draw geometry in provided figure""" cfv.figure(figGeometry.nr) cfv.clf() cfv.drawGeometry(self.rect.geometry(), title="Geometry")