Beispiel #1
0
    def _write_sort1_as_sort1(self, header, page_stamp, page_num, f, msg_temp, is_mag_phase):
        ntimes = self.data.shape[0]

        eids = self.element
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg_temp))

            tx = self.data[itime, :, 0]
            ty = self.data[itime, :, 1]
            tz = self.data[itime, :, 2]
            rx = self.data[itime, :, 3]
            ry = self.data[itime, :, 4]
            rz = self.data[itime, :, 5]
            for eid, itx, ity, itz, irx, iry, irz in zip(eids, tx, ty, tz, rx, ry, rz):
                [txr, tyr, tzr, rxr, ryr, rzr,
                 txi, tyi, tzi, rxi, ryi, rzi] = write_imag_floats_13e([itx, ity, itz, irx, iry, irz], is_mag_phase)
                #'0               1.000000E-01      0.0           2.912573E+00  0.0           0.0           0.0           0.0'
                #'                                    0.0         179.9942        0.0           0.0           0.0           0.0'
                f.write('                %8i    %-13s %-13s %-13s %-13s %-13s %s\n'
                        '                %8s    %-13s %-13s %-13s %-13s %-13s %s\n' % (
                            eid, txr, tyr, tzr, rxr, ryr, rzr,
                            '', txi, tyi, tzi, rxi, ryi, rzi))

            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #2
0
    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 = []
        msg_temp = self.get_f06_header(is_mag_phase=is_mag_phase, is_sort1=is_sort1)

        ntimes = self.data.shape[0]

        eids = self.element
        is_odd = False
        nwrite = len(eids)
        if len(eids) % 2 == 1:
            nwrite -= 1
            is_odd = True

        #print('len(eids)=%s nwrite=%s is_odd=%s' % (len(eids), nwrite, is_odd))
        for itime in range(ntimes):
            dt = self._times[itime]  # TODO: rename this...
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg_temp))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))
            spring_force = self.data[itime, :, 0]

            out = []
            for eid, spring_forcei in zip(eids, spring_force):
                [rspring, ispring] = write_imag_floats_13e([spring_forcei], is_mag_phase)
                #ELEMENT                             AXIAL                                       TORSIONAL
                    #ID.                              STRESS                                         STRESS
                    #14                  0.0          /  0.0                           0.0          /  0.0


                f.write('      %8i   %-13s / %-13s\n' % (eid, rspring, ispring))
            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
    def _write_sort1_as_sort1(self, header, page_stamp, page_num, f, msg_temp):
        ntimes = self.data.shape[0]

        eids = self.element
        is_odd = False
        nwrite = len(eids)
        nrows = nwrite // 4
        nleftover = nwrite - nrows * 4

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg_temp))
            stress = self.data[itime, :, 0]

            out = []
            for eid, stressi in zip(eids, stress):
                out.append([eid, write_float_13e(stressi)])

            for i in range(0, nrows * 4, 4):
                f.write('    %10i  %13s    %10i  %13s    %10i  %13s    %10i  %13s\n' % (
                    tuple(out[i] + out[i + 1] + out[i + 2] + out[i + 3])))

            i = nrows * 4
            if nleftover == 3:
                f.write('    %10i  %13s    %10i  %13s    %10i  %13s\n' % (
                    tuple(out[i] + out[i + 1] + out[i + 2])))
            elif nleftover == 2:
                f.write('    %10i  %13s    %10i  %13s\n' % (
                    tuple(out[i] + out[i + 1])))
            elif nleftover == 1:
                f.write('    %10i  %13s\n' % tuple(out[i]))
            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #4
0
    def write_f06(self, header, page_stamp, page_num=1, f=None, is_mag_phase=False, is_sort1=True):
        msg = self._get_msgs()
        (ntimes, ntotal) = self.data.shape[:2]
        eids = self.elements

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg))

            #[tx, ty, tz, rx, ry, rz]
            tx = self.data[itime, :, 0]
            ty = self.data[itime, :, 1]
            tz = self.data[itime, :, 2]
            rx = self.data[itime, :, 3]
            ry = self.data[itime, :, 4]
            rz = self.data[itime, :, 5]

            # loop over all the elements
            for (i, eid, txi, tyi, tzi, rxi, ryi, rzi) in zip(
                count(), eids, tx, ty, tz, rx, ry, rz):

                vals = [txi, tyi, tzi, rxi, ryi, rzi]
                (vals2, is_all_zeros) = writeFloats13E(vals)
                [txi, tyi, tzi, rxi, ryi, rzi] = vals2
                msg.append('0                   %8i     %-13s %-13s %-13s %-13s %-13s %s\n' % (
                           eid, txi, tyi, tzi, rxi, ryi, rzi))
            f.write(page_stamp % page_num)
            page_num += 1
        if self.nonlinear_factor is None:
            page_num -= 1
        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 = []
        msg = self._get_msgs()
        (ntimes, ntotal) = self.data.shape[:2]
        eids = self.element
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg))

            #[element_force, axial_displacement, axial_velocity, axial_stress, axial_strain, plastic_strain, is_failed]
            element_force = self.data[itime, :, 0]
            axial_displacement = self.data[itime, :, 1]
            axial_velocity = self.data[itime, :, 2]
            axial_stress = self.data[itime, :, 3]
            axial_strain = self.data[itime, :, 4]
            plastic_strain = self.data[itime, :, 5]
            is_failed = self.is_failed[itime, :, 0]

            for (i, eid, element_forcei, axial_displacementi, axial_velocityi, axial_stressi, axial_straini, plastic_straini, is_failedi) in zip(
                count(), eids, element_force, axial_displacement, axial_velocity, axial_stress, axial_strain, plastic_strain, is_failed):

                vals = [element_forcei, axial_displacementi, axial_velocityi, axial_stressi, axial_straini, plastic_straini, is_failedi]
                vals2 = write_floats_13e(vals)
                [element_forcei, axial_displacementi, axial_velocityi, axial_stressi, axial_straini, plastic_straini, is_failedi] = vals2
                f.write('0%8i   %-13s  %-13s  %-13s  %-13s  %-13s  %-13s  %s\n'
                        % (eid, element_forcei, axial_displacementi, axial_velocityi, axial_stressi, axial_straini, plastic_straini, is_failedi))
            f.write(page_stamp % page_num)
            page_num += 1
        if self.nonlinear_factor is None:
            page_num -= 1
        return page_num
Beispiel #6
0
    def write_f06(self, header, page_stamp, page_num=1, f=None, is_mag_phase=False, is_sort1=True):
        msg = self._get_msgs()
        (ntimes, ntotal) = self.data.shape[:2]
        eids = self.element_node[:, 0]
        nids = self.element_node[:, 1]

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg))

            #[radial, azimuthal, axial, shear, omax, oms, ovm]
            radial = self.data[itime, :, 0]
            azimuthal = self.data[itime, :, 1]
            axial = self.data[itime, :, 2]
            shear = self.data[itime, :, 3]
            omax = self.data[itime, :, 4]
            oms = self.data[itime, :, 5]
            ovm = self.data[itime, :, 6]

            # loop over all the elements
            for (i, eid, nid, radiali, azimuthali, axiali, sheari, omaxi, omsi, ovmi) in zip(
                count(), eids, nids, radial, azimuthal, axial, shear, omax, oms, ovm):

                vals = [radiali, azimuthali, axiali, sheari, omaxi, omsi, ovmi]
                (vals2, is_all_zeros) = writeFloats13E(vals)
                [radiali, azimuthali, axiali, sheari, omaxi, omsi, ovmi] = vals2
                f.write('0%8i   %-13s  %-13s  %-13s  %-13s  %-13s  %-13s  %-13s %s\n'
                    % (eid, nid, radiali, azimuthali, axiali, sheari, omaxi, omsi, ovmi))
            f.write(page_stamp % page_num)
            page_num += 1
        if self.nonlinear_factor is None:
            page_num -= 1
        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 = []
        msg = self._get_msgs()
        (ntimes, ntotal) = self.data.shape[:2]
        eids = self.element

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg))
            #[tx, ty, tz, rx, ry, rz]
            tx = self.data[itime, :, 0]
            ty = self.data[itime, :, 1]
            tz = self.data[itime, :, 2]
            rx = self.data[itime, :, 3]
            ry = self.data[itime, :, 4]
            rz = self.data[itime, :, 5]

            for eid, txi, tyi, tzi, rxi, ryi, rzi in zip(
                eids, tx, ty, tz, rx, ry, rz):

                vals = [txi, tyi, tzi, rxi, ryi, rzi]
                vals2 = write_floats_13e(vals)
                [txi, tyi, tzi, rxi, ryi, rzi] = vals2
                f.write('0                   %8i     %-13s %-13s %-13s %-13s %-13s %s\n' % (
                        eid, txi, tyi, tzi, rxi, ryi, rzi))
            f.write(page_stamp % page_num)
            page_num += 1
        if self.nonlinear_factor is None:
            page_num -= 1
        return page_num
Beispiel #8
0
    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 = []
        msg = self._get_msgs()
        (ntimes, ntotal) = self.data.shape[:2]
        eids = self.element
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg))

            compX, shearY, shearZ, axialU, shearV, shearW, slipV, slipW
            compX = self.data[itime, :, 0]
            shearY = self.data[itime, :, 1]
            shearZ = self.data[itime, :, 2]
            axialU = self.data[itime, :, 3]
            shearV = self.data[itime, :, 4]
            shearW = self.data[itime, :, 5]
            slipV = self.data[itime, :, 6]
            slipW = self.data[itime, :, 7]

            for (i, eid, compXi, shearYi, shearZi, axialUi, shearVi, shearWi, slipVi, slipWi) in zip(
                count(), eids, compX, shearY, shearZ, axialU, shearV, shearW, slipV, slipW):

                vals = [compXi, shearYi, shearZi, axialUi, shearVi, shearWi, slipVi, slipWi]
                vals2 = write_floats_13e(vals)
                [compXi, shearYi, shearZi, axialUi, shearVi, shearWi, slipVi, slipWi] = vals2
                f.write('0%8i   %-13s  %-13s  %-13s  %-13s  %-13s  %-13s  %-13s %s\n'
                    % (eid, compXi, shearYi, shearZi, axialUi, shearVi, shearWi, slipVi, slipWi))
            f.write(page_stamp % page_num)
            page_num += 1
        if self.nonlinear_factor is None:
            page_num -= 1
        return page_num
    def _write_sort1_as_sort1(self, header, page_stamp, page_num, f, msg_temp):
        ntimes = self.data.shape[0]

        eids = self.element
        is_odd = False
        nwrite = len(eids)

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg_temp))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))
            axial = self.data[itime, :, 0]
            eqs = self.data[itime, :, 1]
            total = self.data[itime, :, 2]
            epcs = self.data[itime, :, 3]
            ecs = self.data[itime, :, 4]
            lts = self.data[itime, :, 5]

            #print "dt=%s axials=%s eqs=%s ts=%s epcs=%s ecs=%s lts=%s" %(dt,axial,eqs,ts,epcs,ecs,lts)
            #msgE[eid] = '      ELEMENT-ID = %8i\n' % (eid)
            #if eid not in msgT:
                #msgT[eid] = []
            #msgT[eid].append('  %9.3E       %13.6E       %13.6E       %13.6E       %13.6E       %13.6E       %13.6E\n' % (dt, axial, eqs, ts, epcs, ecs, lts))

            for eid, axiali, eqsi, totali, epcsi, ecsi, ltsi in zip(eids, axial, eqs, total, epcs, ecs, lts):
                ([saxial, seqs, stotal, sepcs, secs, slts]) = write_floats_13e(
                    [axiali, eqsi, totali, epcsi, ecsi, ltsi])

            f.write('  %8i       %-13s       %-13s       %-13s       %-13s       %-13s       %s\n' % (
                eid, saxial, seqs, stotal, sepcs, secs, slts))
            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #10
0
    def _write_sort1_as_sort1(self, f06_file, header, page_stamp, msg, page_num):
        (ntimes, ntotal) = self.data.shape[:2]
        eids = self.element
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg))

            sd = self.data[itime, :, 0]
            sxc = self.data[itime, :, 1]
            sxd = self.data[itime, :, 2]
            sxe = self.data[itime, :, 3]
            sxf = self.data[itime, :, 4]
            axial = self.data[itime, :, 5]
            smax = self.data[itime, :, 6]
            smin = self.data[itime, :, 7]
            MS = self.data[itime, :, 8]

            for (i, eid, sdi, sxci, sxdi, sxei, sxfi, axiali, smaxi, smini, MSi) in zip(
                     count(), eids, sd, sxc, sxd, sxe, sxf, axial, smax, smin, MS):

                vals = [sdi, sxci, sxdi, sxei, sxfi, axiali, smaxi, smini, MSi]
                vals2 = write_floats_13e(vals)
                [sdi, sxci, sxdi, sxei, sxfi, axiali, smaxi, smini, MSi] = vals2
                f06_file.write('0%8i   %-13s  %-13s  %-13s  %-13s  %-13s  %-13s  %-13s %s %s\n'
                               % (eid, sdi, sxci, sxdi, sxei, sxfi, axiali, smaxi, smini, MSi))

            f06_file.write(page_stamp % page_num)
            page_num += 1

        if self.nonlinear_factor is None:
            page_num -= 1
        return page_num
Beispiel #11
0
    def _write_f06_transient(self, header, page_stamp, page_num=1, f=None, is_mag_phase=False):
        words = ['                                  S T R A I N S   I N   B E A M   E L E M E N T S        ( C B E A M )\n',
                 '                    STAT DIST/\n',
                 '   ELEMENT-ID  GRID   LENGTH    SXC           SXD           SXE           SXF           S-MAX         S-MIN         M.S.-T   M.S.-C\n']
        msg = []
        itime = 0
        ntimes = len(self.smax)
        for dt, SMaxs in sorted(iteritems(self.smax)):
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            #header[1] = ' %s = %10.4E\n' % (self.data_code['name'], dt)
            msg += header + words
            for eid, Smax in sorted(iteritems(SMaxs)):
                msg.append('0  %8i\n' % eid)
                for i, nid in enumerate(self.grids[eid]):
                    xxb = self.xxb[eid][i]
                    sxc = self.sxc[dt][eid][i]
                    sxd = self.sxd[dt][eid][i]
                    sxe = self.sxe[dt][eid][i]
                    sxf = self.sxf[dt][eid][i]
                    sMax = self.smax[dt][eid][i]
                    sMin = self.smin[dt][eid][i]
                    SMt = self.MS_tension[dt][eid][i]
                    SMc = self.MS_compression[dt][eid][i]
                    (vals2, is_all_zeros) = writeFloats13E([sxc, sxd, sxe, sxf,
                                                            sMax, sMin, SMt, SMc])
                    (sxc, sxd, sxe, sxf, sMax, sMin, SMt, SMc) = vals2
                    msg.append('%19s   %4.3f   %12s %12s %12s %12s %12s %12s %12s %s\n' % (nid, xxb, sxc, sxd, sxe, sxf, sMax, sMin, SMt, SMc))

            msg.append(page_stamp % page_num)
            f.write(''.join(msg))
            msg = ['']
            page_num += 1
            itime += 1
        return page_num - 1
Beispiel #12
0
    def _write_sort1_as_sort1(self, header, page_stamp, page_num, f, msg_temp):
        ntimes = self.data.shape[0]

        eids = self.element
        is_odd = False
        nwrite = len(eids)
        if len(eids) % 2 == 1:
            nwrite -= 1
            is_odd = True

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg_temp))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))
            axial = self.data[itime, :, 0]
            SMa = self.data[itime, :, 1]
            torsion = self.data[itime, :, 2]
            SMt = self.data[itime, :, 3]

            out = []
            for eid, axiali, SMai, torsioni, SMti in zip(eids, axial, SMa, torsion, SMt):
                [axiali, torsioni, SMai, SMti] = write_floats_13e([axiali, torsioni, SMai, SMti])
                out.append([eid, axiali, SMai, torsioni, SMti])

            for i in range(0, nwrite, 2):
                out_line = '      %8i %-13s  %-13s %-13s  %-13s %-8i   %-13s  %-13s %-13s  %-s\n' % (tuple(out[i] + out[i + 1]))
                f.write(out_line)
            if is_odd:
                out_line = '      %8i %-13s  %-13s %-13s  %13s\n' % (tuple(out[-1]))
                f.write(out_line)
            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #13
