Ejemplo n.º 1
0
    def computeMesh(self, filename):
        bse = self.geometry._bse

        B1, quads1, nnode1, mem1, ucoord1, vcoord1 = self.meshS
        B2, quads2, nnode2, mem2, ucoord2, vcoord2 = self.meshM
        nodes1 = B1 * bse.vec['cp_str'].array
        nodes2 = B2 * bse.vec['cp_str'].array

        new_nodes = numpy.vstack([nodes1, nodes2])
        new_ucoord = numpy.concatenate(ucoord1 + ucoord2)
        new_vcoord = numpy.concatenate(vcoord1 + vcoord2)

        mem1 = numpy.concatenate(mem1).astype(int)
        mem2 = numpy.concatenate(mem2).astype(int)
        mem2 += numpy.max(mem1) + 1
        new_mem = numpy.concatenate([mem1, mem2]).astype(int)

        mesh = []
        nodes = []
        quads = []
        quad_groups = []
        group_names = []
        nCount = 0
        nGroup = 0
        for i in range(len(self.surfaceNames)):
            mesh.append([
                self.surfaceNames[i], nodes1[nnode1[i]:nnode1[i + 1]],
                quads1[i]
            ])
            nodes.append(nodes1[nnode1[i]:nnode1[i + 1]])
            quads.append(quads1[i] + nCount)
            nCount = nCount + nnode1[i + 1] - nnode1[i]
            quad_groups.append(nGroup * numpy.ones(quads1[i].shape[0], int))
            group_names.append(self.surfaceNames[i])
            nGroup += 1
        for i in range(self.nmem):
            mesh.append([
                self.memberNames[i], nodes2[nnode2[i]:nnode2[i + 1]], quads2[i]
            ])
            nodes.append(nodes2[nnode2[i]:nnode2[i + 1]])
            quads.append(quads2[i] + nCount)
            nCount = nCount + nnode2[i + 1] - nnode2[i]
            quad_groups.append(nGroup * numpy.ones(quads2[i].shape[0], int))
            group_names.append(self.memberNames[i])
            nGroup += 1

        self.write2TecFEquads(filename, mesh)

        quad_groups = numpy.concatenate(quad_groups)

        nodes = numpy.array(numpy.concatenate(nodes, axis=0)[:, :3], order='F')
        quads = numpy.array(numpy.concatenate(quads, axis=0), order='F')

        nnode = nodes.shape[0]
        nquad = quads.shape[0]
        nid, ids = PSMlib.computeuniquenodes(nnode, nodes, 1e-7)
        nodes, quads = PSMlib.removeduplicatenodes(nnode, nid, nquad, ids,
                                                   nodes, quads)

        nnode = nodes.shape[0]
        nquad = quads.shape[0]
        right = PSMlib.countrightquads(nnode, nquad, nodes, quads)
        quads = PSMlib.removerightquads(nquad, nquad - numpy.sum(right), quads,
                                        right)

        temp = numpy.zeros((nquad, 4), int)
        temp[:, 0] = quad_groups[:]
        temp = PSMlib.removerightquads(nquad, nquad - numpy.sum(right), temp,
                                       right)
        quad_groups = temp[:, 0]

        nnode = nodes.shape[0]
        symm = PSMlib.identifysymmnodes(nnode, nodes)

        self.write2TecFEquads('test.dat', [['test', nodes, quads]])

        import BDFwriter
        BDFwriter.writeBDF(filename + '.bdf', nodes, quads, symm, quad_groups,
                           group_names, new_mem, new_nodes, new_ucoord,
                           new_vcoord)
