Exemplo n.º 1
0
def create_hex_mesh():
    p = part('Part1','C3D8','linear_hex')
    pts = [[0.,0.,0.],
               [1.,0.,0.],
               [1.,1.,0.],
               [0.,1.,0.],
               [0.,0.,1.],
               [1.,0.,1.],
               [1.,1.,1.],
               [0.,1.,1.]]
    nodes = []
    for i in [-1,0]:
        for j in [-1,0]:
            for k in [-1,0]:
                for pt in pts:
                    n = [pt[0]+i,pt[1]+j,pt[2]+k]
                    if n not in nodes:
                        nodes.append([n[0],n[1],n[2]])
    count = 0                  
    for i in [-1,0]:
        for j in [-1,0]:
            for k in [-1,0]:
                count += 1
                nodes_c = [nodes.index([pt[0]+i,pt[1]+j,pt[2]+k])+1 for pt in pts]
                pts_c = [[pt[0]+i,pt[1]+j,pt[2]+k] for pt in pts]
                p.add_element(linear_hex(count, pts_c, nodes_c))
        p.moduli = [1.,1.,1.,1.,1.,1.,1.,1.]
    return [p]                
Exemplo n.º 2
0
 def setUp(self):
     self.pts = [[0.,0.,0.],
                 [1.,0.,0.],
                 [1.,1.,0.],
                 [0.,1.,0.],
                 [0.,0.,1.],
                 [1.,0.,1.],
                 [1.,1.,1.],
                 [0.,1.,1.]]
     self.hex = linear_hex(1, self.pts, range(8))
     self.vtk = create_vtk([-1.,0.,1.])
     self.vtk2 = create_vtk([-1., 0., 1.],[5]*27)
     self.vtk3 = create_vtk([-1., 0., 1.],[0, 5, 10]*9)
Exemplo n.º 3
0
def create_hex_part():
    p = part('Part1','C3D8','linear_hex')
    pts = [[0.,0.,0.],
           [1.,0.,0.],
           [1.,1.,0.],
           [0.,1.,0.],
           [0.,0.,1.],
           [1.,0.,1.],
           [1.,1.,1.],
           [0.,1.,1.]]
    nodes = [repr(n+1) for n in range(8)]
    p.add_element(linear_hex(1, pts, nodes))
    p.moduli = [1.]
    return [p]