0
    def _write_f06_transient(self, header, page_stamp, page_num=1, f=None, is_mag_phase=False):
        words = [
            "                                  S T R A I N S    I N   B A R   E L E M E N T S           ( C B A R )\n",
            "  ELEMENT        SA1            SA2            SA3            SA4           AXIAL          SA-MAX         SA-MIN     M.S.-T\n",
            "    ID.          SB1            SB2            SB3            SB4           STRAIN         SB-MAX         SB-MIN     M.S.-C\n",
        ]
        msg = []
        i = 0
        ntimes = len(self.e1)
        for dt, E1s in sorted(iteritems(self.e1)):
            header = _eigenvalue_header(self, header, i, ntimes, dt)
            msg += header + words
            for eid, e1s in sorted(iteritems(E1s)):
                # eType = self.eType[eid]
                axial = self.axial[dt][eid]
                # MSt = self.MSt[eid]
                # MSc = self.MSc[eid]
                MSt = ""
                MSc = ""

                e1 = self.e1[dt][eid]
                e2 = self.e2[dt][eid]
                e3 = self.e3[dt][eid]
                e4 = self.e4[dt][eid]
                emax = self.emax[dt][eid]
                emin = self.emin[dt][eid]
                vals = [
                    e1[0],
                    e2[0],
                    e3[0],
                    e4[0],
                    axial,
                    emax[0],
                    emin[0],
                    e1[1],
                    e2[1],
                    e3[1],
                    e4[1],
                    emax[1],
                    emin[1],
                ]
                (vals2, is_all_zeros) = writeFloats13E(vals)
                [e10, e20, e30, e40, axial, emax0, emin0, e11, e21, e31, e41, emax1, emin1] = vals2

                msg.append(
                    "0%8i   %-13s  %-13s  %-13s  %-13s  %-13s  %-13s  %-13s %s\n"
                    % (eid, e10, e20, e30, e40, axial, emax0, emin0, MSt)
                )
                msg.append(
                    " %8s   %-13s  %-13s  %-13s  %-13s  %-13s  %-13s  %-13s %s\n"
                    % ("", e11, e21, e31, e41, "", emax1, emin1, MSc)
                )

            msg.append(page_stamp % page_num)
            f.write("".join(msg))
            msg = [""]
            page_num += 1
            i += 1
        return page_num - 1
Beispiel #14
0
    def write_f06(self, header, page_stamp, page_num=1, f=None, is_mag_phase=False, is_sort1=True):
        msg = self._get_msgs()
        ntimes = self.data.shape[0]

        eids = self.element_node[:, 0]
        nids = self.element_node[:, 1]
        locs = self.element_node[:, 2]
        # xxbs = self.xxb
        # print('CBEAM ntimes=%s ntotal=%s' % (ntimes, ntotal))
        loc_map = ["C", "D", "E", "F", "C", "D", "E", "F"]
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write("".join(header + msg))

            longs = self.data[itime, :, 0]
            eqSs = self.data[itime, :, 1]
            tEs = self.data[itime, :, 2]
            epss = self.data[itime, :, 3]
            ecss = self.data[itime, :, 4]

            # msg = ['                        N O N L I N E A R   S T R E S S E S   I N   B E A M   E L E M E N T S     ( C B E A M )\n',
            #' \n',
            #'          ELEMENT    GRID     POINT        STRESS          EQUIVALENT        TOTAL STRAIN      EFF. STRAIN       EFF. CREEP\n',
            #'             ID       ID                                     STRESS                          PLASTIC/NLELAST       STRAIN\n',]
            #'0               1         1     C        1.738817E+03      1.738817E+03      5.796055E-05      0.0               0.0\n',
            #'                                D        1.229523E+03      1.229523E+03      4.098411E-05      0.0               0.0\n',
            eid_old = None
            for (i, eid, nid, loc, longi, eqS, tE, eps, ecs) in zip(
                count(), eids, nids, locs, longs, eqSs, tEs, epss, ecss
            ):

                vals = [longi, eqS, tE, eps, ecs]
                (vals2, is_all_zeros) = writeFloats13E(vals)
                [longi, eqS, tE, eps, ecs] = vals2
                if loc == 0:
                    f.write(
                        "0  %14i  %8i  %4s       %13s     %13s     %13s %13s %s\n"
                        % (eid, nid, "C", longi, eqS, tE, eps, ecs.rstrip())
                    )
                elif loc == 4:
                    f.write(
                        "   %14s  %8i  %4s       %13s     %13s     %13s %13s %s\n"
                        % ("", nid, "C", longi, eqS, tE, eps, ecs.rstrip())
                    )
                else:
                    loci = loc_map[loc]
                    f.write(
                        "   %14s  %8s  %4s       %13s     %13s     %13s %13s %s\n"
                        % ("", "", loci, longi, eqS, tE, eps, ecs.rstrip())
                    )
            f.write(page_stamp % page_num)
            page_num += 1

        if self.nonlinear_factor is None:
            page_num -= 1
        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 = []
        msg, nnodes, cen = _get_plate_msg(self)

        # write the f06
        ntimes = self.data.shape[0]

        eids = self.element_node[:, 0]
        nids = self.element_node[:, 1]

        #cen_word = 'CEN/%i' % nnodes
        cen_word = cen
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))

            #[fiber_dist, oxx, oyy, txy, angle, majorP, minorP, ovm]
            fiber_dist = self.data[itime, :, 0]
            oxx = self.data[itime, :, 1]
            oyy = self.data[itime, :, 2]
            txy = self.data[itime, :, 3]
            angle = self.data[itime, :, 4]
            majorP = self.data[itime, :, 5]
            minorP = self.data[itime, :, 6]
            ovm = self.data[itime, :, 7]

            for (i, eid, nid, fdi, oxxi, oyyi, txyi, anglei, major, minor, ovmi) in zip(
                 count(), eids, nids, fiber_dist, oxx, oyy, txy, angle, majorP, minorP, ovm):
                [fdi, oxxi, oyyi, txyi, major, minor, ovmi] = write_floats_13e(
                    [fdi, oxxi, oyyi, txyi, major, minor, ovmi])
                ilayer = i % 2
                # tria3
                if self.element_type in [33, 74]:  # CQUAD4, CTRIA3
                    if ilayer == 0:
                        f.write('0  %6i   %-13s     %-13s  %-13s  %-13s   %8.4f   %-13s   %-13s  %s\n' % (eid, fdi, oxxi, oyyi, txyi, anglei, major, minor, ovmi))
                    else:
                        f.write('   %6s   %-13s     %-13s  %-13s  %-13s   %8.4f   %-13s   %-13s  %s\n' % ('', fdi, oxxi, oyyi, txyi, anglei, major, minor, ovmi))

                elif self.element_type in [64, 70, 75, 82, 144]:  # CQUAD8, CTRIAR, CTRIA6, CQUADR, CQUAD4
                    # bilinear
                    if nid == 0 and ilayer == 0:  # CEN
                        f.write('0  %8i %8s  %-13s  %-13s %-13s %-13s   %8.4f  %-13s %-13s %s\n' % (eid, cen_word, fdi, oxxi, oyyi, txyi, anglei, major, minor, ovmi))
                    elif ilayer == 0:
                        f.write('   %8s %8i  %-13s  %-13s %-13s %-13s   %8.4f  %-13s %-13s %s\n' % ('', nid, fdi, oxxi, oyyi, txyi, anglei, major, minor, ovmi))
                    elif ilayer == 1:
                        f.write('   %8s %8s  %-13s  %-13s %-13s %-13s   %8.4f  %-13s %-13s %s\n\n' % ('', '', fdi, oxxi, oyyi, txyi, anglei, major, minor, ovmi))
                else:
                    raise NotImplementedError('element_name=%s self.element_type=%s' % (self.element_name, self.element_type))

            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
    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 = []
        msg = self._get_msgs()
        (ntimes, ntotal) = self.data.shape[:2]
        eids = self.element
        #print('CBAR ntimes=%s ntotal=%s' % (ntimes, ntotal))
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg))

            s1a = self.data[itime, :, 0]
            s2a = self.data[itime, :, 1]
            s3a = self.data[itime, :, 2]
            s4a = self.data[itime, :, 3]

            axial = self.data[itime, :, 4]
            smaxa = self.data[itime, :, 5]
            smina = self.data[itime, :, 6]
            MSt = self.data[itime, :, 7]

            s1b = self.data[itime, :, 8]
            s2b = self.data[itime, :, 9]
            s3b = self.data[itime, :, 10]
            s4b = self.data[itime, :, 11]

            smaxb = self.data[itime, :, 12]
            sminb = self.data[itime, :, 13]
            MSc = self.data[itime, :, 14]

            for (i, eid, s1ai, s2ai, s3ai, s4ai, axiali, smaxai, sminai, MSti,
                         s1bi, s2bi, s3bi, s4bi,         smaxbi, sminbi, MSci) in zip(
                count(), eids, s1a, s2a, s3a, s4a, axial, smaxa, smina, MSt,
                               s1b, s2b, s3b, s4b,        smaxb, sminb, MSc):

                vals = [s1ai, s2ai, s3ai, s4ai, axiali, smaxai, sminai, MSti,
                        s1bi, s2bi, s3bi, s4bi,         smaxbi, sminbi, MSci]
                vals2 = write_floats_13e(vals)
                [s1ai, s2ai, s3ai, s4ai, axiali, smaxai, sminai, MSti,
                 s1bi, s2bi, s3bi, s4bi,         smaxbi, sminbi, MSci] = vals2
                f.write('0%8i   %-13s  %-13s  %-13s  %-13s  %-13s  %-13s  %-13s %s\n'
                        ' %8s   %-13s  %-13s  %-13s  %-13s  %-13s  %-13s  %-13s %s\n'
                        % (eid, s1ai, s2ai, s3ai, s4ai, axiali, smaxai, sminai, MSti,
                            '', s1bi, s2bi, s3bi, s4bi, '',     smaxbi, sminbi, MSci))

            f.write(page_stamp % page_num)
            page_num += 1

        if self.nonlinear_factor is None:
            page_num -= 1
        return page_num
Beispiel #17
0
    def _write_f06_transient(self, header, page_stamp, page_num=1, f=None, is_mag_phase=False):
        words = [
            "                                 S T R E S S E S   I N   B A R   E L E M E N T S          ( C B A R )\n",
            "  ELEMENT        SA1            SA2            SA3            SA4           AXIAL          SA-MAX         SA-MIN     M.S.-T\n",
            "    ID.          SB1            SB2            SB3            SB4           STRESS         SB-MAX         SB-MIN     M.S.-C\n",
        ]
        i = 0
        ntimes = len(self.s1)
        for dt, S1s in sorted(iteritems(self.s1)):
            header = _eigenvalue_header(self, header, i, ntimes, dt)
            f.write("".join(header + words))
            for eid, S1 in sorted(iteritems(S1s)):
                # eType = self.eType[eid]
                axial = self.axial[dt][eid]
                # MSt = self.MSt[eid]
                # MSc = self.MSc[eid]
                MSt = ""
                MSc = ""

                s1 = self.s1[dt][eid]
                s2 = self.s2[dt][eid]
                s3 = self.s3[dt][eid]
                s4 = self.s4[dt][eid]
                smax = self.smax[dt][eid]
                smin = self.smin[dt][eid]
                vals = [
                    s1[0],
                    s2[0],
                    s3[0],
                    s4[0],
                    axial,
                    smax[0],
                    smin[0],
                    s1[1],
                    s2[1],
                    s3[1],
                    s4[1],
                    smax[1],
                    smin[1],
                ]
                (vals2, is_all_zeros) = writeFloats13E(vals)
                [s1a, s2a, s3a, s4a, axial, smaxa, smina, s1b, s2b, s3b, s4b, smaxb, sminb] = vals2
                f.write(
                    "0%8i   %-13s  %-13s  %-13s  %-13s  %-13s  %-13s  %-13s %s\n"
                    " %8s   %-13s  %-13s  %-13s  %-13s  %-13s  %-13s  %-13s %s\n"
                    % (eid, s1a, s2a, s3a, s4a, axial, smaxa, smina, MSt, "", s1b, s2b, s3b, s4b, "", smaxb, sminb, MSc)
                )
            f.write(page_stamp % page_num)
            msg = [""]
            page_num += 1
            i += 1
        return page_num - 1
    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 = []
        """
        '      EIGENVALUE =  2.005177E+05'
        '      CYCLES =  7.126832E+01'
        '                                           E L E M E N T   S T R A I N   E N E R G I E S'
        ' '
        '                ELEMENT-TYPE = TETRA               * TOTAL ENERGY OF ALL ELEMENTS IN PROBLEM     =   1.002589E+05'
        '                   MODE               1            * TOTAL ENERGY OF ALL ELEMENTS IN SET      -1 =   1.002589E+05'
        '0'
        '                                    ELEMENT-ID          STRAIN-ENERGY           PERCENT OF TOTAL    STRAIN-ENERGY-DENSITY'
        '                                             4          3.247409E+00                 0.0032              1.948445E+01'
        '                                             5          3.977916E+00                 0.0040              2.386749E+01'
        ''
        '                        TYPE = TETRA    SUBTOTAL        7.225325E+00                 0.0072'
        """
        msg_temp = (
            '                                           E L E M E N T   S T R A I N   E N E R G I E S\n'
            ' \n'
            '                ELEMENT-TYPE = TETRA               * TOTAL ENERGY OF ALL ELEMENTS IN PROBLEM     =   %s\n'
            '                   MODE        %8i            * TOTAL ENERGY OF ALL ELEMENTS IN SET      -1 =   %s\n'
            '0\n'
            '                                    ELEMENT-ID          STRAIN-ENERGY           PERCENT OF TOTAL    STRAIN-ENERGY-DENSITY\n'
        )
        ntimes = self.data.shape[0]

        eids = self.element
        #etype = self.element_data_type
        for itime in range(ntimes):
            dt = self._times[itime]  # TODO: rename this...
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            total_energy = 0.
            total_set_energy = 0.
            msg_temp2 = [msg_temp % (total_energy, itime, total_set_energy)]
            f.write(''.join(header + msg_temp2))

            # energy, percent, density
            energy = self.data[itime, :, 0]
            percent = self.data[itime, :, 1]
            density = self.data[itime, :, 2]

            for (eid, energyi, percenti, densityi) in zip(eids, energy, percent, density):
                senergyi = write_float_13e(energyi)
                sdensityi = write_float_13e(densityi)

                f.write(' %8i  %-13s %.4fs %s\n' % (
                    eid, senergyi, percenti, sdensityi))
            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #19
0
    def write_f06(self, header, page_stamp, page_num=1, f=None, is_mag_phase=False, is_sort1=True):
        msg = self._get_msgs()
        ntimes = self.data.shape[0]

        eids = self.element_node[:, 0]
        nids = self.element_node[:, 1]
        xxbs = self.xxb
        # print('CBEAM ntimes=%s ntotal=%s' % (ntimes, ntotal))
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write("".join(header + msg))

            sxcs = self.data[itime, :, 0]
            sxds = self.data[itime, :, 1]
            sxes = self.data[itime, :, 2]
            sxfs = self.data[itime, :, 3]
            smaxs = self.data[itime, :, 4]
            smins = self.data[itime, :, 5]
            SMts = self.data[itime, :, 6]
            SMcs = self.data[itime, :, 7]

            # loop over all the elements
            eid_old = None
            xxb_old = None
            for (i, eid, nid, xxb, sxc, sxd, sxe, sxf, sMax, sMin, SMt, SMc) in zip(
                count(), eids, nids, xxbs, sxcs, sxds, sxes, sxfs, smaxs, smins, SMts, SMcs
            ):
                if eid != eid_old:
                    f.write("0  %8i\n" % eid)
                if xxb == xxb_old:
                    continue
                # #if eid != eid_old and xxb != xxb_old:
                # continue
                vals = [sxc, sxd, sxe, sxf, sMax, sMin, SMt, SMc]
                (vals2, is_all_zeros) = writeFloats13E(vals)
                [sxc, sxd, sxe, sxf, sMax, sMin, SMt, SMc] = vals2
                f.write(
                    "%19s   %4.3f   %12s %12s %12s %12s %12s %12s %12s %s\n"
                    % (nid, xxb, sxc, sxd, sxe, sxf, sMax, sMin, SMt, SMc.strip())
                )
                eid_old = eid
                xxb_old = xxb

            f.write(page_stamp % page_num)
            page_num += 1

        if self.nonlinear_factor is None:
            page_num -= 1
        return page_num
