from abapy.mesh import RegularQuadMesh from matplotlib import pyplot as plt # Creating a mesh m = RegularQuadMesh(N1=2, N2=2) x0, y0, z0 = m.get_edges() # Finding the node located at x = y =0.: nodes = m.nodes for i in xrange(len(nodes.labels)): if nodes.x[i] == 0. and nodes.y[i] == 0.: node = nodes.labels[i] # Removing this node m.drop_node(node) x1, y1, z1 = m.get_edges() bbx, bby, bbz = m.nodes.boundingBox() plt.figure() plt.clf() plt.gca().set_aspect('equal') plt.axis('off') plt.xlim(bbx) plt.ylim(bby) plt.plot(x0, y0, 'r-', linewidth=2., label='Removed element') plt.plot(x1, y1, 'b-', linewidth=2., label='New mesh') plt.legend() plt.show()
from abapy.mesh import RegularQuadMesh from matplotlib import pyplot as plt # Creating a mesh m = RegularQuadMesh(N1 = 2, N2 = 2) x0, y0, z0 = m.get_edges() # Finding the node located at x = y =0.: nodes = m.nodes for i in xrange(len(nodes.labels)): if nodes.x[i] == 0. and nodes.y[i] == 0.: node = nodes.labels[i] # Removing this node m.drop_node(node) x1, y1, z1 = m.get_edges() bbx, bby, bbz = m.nodes.boundingBox() plt.figure() plt.clf() plt.gca().set_aspect('equal') plt.axis('off') plt.xlim(bbx) plt.ylim(bby) plt.plot(x0,y0, 'r-', linewidth = 2., label = 'Removed element') plt.plot(x1,y1, 'b-', linewidth = 2., label = 'New mesh') plt.legend() plt.show()
return s_rr, s_zz, s_tt, s_rz, s_rt, s_zt return ux, uy, uz N1, N2 = 50, 50 l1, l2 = 1., 1. Ncolor = 200 levels = linspace(0., 10., 20) mesh = RegularQuadMesh(N1=N1, N2=N2, l1=l1, l2=l2) # Finding the node located at x = y =0.: nodes = mesh.nodes for i in xrange(len(nodes.labels)): if nodes.x[i] == 0. and nodes.y[i] == 0.: node = nodes.labels[i] mesh.drop_node(node) tensorField = mesh.nodes.eval_tensorFunction(boussinesq) field = tensorField.get_component(22) # sigma_zz field2 = tensorField.vonmises() # von Mises stress field3 = tensorField.pressure() # pressure fig = plt.figure(figsize=(16, 4)) ax = fig.add_subplot(131) ax2 = fig.add_subplot(132) ax3 = fig.add_subplot(133) ax.set_aspect('equal') ax2.set_aspect('equal') ax3.set_aspect('equal') ax.set_xticks([]) ax.set_yticks([]) ax2.set_xticks([])
return s_rr, s_zz, s_tt, s_rz, s_rt, s_zt return ux, uy, uz N1, N2 = 50, 50 l1, l2 = 1., 1. Ncolor = 200 levels = linspace(0., 10., 20) mesh = RegularQuadMesh(N1 = N1, N2 = N2, l1 = l1, l2 = l2) # Finding the node located at x = y =0.: nodes = mesh.nodes for i in xrange(len(nodes.labels)): if nodes.x[i] == 0. and nodes.y[i] == 0.: node = nodes.labels[i] mesh.drop_node(node) tensorField = mesh.nodes.eval_tensorFunction(boussinesq) field = tensorField.get_component(22) # sigma_zz field2 = tensorField.vonmises() # von Mises stress field3 = tensorField.pressure() # pressure fig = plt.figure(figsize=(16,4)) ax = fig.add_subplot(131) ax2 = fig.add_subplot(132) ax3 = fig.add_subplot(133) ax.set_aspect('equal') ax2.set_aspect('equal') ax3.set_aspect('equal') ax.set_xticks([]) ax.set_yticks([]) ax2.set_xticks([])