Ejemplo n.º 1
0
    def write_f06(self,
                  header,
                  pageStamp,
                  page_num=1,
                  f=None,
                  is_mag_phase=False):
        if self.nonlinear_factor is not None:
            return self._write_f06_transient(header, pageStamp, page_num, f)

        msg = header + [
            '                                  S T R E S S E S   A T   G R I D   P O I N T S   - -     S U R F A C E       5\n',
            '0                       SURFACE X-AXIS X  NORMAL(Z-AXIS)  Z         REFERENCE COORDINATE SYSTEM FOR SURFACE DEFINITION CID        0\n',
            '     GRID      ELEMENT            STRESSES IN SURFACE SYSTEM           PRINCIPAL STRESSES            MAX             \n',
            '     ID          ID    FIBRE   NORMAL-X   NORMAL-Y   SHEAR-XY     ANGLE      MAJOR      MINOR      SHEAR     VON MISES\n'
        ]
        #'0     13683          3736    TRIAX6         4.996584E+00   0.0            1.203093E+02   0.0            0.0            0.0'
        #'      13683          3737    TRIAX6        -4.996584E+00   0.0           -1.203093E+02   0.0            0.0            0.0'
        #'      13683                  *TOTALS*       6.366463E-12   0.0           -1.364242E-12   0.0            0.0            0.0'
        for eKey, nxs in sorted(iteritems(self.nx)):
            eKey2 = eKey
            zero = '0'
            for iLoad, nx in enumerate(nxs):
                ny = self.ny[eKey][iLoad]
                txy = self.txy[eKey][iLoad]
                angle = self.angle[eKey][iLoad]
                majorP = self.majorP[eKey][iLoad]
                minorP = self.minorP[eKey][iLoad]
                tmax = self.tmax[eKey][iLoad]
                ovm = self.ovm[eKey][iLoad]

                (elemName) = self.elemName[eKey][iLoad]
                eid = self.eids[eKey][iLoad]
                vals = [nx, ny, txy, majorP, minorP, tmax, ovm]
                (vals2, is_all_zeros) = writeFloats10E(vals)
                [nx, ny, txy, majorP, minorP, tmax, ovm] = vals2
                if eid == 0:
                    eid = zero
                angle, isAllZero = writeFloats8p4F([angle])
                anglei = angle[0]
                msg.append(
                    '%s%8s  %8s   %4s    %s %s %s   %8s %10s %10s %10s  %s\n' %
                    (zero, eKey2, eid, elemName, nx, ny, txy, anglei, majorP,
                     minorP, tmax, ovm))
                zero = ' '
                eKey2 = ' '
        msg.append(pageStamp % page_num)
        f.write(''.join(msg))
        return page_num
    def write_f06(self, f, header=None, page_stamp='PAGE %s', page_num=1, is_mag_phase=False, is_sort1=True):
        if header is None:
            header = []
        if self.nonlinear_factor is not None:
            return self._write_f06_transient(header, page_stamp, page_num, f, is_mag_phase=is_mag_phase, is_sort1=is_sort1)

        msg = header + ['                                  S T R E S S E S   A T   G R I D   P O I N T S   - -     S U R F A C E       5\n',
                        '0                       SURFACE X-AXIS X  NORMAL(Z-AXIS)  Z         REFERENCE COORDINATE SYSTEM FOR SURFACE DEFINITION CID        0\n',
                        '     GRID      ELEMENT            STRESSES IN SURFACE SYSTEM           PRINCIPAL STRESSES            MAX             \n',
                        '     ID          ID    FIBRE   NORMAL-X   NORMAL-Y   SHEAR-XY     ANGLE      MAJOR      MINOR      SHEAR     VON MISES\n']
              #'0     13683          3736    TRIAX6         4.996584E+00   0.0            1.203093E+02   0.0            0.0            0.0'
              #'      13683          3737    TRIAX6        -4.996584E+00   0.0           -1.203093E+02   0.0            0.0            0.0'
              #'      13683                  *TOTALS*       6.366463E-12   0.0           -1.364242E-12   0.0            0.0            0.0'
        for ekey, nxs in sorted(iteritems(self.nx)):
            ekey2 = ekey
            zero = '0'
            for iLoad, nx in enumerate(nxs):
                ny = self.ny[ekey][iLoad]
                txy = self.txy[ekey][iLoad]
                angle = self.angle[ekey][iLoad]
                majorP = self.majorP[ekey][iLoad]
                minorP = self.minorP[ekey][iLoad]
                tmax = self.tmax[ekey][iLoad]
                ovm = self.ovm[ekey][iLoad]

                (elemName) = self.elemName[ekey][iLoad]
                eid = self.eids[ekey][iLoad]
                vals = [nx, ny, txy, majorP, minorP, tmax, ovm]
                (vals2, is_all_zeros) = writeFloats10E(vals)
                [nx, ny, txy, majorP, minorP, tmax, ovm] = vals2
                if eid == 0:
                    eid = zero
                angle, isAllZero = writeFloats8p4F([angle])
                anglei = angle[0]
                msg.append('%s%8s  %8s   %4s    %s %s %s   %8s %10s %10s %10s  %s\n' % (zero, ekey2, eid, elemName, nx, ny, txy, anglei, majorP, minorP, tmax, ovm))
                zero = ' '
                ekey2 = ' '
        msg.append(page_stamp % page_num)
        f.write(''.join(msg))
        return page_num