Beispiel #20
0
    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 = []
        msg_temp = self.get_f06_header()

        # write the f06
        ntimes = self.data.shape[0]

        eids = self.element
        is_odd = False
        nwrite = len(eids)
        if len(eids) % 2 == 1:
            nwrite -= 1
            is_odd = True

        for itime in range(ntimes):
            dt = self._times[itime]  # TODO: rename this...
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg_temp))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))
            max_shear = self.data[itime, :, 0]
            avg_shear = self.data[itime, :, 1]
            margin = self.data[itime, :, 2]

            out = []
            for eid, max_sheari, avg_sheari, margini in zip(
                    eids, max_shear, avg_shear, margin):
                #[max_sheari, avg_sheari, margini] = write_floats_13e([max_sheari, avg_sheari, margini])
                out.append([eid, max_sheari, avg_sheari, margini])

            for i in range(0, nwrite, 2):
                out_line = '      %8i   %13s  %10.4E %13s  %8i   %13s  %10.4E %s\n' % (
                    tuple(out[i] + out[i + 1]))
                f.write(out_line)
            if is_odd:
                out_line = '      %8i   %13s  %10.4E %s\n' % tuple(out[-1])
                f.write(out_line)
            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
    def write_f06(self,
                  f06_file,
                  header=None,
                  page_stamp='PAGE %s',
                  page_num=1,
                  is_mag_phase=False,
                  is_sort1=True):
        if header is None:
            header = []
        ## TODO: add the f06 header
        msg_temp = [
            '          T E M P E R A T U R E   G R A D I E N T S   A N D   F L U X E S   I N   T R I A N G U L A R   P - E L E M E N T S\n'
            '                 VU-ELEMENT ID=  100005001, P-ELEMENT ID =       5, OUTPUT COORD. ID= (LOCAL), P OF EDGES =  2  2  2\n'  # TODO: wrong
            '                       LOCAL X DIR. = PROJECTED +X DIR.,  LOCAL NORMAL = COUNTER-CLOCKWISE,  ANGLE =    0.0000\n'  # TODO: wrong
            '\n'
            '             VUGRID      X-GRADIENT       Y-GRADIENT       Z-GRADIENT        X-FLUX           Y-FLUX           Z-FLUX    \n'
            #'          111005001     2.000000E+01    -4.799646E-14     0.000000E+00    -4.080000E+03     9.791279E-12     0.000000E+00\n'
        ]
        ntimes = self.data.shape[0]

        #eids = self.element
        for itime in range(ntimes):
            dt = self._times[itime]  # TODO: rename this...
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg_temp))

            # [xgrad, ygrad, zgrad, xflux, yflux, zflux]
            #nids = self.int_data[itime, :, 0]
            vugrids = self.int_data[itime, :, 0]
            print(vugrids)
            xgrad = self.data[itime, :, 0]
            ygrad = self.data[itime, :, 1]
            zgrad = self.data[itime, :, 2]
            xflux = self.data[itime, :, 3]
            yflux = self.data[itime, :, 4]
            zflux = self.data[itime, :, 5]

            for (vugrid, xgradi, ygradi, zgradi, xfluxi, yfluxi,
                 zfluxi) in zip(vugrids, xgrad, ygrad, zgrad, xflux, yflux,
                                zflux):
                f06_file.write(
                    '         %10i    %-13E    %-13E    %-13E    %-13E    %-13E    %-13E\n'
                    % (vugrid, xgradi, ygradi, zgradi, xfluxi, yfluxi, zfluxi))
            f06_file.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #22
0
    def write_f06(self, f06_file, header=None, page_stamp='PAGE %s', page_num=1,
                  is_mag_phase=False, is_sort1=True):
        if header is None:
            header = []
        msg = self._get_msgs()
        ntimes = self.data.shape[0]

        eids = self.element_node[:, 0]
        nids = self.element_node[:, 1]
        xxbs = self.xxb
        #print('CBEAM ntimes=%s ntotal=%s' % (ntimes, ntotal))
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg))

            sxcs = self.data[itime, :, 0]
            sxds = self.data[itime, :, 1]
            sxes = self.data[itime, :, 2]
            sxfs = self.data[itime, :, 3]

            eid_old = None
            xxb_old = None
            for (eid, nid, xxb, sxc, sxd, sxe, sxf) in zip(
                eids, nids, xxbs, sxcs, sxds, sxes, sxfs):
                if eid != eid_old:
                    f06_file.write('0  %8i\n' % eid)
                if xxb == xxb_old:
                    continue
                # #if eid != eid_old and xxb != xxb_old:
                    #continue
                vals = [sxc, sxd, sxe, sxf]
                vals2 = write_floats_13e(vals)
                [sxc, sxd, sxe, sxf] = vals2
                f06_file.write('%19s   %4.3f   %12s %12s %12s %s\n' % (
                    nid, xxb, sxc, sxd, sxe, sxf.strip()))
                eid_old = eid
                xxb_old = xxb

            f06_file.write(page_stamp % page_num)
            page_num += 1

        if self.nonlinear_factor in (None, np.nan):
            page_num -= 1
        return page_num
Beispiel #23
0
    def write_f06(self,
                  f06_file,
                  header=None,
                  page_stamp='PAGE %s',
                  page_num=1,
                  is_mag_phase=False,
                  is_sort1=True):
        if header is None:
            header = []
        msg = self._get_msgs()
        (ntimes, unused_ntotal) = self.data.shape[:2]
        eids = self.element_node[:, 0]
        nids = self.element_node[:, 1]

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg))

            #[radial, azimuthal, axial, shear, omax, oms, ovm]
            radial = self.data[itime, :, 0]
            azimuthal = self.data[itime, :, 1]
            axial = self.data[itime, :, 2]
            shear = self.data[itime, :, 3]
            omax = self.data[itime, :, 4]
            oms = self.data[itime, :, 5]
            ovm = self.data[itime, :, 6]

            for (eid, nid, radiali, azimuthali, axiali, sheari, omaxi, omsi,
                 ovmi) in zip(eids, nids, radial, azimuthal, axial, shear,
                              omax, oms, ovm):

                vals = [radiali, azimuthali, axiali, sheari, omaxi, omsi, ovmi]
                vals2 = write_floats_13e(vals)
                [radiali, azimuthali, axiali, sheari, omaxi, omsi,
                 ovmi] = vals2
                f06_file.write(
                    '0%8i   %-13s  %-13s  %-13s  %-13s  %-13s  %-13s  %-13s %s\n'
                    % (eid, nid, radiali, azimuthali, axiali, sheari, omaxi,
                       omsi, ovmi))
            f06_file.write(page_stamp % page_num)
            page_num += 1
        if self.nonlinear_factor in (None, np.nan):
            page_num -= 1
        return page_num
Beispiel #24
0
    def _write_sort1_as_sort1(self, header, page_stamp, page_num, f06_file, msg_temp):
        """
        ::
              ELEMENT-ID =      20
                  N O N L I N E A R   F O R C E S  A N D  S T R E S S E S  I N   S C A L A R   S P R I N G S    ( C E L A S 1 )

                     STEP            FORCE         STRESS                        STEP            FORCE         STRESS
                 5.000000E-02     2.000000E+01   1.000000E+01                1.000000E-01     4.000000E+01   2.000000E+01
                 1.500000E-01     6.000000E+01   3.000000E+01                2.000000E-01     8.000000E+01   4.000000E+01
        """
        ntimes = self.data.shape[0]

        eids = self.element
        neids = len(eids)
        is_odd = neids % 2 == 1
        if is_odd:
            neids -= 1

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg_temp))
            force = self.data[itime, :, 0]
            stress = self.data[itime, :, 1]
            for i, eid, forcei, stressi, in zip(count(step=2), eids[:neids:2], force[:neids:2], stress[:neids:2]):
                f06_file.write(
                    '         %-13i   %-13s  %-13s                %-13s   %-13s  %s\n' % (
                        eid,
                        write_float_13e(forcei),
                        write_float_13e(stressi),
                        eids[i + 1],
                        write_float_13e(force[i + 1]),
                        write_float_13e(stress[i + 1])
                ))
            if is_odd:
                f06_file.write('         %-13i   %-13s  %s\n' % (
                    eids[neids],
                    write_float_13e(force[neids]),
                    write_float_13e(stress[neids])
                ))

            f06_file.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #25
0
    def _write_sort1_as_sort1(self, header, page_stamp, page_num, f06_file, msg_temp, is_mag_phase):
        ntimes = self.data.shape[0]

        eids = self.element
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg_temp))

            axial = self.data[itime, :, 0]
            torsion = self.data[itime, :, 1]
            for eid, iaxial, itorsion in zip(eids, axial, torsion):
                [axialr, torsionr, axiali, torsioni] = write_imag_floats_13e([iaxial, itorsion], is_mag_phase)
                f06_file.write('                %8i                 %-13s / %-13s                 %-13s / %s\n' % (
                    eid, axialr, axiali, torsionr, torsioni))

            f06_file.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #26
0
    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 = []
        msg_temp = self.get_f06_header(is_mag_phase=is_mag_phase,
                                       is_sort1=is_sort1)

        ntimes = self.data.shape[0]

        eids = self.element
        is_odd = False
        nwrite = len(eids)
        if len(eids) % 2 == 1:
            nwrite -= 1
            is_odd = True

        #print('len(eids)=%s nwrite=%s is_odd=%s' % (len(eids), nwrite, is_odd))
        for itime in range(ntimes):
            dt = self._times[itime]  # TODO: rename this...
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg_temp))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))
            spring_force = self.data[itime, :, 0]

            out = []
            for eid, spring_forcei in zip(eids, spring_force):
                [rspring, ispring] = write_imag_floats_13e([spring_forcei],
                                                           is_mag_phase)
                #ELEMENT                             AXIAL                                       TORSIONAL
                #ID.                              STRESS                                         STRESS
                #14                  0.0          /  0.0                           0.0          /  0.0

                f.write('      %8i   %-13s / %-13s\n' %
                        (eid, rspring, ispring))
            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
    def _write_sort1_as_sort1(self, header, page_stamp, page_num, f, msg_temp):
        """
        ::
              ELEMENT-ID =      20
                  N O N L I N E A R   F O R C E S  A N D  S T R E S S E S  I N   S C A L A R   S P R I N G S    ( C E L A S 1 )

                     STEP            FORCE         STRESS                        STEP            FORCE         STRESS
                 5.000000E-02     2.000000E+01   1.000000E+01                1.000000E-01     4.000000E+01   2.000000E+01
                 1.500000E-01     6.000000E+01   3.000000E+01                2.000000E-01     8.000000E+01   4.000000E+01
        """
        ntimes = self.data.shape[0]

        eids = self.element
        neids = len(eids)
        is_odd = neids % 2 == 1
        if is_odd:
            neids -= 1

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg_temp))
            force = self.data[itime, :, 0]
            stress = self.data[itime, :, 1]
            for i, eid, forcei, stressi, in zip(count(step=2), eids[:neids:2], force[:neids:2], stress[:neids:2]):
                f.write('         %-13i   %-13s  %-13s                %-13s   %-13s  %s\n' % (
                    eid,
                    write_float_13e(forcei),
                    write_float_13e(stressi),
                    eids[i + 1],
                    write_float_13e(force[i + 1]),
                    write_float_13e(stress[i + 1])
                ))
            if is_odd:
                f.write('         %-13i   %-13s  %s\n' % (
                    eids[neids],
                    write_float_13e(force[neids]),
                    write_float_13e(stress[neids])
                ))

            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #28
0
    def _write_sort1_as_sort1(self, header, page_stamp, page_num, f, msg_temp, is_mag_phase):
        ntimes = self.data.shape[0]

        eids = self.element
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg_temp))

            axial = self.data[itime, :, 0]
            torsion = self.data[itime, :, 1]
            for eid, iaxial, itorsion in zip(eids, axial, torsion):
                [axialr, torsionr, axiali, torsioni] = write_imag_floats_13e([iaxial, itorsion], is_mag_phase)
                f.write('                %8i                 %-13s / %-13s                 %-13s / %s\n' % (
                    eid, axialr, axiali, torsionr, torsioni))

            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #29
0
    def _write_sort1_as_sort1(self, header, page_stamp, page_num, f06_file,
                              msg_temp, is_mag_phase):
        r"""
        C:\\Users\\sdoyle\\Dropbox\\move_tpl\\ofprand1.op2

        '                         C O M P L E X   F O R C E S   I N   B U S H   E L E M E N T S   ( C B U S H ) '
        '                                                          (REAL/IMAGINARY)'
        ' '
        '                  FREQUENCY         FORCE-X       FORCE-Y       FORCE-Z      MOMENT-X      MOMENT-Y      MOMENT-Z  '
        '0               0.0               1.006599E-02  0.0           4.314467E-01  0.0           0.0           0.0'
        '                                 -3.338092E-04  0.0          -9.563536E-03  0.0           0.0           0.0'
        """
        ntimes = self.data.shape[0]

        eids = self.element
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg_temp))

            tx = self.data[itime, :, 0]
            ty = self.data[itime, :, 1]
            tz = self.data[itime, :, 2]
            rx = self.data[itime, :, 3]
            ry = self.data[itime, :, 4]
            rz = self.data[itime, :, 5]
            for eid, itx, ity, itz, irx, iry, irz in zip(
                    eids, tx, ty, tz, rx, ry, rz):
                [txr, tyr, tzr, rxr, ryr, rzr, txi, tyi, tzi, rxi, ryi,
                 rzi] = write_imag_floats_13e([itx, ity, itz, irx, iry, irz],
                                              is_mag_phase)
                #'0               1.000000E-01      0.0           2.912573E+00  0.0           0.0           0.0           0.0'
                #'                                    0.0         179.9942        0.0           0.0           0.0           0.0'
                f06_file.write(
                    '                %8i    %-13s %-13s %-13s %-13s %-13s %s\n'
                    '                %8s    %-13s %-13s %-13s %-13s %-13s %s\n'
                    % (eid, txr, tyr, tzr, rxr, ryr, rzr, '', txi, tyi, tzi,
                       rxi, ryi, rzi))

            f06_file.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
    def write_f06(self, header, page_stamp, page_num=1, f=None, is_mag_phase=False, is_sort1=True):
        msg = self._get_f06_msg()

        ntimes = self.data.shape[0]

        eids = self.node_element[:, 1]
        nids = self.node_element[:, 0]
        enames = self.element_names

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))

            #[t1, t2, t3, r1, r2, r3]
            t1 = self.data[itime, :, 0]
            t2 = self.data[itime, :, 1]
            t3 = self.data[itime, :, 2]
            r1 = self.data[itime, :, 3]
            r2 = self.data[itime, :, 4]
            r3 = self.data[itime, :, 5]

            zero = ' '
            for (nid, eid, ename, t1i, t2i, t3i, r1i, r2i, r3i) in zip(
                 nids, eids, enames, t1, t2, t3, r1, r2, r3):

                vals = [t1i, t2i, t3i, r1i, r2i, r3i]
                (vals2, is_all_zeros) = writeFloats13E(vals)
                [f1, f2, f3, m1, m2, m3] = vals2
                if eid == 0:
                    f.write('   %8s    %10s    %s      %-13s  %-13s  %-13s  %-13s  %-13s  %s\n' % (
                            nid, eid, ename, f1, f2, f3, m1, m2, m3))
                    zero = '0'
                else:
                    f.write('%s  %8s    %10s    %s      %-13s  %-13s  %-13s  %-13s  %-13s  %s\n' % (
                            zero, nid, eid, ename, f1, f2, f3, m1, m2, m3))
                    zero = ' '
            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #31
0
    def write_f06(self, header, page_stamp, page_num=1, f=None, is_mag_phase=False):
        (elem_name, msg_temp) = self.get_f06_header(is_mag_phase)

        # write the f06
        ntimes = self.data.shape[0]

        eids = self.element
        is_odd = False
        nwrite = len(eids)
        if len(eids) % 2 == 1:
            nwrite -= 1
            is_odd = True

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg_temp))

            # TODO: can I get this without a reshape?
            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))
            axial = self.data[itime, :, 0]
            SMa = self.data[itime, :, 1]
            torsion = self.data[itime, :, 2]
            SMt = self.data[itime, :, 3]

            # loop over all the elements
            out = []
            for eid, axiali, SMai, torsioni, SMti in zip(eids, axial, SMa, torsion, SMt):
                ([axiali, torsioni, SMai, SMti],
                is_all_zeros) = writeFloats13E([axiali, torsioni, SMai, SMti])
                out.append([eid, axiali, SMai, torsioni, SMti])

            for i in range(0, nwrite, 2):
                outLine = '      %8i %-13s  %-13s %-13s  %-13s %-8i   %-13s  %-13s %-13s  %-s\n' % (tuple(out[i] + out[i + 1]))
                f.write(outLine)
            if is_odd:
                outLine = '      %8i %-13s  %-13s %-13s  %13s\n' % (tuple(out[-1]))
                f.write(outLine)
            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
    def write_f06(self,
                  f06_file,
                  header=None,
                  page_stamp='PAGE %s',
                  page_num=1,
                  is_mag_phase=False,
                  is_sort1=True):
        if header is None:
            header = []
        msg_temp = [
            '                   F I N I T E   E L E M E N T   T E M P E R A T U R E   G R A D I E N T S   A N D   F L U X E S  \n'
            ' \n'
            '    ELEMENT-ID   EL-TYPE        X-GRADIENT       Y-GRADIENT       Z-GRADIENT        X-FLUX           Y-FLUX           Z-FLUX\n'
            #'            10    ROD         -1.889713E+02                                       3.779427E+04'
        ]
        ntimes = self.data.shape[0]

        eids = self.element
        etype = self.element_data_type
        for itime in range(ntimes):
            dt = self._times[itime]  # TODO: rename this...
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg_temp))

            xgrad = self.data[itime, :, 0]
            #ygrad = self.data[itime, :, 1]
            #zgrad = self.data[itime, :, 2]
            xflux = self.data[itime, :, 1]
            #yflux = self.data[itime, :, 4]
            #zflux = self.data[itime, :, 5]

            for (eid, etypei, xgradi, xfluxi) in zip(eids, etype, xgrad,
                                                     xflux):
                (sxgradi, sxfluxi) = write_floats_13e([xgradi, xfluxi])

                # TODO: hopa is probably the wrong type
                f06_file.write(' %8i  %8s %-13s %-13s %-13s %s\n' %
                               (eid, etypei, sxgradi, '', '', sxfluxi))
            f06_file.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #33
