def storeDisplacements(self, model, U, case):
        """
        fills the displacement object
        """
        self.iSubcases = []
        #self.log = None
        analysisCode = 1
        transient = False
        iSubcase = case.id
        isSort1 = False
        dt = None

        dataCode = {
            'log': self.log,
            'analysisCode': analysisCode,
            'deviceCode': 1,
            'tableCode': 1,
            'sortCode': 0,
            'sortBits': [0, 0, 0],
            'numWide': 8,
            'tableName': 'OUG',
            'nonlinearFactor': None
        }
        #print "headers = %s" %(headers)

        disp = DisplacementObject(dataCode, isSort1, iSubcase, dt=False)

        data = []

        i = 0
        #(nodeID,gridType,t1,t2,t3,r1,r2,r3) = line
        for (nid, node) in sorted(model.nodes.iteritems()):
            line = [nid]
            if node.type == 'GRID':
                line.append('G')
            else:
                raise NotImplementedError('node.type=%s' % (node.type))
            if self.is3D:
                line += U[i:i + 6]  # 1,2,3,4,5,6
                i += 6
            else:
                line += [U[i], U[i + 1], 0., 0., U[i + 2], 0.]  # 1,2,5
                i += 3
            #print("line = ",line)
            data.append(line)
        disp.addF06Data(data, dt)
        self.displacements[iSubcase] = disp
        self.iSubcases.append(iSubcase)
Ejemplo n.º 2
0
    def getDisplacement(self):
        """
        @code
                                             D I S P L A C E M E N T   V E C T O R

        POINT ID.   TYPE          T1             T2             T3             R1             R2             R3
               1      G      9.663032E-05   0.0           -2.199001E-04   0.0           -9.121119E-05   0.0
               2      G      0.0            0.0            0.0            0.0            0.0            0.0
               3      G      0.0            0.0            0.0            0.0            0.0            0.0

        analysisCode = 1 (Statics)
        deviceCode   = 1 (Print)
        tableCode    = 1 (Displacement)
        sortCode     = 0 (Sort2,Real,Sorted Results) => sortBits = [0,0,0]
        numWide      = 8 (???)
        @endcode
        """
        (subcaseName, iSubcase, transient, dt, analysisCode,
         isSort1) = self.readSubcaseNameID()
        headers = self.skip(2)
        dataCode = {
            'log': self.log,
            'analysisCode': analysisCode,
            'deviceCode': 1,
            'tableCode': 1,
            'sortCode': 0,
            'sortBits': [0, 0, 0],
            'numWide': 8,
            'tableName': 'OUG',
            'nonlinearFactor': dt
        }
        #print "headers = %s" %(headers)
        dataTypes = [int, str, float, float, float, float, float, float]
        data = self.readTable(dataTypes)

        if iSubcase in self.displacements:
            self.displacements[iSubcase].addF06Data(data, transient)
        else:
            isSort1 = True
            disp = DisplacementObject(dataCode, isSort1, iSubcase)
            disp.addF06Data(data, transient)
            self.displacements[iSubcase] = disp
        self.iSubcases.append(iSubcase)
Ejemplo n.º 3
0
    def storeDisplacements(self, model, U, case):
        """
        fills the displacement object
        """
        self.iSubcases = []
        #self.log = None
        analysisCode = 1
        transient = False
        iSubcase = case.id
        isSort1 = False
        dt = None

        dataCode = {'log': self.log, 'analysisCode': analysisCode,
                    'deviceCode': 1, 'tableCode': 1, 'sortCode': 0,
                    'sortBits': [0, 0, 0], 'numWide': 8, 'tableName': 'OUG',
                    'nonlinearFactor': None}
        #print "headers = %s" %(headers)

        disp = DisplacementObject(dataCode, isSort1, iSubcase, dt=False)

        data = []

        i = 0
        #(nodeID,gridType,t1,t2,t3,r1,r2,r3) = line
        for (nid, node) in sorted(model.nodes.iteritems()):
            line = [nid]
            if node.type == 'GRID':
                line.append('G')
            else:
                raise NotImplementedError('node.type=%s' % (node.type))
            if self.is3D:
                line += U[i:i + 6]  # 1,2,3,4,5,6
                i += 6
            else:
                line += [U[i], U[i + 1], 0., 0., U[i + 2], 0.]  # 1,2,5
                i += 3
            #print("line = ",line)
            data.append(line)
        disp.addF06Data(data, dt)
        self.displacements[iSubcase] = disp
        self.iSubcases.append(iSubcase)
    def writeResults(self, case):
        Us = self.Us
        Um = self.Um
        Ua = self.Ua

        iUs = self.iUs
        iUm = self.iUm
        iUa = self.iUa
        pageNum = 1

        if case.hasParameter('DISPLACEMENT'):
            (value, options) = case.get_parameter('DISPLACEMENT')
            if options is not []:
                UgSeparate = [[Ua, iUa], [Us, iUs], [Um, iUm]]
                Ug = departition_dense_vector(UgSeparate)

                result = DisplacementObject(dataCode, transient)
                result.addF06Data()

                if 'PRINT' in options:
                    f06.write(result.writeF06(header, pageStamp, pageNum))
                if 'PLOT' in options:
                    op2.write(result.writeOP2(self.Title, self.Subtitle))
