Exemple #1
0
 def MakeMesh(self):
   """
   Builds the mesh
   """
   Ri = self.inner_radius
   Ro = self.outer_radius
   thickness = self.thickness
   Nr, Nt, Na = self.Nr, self.Nt, self.Na
   mesh = RegularQuadMesh(Nt, Nr, .25, Ro - Ri, name = self.elType)
   mesh.nodes.add_set_by_func('left_nodes', lambda x, y, z, labels: x == 0.)
   mesh.nodes.add_set_by_func('right_nodes', lambda x, y, z, labels: x == .25)
      
   def function(x, y, z, labels):
     theta = 2 * np.pi * (.25 - x)
     r = y + Ri
     ux = -x + r * np.cos(theta)
     uy = -y + r * np.sin(theta)
     uz = 0. * z
     return ux, uy, uz
   vectorField = mesh.nodes.eval_vectorFunction(function)
   mesh.nodes.apply_displacement(vectorField)
   nodes = mesh.nodes
   for i in xrange(len(nodes.labels)):
     if nodes.x[i] < 0.: 
       nodes.x[i] = 0. 
   
   mesh.add_set('all_elements', mesh.labels)
   mesh.add_set('surface_elements',range( Nt * (Nr-1)+1, Nt*Nr+1  ))
   mesh.add_surface('surface_faces',[ ('surface_elements',3) ])
   if self.is_3D:
      mesh = mesh.extrude(N = Na, l = thickness, mapping = {self.elType: self.elType})  
   self.mesh = mesh
Exemple #2
0
from abapy.mesh import RegularQuadMesh
mesh = RegularQuadMesh()
mesh.add_surface('topsurface', [('top', 1)])
mesh.add_surface('topsurface', [('top', 2)])
mesh.surfaces
Exemple #3
0
from abapy.mesh import RegularQuadMesh, Mesh
from matplotlib import pyplot as plt
from array import array
from abapy.indentation import IndentationMesh

m = RegularQuadMesh(N1 = 2, N2 =2)
m.connectivity[2] = array(m.dti,[5, 7, 4])
m.connectivity[3] = array(m.dti,[5, 6, 9])
m.add_set('el_set',[1,2])
m.add_set('el_set2',[2,4])
m.add_surface('my_surface',[('el_set',1),])
m2 = m.sweep(sweep_angle = 70., N = 2, extrude=True)
x,y,z = m.get_edges()
x2,y2,z2 = m2.get_edges()

# Adding some 3D "home made" perspective:
zx, zy = .3, .3
for i in xrange(len(x2)):
  if x2[i] != None:
    x2[i] += zx * z2[i]
    y2[i] += zy * z2[i]
    
# Plotting stuff
plt.figure()
plt.clf()
plt.gca().set_aspect('equal')
plt.axis('off')
plt.plot(x,y, 'b-', linewidth  = 4., label = 'Orginal Mesh')
plt.plot(x2,y2, 'r-', linewidth  = 1., label = 'Sweeped mesh')
plt.legend()
plt.show()
Exemple #4
0
from abapy.mesh import RegularQuadMesh, Mesh
from matplotlib import pyplot as plt

m = RegularQuadMesh(N1=2, N2=2)
m.add_set('el_set', [1, 2])
m.add_surface('my_surface', [
    ('el_set', 2),
])
m2 = m.extrude(l=1., N=2)
x, y, z = m.get_edges()
x2, y2, z2 = m2.get_edges()

# Adding some 3D "home made" perspective:
zx, zy = .3, .3
for i in xrange(len(x2)):
    if x2[i] != None:
        x2[i] += zx * z2[i]
        y2[i] += zy * z2[i]

# Plotting stuff
plt.figure()
plt.clf()
plt.gca().set_aspect('equal')
plt.axis('off')
plt.plot(x, y, 'b-', linewidth=4., label='Orginal Mesh')
plt.plot(x2, y2, 'r-', linewidth=1., label='Extruded mesh')
plt.legend()
plt.show()
from abapy.mesh import RegularQuadMesh
mesh = RegularQuadMesh()
mesh.add_surface('topsurface', [ ('top', 1) ])
mesh.add_surface('topsurface', [ ('top', 2) ])
mesh.surfaces