0
    def write_f06(self, header, page_stamp, page_num=1, f=None, is_mag_phase=False):
        msg_temp = self.get_f06_header()

        # write the f06
        (ntimes, ntotal, three) = self.data.shape

        eids = self.element
        is_odd = False
        nwrite = len(eids)
        if len(eids) % 2 == 1:
            nwrite -= 1
            is_odd = True

        for itime in range(ntimes):
            dt = self.times[itime]  # TODO: rename this...
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg_temp))

            # TODO: can I get this without a reshape?
            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))
            max_shear = self.data[itime, :, 0]
            avg_shear = self.data[itime, :, 1]
            margin = self.data[itime, :, 2]

            # loop over all the elements
            out = []
            for eid, max_sheari, avg_sheari, margini in zip(eids, max_shear, avg_shear, margin):
                #([max_sheari, avg_sheari, margini],
                #is_all_zeros) = writeFloats13E([max_sheari, avg_sheari, margini])
                out.append([eid, max_sheari, avg_sheari, margini])

            for i in range(0, nwrite, 2):
                outLine = '      %8i   %13s  %10.4E %13s  %8i   %13s  %10.4E %s\n' % (tuple(out[i] + out[i + 1]))
                f.write(outLine)
            if is_odd:
                outLine = '      %8i   %13s  %10.4E %s\n' % tuple(out[-1])
                f.write(outLine)
            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #34
0
    def _write_sort1_as_sort1(self, header, page_stamp, page_num, f06,
                              msg_temp):
        ntimes = self.data.shape[0]

        eids = self.element
        is_odd = False
        nwrite = len(eids)
        if len(eids) % 2 == 1:
            nwrite -= 1
            is_odd = True

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06.write(''.join(header + msg_temp))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))
            axial = self.data[itime, :, 0]
            SMa = self.data[itime, :, 1]
            torsion = self.data[itime, :, 2]
            SMt = self.data[itime, :, 3]

            out = []
            for eid, axiali, SMai, torsioni, SMti in zip(
                    eids, axial, SMa, torsion, SMt):
                [axiali, torsioni, SMai,
                 SMti] = write_floats_13e([axiali, torsioni, SMai, SMti])
                out.append([eid, axiali, SMai, torsioni, SMti])

            for i in range(0, nwrite, 2):
                out_line = '      %8i %-13s  %-13s %-13s  %-13s %-8i   %-13s  %-13s %-13s  %-s\n' % (
                    tuple(out[i] + out[i + 1]))
                f06.write(out_line)
            if is_odd:
                out_line = '      %8i %-13s  %-13s %-13s  %13s\n' % (tuple(
                    out[-1]))
                f06.write(out_line)
            f06.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #35
0
    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 = []
        msg_temp = self.get_f06_header()

        # write the f06
        ntimes = self.data.shape[0]

        eids = self.element
        is_odd = False
        nwrite = len(eids)
        if len(eids) % 2 == 1:
            nwrite -= 1
            is_odd = True

        for itime in range(ntimes):
            dt = self._times[itime]  # TODO: rename this...
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg_temp))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))
            max_shear = self.data[itime, :, 0]
            avg_shear = self.data[itime, :, 1]
            margin = self.data[itime, :, 2]

            out = []
            for eid, max_sheari, avg_sheari, margini in zip(eids, max_shear, avg_shear, margin):
                #[max_sheari, avg_sheari, margini] = write_floats_13e([max_sheari, avg_sheari, margini])
                out.append([eid, max_sheari, avg_sheari, margini])

            for i in range(0, nwrite, 2):
                out_line = '      %8i   %13s  %10.4E %13s  %8i   %13s  %10.4E %s\n' % (tuple(out[i] + out[i + 1]))
                f.write(out_line)
            if is_odd:
                out_line = '      %8i   %13s  %10.4E %s\n' % tuple(out[-1])
                f.write(out_line)
            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #36
0
    def write_f06(self,
                  f06_file,
                  header=None,
                  page_stamp='PAGE %s',
                  page_num=1,
                  is_mag_phase=False,
                  is_sort1=True):
        if header is None:
            header = []
        msg = self._get_msgs()
        (ntimes, ntotal) = self.data.shape[:2]
        eids = self.element

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg))
            #[tx, ty, tz, rx, ry, rz]
            tx = self.data[itime, :, 0]
            ty = self.data[itime, :, 1]
            tz = self.data[itime, :, 2]
            rx = self.data[itime, :, 3]
            ry = self.data[itime, :, 4]
            rz = self.data[itime, :, 5]

            for eid, txi, tyi, tzi, rxi, ryi, rzi in zip(
                    eids, tx, ty, tz, rx, ry, rz):

                vals = [txi, tyi, tzi, rxi, ryi, rzi]
                vals2 = write_floats_13e(vals)
                [txi, tyi, tzi, rxi, ryi, rzi] = vals2
                f06_file.write(
                    '0                   %8i     %-13s %-13s %-13s %-13s %-13s %s\n'
                    % (eid, txi, tyi, tzi, rxi, ryi, rzi))
            f06_file.write(page_stamp % page_num)
            page_num += 1
        if self.nonlinear_factor in (None, np.nan):
            page_num -= 1
        return page_num
Beispiel #37
0
    def _write_sort1_as_sort1(self, f06_file, header, page_stamp, msg,
                              page_num):
        ntimes = self.data.shape[0]
        eids = self.element
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg))

            sd = self.data[itime, :, 0]
            sxc = self.data[itime, :, 1]
            sxd = self.data[itime, :, 2]
            sxe = self.data[itime, :, 3]
            sxf = self.data[itime, :, 4]
            axial = self.data[itime, :, 5]
            smax = self.data[itime, :, 6]
            smin = self.data[itime, :, 7]
            MS = self.data[itime, :, 8]

            for (i, eid, sdi, sxci, sxdi, sxei, sxfi, axiali, smaxi, smini,
                 MSi) in zip(count(), eids, sd, sxc, sxd, sxe, sxf, axial,
                             smax, smin, MS):

                vals = [sdi, sxci, sxdi, sxei, sxfi, axiali, smaxi, smini, MSi]
                vals2 = write_floats_13e(vals)
                [sdi, sxci, sxdi, sxei, sxfi, axiali, smaxi, smini,
                 MSi] = vals2
                f06_file.write(
                    '0%8i   %-13s  %-13s  %-13s  %-13s  %-13s  %-13s  %-13s %s %s\n'
                    % (eid, sdi, sxci, sxdi, sxei, sxfi, axiali, smaxi, smini,
                       MSi))

            f06_file.write(page_stamp % page_num)
            page_num += 1

        if self.nonlinear_factor in (None, np.nan):
            page_num -= 1
        return page_num
    def write_f06(self,
                  f06_file,
                  header=None,
                  page_stamp='PAGE %s',
                  page_num=1,
                  is_mag_phase=False,
                  is_sort1=True):
        if header is None:
            header = []
        msg_temp = [
            #'                   F I N I T E   E L E M E N T   T E M P E R A T U R E   G R A D I E N T S   A N D   F L U X E S  '
            #' '
            #'    ELEMENT-ID   EL-TYPE        X-GRADIENT       Y-GRADIENT       Z-GRADIENT        X-FLUX           Y-FLUX           Z-FLUX'
            #'             1    QUAD4       -8.372393E-01     1.776357E-15                      8.372393E-01    -1.776357E-15'
            '                                RealConvHeatFluxArray\n'
            '               ELEMENT-ID      FREE-CONVECTION   CONTROL-NODE   FREE-CONVECTION-K\n'
        ]
        ntimes = self.data.shape[0]

        eids = self.element_node[:, 0]
        nids = self.element_node[:, 1]
        for itime in range(ntimes):
            dt = self._times[itime]  # TODO: rename this...
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg_temp))

            # [free_conv, free_conv_k]
            free_conv = self.data[itime, :, 0]
            free_conv_k = self.data[itime, :, 1]

            for (eid, nid, free_convi,
                 free_conv_ki) in zip(eids, nids, free_conv, free_conv_k):
                f06_file.write(' %8i  %-13s %-13s %s\n' %
                               (eid, write_float_13e(free_convi), nid,
                                write_float_13e(free_conv_ki)))
            f06_file.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #39
0
    def _write_f06_transient(self, header, page_stamp, page_num=1, f=None, is_mag_phase=False):
        words = ['                                     S T R E S S E S   I N   R O D   E L E M E N T S      ( C R O D )\n',
                 '       ELEMENT       AXIAL       SAFETY      TORSIONAL     SAFETY       ELEMENT       AXIAL       SAFETY      TORSIONAL     SAFETY\n',
                 '         ID.        STRESS       MARGIN        STRESS      MARGIN         ID.        STRESS       MARGIN        STRESS      MARGIN\n']
        msg = []
        itime = 0
        ntimes = len(self.axial)
        for dt, axials in sorted(iteritems(self.axial)):
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            msg += header + words
            out = []
            for eid in sorted(axials):
                axial = self.axial[dt][eid]
                MSa = self.MS_axial[dt][eid]
                torsion = self.torsion[dt][eid]
                MSt = self.MS_torsion[dt][eid]

                (vals2, is_all_zeros) = writeFloats13E([axial, torsion])
                (axial, torsion) = vals2
                out.append([eid, axial, MSa, torsion, MSt])

            nOut = len(out)
            nWrite = nOut
            if nOut % 2 == 1:
                nWrite = nOut - 1
            for i in range(0, nWrite, 2):
                outLine = '      %8i   %13s  %10.4E %13s  %10.4E   %8i   %13s  %10.4E %13s  %10.4E\n' % (tuple(out[i] + out[i + 1]))
                msg.append(outLine)

            if nOut % 2 == 1:
                outLine = '      %8i   %13s  %10.4E %13s  %10.4E\n' % (tuple(out[-1]))
                msg.append(outLine)
            msg.append(page_stamp % page_num)
            f.write(''.join(msg))
            page_num += 1
            itime += 1
        return page_num - 1
Beispiel #40
0
    def _write_sort1_as_sort1(self, header, page_stamp, page_num, f06_file,
                              msg_temp):
        ntimes = self.data.shape[0]

        eids = self.element
        #is_odd = False
        #nwrite = len(eids)

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg_temp))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))
            axial = self.data[itime, :, 0]
            eqs = self.data[itime, :, 1]
            total = self.data[itime, :, 2]
            epcs = self.data[itime, :, 3]
            ecs = self.data[itime, :, 4]
            lts = self.data[itime, :, 5]

            #print "dt=%s axials=%s eqs=%s ts=%s epcs=%s ecs=%s lts=%s" %(dt,axial,eqs,ts,epcs,ecs,lts)
            #msgE[eid] = '      ELEMENT-ID = %8i\n' % (eid)
            #if eid not in msgT:
            #msgT[eid] = []
            #msgT[eid].append('  %9.3E       %13.6E       %13.6E       %13.6E       %13.6E       %13.6E       %13.6E\n' % (dt, axial, eqs, ts, epcs, ecs, lts))

            for eid, axiali, eqsi, totali, epcsi, ecsi, ltsi in zip(
                    eids, axial, eqs, total, epcs, ecs, lts):
                ([saxial, seqs, stotal, sepcs, secs, slts]) = write_floats_13e(
                    [axiali, eqsi, totali, epcsi, ecsi, ltsi])
                f06_file.write(
                    '  %8i       %-13s       %-13s       %-13s       %-13s       %-13s       %s\n'
                    % (eid, saxial, seqs, stotal, sepcs, secs, slts))
            f06_file.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #41
0
    def write_f06(self, f06_file, header=None, page_stamp='PAGE %s', page_num=1,
                  is_mag_phase=False, is_sort1=True):
        if header is None:
            header = []
        msg = self._get_msgs()
        (ntimes, ntotal) = self.data.shape[:2]
        eids = self.element
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg))

            #comp_x, shear_y, shear_z, axial_u, shear_v, shear_w, slip_v, slip_w
            comp_x = self.data[itime, :, 0]
            shear_y = self.data[itime, :, 1]
            shear_z = self.data[itime, :, 2]
            axial_u = self.data[itime, :, 3]
            shear_v = self.data[itime, :, 4]
            shear_w = self.data[itime, :, 5]
            slip_v = self.data[itime, :, 6]
            slip_w = self.data[itime, :, 7]
            for (i, eid, comp_xi, shear_yi, shear_zi, axial_ui, shear_vi, shear_wi, slip_vi, slip_wi) in zip(
                count(), eids, comp_x, shear_y, shear_z, axial_u, shear_v, shear_w, slip_v, slip_w):

                vals = [comp_xi, shear_yi, shear_zi, axial_ui, shear_vi, shear_wi, slip_vi, slip_wi]
                vals2 = write_floats_13e(vals)
                [comp_xi, shear_yi, shear_zi, axial_ui,
                 shear_vi, shear_wi, slip_vi, slip_wi] = vals2
                f06_file.write(
                    '0%8i   %-13s  %-13s  %-13s  %-13s  %-13s  %-13s  %-13s %s\n'
                    % (eid, comp_xi, shear_yi, shear_zi, axial_ui,
                       shear_vi, shear_wi, slip_vi, slip_wi))
            f06_file.write(page_stamp % page_num)
            page_num += 1
        if self.nonlinear_factor in (None, np.nan):
            page_num -= 1
        return page_num
    def _write_f06_transient(self, header, page_stamp, page_num=1, f=None,
                             is_mag_phase=False, is_sort1=True):
        msg_pack = ['                                          G R I D   P O I N T   F O R C E   B A L A N C E\n',
                    ' \n',
                    '   POINT-ID    ELEMENT-ID     SOURCE             T1             T2             T3             R1             R2             R3\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'
        ntimes = len(self.force_moment)
        itime = 0
        msg = ['']
        for dt, Forces in sorted(iteritems(self.force_moment)):
            zero = ' '
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            msg += header + msg_pack
            for eKey, Force in sorted(iteritems(Forces)):
                for iLoad, force in enumerate(Force):
                    (f1, f2, f3, m1, m2, m3) = force
                    elemName = self.elemName[dt][eKey][iLoad]
                    eid = self.eids[dt][eKey][iLoad]

                    vals = [f1, f2, f3, m1, m2, m3]
                    (vals2, is_all_zeros) = writeFloats13E(vals)
                    [f1, f2, f3, m1, m2, m3] = vals2
                    if eid == 0:
                        eid = ''
                    msg.append('%s  %8s    %10s    %-8s      %-13s  %-13s  %-13s  %-13s  %-13s  %s\n' % (zero, eKey, eid, elemName,
                                                                                                        f1, f2, f3, m1, m2, m3))
                    zero = ' '
                zero = '0'

            msg.append(page_stamp % page_num)
            f.write(''.join(msg))
            msg = ['']
            itime += 1
            page_num += 1
        return page_num - 1
Beispiel #43
0
    def write_f06(self, f06_file, header=None, page_stamp='PAGE %s',
                  page_num=1, is_mag_phase=False, is_sort1=True):
        if header is None:
            header = []
        msg = self._get_msgs()
        ntimes = self.data.shape[0]
        eids = self.element
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg))

            #[element_force, axial_displacement, axial_velocity, axial_stress, axial_strain, plastic_strain, is_failed]
            element_force = self.data[itime, :, 0]
            axial_displacement = self.data[itime, :, 1]
            axial_velocity = self.data[itime, :, 2]
            axial_stress = self.data[itime, :, 3]
            axial_strain = self.data[itime, :, 4]
            plastic_strain = self.data[itime, :, 5]
            is_failed = self.is_failed[itime, :, 0]

            for (i, eid, element_forcei, axial_displacementi, axial_velocityi, axial_stressi, axial_straini, plastic_straini, is_failedi) in zip(
                count(), eids, element_force, axial_displacement, axial_velocity, axial_stress, axial_strain, plastic_strain, is_failed):

                vals = [element_forcei, axial_displacementi, axial_velocityi, axial_stressi, axial_straini, plastic_straini, is_failedi]
                vals2 = write_floats_13e(vals)
                [element_forcei, axial_displacementi, axial_velocityi, axial_stressi, axial_straini, plastic_straini, is_failedi] = vals2
                f06_file.write(
                    '0%8i   %-13s  %-13s  %-13s  %-13s  %-13s  %-13s  %s\n'
                    % (eid, element_forcei, axial_displacementi, axial_velocityi, axial_stressi,
                       axial_straini, plastic_straini, is_failedi))
            f06_file.write(page_stamp % page_num)
            page_num += 1
        if self.nonlinear_factor in (None, np.nan):
            page_num -= 1
        return page_num
Beispiel #44
0
    def _write_sort1_as_sort1(self, header, page_stamp, page_num, f06_file,
                              msg_temp):
        ntimes = self.data.shape[0]

        eids = self.element
        nwrite = len(eids)
        nrows = nwrite // 4
        nleftover = nwrite - nrows * 4

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg_temp))
            stress = self.data[itime, :, 0]

            out = []
            for eid, stressi in zip(eids, stress):
                out.append([eid, write_float_13e(stressi)])

            for i in range(0, nrows * 4, 4):
                f06_file.write(
                    '    %10i  %13s    %10i  %13s    %10i  %13s    %10i  %13s\n'
                    % (tuple(out[i] + out[i + 1] + out[i + 2] + out[i + 3])))

            i = nrows * 4
            if nleftover == 3:
                f06_file.write('    %10i  %13s    %10i  %13s    %10i  %13s\n' %
                               (tuple(out[i] + out[i + 1] + out[i + 2])))
            elif nleftover == 2:
                f06_file.write('    %10i  %13s    %10i  %13s\n' %
                               (tuple(out[i] + out[i + 1])))
            elif nleftover == 1:
                f06_file.write('    %10i  %13s\n' % tuple(out[i]))
            f06_file.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #45