Ejemplo n.º 5
0
    def getDisplacement(self):
        """
        @code
                                             D I S P L A C E M E N T   V E C T O R

        POINT ID.   TYPE          T1             T2             T3             R1             R2             R3
               1      G      9.663032E-05   0.0           -2.199001E-04   0.0           -9.121119E-05   0.0
               2      G      0.0            0.0            0.0            0.0            0.0            0.0
               3      G      0.0            0.0            0.0            0.0            0.0            0.0

        analysisCode = 1 (Statics)
        deviceCode   = 1 (Print)
        tableCode    = 1 (Displacement)
        sortCode     = 0 (Sort2,Real,Sorted Results) => sortBits = [0,0,0]
        numWide      = 8 (???)
        @endcode
        """
        (subcaseName, iSubcase, transient, dt, analysisCode,
            isSort1) = self.readSubcaseNameID()
        headers = self.skip(2)
        dataCode = {'log': self.log, 'analysisCode': analysisCode,
                    'deviceCode': 1, 'tableCode': 1,
                    'sortCode': 0, 'sortBits': [0, 0, 0], 'numWide': 8,
                    'tableName': 'OUG', 'nonlinearFactor': dt}
        #print "headers = %s" %(headers)
        dataTypes = [int, str, float, float, float, float, float, float]
        data = self.readTable(dataTypes)

        if iSubcase in self.displacements:
            self.displacements[iSubcase].addF06Data(data, transient)
        else:
            isSort1 = True
            disp = DisplacementObject(dataCode, isSort1, iSubcase)
            disp.addF06Data(data, transient)
            self.displacements[iSubcase] = disp
        self.iSubcases.append(iSubcase)
Ejemplo n.º 6
0
    def writeResults(self, case):
        Us = self.Us
        Um = self.Um
        Ua = self.Ua

        iUs = self.iUs
        iUm = self.iUm
        iUa = self.iUa
        pageNum = 1

        if case.hasParameter('DISPLACEMENT'):
            (value, options) = case.get_parameter('DISPLACEMENT')
            if options is not []:
                UgSeparate = [[Ua, iUa], [Us, iUs], [Um, iUm]]
                Ug = departition_dense_vector(UgSeparate)

                result = DisplacementObject(dataCode, transient)
                result.addF06Data()

                if 'PRINT' in options:
                    f06.write(result.writeF06(header, pageStamp, pageNum))
                if 'PLOT' in options:
                    op2.write(result.writeOP2(self.Title, self.Subtitle))

        if case.hasParameter('SPCFORCES'):
            (value, options) = case.get_parameter('SPCFORCES')
            if options is not []:
                SPCForces = Ksa * Ua + Kss * Us
                if isMPC:
                    SPCForces += Ksm * Um

                result = SPCForcesObject(dataCode, transient)
                result.addF06Data()
                if 'PRINT' in options:
                    f06.write(result.writeF06(header, pageStamp, pageNum))
                if 'PLOT' in options:
                    op2.write(result.writeOP2(Title, Subtitle))

        if case.hasParameter('MPCFORCES'):
            if options is not []:
                (value, options) = case.get_parameter('MPCFORCES')
                MPCForces = Kma * Ua + Kmm * Um
                if isSPC:
                    MPCForces += Kms * Us

                result = MPCForcesObject(dataCode, transient)
                result.addF06Data()
                if 'PRINT' in options:
                    f06.write(result.writeF06(header, pageStamp, pageNum))
                if 'PLOT' in options:
                    f06.write(result.writeOP2(Title, Subtitle))

        if case.hasParameter('GPFORCE'):
            if options is not []:
                (value, options) = case.get_parameter('GPFORCE')
                AppliedLoads = Kaa * Ua
                if isSPC:
                    AppliedLoads += Kas * Us
                if isMPC:
                    AppliedLoads += Kam * Um

                result = AppliedLoadsObject(dataCode, transient)
                result.addF06Data()
                if 'PRINT' in options:
                    f06.write(result.writeF06(header, pageStamp, pageNum))
                if 'PLOT' in options:
                    op2.write(result.writeOP2(Title, Subtitle))

        if case.hasParameter('STRAIN'):
            if options is not []:
                (value, options) = case.get_parameter('STRAIN')

                for (eid, elem) in sorted(model.elements()):
                    pass

                result = xxxObject(dataCode, transient)
                result.addF06Data()
                if 'PRINT' in options:
                    f06.write(result.writeF06(header, pageStamp, pageNum))
                if 'PLOT' in options:
                    op2.write(result.writeOP2(Title, Subtitle))