Ejemplo n.º 2
0
    def computeMesh(self, filename):
        oml0 = self.geometry.oml0

        oml0.computePoints()

        B1, quads1, nnode1 = self.meshS
        B2, quads2, nnode2 = self.meshM
        nodes1 = B1.dot(oml0.C)
        nodes2 = B2.dot(oml0.C)

        mesh = []
        nodes = []
        quads = []
        quad_groups = []
        group_names = []
        nCount = 0
        nGroup = 0
        for i in range(len(self.surfaceNames)):
            mesh.append([self.surfaceNames[i], nodes1[nnode1[i]:nnode1[i+1]], quads1[i]])
            nodes.append(nodes1[nnode1[i]:nnode1[i+1]])
            quads.append(quads1[i]+nCount)
            nCount = nCount + nnode1[i+1] - nnode1[i]
            quad_groups.append(nGroup*numpy.ones(quads1[i].shape[0], int))
            group_names.append(self.surfaceNames[i])
            nGroup += 1
        for i in range(self.nmem):
            mesh.append([self.memberNames[i], nodes2[nnode2[i]:nnode2[i+1]], quads2[i]])
            nodes.append(nodes2[nnode2[i]:nnode2[i+1]])
            quads.append(quads2[i]+nCount)
            nCount = nCount + nnode2[i+1] - nnode2[i]
            quad_groups.append(nGroup*numpy.ones(quads2[i].shape[0], int))
            group_names.append(self.memberNames[i])
            nGroup += 1

        self.geometry.oml0.export.write2TecFEquads(filename,mesh,self.geometry.oml0.var)

        quad_groups = numpy.concatenate(quad_groups)

        nodes = numpy.array(numpy.concatenate(nodes,axis=0)[:,:3], order='F')
        quads = numpy.array(numpy.concatenate(quads,axis=0), order='F')

        nnode = nodes.shape[0]
        nquad = quads.shape[0]
        nid, ids = PSMlib.computeuniquenodes(nnode, nodes, 1e-7)
        nodes, quads = PSMlib.removeduplicatenodes(nnode, nid, nquad, ids, nodes, quads)

        nnode = nodes.shape[0]
        nquad = quads.shape[0]
        right = PSMlib.countrightquads(nnode, nquad, nodes, quads)
        quads = PSMlib.removerightquads(nquad, nquad-numpy.sum(right), quads, right)

        temp = numpy.zeros((nquad,4), int)
        temp[:,0] = quad_groups[:]
        temp = PSMlib.removerightquads(nquad, nquad-numpy.sum(right), temp, right)
        quad_groups = temp[:,0]

        nnode = nodes.shape[0]
        symm = PSMlib.identifysymmnodes(nnode, nodes)

        self.geometry.oml0.export.write2TecFEquads('test.dat',[['test',nodes,quads]],self.geometry.oml0.var[:3])

        import BDFwriter
        BDFwriter.writeBDF(filename+'.bdf',nodes,quads,symm,quad_groups,group_names)
Ejemplo n.º 3
0
    def computeMesh(self, filename):
        oml0 = self.geometry.oml0

        oml0.computePoints()

        B1, quads1, nnode1 = self.meshS
        B2, quads2, nnode2 = self.meshM
        nodes1 = B1.dot(oml0.C)
        nodes2 = B2.dot(oml0.C)

        mesh = []
        nodes = []
        quads = []
        quad_groups = []
        group_names = []
        nCount = 0
        nGroup = 0
        for i in range(len(self.surfaceNames)):
            mesh.append([
                self.surfaceNames[i], nodes1[nnode1[i]:nnode1[i + 1]],
                quads1[i]
            ])
            nodes.append(nodes1[nnode1[i]:nnode1[i + 1]])
            quads.append(quads1[i] + nCount)
            nCount = nCount + nnode1[i + 1] - nnode1[i]
            quad_groups.append(nGroup * numpy.ones(quads1[i].shape[0], int))
            group_names.append(self.surfaceNames[i])
            nGroup += 1
        for i in range(self.nmem):
            mesh.append([
                self.memberNames[i], nodes2[nnode2[i]:nnode2[i + 1]], quads2[i]
            ])
            nodes.append(nodes2[nnode2[i]:nnode2[i + 1]])
            quads.append(quads2[i] + nCount)
            nCount = nCount + nnode2[i + 1] - nnode2[i]
            quad_groups.append(nGroup * numpy.ones(quads2[i].shape[0], int))
            group_names.append(self.memberNames[i])
            nGroup += 1

        self.geometry.oml0.export.write2TecFEquads(filename, mesh,
                                                   self.geometry.oml0.var)

        quad_groups = numpy.concatenate(quad_groups)

        nodes = numpy.array(numpy.concatenate(nodes, axis=0)[:, :3], order='F')
        quads = numpy.array(numpy.concatenate(quads, axis=0), order='F')

        nnode = nodes.shape[0]
        nquad = quads.shape[0]
        nid, ids = PSMlib.computeuniquenodes(nnode, nodes, 1e-7)
        nodes, quads = PSMlib.removeduplicatenodes(nnode, nid, nquad, ids,
                                                   nodes, quads)

        nnode = nodes.shape[0]
        nquad = quads.shape[0]
        right = PSMlib.countrightquads(nnode, nquad, nodes, quads)
        quads = PSMlib.removerightquads(nquad, nquad - numpy.sum(right), quads,
                                        right)

        temp = numpy.zeros((nquad, 4), int)
        temp[:, 0] = quad_groups[:]
        temp = PSMlib.removerightquads(nquad, nquad - numpy.sum(right), temp,
                                       right)
        quad_groups = temp[:, 0]

        nnode = nodes.shape[0]
        symm = PSMlib.identifysymmnodes(nnode, nodes)

        self.geometry.oml0.export.write2TecFEquads('test.dat',
                                                   [['test', nodes, quads]],
                                                   self.geometry.oml0.var[:3])

        import BDFwriter
        BDFwriter.writeBDF(filename + '.bdf', nodes, quads, symm, quad_groups,
                           group_names)