0
    def write_f06(self,
                  f06_file,
                  header=None,
                  page_stamp='PAGE %s',
                  page_num=1,
                  is_mag_phase=False,
                  is_sort1=True):
        if header is None:
            header = []
        msg, nnodes, cen = _get_plate_msg(self)

        # write the f06
        ntimes = self.data.shape[0]

        eids = self.element_node[:, 0]
        nids = self.element_node[:, 1]

        #cen_word = 'CEN/%i' % nnodes
        cen_word = cen
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))

            #[fiber_dist, oxx, oyy, txy, angle, majorP, minorP, ovm]
            fiber_dist = self.data[itime, :, 0]
            oxx = self.data[itime, :, 1]
            oyy = self.data[itime, :, 2]
            txy = self.data[itime, :, 3]
            angle = self.data[itime, :, 4]
            major_principal = self.data[itime, :, 5]
            minor_principal = self.data[itime, :, 6]
            ovm = self.data[itime, :, 7]

            is_linear = self.element_type in {33, 74, 227, 228, 83}
            is_bilinear = self.element_type in {64, 70, 75, 82, 144}
            for (i, eid, nid, fdi, oxxi, oyyi, txyi, anglei, major, minor,
                 ovmi) in zip(count(), eids, nids, fiber_dist, oxx, oyy, txy,
                              angle, major_principal, minor_principal, ovm):
                [fdi, oxxi, oyyi, txyi, major, minor, ovmi] = write_floats_13e(
                    [fdi, oxxi, oyyi, txyi, major, minor, ovmi])
                ilayer = i % 2
                # tria3
                if is_linear:  # CQUAD4, CTRIA3, CTRIAR linear, CQUADR linear
                    if ilayer == 0:
                        f06_file.write(
                            '0  %6i   %-13s     %-13s  %-13s  %-13s   %8.4f   %-13s   %-13s  %s\n'
                            % (eid, fdi, oxxi, oyyi, txyi, anglei, major,
                               minor, ovmi))
                    else:
                        f06_file.write(
                            '   %6s   %-13s     %-13s  %-13s  %-13s   %8.4f   %-13s   %-13s  %s\n'
                            % ('', fdi, oxxi, oyyi, txyi, anglei, major, minor,
                               ovmi))

                elif is_bilinear:  # CQUAD8, CTRIAR, CTRIA6, CQUADR, CQUAD4
                    # bilinear
                    if nid == 0 and ilayer == 0:  # CEN
                        f06_file.write(
                            '0  %8i %8s  %-13s  %-13s %-13s %-13s   %8.4f  %-13s %-13s %s\n'
                            % (eid, cen_word, fdi, oxxi, oyyi, txyi, anglei,
                               major, minor, ovmi))
                    elif ilayer == 0:
                        f06_file.write(
                            '   %8s %8i  %-13s  %-13s %-13s %-13s   %8.4f  %-13s %-13s %s\n'
                            % ('', nid, fdi, oxxi, oyyi, txyi, anglei, major,
                               minor, ovmi))
                    elif ilayer == 1:
                        f06_file.write(
                            '   %8s %8s  %-13s  %-13s %-13s %-13s   %8.4f  %-13s %-13s %s\n\n'
                            % ('', '', fdi, oxxi, oyyi, txyi, anglei, major,
                               minor, ovmi))
                else:  # pragma: no cover
                    msg = 'element_name=%s self.element_type=%s' % (
                        self.element_name, self.element_type)
                    raise NotImplementedError(msg)

            f06_file.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #46
0
    def write_f06(self,
                  f06_file,
                  header=None,
                  page_stamp='PAGE %s',
                  page_num=1,
                  is_mag_phase=False,
                  is_sort1=True):
        if header is None:
            header = []
        msg = self._get_msgs()
        ntimes = self.data.shape[0]

        eids = self.element_node[:, 0]
        nids = self.element_node[:, 1]
        locs = self.element_node[:, 2]
        #xxbs = self.xxb
        #print('CBEAM ntimes=%s ntotal=%s' % (ntimes, ntotal))
        loc_map = [
            'C',
            'D',
            'E',
            'F',
            'C',
            'D',
            'E',
            'F',
        ]
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg))

            longs = self.data[itime, :, 0]
            eqss = self.data[itime, :, 1]
            tes = self.data[itime, :, 2]
            epss = self.data[itime, :, 3]
            ecss = self.data[itime, :, 4]

            #msg = ['                        N O N L I N E A R   S T R E S S E S   I N   B E A M   E L E M E N T S     ( C B E A M )\n',
            #' \n',
            #'          ELEMENT    GRID     POINT        STRESS          EQUIVALENT        TOTAL STRAIN      EFF. STRAIN       EFF. CREEP\n',
            #'             ID       ID                                     STRESS                          PLASTIC/NLELAST       STRAIN\n',]
            #'0               1         1     C        1.738817E+03      1.738817E+03      5.796055E-05      0.0               0.0\n',
            #'                                D        1.229523E+03      1.229523E+03      4.098411E-05      0.0               0.0\n',
            for (eid, nid, loc, longi, eqs, te, eps,
                 ecs) in zip(eids, nids, locs, longs, eqss, tes, epss, ecss):

                vals = [longi, eqs, te, eps, ecs]
                vals2 = write_floats_13e(vals)
                [longi, eqs, te, eps, ecs] = vals2
                if loc == 0:
                    f06_file.write(
                        '0  %14i  %8i  %4s       %13s     %13s     %13s %13s %s\n'
                        % (eid, nid, 'C', longi, eqs, te, eps, ecs.rstrip()))
                elif loc == 4:
                    f06_file.write(
                        '   %14s  %8i  %4s       %13s     %13s     %13s %13s %s\n'
                        % ('', nid, 'C', longi, eqs, te, eps, ecs.rstrip()))
                else:
                    loci = loc_map[loc]
                    f06_file.write(
                        '   %14s  %8s  %4s       %13s     %13s     %13s %13s %s\n'
                        % ('', '', loci, longi, eqs, te, eps, ecs.rstrip()))
            f06_file.write(page_stamp % page_num)
            page_num += 1

        if self.nonlinear_factor in (None, np.nan):
            page_num -= 1
        return page_num
Beispiel #47
0
    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 = []
        msg = self._get_msgs()
        (ntimes, ntotal) = self.data.shape[:2]
        eids = self.element
        #print('CBAR ntimes=%s ntotal=%s' % (ntimes, ntotal))
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg))

            s1a = self.data[itime, :, 0]
            s2a = self.data[itime, :, 1]
            s3a = self.data[itime, :, 2]
            s4a = self.data[itime, :, 3]

            axial = self.data[itime, :, 4]
            smaxa = self.data[itime, :, 5]
            smina = self.data[itime, :, 6]
            MSt = self.data[itime, :, 7]

            s1b = self.data[itime, :, 8]
            s2b = self.data[itime, :, 9]
            s3b = self.data[itime, :, 10]
            s4b = self.data[itime, :, 11]

            smaxb = self.data[itime, :, 12]
            sminb = self.data[itime, :, 13]
            MSc = self.data[itime, :, 14]

            for (i, eid, s1ai, s2ai, s3ai, s4ai, axiali, smaxai, sminai, MSti,
                 s1bi, s2bi, s3bi, s4bi, smaxbi, sminbi,
                 MSci) in zip(count(), eids, s1a, s2a, s3a, s4a, axial, smaxa,
                              smina, MSt, s1b, s2b, s3b, s4b, smaxb, sminb,
                              MSc):

                vals = [
                    s1ai, s2ai, s3ai, s4ai, axiali, smaxai, sminai, MSti, s1bi,
                    s2bi, s3bi, s4bi, smaxbi, sminbi, MSci
                ]
                vals2 = write_floats_13e(vals)
                [
                    s1ai, s2ai, s3ai, s4ai, axiali, smaxai, sminai, MSti, s1bi,
                    s2bi, s3bi, s4bi, smaxbi, sminbi, MSci
                ] = vals2
                f.write(
                    '0%8i   %-13s  %-13s  %-13s  %-13s  %-13s  %-13s  %-13s %s\n'
                    ' %8s   %-13s  %-13s  %-13s  %-13s  %-13s  %-13s  %-13s %s\n'
                    %
                    (eid, s1ai, s2ai, s3ai, s4ai, axiali, smaxai, sminai, MSti,
                     '', s1bi, s2bi, s3bi, s4bi, '', smaxbi, sminbi, MSci))

            f.write(page_stamp % page_num)
            page_num += 1

        if self.nonlinear_factor is None:
            page_num -= 1
        return page_num
Beispiel #48
0
    def write_f06(self, f06_file, header=None, page_stamp='PAGE %s',
                  page_num=1, is_mag_phase=False, is_sort1=True):
        if header is None:
            header = []
        #msg, nnodes, is_bilinear = self._get_msgs()
        if self.is_von_mises:
            von = 'VON'
            mises = 'MISES'
        else:
            von = 'MAX'
            mises = 'SHEAR'

        if self.is_strain:
            words = ['   ELEMENT  PLY   STRAINS IN FIBER AND MATRIX DIRECTIONS    INTER-LAMINAR   STRAINS  PRINCIPAL  STRAINS (ZERO SHEAR)      %s\n' % von,
                     '     ID      ID    NORMAL-1     NORMAL-2     SHEAR-12     SHEAR XZ-MAT  SHEAR YZ-MAT  ANGLE    MAJOR        MINOR        %s\n' % mises]
        else:
            words = ['   ELEMENT  PLY  STRESSES IN FIBER AND MATRIX DIRECTIONS    INTER-LAMINAR  STRESSES  PRINCIPAL STRESSES (ZERO SHEAR)      %s\n' % von,
                     '     ID      ID    NORMAL-1     NORMAL-2     SHEAR-12     SHEAR XZ-MAT  SHEAR YZ-MAT  ANGLE    MAJOR        MINOR        %s\n' % mises]

        if self.element_type == 95:  # CQUAD4
            if self.is_strain:
                msg = ['                     S T R A I N S   I N   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( Q U A D 4 )\n'] + words
            else:
                msg = ['                   S T R E S S E S   I N   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( Q U A D 4 )\n'] + words
        #elif self.element_type == 96:  # CQUAD8
            #nnodes_per_element = 1
        elif self.element_type == 97:  # CTRIA3
            if self.is_strain:
                msg = ['                     S T R A I N S   I N   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( T R I A 3 )\n'] + words
            else:
                msg = ['                   S T R E S S E S   I N   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( T R I A 3 )\n'] + words
        elif self.element_type == 96:  # QUAD8
            # good
            if self.is_strain:
                msg = ['                     S T R A I N S   I N   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( Q U A D 8 )\n'] + words
            else:
                msg = ['                   S T R E S S E S   I N   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( Q U A D 8 )\n'] + words

        elif self.element_type == 98:  # CTRIA6
            # good
            if self.is_strain:
                msg = ['                     S T R A I N S   I N   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( T R I A 6 )\n'] + words
            else:
                msg = ['                   S T R E S S E S   I N   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( T R I A 6 )\n'] + words
        else:
            msg = 'element_name=%s element_type=%s' % (self.element_name, self.element_type)
            raise NotImplementedError(msg)

        # write the f06
        ntimes = self.data.shape[0]

        eids = self.element_layer[:, 0]
        layers = self.element_layer[:, 1]

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))

            #[o11, o22, t12, t1z, t2z, angle, major, minor, ovm]
            o11 = self.data[itime, :, 0]
            o22 = self.data[itime, :, 1]
            t12 = self.data[itime, :, 2]
            t1z = self.data[itime, :, 3]
            t2z = self.data[itime, :, 4]
            angle = self.data[itime, :, 5]
            major = self.data[itime, :, 6]
            minor = self.data[itime, :, 7]
            ovm = self.data[itime, :, 8]

            for eid, layer, o11i, o22i, t12i, t1zi, t2zi, anglei, majori, minori, ovmi in zip(
                eids, layers, o11, o22, t12, t1z, t2z, angle, major, minor, ovm):

                [o11i, o22i, t12i, t1zi, t2zi, majori, minori, ovmi] = write_floats_12e([
                 o11i, o22i, t12i, t1zi, t2zi, majori, minori, ovmi])
                f06_file.write('0 %8s %4s  %12s %12s %12s   %12s %12s  %6.2F %12s %12s %s\n'
                               % (eid, layer, o11i, o22i, t12i, t1zi, t2zi, anglei, majori, minori, ovmi))
            f06_file.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #49
0
    def write_f06(self,
                  f06_file,
                  header=None,
                  page_stamp: str = 'PAGE %s',
                  page_num: int = 1,
                  is_mag_phase: bool = False,
                  is_sort1: bool = True):
        if header is None:
            header = []
        nnodes, msg_temp = _get_f06_header_nnodes(self, is_mag_phase)

        # write the f06
        ntimes = self.data.shape[0]

        eids2 = self.element_node[:, 0]
        nodes = self.element_node[:, 1]

        eids3 = self.element_cid[:, 0]
        cids3 = self.element_cid[:, 1]

        nnodes_expected = self.nnodes
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg_temp))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))
            oxx = self.data[itime, :, 0]
            oyy = self.data[itime, :, 1]
            ozz = self.data[itime, :, 2]
            txy = self.data[itime, :, 3]
            tyz = self.data[itime, :, 4]
            txz = self.data[itime, :, 5]
            #o1 = self.data[itime, :, 6]
            #o2 = self.data[itime, :, 7]
            #o3 = self.data[itime, :, 8]
            ovm = self.data[itime, :, 6]
            #p = (o1 + o2 + o3) / -3.

            ennodes = nnodes_expected
            for i, deid, node_id, doxx, doyy, dozz, dtxy, dtyz, dtxz, dovm in zip(
                    count(), eids2, nodes, oxx, oyy, ozz, txy, tyz, txz, ovm):

                # o1-max
                # o2-mid
                # o3-min
                #assert do1 >= do2 >= do3, 'o1 >= o2 >= o3; eid=%s o1=%e o2=%e o3=%e' % (deid, do1, do2, do3)
                [oxxi, oyyi, ozzi, txyi, tyzi, txzi, ovmi] = write_floats_13e(
                    [doxx, doyy, dozz, dtxy, dtyz, dtxz, dovm])

                assert node_id > 0, node_id
                if i % ennodes == 0:
                    j = where(eids3 == deid)[0][0]
                    cid = cids3[j]

                    f06_file.write('0  %8s    %8iGRID CS  %i GP\n' %
                                   (deid, cid, nnodes))
                    f06_file.write(
                        '0              %8s  X  %-13s  XY  %-13s   %s\n'
                        '               %8s  Y  %-13s  YZ  %-13s\n'
                        '               %8s  Z  %-13s  ZX  %-13s\n' %
                        (node_id, oxxi, txyi, ovmi, '', oyyi, tyzi, '', ozzi,
                         txzi))
                else:
                    f06_file.write(
                        '0              %8s  X  %-13s  XY  %-13s   %s\n'
                        '               %8s  Y  %-13s  YZ  %-13s\n'
                        '               %8s  Z  %-13s  ZX  %-13s\n' % (
                            node_id,
                            oxxi,
                            txyi,
                            ovmi,
                            '',
                            oyyi,
                            tyzi,
                            '',
                            ozzi,
                            txzi,
                        ))
                i += 1
            f06_file.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #50
