# ---- Solve problem -------------------------------------------------------- solver = cfslv.Plan2DSolver(mesh) solver.addBC(rect.leftId, 0.0) solver.addForceTotal(rect.topId, -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.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,
# Degrees of freedom per node. mesh.dofs_per_node = 2 mesh.el_size_factor = 0.05 # mesh.gmsh_exec_path = "D:\\vsmn20-software\\gmsh\gmsh.exe" coords, edof, dofs, bdofs, elementmarkers = mesh.create() # ---- Visualise mesh ------------------------------------------------------- # Hold left mouse button to pan. # Hold right mouse button to zoom. # Draw the geometry. cfv.draw_geometry(g, label_curves=True) # New figure window cfv.figure() # Draws the mesh. cfv.draw_mesh(coords=coords, edof=edof, dofs_per_node=mesh.dofs_per_node, el_type=mesh.el_type, filled=True, title="Example 02") # Show grid
coords, edof, dofs, bdofs, _ = cfm.mesh(g, el_type, dofs_per_node) #coords, edof, dofs, bdofs, _ = cfm.mesh( # g, el_type, dofs_per_node, gmsh_exec_path="D:\\vsmn20-software\\gmsh\gmsh.exe") # ---- Visualise mesh ------------------------------------------------------- # Hold Left Mouse button to rotate. # Hold right mouse button to zoom. # Hold SHIFT and left mouse button to pan. # Hold SHIFT and right mouse button to change the field of view. # Hold Ctrl and left mouse button to roll the camera. # Draw geometry cfv.draw_geometry(g, draw_points=False) # Draw mesh cfv.figure() cfv.draw_mesh(coords=coords, edof=edof, dofs_per_node=dofs_per_node, el_type=el_type, filled=True) # Add a text in world space cfv.add_text("This is a Text", pos=(1, 0.5, 0.5), angle=45) # Add a label in the screen space
def drawGeometry(self, figGeometry): """Draws geometry in specified figure""" cfv.figure(figGeometry.nr) cfv.clf() cfv.draw_geometry(self.g, draw_points=False, label_curves=True)
# Element type 3 is quad. (2 is triangle. See user manual for more element types) mesh.el_type = 3 # Degrees of freedom per node. mesh.dofs_per_node = 1 # mesh.gmsh_exec_path = "D:\\vsmn20-software\\gmsh\gmsh.exe" coords, edof, dofs, bdofs, elementmarkers = mesh.create() # ---- Visualise mesh ------------------------------------------------------- # Draw geometry cfv.draw_geometry(g) # Draw mesh cfv.figure() cfv.draw_mesh(coords, edof, dofs_per_node=mesh.dofs_per_node, el_type=mesh.el_type, filled=True) # Enter main loop cfv.show_and_wait()
# Create mesh coords, edof, dofs, bdofs, elementmarkers = cfm.mesh(g, el_type, 0.3, dofs_per_node) #coords, edof, dofs, bdofs, _ = cfm.mesh( # g, el_type, 0.3, dofs_per_node, gmsh_exec_path="D:\\vsmn20-software\\gmsh\gmsh.exe") # ---- Visualise mesh ------------------------------------------------------- # Create two axes that are viewed from the same camera: cfv.figure() a1 = cfv.subplot(121) a2 = cfv.subplot(122) cam = cfv.camera3d() a1.camera = a2.camera = cam # Draw geometry and mesh cfv.draw_geometry(g, axes=a1) cfv.draw_mesh(coords=coords, edof=edof, dofsPerNode=dofs_per_node, elType=el_type, filled=False, axes=a2) # Enter main loop cfv.show_and_wait()
# Handle quad elements es, et = cfc.planqs(ex[i, :], ey[i, :], elprop[elementmarkers[i]][0], elprop[elementmarkers[i]][1], ed[i, :]) von_mises.append( np.math.sqrt( pow(es[0], 2) - es[0] * es[1] + pow(es[1], 2) + 3 * pow(es[2], 2))) # ---- Visualise results ---------------------------------------------------- cfu.info("Drawing results...") 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,
def drawGeometry(self, figGeometry): """Draw geometry in provided figure""" cfv.figure(figGeometry.nr) cfv.clf() cfv.draw_geometry(self.rect.geometry(), title="Geometry")