Ejemplo n.º 4
0
    def computeMesh(self, filename):
        bse = self.geometry._bse

        B1, quads1, nnode1, mem1, ucoord1, vcoord1 = self.meshS
        B2, quads2, nnode2, mem2, ucoord2, vcoord2 = self.meshM
        nodes1 = B1 * bse.vec['cp_str'].array
        nodes2 = B2 * bse.vec['cp_str'].array

        new_nodes = numpy.vstack([nodes1, nodes2])
        new_ucoord = numpy.concatenate(ucoord1+ucoord2)
        new_vcoord = numpy.concatenate(vcoord1+vcoord2)

        mem1 = numpy.concatenate(mem1).astype(int)
        mem2 = numpy.concatenate(mem2).astype(int)
        mem2 += numpy.max(mem1) + 1
        new_mem = numpy.concatenate([mem1, mem2]).astype(int)

        mesh = []
        nodes = []
        quads = []
        quad_groups = []
        group_names = []
        nCount = 0
        nGroup = 0
        for i in range(len(self.surfaceNames)):
            mesh.append([self.surfaceNames[i], nodes1[nnode1[i]:nnode1[i+1]], quads1[i]])
            nodes.append(nodes1[nnode1[i]:nnode1[i+1]])
            quads.append(quads1[i]+nCount)
            nCount = nCount + nnode1[i+1] - nnode1[i]
            quad_groups.append(nGroup*numpy.ones(quads1[i].shape[0], int))
            group_names.append(self.surfaceNames[i])
            nGroup += 1
        for i in range(self.nmem):
            mesh.append([self.memberNames[i], nodes2[nnode2[i]:nnode2[i+1]], quads2[i]])
            nodes.append(nodes2[nnode2[i]:nnode2[i+1]])
            quads.append(quads2[i]+nCount)
            nCount = nCount + nnode2[i+1] - nnode2[i]
            quad_groups.append(nGroup*numpy.ones(quads2[i].shape[0], int))
            group_names.append(self.memberNames[i])
            nGroup += 1

        self.write2TecFEquads(filename,mesh)

        quad_groups = numpy.concatenate(quad_groups)

        nodes = numpy.array(numpy.concatenate(nodes,axis=0)[:,:3], order='F')
        quads = numpy.array(numpy.concatenate(quads,axis=0), order='F')

        nnode = nodes.shape[0]
        nquad = quads.shape[0]
        nid, ids = PSMlib.computeuniquenodes(nnode, nodes, 1e-7)
        nodes, quads = PSMlib.removeduplicatenodes(nnode, nid, nquad, ids, nodes, quads)

        nnode = nodes.shape[0]
        nquad = quads.shape[0]
        right = PSMlib.countrightquads(nnode, nquad, nodes, quads)
        quads = PSMlib.removerightquads(nquad, nquad-numpy.sum(right), quads, right)

        temp = numpy.zeros((nquad,4), int)
        temp[:,0] = quad_groups[:]
        temp = PSMlib.removerightquads(nquad, nquad-numpy.sum(right), temp, right)
        quad_groups = temp[:,0]

        nnode = nodes.shape[0]
        symm = PSMlib.identifysymmnodes(nnode, nodes)

        self.write2TecFEquads('test.dat',[['test',nodes,quads]])

        import BDFwriter
        BDFwriter.writeBDF(filename+'.bdf',nodes,quads,symm,quad_groups,group_names,
                           new_mem, new_nodes, new_ucoord, new_vcoord)