0
    def write_f06(self,
                  f06_file,
                  header=None,
                  page_stamp='PAGE %s',
                  page_num: int = 1,
                  is_mag_phase: bool = False,
                  is_sort1: bool = True):
        """
        '          S T R E N G T H   R A T I O S   F O R   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( Q U A D 4 )'
        '   ELEMENT  FAILURE    PLY  SRP-STRENGTH RATIO FOR PLY  SRB-STRENGTH RATIO FOR BONDING  STRENGTH RATIO FOR ELEMENT     FLAG'
        '     ID      THEORY     ID  (DIRECT STRESSES/STRAINS)     (INTER-LAMINAR STRESSES)      MIN OF SRP,SRB FOR ALL PLIES'
        '        57   TSAI-WU     1      1.420811E+00      '
        '                                                                 8.824254E+05                                               '
        '                         2      1.130841E+01      '
        '                                                                 8.670931E+05                                               '
        '                         3      4.838508E+00      '
        '                                                                 8.183240E+05                                               '
        '                         4      2.312551E+00      '
        '                                                                 8.036290E+05                                             '
        '                         5      2.316453E+00      '
        '                                                                 8.183240E+05                                               '
        '                         6      4.871836E+00      '
        '                                                                 8.670931E+05                                               '
        '                         7      1.148123E+01      '
        '                                                                 8.824254E+05                                               '
        '                         8      1.443441E+00      '
        '                                                                                               1.420811E+00                 '
        '        59   TSAI-WU     1      1.069008E+00      '
        """
        #raise NotImplementedError('write_f06')
        if header is None:
            header = []
        #msg, nnodes, is_bilinear = self._get_msgs()
        #if self.is_von_mises:
        #von = 'VON'
        #mises = 'MISES'
        #else:
        #von = 'MAX'
        #mises = 'SHEAR'
        if self.element_type == 95:  # CQUAD4
            etype = '          S T R E N G T H   R A T I O S   F O R   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( Q U A D 4 )\n'
        elif self.element_type == 96:  # CQUAD8
            etype = '          F A I L U R E   I N D I C E S   F O R   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( Q U A D 8 )\n'
        elif self.element_type == 97:  # CTRIA3
            etype = '          S T R E N G T H   R A T I O S   F O R   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( T R I A 3 )\n'
        elif self.element_type == 98:  # CTRIA6
            etype = '          F A I L U R E   I N D I C E S   F O R   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( T R I A 6 )\n'
        else:
            print(''.join(self.get_stats()))
            msg = 'element_name=%s element_type=%s' % (self.element_name,
                                                       self.element_type)
            raise NotImplementedError(msg)

        msg = [
            etype,
            '   ELEMENT  FAILURE    PLY  SRP-STRENGTH RATIO FOR PLY  SRB-STRENGTH RATIO FOR BONDING  STRENGTH RATIO FOR ELEMENT     FLAG\n'
            '     ID      THEORY     ID  (DIRECT STRESSES/STRAINS)     (INTER-LAMINAR STRESSES)      MIN OF SRP,SRB FOR ALL PLIES\n'
        ]

        # write the f06
        ntimes = self.data.shape[0]

        eids = self.element_layer[:, 0]
        layers = self.element_layer[:, 1]
        element_by_layer, ueids = pivot_table(layers, eids, layers)
        nlayers = np.nanmax(element_by_layer, axis=1)
        assert len(nlayers) == len(ueids)

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))
            # min_sr_bonding_fi_bonding
            #[strength_ratio_ply, failure_index_bonding, strength_ratio_bonding]
            strength_ratio_ply = self.data[itime, :, 0]
            failure_index_bonding = self.data[itime, :, 1]
            strength_ratio_bonding = self.data[itime, :, 2]

            i = 0
            is_nans_sr_bonding = np.isnan(strength_ratio_bonding)
            #is_nans_fi_bonding = np.isnan(failure_index_bonding)
            #print(is_nans.tolist())
            #print("nlayers =", nlayers.tolist())
            if 1:
                for eid, nlayer in zip(ueids, nlayers):
                    i0 = i
                    i1 = i + nlayer
                    #ft = failure_theory[i]
                    sr_ply = strength_ratio_ply[i]
                    sr_plys = write_float_13e(sr_ply)
                    #sr_bonding = strength_ratio_bonding[i]
                    #sr_bondings = write_float_13e(sr_bonding)

                    #fi_bondings = '             ' if is_nans_fi_bonding[i] else write_float_13e(failure_index_bonding[i])
                    sr_bondings = '             ' if is_nans_sr_bonding[
                        i] else write_float_13e(strength_ratio_bonding[i])

                    ft = self.failure_theory_flag[i, 0]
                    flag = self.failure_theory_flag[i, 1]

                    # layer1
                    f06_file.write(
                        '  %8d  %8s %5d     %s      \n'
                        '                                                                %s                                               \n'
                        % (eid, ft, 1, sr_plys, sr_bondings))
                    i += 1

                    for jlayer in range(1, nlayer - 1):
                        ilayer = layers[i]
                        sr_ply = strength_ratio_ply[i]
                        sr_plys = write_float_13e(sr_ply)
                        #sr_bonding = strength_ratio_bonding[i]
                        #sr_bondings = write_float_13e(sr_bonding)
                        #fi_bondings = '             ' if is_nans_fi_bonding[i] else write_float_13e(failure_index_bonding[i])
                        sr_bondings = '             ' if is_nans_sr_bonding[
                            i] else write_float_13e(strength_ratio_bonding[i])

                        f06_file.write(
                            '                     %5d     %s      \n'
                            '                                                                %s                                               \n'
                            % (ilayer, sr_plys, sr_bondings))
                        i += 1

                    # final
                    sr_ply = strength_ratio_ply[i]
                    sr_plys = write_float_13e(sr_ply)

                    sr_ply = strength_ratio_ply[i]
                    sr_plys = write_float_13e(sr_ply)
                    all_data = strength_ratio_ply[i0:i1]
                    min_sr_plys = nanmin13s(all_data)
                    #min_sr_ply = np.nanmin(strength_ratio_ply[i0:i1])
                    #min_sr_plys = write_float_13e(min_sr_ply)
                    #min_sr_plys = ' ?.??????E+00'
                    f06_file.write(
                        '                     %5d     %s      \n'
                        '                                                                                              %13s                 \n'
                        % (nlayer, sr_plys, min_sr_plys))
                    i += 1
            else:
                # loop over nlayers max and ueids
                failure_theory = self.failure_theory_flag[:, 0]
                flags = self.failure_theory_flag[:, 1]
                for eid, layer, ft, sr_ply, fi_bonding, sr_bonding, flag in zip(
                        eids, layers, failure_theory, strength_ratio_ply,
                        failure_index_bonding, strength_ratio_bonding, flags):
                    # TODO: super slow way to get the max layer id
                    irows = np.where(eids == eid)[0]
                    nlayers = len(irows)
                    #ft = 'TSAI-WU'

                    sr_plys = write_float_12e(sr_ply)
                    sr_bondings = write_float_12e(sr_bonding)
                    if layer == 1:
                        #eid=3;
                        #sr_ply=1.34007; fi_bonding='' sr_bonding=34482.3; min(sr_bonding, fi_bonding)=nan flag=''
                        #print(eid, layer, sr_plys, fi_bonding, sr_bondings)
                        f06_file.write(
                            '  %8d  %8s %5d      %s      \n'
                            '                                                                 %s                                               \n'
                            % (eid, ft, layer, sr_plys, sr_bondings))
                    elif layer == nlayers:
                        f06_file.write(
                            '                     %5d      %s      \n'
                            '                                                                                               ?.??????E+00                 \n'
                            % (layer, sr_plys))
                    else:
                        f06_file.write(
                            '                     %5d      %s      \n'
                            '                                                                 %s                                               \n'
                            % (layer, sr_plys, sr_bondings))
            f06_file.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #51
0
    def write_f06(self,
                  f06,
                  header=None,
                  page_stamp='PAGE %s',
                  page_num=1,
                  is_mag_phase=False,
                  is_sort1=True):
        if header is None:
            header = []
        nnodes, msg_temp = _get_f06_header_nnodes(self, is_mag_phase)

        # write the f06
        ntimes = self.data.shape[0]

        eids2 = self.element_node[:, 0]
        nodes = self.element_node[:, 1]

        eids3 = self.element_cid[:, 0]
        cids3 = self.element_cid[:, 1]

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06.write(''.join(header + msg_temp))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))
            oxx = self.data[itime, :, 0]
            oyy = self.data[itime, :, 1]
            ozz = self.data[itime, :, 2]
            txy = self.data[itime, :, 3]
            tyz = self.data[itime, :, 4]
            txz = self.data[itime, :, 5]
            o1 = self.data[itime, :, 6]
            o2 = self.data[itime, :, 7]
            o3 = self.data[itime, :, 8]
            ovm = self.data[itime, :, 9]
            p = (o1 + o2 + o3) / -3.

            cnnodes = nnodes + 1
            for i, deid, node_id, doxx, doyy, dozz, dtxy, dtyz, dtxz, do1, do2, do3, dp, dovm in zip(
                    count(), eids2, nodes, oxx, oyy, ozz, txy, tyz, txz, o1,
                    o2, o3, p, ovm):

                j = where(eids3 == deid)[0]
                cid = cids3[j]
                A = [[doxx, dtxy, dtxz], [dtxy, doyy, dtyz],
                     [dtxz, dtyz, dozz]]
                (Lambda,
                 v) = eigh(A)  # a hermitian matrix is a symmetric-real matrix

                # o1-max
                # o2-mid
                # o3-min
                assert do1 >= do2 >= do3, 'o1 >= o2 >= o3; eid=%s o1=%e o2=%e o3=%e' % (
                    deid, do1, do2, do3)
                [oxxi, oyyi, ozzi, txyi, tyzi, txzi, o1i, o2i, o3i, pi,
                 ovmi] = write_floats_13e([
                     doxx, doyy, dozz, dtxy, dtyz, dtxz, do1, do2, do3, dp,
                     dovm
                 ])

                if i % cnnodes == 0:
                    f06.write('0  %8s    %8iGRID CS  %i GP\n' %
                              (deid, cid, nnodes))
                    f06.write(
                        '0              %8s  X  %-13s  XY  %-13s   A  %-13s  LX%5.2f%5.2f%5.2f  %-13s   %s\n'
                        '               %8s  Y  %-13s  YZ  %-13s   B  %-13s  LY%5.2f%5.2f%5.2f\n'
                        '               %8s  Z  %-13s  ZX  %-13s   C  %-13s  LZ%5.2f%5.2f%5.2f\n'
                        % ('CENTER', oxxi, txyi, o1i, v[0, 1], v[0, 2],
                           v[0, 0], pi, ovmi, '', oyyi, tyzi, o2i, v[1, 1],
                           v[1, 2], v[1, 0], '', ozzi, txzi, o3i, v[2, 1],
                           v[2, 2], v[2, 0]))
                else:
                    f06.write(
                        '0              %8s  X  %-13s  XY  %-13s   A  %-13s  LX%5.2f%5.2f%5.2f  %-13s   %s\n'
                        '               %8s  Y  %-13s  YZ  %-13s   B  %-13s  LY%5.2f%5.2f%5.2f\n'
                        '               %8s  Z  %-13s  ZX  %-13s   C  %-13s  LZ%5.2f%5.2f%5.2f\n'
                        % (node_id, oxxi, txyi, o1i, v[0, 1], v[0, 2], v[0, 0],
                           pi, ovmi, '', oyyi, tyzi, o2i, v[1, 1], v[1, 2],
                           v[1, 0], '', ozzi, txzi, o3i, v[2, 1], v[2, 2],
                           v[2, 0]))
                i += 1
            f06.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #52
0
    def write_f06(self,
                  f06_file,
                  header=None,
                  page_stamp='PAGE %s',
                  page_num=1,
                  is_mag_phase=False,
                  is_sort1=True):
        if header is None:
            header = []
        # '      EIGENVALUE =  2.005177E+05'
        # '      CYCLES =  7.126832E+01'
        # '                                           E L E M E N T   S T R A I N   E N E R G I E S'
        # ' '
        # '                ELEMENT-TYPE = TETRA               * TOTAL ENERGY OF ALL ELEMENTS IN PROBLEM     =   1.002589E+05'
        # '                   MODE               1            * TOTAL ENERGY OF ALL ELEMENTS IN SET      -1 =   1.002589E+05'
        # '0'
        # '                                    ELEMENT-ID          STRAIN-ENERGY           PERCENT OF TOTAL    STRAIN-ENERGY-DENSITY'
        # '                                             4          3.247409E+00                 0.0032              1.948445E+01'
        # '                                             5          3.977916E+00                 0.0040              2.386749E+01'
        # ''
        # '                        TYPE = TETRA    SUBTOTAL        7.225325E+00                 0.0072'

        msg_temp = (
            '                                           E L E M E N T   S T R A I N   E N E R G I E S\n'
            ' \n'
            '                ELEMENT-TYPE = %s               * TOTAL ENERGY OF ALL ELEMENTS IN PROBLEM     =   %s\n'
            '                   MODE        %8i            * TOTAL ENERGY OF ALL ELEMENTS IN SET      -1 =   %s\n'
            '0\n'
            '                                    ELEMENT-ID          STRAIN-ENERGY           PERCENT OF TOTAL    STRAIN-ENERGY-DENSITY\n'
        )
        ntimes = self.data.shape[0]

        #etype = self.element_data_type
        for itime in range(ntimes):
            dt = self._times[itime]  # TODO: rename this...
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            total_energy = 0.
            total_set_energy = 0.

            eids = self.element[itime, :]
            # energy, percent, density
            energy = self.data[itime, :, 0]
            percent = self.data[itime, :, 1]
            density = self.data[itime, :, 2]

            #itotal = np.where(eids == 100000000)[0][0]
            #total_energy = self.data[:, :, 0].sum()
            #total_set_energy = energy.sum()
            #total_set_energy = energy[itotal]
            #total_percent = percent.sum()

            msg_temp2 = [
                msg_temp %
                (self.element_name, total_energy, itime + 1, total_set_energy)
            ]
            f06_file.write(''.join(header + msg_temp2))

            fmt1 = ' ' * 36 + '%10s         %-13s                 %.4f             %s\n'
            fmt1_nan = ' ' * 36 + '%10s         %-13s                 %.4f             %s\n'
            fmt2 = '\n                        TYPE = %-8s SUBTOTAL       %13s                 %.4f\n'

            for (eid, energyi, percenti,
                 densityi) in zip(eids, energy, percent, density):
                senergyi = write_float_13e(energyi)
                sdensityi = write_float_13e(densityi)
                # ELEMENT-ID    STRAIN-ENERGY   PERCENT OF TOTAL  STRAIN-ENERGY-DENSITY
                #          1   -8.307121E-12         0.0052           -2.886861E-12
                if eid == 100000000:
                    f06_file.write(fmt2 %
                                   (self.element_name, senergyi, percenti))
                    break
                try:
                    f06_file.write(fmt1 % (eid, senergyi, percenti, sdensityi))
                except TypeError:
                    #print('eid = %r; type=%s' % (eid, type(eid)))
                    #print('senergyi = %r; type=%s' % (senergyi, type(senergyi)))
                    #print('percenti = %r; type=%s' % (percenti, type(percenti)))
                    #print('sdensityi = %r; type=%s' % (sdensityi, type(sdensityi)))
                    assert np.isnan(
                        sdensityi), 'eid=%s sdensityi=%s' % (eid, sdensityi)
                    f06_file.write(fmt1_nan % (eid, senergyi, percenti, ''))
                    #if 0:
                    #print('senergyi = %r; type=%s' % (senergyi, type(senergyi)))
                    #print('percenti = %r; type=%s' % (percenti, type(percenti)))
                    #print('sdensityi = %r; type=%s' % (sdensityi, type(sdensityi)))
                    #msg = fmt1 % (eid, senergyi, percenti, sdensityi)
                    #raise TypeError(msg)
                    #raise RuntimeError(msg)

            f06_file.write(page_stamp % page_num)
            page_num += 1
            break
        return page_num - 1
Beispiel #53
0
    def write_f06(self, f06, header=None, page_stamp='PAGE %s', page_num=1, is_mag_phase=False, is_sort1=True):
        if header is None:
            header = []
        nnodes, msg_temp = _get_f06_header_nnodes(self, is_mag_phase)

        # write the f06
        ntimes = self.data.shape[0]

        eids2 = self.element_node[:, 0]
        nodes = self.element_node[:, 1]

        eids3 = self.element_cid[:, 0]
        cids3 = self.element_cid[:, 1]

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06.write(''.join(header + msg_temp))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))
            oxx = self.data[itime, :, 0]
            oyy = self.data[itime, :, 1]
            ozz = self.data[itime, :, 2]
            txy = self.data[itime, :, 3]
            tyz = self.data[itime, :, 4]
            txz = self.data[itime, :, 5]
            o1 = self.data[itime, :, 6]
            o2 = self.data[itime, :, 7]
            o3 = self.data[itime, :, 8]
            ovm = self.data[itime, :, 9]
            p = (o1 + o2 + o3) / -3.

            cnnodes = nnodes + 1
            for i, deid, node_id, doxx, doyy, dozz, dtxy, dtyz, dtxz, do1, do2, do3, dp, dovm in zip(
                count(), eids2, nodes, oxx, oyy, ozz, txy, tyz, txz, o1, o2, o3, p, ovm):

                j = where(eids3 == deid)[0]
                cid = cids3[j]
                A = [[doxx, dtxy, dtxz],
                     [dtxy, doyy, dtyz],
                     [dtxz, dtyz, dozz]]
                (Lambda, v) = eigh(A)  # a hermitian matrix is a symmetric-real matrix

                # o1-max
                # o2-mid
                # o3-min
                assert do1 >= do2 >= do3, 'o1 >= o2 >= o3; eid=%s o1=%e o2=%e o3=%e' % (deid, do1, do2, do3)
                [oxxi, oyyi, ozzi, txyi, tyzi, txzi, o1i, o2i, o3i, pi, ovmi] = write_floats_13e(
                    [doxx, doyy, dozz, dtxy, dtyz, dtxz, do1, do2, do3, dp, dovm])

                if i % cnnodes == 0:
                    f06.write('0  %8s    %8iGRID CS  %i GP\n' % (deid, cid, nnodes))
                    f06.write('0              %8s  X  %-13s  XY  %-13s   A  %-13s  LX%5.2f%5.2f%5.2f  %-13s   %s\n'
                              '               %8s  Y  %-13s  YZ  %-13s   B  %-13s  LY%5.2f%5.2f%5.2f\n'
                              '               %8s  Z  %-13s  ZX  %-13s   C  %-13s  LZ%5.2f%5.2f%5.2f\n'
                              % ('CENTER', oxxi, txyi, o1i, v[0, 1], v[0, 2], v[0, 0], pi, ovmi,
                                 '', oyyi, tyzi, o2i, v[1, 1], v[1, 2], v[1, 0],
                                 '', ozzi, txzi, o3i, v[2, 1], v[2, 2], v[2, 0]))
                else:
                    f06.write('0              %8s  X  %-13s  XY  %-13s   A  %-13s  LX%5.2f%5.2f%5.2f  %-13s   %s\n'
                              '               %8s  Y  %-13s  YZ  %-13s   B  %-13s  LY%5.2f%5.2f%5.2f\n'
                              '               %8s  Z  %-13s  ZX  %-13s   C  %-13s  LZ%5.2f%5.2f%5.2f\n'
                              % (node_id, oxxi, txyi, o1i, v[0, 1], v[0, 2], v[0, 0], pi, ovmi,
                                 '', oyyi, tyzi, o2i, v[1, 1], v[1, 2], v[1, 0],
                                 '', ozzi, txzi, o3i, v[2, 1], v[2, 2], v[2, 0]))
                i += 1
            f06.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #54
0
    def write_f06(self,
                  f06_file,
                  header=None,
                  page_stamp='PAGE %s',
                  page_num=1,
                  is_mag_phase=False,
                  is_sort1=True):
        if header is None:
            header = []
        msg_temp = (
            '                               E L E M E N T   S T R A I N   E N E R G I E S   ( A V E R A G E )                 \n'
            ' \n'
            '                ELEMENT-TYPE = %-5s               * TOTAL ENERGY OF ALL ELEMENTS IN PROBLEM     =   %s\n'
            '                SUBCASE               1            * TOTAL ENERGY OF ALL ELEMENTS IN SET      -1 =   %s\n'
            '0\n'
            '                       ELEMENT-ID       STRAIN-ENERGY (MAG/PHASE)               PERCENT OF TOTAL    STRAIN-ENERGY-DENSITY\n'
            #'                                5       2.027844E-10 /   0.0                         1.2581              2.027844E-09'
        )
        ntimes = self.data.shape[0]

        #etype = self.element_data_type
        for itime in range(ntimes):
            dt = self._times[itime]  # TODO: rename this...
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            total_energy = 0.
            total_set_energy = 0.

            eids = self.element[itime, :]
            # energyr, energyi, percent, density
            energyr = self.data[itime, :, 0]
            energyi = self.data[itime, :, 1]
            percent = self.data[itime, :, 2]
            density = self.data[itime, :, 3]

            #total_energy = self.data[:, :, 0].sum()
            #total_set_energy = energy.sum()
            #total_set_energy = energy[itotal]
            #total_percent = percent.sum()

            msg_temp2 = [
                msg_temp % (self.element_name, total_energy, total_set_energy)
            ]
            f06_file.write(''.join(header + msg_temp2))

            fmt1 = ' ' * 23 + '%10i      %-13s /  %-13s               %7.4f             %s\n'
            fmt2 = '\n                        TYPE = %-8s SUBTOTAL       %13s                 %.4f\n'

            for (eid, energyri, energyii, percenti,
                 densityi) in zip(eids, energyr, energyi, percent, density):
                senergyr = write_float_13e(energyri)
                senergyi = write_float_13e(energyii)
                sdensityi = write_float_13e(densityi)
                # ELEMENT-ID    STRAIN-ENERGY   PERCENT OF TOTAL  STRAIN-ENERGY-DENSITY
                #          1   -8.307121E-12         0.0052           -2.886861E-12
                #if eid == 100000000:
                #f06_file.write(fmt2 % (self.element_name, senergyi, percenti))
                #break
                f06_file.write(fmt1 %
                               (eid, senergyr, senergyi, percenti, sdensityi))
            f06_file.write(page_stamp % page_num)
            page_num += 1
            #break
        return page_num - 1
Beispiel #55
0
    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 = []
        # msg, nnodes, cen = _get_plate_msg(self)
        if self.element_type == 88:
            msg = [
                "                   N O N L I N E A R   S T R E S S E S   I N   T R I A N G U L A R   E L E M E N T S      ( T R I A 3 )\n"
                " \n"
                "    ELEMENT      FIBER                        STRESSES/ TOTAL STRAINS                     EQUIVALENT    EFF. STRAIN     EFF. CREEP\n"
                "       ID      DISTANCE           X              Y             Z               XY           STRESS    PLASTIC/NLELAST     STRAIN\n"
            ]
        elif self.element_type == 90:
            msg = [
                "               N O N L I N E A R   S T R E S S E S   I N   Q U A D R I L A T E R A L   E L E M E N T S    ( Q U A D 4 )\n"
                " \n"
                "    ELEMENT      FIBER                        STRESSES/ TOTAL STRAINS                     EQUIVALENT    EFF. STRAIN     EFF. CREEP\n"
                "       ID      DISTANCE           X              Y             Z               XY           STRESS    PLASTIC/NLELAST     STRAIN\n"
                #'0         1  -2.500000E-02  -4.829193E+00  -1.640651E-05                 -1.907010E-04   4.829185E+00   0.0            0.0\n'
                #'                            -4.829188E-05   1.448741E-05                 -4.958226E-09\n'
                #'              2.500000E-02   4.770547E+00   1.493975E-04                  1.907012E-04   4.770473E+00   0.0            0.0\n'
                #'                             4.770502E-05  -1.431015E-05                  4.958231E-09\n'
            ]
        else:
            raise NotImplementedError("element_name=%s self.element_type=%s" % (self.element_name, self.element_type))

        # msg = [
        #'               N O N L I N E A R   S T R E S S E S   I N   Q U A D R I L A T E R A L   E L E M E N T S    ( Q U A D 4 )\n'
        #' \n'
        #'    ELEMENT      FIBER                        STRESSES/ TOTAL STRAINS                     EQUIVALENT    EFF. STRAIN     EFF. CREEP\n'
        #'       ID      DISTANCE           X              Y             Z               XY           STRESS    PLASTIC/NLELAST     STRAIN\n'
        ##'0         1  -2.500000E-02  -4.829193E+00  -1.640651E-05                 -1.907010E-04   4.829185E+00   0.0            0.0\n'
        ##'                            -4.829188E-05   1.448741E-05                 -4.958226E-09\n'
        ##'              2.500000E-02   4.770547E+00   1.493975E-04                  1.907012E-04   4.770473E+00   0.0            0.0\n'
        ##'                             4.770502E-05  -1.431015E-05                  4.958231E-09\n'
        # ]

        # write the f06
        ntimes = self.data.shape[0]

        eids = self.element_node[:, 0]
        nids = self.element_node[:, 1]

        # cen_word = 'CEN/%i' % nnodes
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write("".join(header + msg))

            # print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))

            # [fiber_dist, oxx, oyy, ozz, txy, es, eps, ecs, exx, eyy, ezz, etxy]
            fiber_dist = self.data[itime, :, 0]
            oxx = self.data[itime, :, 1]
            oyy = self.data[itime, :, 2]
            ozz = self.data[itime, :, 3]
            txy = self.data[itime, :, 4]
            es = self.data[itime, :, 5]
            eps = self.data[itime, :, 6]
            ecs = self.data[itime, :, 7]
            exx = self.data[itime, :, 8]
            eyy = self.data[itime, :, 9]
            ezz = self.data[itime, :, 10]
            exy = self.data[itime, :, 11]

            for (i, eid, nid, fdi, oxxi, oyyi, ozzi, txyi, exxi, eyyi, ezzi, exyi, esi, epsi, ecsi) in zip(
                cycle([0, 1]), eids, nids, fiber_dist, oxx, oyy, ozz, txy, exx, eyy, ezz, exy, es, eps, ecs
            ):
                # [fdi, oxxi, oyyi, txyi, major, minor, ovmi] = write_floats_13e(
                # [fdi, oxxi, oyyi, txyi, major, minor, ovmi])

                #'    ELEMENT      FIBER                        STRESSES/ TOTAL STRAINS                     EQUIVALENT    EFF. STRAIN     EFF. CREEP\n'
                #'       ID      DISTANCE           X              Y             Z               XY           STRESS    PLASTIC/NLELAST     STRAIN\n'
                #'0         1  -2.500000E-02  -4.829193E+00  -1.640651E-05                 -1.907010E-04   4.829185E+00   0.0            0.0\n'
                #'                            -4.829188E-05   1.448741E-05                 -4.958226E-09\n'
                #'              2.500000E-02   4.770547E+00   1.493975E-04                  1.907012E-04   4.770473E+00   0.0            0.0\n'
                #'                             4.770502E-05  -1.431015E-05                  4.958231E-09\n'
                if i == 0:
                    f.write(
                        "0  %8i  %-13s  %-13s  %-13s                 %-13s  %-13s  %-13s  %s\n"
                        "                            %-13s  %-13s                 %s\n"
                        % (
                            # A
                            # eid, write_float_13e(fdi),
                            # write_float_13e(oxxi), write_float_13e(oyyi),
                            ##write_float_13e(ozzi),
                            # write_float_13e(txyi),
                            # write_float_13e(esi), write_float_13e(epsi),
                            # write_float_13e(ecsi),
                            # write_float_13e(exxi), write_float_13e(eyyi),
                            ##write_float_13e(ezzi),
                            # write_float_13e(exyi),
                            #    ELEMENT  FIBER  XYZ STRESS     EQUIVALENT  EFF.STRAIN  EFF.CREEP\n'
                            eid,
                            write_float_13e(fdi),
                            write_float_13e(oxxi),
                            write_float_13e(oyyi),
                            # write_float_13e(ozzi),
                            write_float_13e(txyi),
                            write_float_13e(esi),
                            write_float_13e(epsi),
                            write_float_13e(ecsi),
                            write_float_13e(exxi),
                            write_float_13e(eyyi),
                            # write_float_13e(ezzi),
                            write_float_13e(exyi),
                        )
                    )
                else:
                    f.write(
                        "             %-13s  %-13s  %-13s                 %-13s  %-13s  %-13s  %s\n"
                        "                            %-13s  %-13s                 %s\n"
                        % (
                            write_float_13e(fdi),
                            write_float_13e(oxxi),
                            write_float_13e(oyyi),
                            # write_float_13e(ozzi),
                            write_float_13e(txyi),
                            write_float_13e(esi),
                            write_float_13e(epsi),
                            write_float_13e(ecsi),
                            write_float_13e(exxi),
                            write_float_13e(eyyi),
                            # write_float_13e(ezzi),
                            write_float_13e(exyi),
                        )
                    )

            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
    def write_f06(self,
                  f06_file,
                  header=None,
                  page_stamp='PAGE %s',
                  page_num=1,
                  is_mag_phase=False,
                  is_sort1=True):
        if header is None:
            header = []

        cid = self.refid
        axis_int = self.oCoord
        axis_map = {0: 'X', 1: 'Y', 2: 'Z'}
        axis = axis_map[axis_int]
        msg = [
            '                                  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    %s\n'
            % self.ogs_id,
            '0                       SURFACE X-AXIS X  NORMAL(Z-AXIS)  %s         REFERENCE COORDINATE SYSTEM FOR SURFACE DEFINITION CID        %s\n'
            % (axis, cid),
            '     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'
        ntimes = self.data.shape[0]

        nids = self.node_element[:, 0]
        eids = self.node_element[:, 1]
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg))

            nx = self.data[itime, :, 0]
            ny = self.data[itime, :, 1]
            txy = self.data[itime, :, 2]
            angle = self.data[itime, :, 3]
            majorp = self.data[itime, :, 4]
            minorp = self.data[itime, :, 5]
            tmax = self.data[itime, :, 6]
            ovm = self.data[itime, :, 7]
            fibers = self.location
            nid_old = -1
            for (nid, eid, fiber, nxi, nyi, txyi, anglei, majorpi, minorpi,
                 tmaxi, ovmi) in zip(nids, eids, fibers, nx, ny, txy, angle,
                                     majorp, minorp, tmax, ovm):
                [nxi, nyi, txyi, majorpi, minorpi, tmaxi,
                 ovmi] = write_floats_10e(
                     [nxi, nyi, txyi, majorpi, minorpi, tmaxi, ovmi])
                if nid > nid_old:
                    f06_file.write(
                        '0%8s  %8s   %4s    %-10s %-10s %-10s  %8.4f %10s %10s %10s  %s\n'
                        % (nid, eid, fiber, nxi, nyi, txyi, anglei, majorpi,
                           minorpi, tmaxi, ovmi))
                else:
                    f06_file.write(
                        ' %8s  %8s   %4s    %-10s %-10s %-10s  %8.4f %10s %10s %10s  %s\n'
                        % ('', '', fiber, nxi, nyi, txyi, anglei, majorpi,
                           minorpi, tmaxi, ovmi))
                nid_old = nid
            f06_file.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #57
0
    def write_f06(self,
                  f06_file,
                  header=None,
                  page_stamp='PAGE %s',
                  page_num=1,
                  is_mag_phase=False,
                  is_sort1=True):
        if header is None:
            header = []
        #msg, nnodes, cen = _get_plate_msg(self)
        if self.element_type == 88:
            msg = [
                '                   N O N L I N E A R   S T R E S S E S   I N   T R I A N G U L A R   E L E M E N T S      ( T R I A 3 )\n'
                ' \n'
                '    ELEMENT      FIBER                        STRESSES/ TOTAL STRAINS                     EQUIVALENT    EFF. STRAIN     EFF. CREEP\n'
                '       ID      DISTANCE           X              Y             Z               XY           STRESS    PLASTIC/NLELAST     STRAIN\n'
            ]
        elif self.element_type == 90:
            msg = [
                '               N O N L I N E A R   S T R E S S E S   I N   Q U A D R I L A T E R A L   E L E M E N T S    ( Q U A D 4 )\n'
                ' \n'
                '    ELEMENT      FIBER                        STRESSES/ TOTAL STRAINS                     EQUIVALENT    EFF. STRAIN     EFF. CREEP\n'
                '       ID      DISTANCE           X              Y             Z               XY           STRESS    PLASTIC/NLELAST     STRAIN\n'
                #'0         1  -2.500000E-02  -4.829193E+00  -1.640651E-05                 -1.907010E-04   4.829185E+00   0.0            0.0\n'
                #'                            -4.829188E-05   1.448741E-05                 -4.958226E-09\n'
                #'              2.500000E-02   4.770547E+00   1.493975E-04                  1.907012E-04   4.770473E+00   0.0            0.0\n'
                #'                             4.770502E-05  -1.431015E-05                  4.958231E-09\n'
            ]
        else:  # pragma: no cover
            raise NotImplementedError('element_name=%s self.element_type=%s' %
                                      (self.element_name, self.element_type))

        #msg = [
        #'               N O N L I N E A R   S T R E S S E S   I N   Q U A D R I L A T E R A L   E L E M E N T S    ( Q U A D 4 )\n'
        #' \n'
        #'    ELEMENT      FIBER                        STRESSES/ TOTAL STRAINS                     EQUIVALENT    EFF. STRAIN     EFF. CREEP\n'
        #'       ID      DISTANCE           X              Y             Z               XY           STRESS    PLASTIC/NLELAST     STRAIN\n'
        #'0         1  -2.500000E-02  -4.829193E+00  -1.640651E-05                 -1.907010E-04   4.829185E+00   0.0            0.0\n'
        #'                            -4.829188E-05   1.448741E-05                 -4.958226E-09\n'
        #'              2.500000E-02   4.770547E+00   1.493975E-04                  1.907012E-04   4.770473E+00   0.0            0.0\n'
        #'                             4.770502E-05  -1.431015E-05                  4.958231E-09\n'
        #]

        # write the f06
        ntimes = self.data.shape[0]
        eids = self.element

        #cen_word = 'CEN/%i' % nnodes
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))

            #[fiber_dist, oxx, oyy, ozz, txy, es, eps, ecs, exx, eyy, ezz, etxy]
            fiber_dist = self.data[itime, :, 0]
            oxx = self.data[itime, :, 1]
            oyy = self.data[itime, :, 2]
            ozz = self.data[itime, :, 3]
            txy = self.data[itime, :, 4]
            es = self.data[itime, :, 5]
            eps = self.data[itime, :, 6]
            ecs = self.data[itime, :, 7]
            exx = self.data[itime, :, 8]
            eyy = self.data[itime, :, 9]
            ezz = self.data[itime, :, 10]
            exy = self.data[itime, :, 11]

            for (i, eid, fdi, oxxi, oyyi, ozzi, txyi, exxi, eyyi, ezzi, exyi,
                 esi, epsi, ecsi) in zip(cycle([0, 1]), eids, fiber_dist, oxx,
                                         oyy, ozz, txy, exx, eyy, ezz, exy, es,
                                         eps, ecs):
                #[fdi, oxxi, oyyi, txyi, major, minor, ovmi] = write_floats_13e(
                #[fdi, oxxi, oyyi, txyi, major, minor, ovmi])

                #'    ELEMENT      FIBER                        STRESSES/ TOTAL STRAINS                     EQUIVALENT    EFF. STRAIN     EFF. CREEP\n'
                #'       ID      DISTANCE           X              Y             Z               XY           STRESS    PLASTIC/NLELAST     STRAIN\n'
                #'0         1  -2.500000E-02  -4.829193E+00  -1.640651E-05                 -1.907010E-04   4.829185E+00   0.0            0.0\n'
                #'                            -4.829188E-05   1.448741E-05                 -4.958226E-09\n'
                #'              2.500000E-02   4.770547E+00   1.493975E-04                  1.907012E-04   4.770473E+00   0.0            0.0\n'
                #'                             4.770502E-05  -1.431015E-05                  4.958231E-09\n'
                if i == 0:
                    f06_file.write(
                        '0  %8i  %-13s  %-13s  %-13s                 %-13s  %-13s  %-13s  %s\n'
                        '                            %-13s  %-13s                 %s\n'
                        % (
                            # A
                            #    ELEMENT  FIBER  XYZ STRESS     EQUIVALENT  EFF.STRAIN  EFF.CREEP\n'
                            eid,
                            write_float_13e(fdi),
                            write_float_13e(oxxi),
                            write_float_13e(oyyi),
                            #write_float_13e(ozzi),
                            write_float_13e(txyi),
                            write_float_13e(esi),
                            write_float_13e(epsi),
                            write_float_13e(ecsi),
                            write_float_13e(exxi),
                            write_float_13e(eyyi),
                            #write_float_13e(ezzi),
                            write_float_13e(exyi),
                        ))
                else:
                    f06_file.write(
                        '             %-13s  %-13s  %-13s                 %-13s  %-13s  %-13s  %s\n'
                        '                            %-13s  %-13s                 %s\n'
                        % (
                            write_float_13e(fdi),
                            write_float_13e(oxxi),
                            write_float_13e(oyyi),
                            #write_float_13e(ozzi),
                            write_float_13e(txyi),
                            write_float_13e(esi),
                            write_float_13e(epsi),
                            write_float_13e(ecsi),
                            write_float_13e(exxi),
                            write_float_13e(eyyi),
                            #write_float_13e(ezzi),
                            write_float_13e(exyi),
                        ))

            f06_file.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
    def write_f06(self,
                  f06_file,
                  header=None,
                  page_stamp='PAGE %s',
                  page_num=1,
                  is_mag_phase=False,
                  is_sort1=True):
        """
        '    D I R E C T   S T R E S S E S   A T   G R I D   P O I N T S   - -       V O L U M E      101'
        '        OUTPUT COORDINATE SYSTEM =       0  BASIC   '
        '    GRID            NORMAL-X    NORMAL-Y    NORMAL-Z      SHEAR-XY    SHEAR-YZ    SHEAR-ZX        MEAN      VON MISES'
        '    ID                                                                                           PRESSURE'
        '        1           1.455E+03  -1.548E+02  -2.927E+02    -1.573E+01   3.326E+01  -3.438E+03     -3.357E+02   6.188E+03'
        '        2           1.093E+03  -1.996E+02  -1.682E+02     1.542E+02   5.962E+01  -4.104E+03     -2.417E+02   7.227E+03'
        """
        if header is None:
            header = []

        cid = self.refid
        #axis_int = self.oCoord
        #axis_map = {0 : 'X', 1 : 'Y', 2 : 'Z'}
        #axis = axis_map[axis_int]
        msg = [
            '                    D I R E C T   S T R E S S E S   A T   G R I D   P O I N T S   - -       V O L U M E      %3i\n'
            '                              OUTPUT COORDINATE SYSTEM = %7i  ELEMENT \n'
            '     GRID            NORMAL-X    NORMAL-Y    NORMAL-Z      SHEAR-XY    SHEAR-YZ    SHEAR-ZX        MEAN      VON MISES\n'
            '     ID                                                                                           PRESSURE\n'
            % (
                #'     8086           6.136E-02   2.131E-01   8.353E-02    -2.268E+00  -2.274E-13   1.525E-13     -1.193E-01   3.930E+00'
                self.ogs_id,
                cid)
        ]

        ntimes = self.data.shape[0]

        nids = self.node
        zero = ' '
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg))

            nx = self.data[itime, :, 0]
            ny = self.data[itime, :, 1]
            nz = self.data[itime, :, 2]
            txy = self.data[itime, :, 3]
            tyz = self.data[itime, :, 4]
            txz = self.data[itime, :, 5]
            pressure = self.data[itime, :, 6]
            ovm = self.data[itime, :, 7]
            for (nid, nxi, nyi, nzi, txyi, tyzi, txzi, pressurei,
                 ovmi) in zip(nids, nx, ny, nz, txy, tyz, txz, pressure, ovm):
                [nxi, nyi, nzi, txyi, tyzi, txzi, pressurei,
                 ovmi] = write_floats_10e(
                     [nxi, nyi, nzi, txyi, tyzi, txzi, pressurei, ovmi])

                f06_file.write(
                    '%s%8s          %-10s  %-10s  %-10s    %-10s  %-10s  %-10s     %-10s  %-s\n'
                    % (zero, nid, nxi, nyi, nzi, txyi, tyzi, txzi, pressurei,
                       ovmi.rstrip()))
            f06_file.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
Beispiel #59
0
    def write_f06(self,
                  f06_file,
                  header=None,
                  page_stamp='PAGE %s',
                  page_num=1,
                  is_mag_phase=False,
                  is_sort1=True):  # pragma: no cover
        if header is None:
            header = []
        #raise NotImplementedError('RealNonlinearSolidArray.write_f06')
        #msg, nnodes, cen = _get_plate_msg(self)
        #if self.element_type == 85:
        ##etype = 'CTETRANL'
        #nnodes_per_element = 5
        #elif self.element_type == 91:
        ##etype = 'CPENTANL'
        #nnodes_per_element = 7
        #elif self.element_type == 93:
        ##etype = 'CHEXANL'
        #nnodes_per_element = 9
        #else:
        #raise NotImplementedError('name=%r type=%s' % (self.element_name, self.element_type))
        if self.element_type == 85:
            msg = [
                '          N O N L I N E A R   S T R E S S E S   I N   T E T R A H E D R O N   S O L I D   E L E M E N T S   ( T E T R A )'
                ' \n'
                '  ELEMENT GRID/   POINT                         STRESSES/ TOTAL STRAINS                          EQUIVALENT EFF. STRAIN  EFF. CREEP\n'
                '     ID   GAUSS     ID       X           Y           Z           XY          YZ          ZX        STRESS   PLAS/NLELAS   STRAIN\n'
            ]
        elif self.element_type == 91:
            msg = [
                '          N O N L I N E A R   S T R E S S E S   I N   P E N T A H E D R O N   S O L I D   E L E M E N T S   ( P E N T A )'
                ' \n'
                '  ELEMENT GRID/   POINT                         STRESSES/ TOTAL STRAINS                          EQUIVALENT EFF. STRAIN  EFF. CREEP\n'
                '     ID   GAUSS     ID       X           Y           Z           XY          YZ          ZX        STRESS   PLAS/NLELAS   STRAIN\n'
            ]
        elif self.element_type == 93:
            msg = [
                '          N O N L I N E A R   S T R E S S E S   I N   H E X A H E D R O N   S O L I D   E L E M E N T S     ( H E X A )\n'
                ' \n'
                '  ELEMENT GRID/   POINT                         STRESSES/ TOTAL STRAINS                          EQUIVALENT EFF. STRAIN  EFF. CREEP\n'
                '     ID   GAUSS     ID       X           Y           Z           XY          YZ          ZX        STRESS   PLAS/NLELAS   STRAIN\n'
                #'0       1 GRID   CENTER  1.0000E+04  1.5916E-12  1.3642E-12 -3.5862E-13  8.3400E-14   0.0        1.0000E+04   0.0         0.0'
                #'                         1.5626E-03 -4.6877E-04 -4.6877E-04 -1.4569E-19  3.3881E-20   0.0'
                #'                      1  1.0000E+04 -1.8190E-12  4.5475E-13 -6.3308E-13  7.4789E-13 -4.6225E-13  1.0000E+04   0.0         0.0'
                #'                         1.5626E-03 -4.6877E-04 -4.6877E-04 -2.5719E-19  3.0383E-19 -1.8779E-19'
            ]
        elif self.element_type == 256:
            msg = [
                '          N O N L I N E A R   S T R E S S E S   I N   P Y R A M I D   S O L I D   E L E M E N T S     ( P Y R A M )\n'
                ' \n'
                '  ELEMENT GRID/   POINT                         STRESSES/ TOTAL STRAINS                          EQUIVALENT EFF. STRAIN  EFF. CREEP\n'
                '     ID   GAUSS     ID       X           Y           Z           XY          YZ          ZX        STRESS   PLAS/NLELAS   STRAIN\n'
            ]
        else:  # pragma: no cover
            raise NotImplementedError('element_name=%s self.element_type=%s' %
                                      (self.element_name, self.element_type))

        # write the f06
        ntimes = self.data.shape[0]

        eids = self.element_node[:, 0]
        nids = self.element_node[:, 1]

        #cen_word = 'CEN/%i' % nnodes
        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f06_file.write(''.join(header + msg))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))

            #oxx, oyy, ozz, txy, tyz, txz, se, eps, ecs,
            #exx, eyy, ezz, exy, eyz, exz
            oxx = self.data[itime, :, 0]
            oyy = self.data[itime, :, 1]
            ozz = self.data[itime, :, 2]
            txy = self.data[itime, :, 3]
            tyz = self.data[itime, :, 4]
            txz = self.data[itime, :, 5]

            se = self.data[itime, :, 6]
            eps = self.data[itime, :, 7]
            ecs = self.data[itime, :, 8]

            exx = self.data[itime, :, 9]
            eyy = self.data[itime, :, 10]
            ezz = self.data[itime, :, 11]
            exy = self.data[itime, :, 12]
            eyz = self.data[itime, :, 13]
            exz = self.data[itime, :, 14]

            #oxx, oyy, ozz, txy, tyz, txz, se, eps, ecs,
            #exx, eyy, ezz, exy, eyz, exz

            for (eid, nid, oxxi, oyyi, ozzi, txyi, tyzi, txzi, sei, epsi, ecsi,
                 exxi, eyyi, ezzi, exyi, eyzi,
                 exzi) in zip(eids, nids, oxx, oyy, ozz, txy, tyz, txz, se,
                              eps, ecs, exx, eyy, ezz, exy, eyz, exz):

                #'    ELEMENT      FIBER                        STRESSES/ TOTAL STRAINS                     EQUIVALENT    EFF. STRAIN     EFF. CREEP\n'
                #'       ID      DISTANCE           X              Y             Z               XY           STRESS    PLASTIC/NLELAST     STRAIN\n'
                #'0       1 GRID   CENTER  1.0000E+04  1.5916E-12  1.3642E-12 -3.5862E-13  8.3400E-14   0.0        1.0000E+04   0.0         0.0'
                #'                         1.5626E-03 -4.6877E-04 -4.6877E-04 -1.4569E-19  3.3881E-20   0.0'
                #'                      1  1.0000E+04 -1.8190E-12  4.5475E-13 -6.3308E-13  7.4789E-13 -4.6225E-13  1.0000E+04   0.0         0.0'
                #'                         1.5626E-03 -4.6877E-04 -4.6877E-04 -2.5719E-19  3.0383E-19 -1.8779E-19'
                if nid == 0:
                    #nid = '  CENTER'
                    #assert len(nid) == 8
                    f06_file.write(
                        '0%8i GRID   CENTER %-11s %-11s %-11s %-11s %-11s %-11s %-11s %-11s %s\n'
                        '                        %-11s %-11s %-11s %-11s %-11s %-11s\n'
                        % (
                            # A
                            #oxxi, oyyi, ozzi, txyi, tyzi, txzi, sei, epsi, ecsi,
                            #exxi, eyyi, ezzi, exyi, eyzi, exzi
                            #    ELEMENT  FIBER  XYZ STRESS     EQUIVALENT  EFF.STRAIN  EFF.CREEP\n'
                            eid,
                            write_float_11e(oxxi),
                            write_float_11e(oyyi),
                            write_float_11e(ozzi),
                            write_float_11e(txyi),
                            write_float_11e(tyzi),
                            write_float_11e(txzi),
                            write_float_11e(sei),
                            write_float_11e(epsi),
                            write_float_11e(ecsi),
                            write_float_11e(exxi),
                            write_float_11e(eyyi),
                            write_float_11e(ezzi),
                            write_float_11e(exyi),
                            write_float_11e(eyzi),
                            write_float_11e(exzi),
                        ))
                else:
                    f06_file.write(
                        ' %8s      %8s %-11s %-11s %-11s %-11s %-11s %-11s %-11s %-11s %s\n'
                        '                        %-11s %-11s %-11s %-11s %-11s %s\n'
                        % (
                            # A
                            #oxxi, oyyi, ozzi, txyi, tyzi, txzi, sei, epsi, ecsi,
                            #exxi, eyyi, ezzi, exyi, eyzi, exzi
                            #    ELEMENT  FIBER  XYZ STRESS     EQUIVALENT  EFF.STRAIN  EFF.CREEP\n'
                            '',
                            nid,
                            write_float_11e(oxxi),
                            write_float_11e(oyyi),
                            write_float_11e(ozzi),
                            write_float_11e(txyi),
                            write_float_11e(tyzi),
                            write_float_11e(txzi),
                            write_float_11e(sei),
                            write_float_11e(epsi),
                            write_float_11e(ecsi),
                            write_float_11e(exxi),
                            write_float_11e(eyyi),
                            write_float_11e(ezzi),
                            write_float_11e(exyi),
                            write_float_11e(eyzi),
                            write_float_11e(exzi),
                        ))
            f06_file.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1
    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 = []
        #msg, nnodes, is_bilinear = self._get_msgs()
        if self.is_von_mises():
            von = 'VON'
            mises = 'MISES'
        else:
            von = 'MAX'
            mises = 'SHEAR'

        if self.is_strain():
            words = ['   ELEMENT  PLY   STRAINS IN FIBER AND MATRIX DIRECTIONS    INTER-LAMINAR   STRAINS  PRINCIPAL  STRAINS (ZERO SHEAR)      %s\n' % von,
                     '     ID      ID    NORMAL-1     NORMAL-2     SHEAR-12     SHEAR XZ-MAT  SHEAR YZ-MAT  ANGLE    MAJOR        MINOR        %s\n' % mises]
        else:
            words = ['   ELEMENT  PLY  STRESSES IN FIBER AND MATRIX DIRECTIONS    INTER-LAMINAR  STRESSES  PRINCIPAL STRESSES (ZERO SHEAR)      %s\n' % von,
                     '     ID      ID    NORMAL-1     NORMAL-2     SHEAR-12     SHEAR XZ-MAT  SHEAR YZ-MAT  ANGLE    MAJOR        MINOR        %s\n' % mises]

        if self.element_type == 95:  # CQUAD4
            if self.is_strain():
                msg = ['                     S T R A I N S   I N   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( Q U A D 4 )\n'] + words
            else:
                msg = ['                   S T R E S S E S   I N   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( Q U A D 4 )\n'] + words
        #elif self.element_type == 96:  # CQUAD8
            #nnodes_per_element = 1
        elif self.element_type == 97:  # CTRIA3
            if self.is_strain():
                msg = ['                     S T R A I N S   I N   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( T R I A 3 )\n'] + words
            else:
                msg = ['                   S T R E S S E S   I N   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( T R I A 3 )\n'] + words
        elif self.element_type == 96:  # QUAD8
            # good
            if self.is_strain():
                msg = ['                     S T R A I N S   I N   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( Q U A D 8 )\n'] + words
            else:
                msg = ['                   S T R E S S E S   I N   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( Q U A D 8 )\n'] + words

        elif self.element_type == 98:  # CTRIA6
            # good
            if self.is_strain():
                msg = ['                     S T R A I N S   I N   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( T R I A 6 )\n'] + words
            else:
                msg = ['                   S T R E S S E S   I N   L A Y E R E D   C O M P O S I T E   E L E M E N T S   ( T R I A 6 )\n'] + words
        else:
            raise NotImplementedError('element_name=%s element_type=%s' % (self.element_name, self.element_type))

        # write the f06
        ntimes = self.data.shape[0]

        eids = self.element_layer[:, 0]
        layers = self.element_layer[:, 1]

        for itime in range(ntimes):
            dt = self._times[itime]
            header = _eigenvalue_header(self, header, itime, ntimes, dt)
            f.write(''.join(header + msg))

            #print("self.data.shape=%s itime=%s ieids=%s" % (str(self.data.shape), itime, str(ieids)))

            #[o11, o22, t12, t1z, t2z, angle, major, minor, ovm]
            o11 = self.data[itime, :, 0]
            o22 = self.data[itime, :, 1]
            t12 = self.data[itime, :, 2]
            t1z = self.data[itime, :, 3]
            t2z = self.data[itime, :, 4]
            angle = self.data[itime, :, 5]
            major = self.data[itime, :, 6]
            minor = self.data[itime, :, 7]
            ovm = self.data[itime, :, 8]

            for eid, layer, o11i, o22i, t12i, t1zi, t2zi, anglei, majori, minori, ovmi in zip(
                eids, layers, o11, o22, t12, t1z, t2z, angle, major, minor, ovm):

                ([o11i, o22i, t12i, t1zi, t2zi, majori, minori, ovmi], is_all_zeros) = writeFloats12E([
                  o11i, o22i, t12i, t1zi, t2zi, majori, minori, ovmi])
                f.write('0 %8s %4s  %12s %12s %12s   %12s %12s  %6.2F %12s %12s %s\n'
                        % (eid, layer, o11i, o22i, t12i, t1zi, t2zi, anglei, majori, minori, ovmi))
            f.write(page_stamp % page_num)
            page_num += 1
        return page_num - 1