示例#1
0
    def _read_pload4_nx(self, data, n):  ## inconsistent with DMAP
        """
        PLOAD4(7209,72,299) - the marker for Record 20

        Word Name Type Description
        1 SID          I Load set identification number
        2 EID          I Element identification number
        3 P(4)        RS Pressures
        7 G1           I Grid point identification number at a corner of the face
        8 G34          I Grid point identification number at a diagonal from G1 or CTETRA corner
        9  CID         I Coordinate system identification number
        10 N(3)       RS Components of a vector coordinate system defined by CID
        """
        ntotal = 48 * self.factor  # 12*4
        nentries = (len(data) - n) // ntotal
        assert (len(data) - n) % ntotal == 0
        loads = []
        s = Struct(mapfmt(self._endian + b'2i 4f 3i 3f', self.size))
        for unused_i in range(nentries):
            edata = data[n:n + ntotal]
            out = s.unpack(edata)
            if self.is_debug_file:
                self.binary_debug.write('  PLOAD4=%s\n' % str(out))
            (sid, eid, p1, p2, p3, p4, g1, g34, cid, n1, n2, n3) = out

            surf_or_line = None
            line_load_dir = None
            load = PLOAD4.add_op2_data(
                [sid, eid, [p1, p2, p3, p4], g1, g34,
                 cid, [n1, n2, n3], surf_or_line, line_load_dir])
            load.validate()
            loads.append(load)
            n += ntotal
        self.card_count['PLOAD4'] = nentries
        return n, loads
示例#2
0
    def _read_feface(self, data: bytes, n: int) -> int:
        """
        Word Name Type Description
        1 FACEID    I Face identification number
        2 GRID1     I Identification number of end GRID 1
        3 GRID2     I Identification number of end GRID 2
        4 GRID3     I Identification number of end GRID 3
        5 GRID4     I Identification number of end GRID 4
        6 CIDBC     I Coordinate system identification number for the constraints
        7 SURFID(2) I Alternate method used to specify the geometry
        """
        ntotal = 32 * self.factor
        structi = Struct(mapfmt(self._endian + b'8i', self.size))
        nentries = (len(data) - n) // ntotal
        for unused_i in range(nentries):
            edata = data[n:n + ntotal]
            out = structi.unpack(edata)
            (face_id, n1, n2, n3, n4, cid, surf_id1, surf_id2) = out
            if self.is_debug_file:
                self.binary_debug.write('  FEFACE=%s\n' % str(out))

            nodes = [n1, n2, n3, n4]
            surf_ids = [surf_id1, surf_id2]
            feface = self.add_feface(face_id, nodes, cid, surf_ids)
            n += ntotal
        self.increase_card_count('FEFACE', nentries)
        return n
示例#3
0
    def _read_mat10(self, data: bytes, n: int) -> int:
        """
        MAT10(2801,28,365) - record 9

        Word Name Type Description
        1 MID   I Material identification number
        2 BULK RS Bulk modulus
        3 RHO  RS Mass density
        4 C    RS Speed of sound
        5 GE   RS Structural damping coefficient

        """
        ntotal = 20 * self.factor  # 5*4
        s = Struct(mapfmt(self._endian + b'i4f', self.size))
        nmaterials = (len(data) - n) // ntotal
        assert nmaterials > 0, nmaterials
        for unused_i in range(nmaterials):
            edata = data[n:n + ntotal]
            out = s.unpack(edata)
            n += ntotal

            (mid, bulk, rho, c, ge) = out
            if self.is_debug_file:
                self.binary_debug.write('  MAT10=%s\n' % str(out))
            if mid == 0 and bulk == 0. and rho == 0. and c == 0. and ge == 0.:
                self.log.debug('  skipping empty MAT10...')
                continue
            mat = MAT10.add_op2_data(out)
            assert mat.mid > 0, mat
            self.add_op2_material(mat)
        self.card_count['MAT10'] = nmaterials
        return n
示例#4
0
    def _read_ploadx(self, data: bytes, n: int) -> int:
        """
        Record - PLOADX(7001,70,278)
        This record is obsolete

        Word Name Type Description
        1 SID   I Load set identification number
        2 P(2) RS Pressure
        4 G(3)  I Grid point identification numbers
        """
        ntotal = 24 * self.factor  # 6*4
        nentries = (len(data) - n) // ntotal
        assert (len(data) - n) % ntotal == 0
        struc = Struct(mapfmt(self._endian + b'iff3i', self.size))
        for unused_i in range(nentries):
            edata = data[n:n + ntotal]
            out = struc.unpack(edata)
            if self.is_debug_file:
                self.binary_debug.write('  PLOADX=%s\n' % str(out))
            fields = ['PLOADX'] + list(out)
            self.reject_lines.append(print_card_16(fields))
            #load = PLOADX.add_op2_data(out)
            #self._add_load_object(load)

            #n += ntotal + 28 * self.factor
            n += ntotal
        self.card_count['PLOADX'] = nentries
        return n
示例#5
0
    def _read_grid_maybe(self, data: bytes, n: int) -> int:  # pragma: no cover
        """
        (4501, 45, 1120001) - the marker for Record 17
        this is a GRID card with double vales for xyz
        """
        ntotal = 44 * self.factor
        structi = Struct(mapfmt(self._endian + b'2i 3d 3i', self.size))
        nentries = (len(data) - n) // ntotal
        leftover = (len(data) - n) % ntotal
        assert leftover == 0, f'ndata={len(data)-n} leftover={leftover}'
        for unused_i in range(nentries):
            edata = data[n:n + ntotal]
            out = structi.unpack(edata)
            (nid, cp, x1, x2, x3, cd, ps, seid) = out
            if self.is_debug_file:
                self.binary_debug.write('  GRID=%s\n' % str(out))

            # cd can be < 0
            if ps == 0:
                ps = ''
            node = GRID(nid, np.array([x1, x2, x3]), cp, cd, ps, seid)
            self._type_to_id_map['GRID'].append(nid)
            self.nodes[nid] = node
            #self.log.debug(f'  nid={nid} cp={cp} x=[{x1:g}, {x2:g}, {x3:g}] cd={cd} ps={ps} seid={seid}')

            n += ntotal
        self.increase_card_count('GRID', nentries)
        return n
示例#6
0
    def _read_sebulk(self, data: bytes, n: int) -> int:
        """
        Record 18 -- SEBULK(1427,14,465)

        Word Name Type Description
        1 SEID    I Superelement identification number
        2 TYPE    I Superelement type
        3 RSEID   I Reference superelement identification number
        4 METHOD  I Boundary point search method: 1=automatic or 2=manual
        5 TOL    RS Location tolerance
        6 LOC     I Coincident location check option: yes=1 or no=2
        7 MEDIA   I Media format of boundary data of external SE
        8 UNIT    I FORTRAN unit number of OP2 and OP4 input of external SE
        """
        ntotal = 32 * self.factor # 4*8
        nentries = (len(data) - n) // ntotal
        structi = Struct(mapfmt(self._endian + b'4if3i', self.size))

        superelement_type_int_to_superelement_type = {
            1 : 'PRIMARY',
            5 : 'EXTOP2',
            6 : 'MIRROR',
            7 : 'FRFOP2',
        }
        loc_int_to_loc = {
            1 : 'YES',
            2 : 'NO',
        }
        method_int_to_method = {
            1: 'AUTO',
            2: 'MANUAL',
        }
        for unused_i in range(nentries):
            edata = data[n:n + ntotal]  # 4*8
            out = structi.unpack(edata)
            (seid, superelement_type_int, rseid, method_int, tol, loc_int, media, unit) = out
            try:
                superelement_type = superelement_type_int_to_superelement_type[superelement_type_int]
            except KeyError:  # pragma: no cover
                raise NotImplementedError(f'superelement_type={superelement_type_int} not in [PRIMARY, EXTOP2, MIRROR, FRFOP2]')

            try:
                loc = loc_int_to_loc[loc_int]
            except KeyError:  # pragma: no cover
                raise NotImplementedError(f'loc={loc_int} not in [YES, NO]')

            try:
                method = method_int_to_method[method_int]
            except KeyError:  # pragma: no cover
                raise NotImplementedError(f'method={method_int} not in [AUTO, MANUAL]')

            if self.is_debug_file:
                self.binary_debug.write('  SEBULK=%s\n' % str(out))
            #media,
            sebulk = self.add_sebulk(seid, superelement_type, rseid,
                                     method=method, tol=tol, loc=loc, unitno=unit)
            sebulk.validate()
            n += 32 * self.factor
        self.increase_card_count('SEBULK', nentries)
        return n
示例#7
0
    def _read_matt11(self, data: bytes, n: int) -> int:
        """
        Record – MATT11(3303,33,988)
        Solid orthotropic material temperature dependence.
        Defines the temperature dependent material property for a
        3D orthotropic material for isoparametric solid elements.

        Word Name Type Description

        1 MID   I Material identification number
        2 TE1   I TABLEMi ID for modulus of elasticity in the 1-direction
        3 TE2   I TABLEMi ID for modulus of elasticity in the 2-direction
        4 TE3   I TABLEMi ID for modulus of elasticity in the 3-direction
        5 TNU12 I TABLEMi ID for Poisson's ratio (ε2/ε1 for uniaxial loading in the 1-direction)
        6 TNU13 I TABLEMi ID for Poisson's ratio (ε3/ε1 for uniaxial loading in the 1-direction)
        7 TNU23 I TABLEMi ID for Poisson's ratio (ε3/ε2 for uniaxial loading in the 2-direction)
        8 TRHO  I TABLEMi ID for mass density
        9 TG12  I TABLEMi ID for shear modulus in 1–2 plane
        10 TG13 I TABLEMi ID for shear modulus in 1–3 plane
        11 TG23 I TABLEMi ID for shear modulus in 2–3 plane
        12 TA1  I TABLEMi ID for thermal expansion coefficient in the 1-direction
        13 TA2  I TABLEMi ID for thermal expansion coefficient in the 2-direction
        14 TA3  I TABLEMi ID for thermal expansion coefficient in the 3-direction
        15 UNDEF None
        16 TGE RS TABLEMi ID for structural damping coefficient
        17 UNDEF(16) None
        ints = (1, 10, 20, 20, 30, 30, 30, 40, 40, 50, 60, 70, 70, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
        """
        ntotal = 128  # 32*4
        #self.show_data(data[n:], types='if')
        struct1 = Struct(mapfmt(self._endian + b'32i', self.size))
        nmaterials = (len(data) - n) // ntotal
        for unused_i in range(nmaterials):
            edata = data[n:n + ntotal]
            out = struct1.unpack(edata)
            mid, te1, te2, te3, tnu12, tnu13, tnu23, trho, tg12, tg13, tg23, ta1, ta2, ta3, blank, tge, *other = out
            if self.is_debug_file:
                self.binary_debug.write('  MATT11=%s\n' % str(out))
            #print(mid, te1, te2, te3, tnu12, tnu13, tnu23, trho, tg12, tg13, tg23, ta1, ta2, ta3, blank, tge)
            assert min(other) == 0, other
            assert max(other) == 0, other
            #assert a == 0, out
            #assert b == 0, out
            #assert c == 0, out
            #assert d == 0, out
            #assert e == 0, out
            #MATT9(mid, g11_table=None, g12_table=None, g13_table=None, g14_table=None,
            #g15_table=None, g16_table=None, g22_table=None, g23_table=None,
            #g24_table=None, g25_table=None, g26_table=None, g33_table=None,
            #g34_table=None, g35_table=None, g36_table=None, g44_table=None,
            #g45_table=None, g46_table=None, g55_table=None, g56_table=None,
            #g66_table=None, rho_table=None,
            #a1_table=None, a2_table=None, a3_table=None,
            #a4_table=None, a5_table=None, a6_table=None, ge_table=None, comment='')
            #mat = MATT11(mid, *tc_tables, trho, ta1, ta2, ta3, ta4, ta5, ta6, tge, comment='')
            #self._add_material_dependence_object(mat, allow_overwrites=False)
            n += ntotal
        self.card_count['MATT11'] = nmaterials
        self.log.warning('skipping MATT11 in MPT')
        return n
示例#8
0
    def _read_grav(self, data: bytes, n: int) -> int:
        """
        GRAV(4401,44,26) - the marker for Record 7

        Word Name Type Description
        1 SID I Load set identification number
        2 CID I Coordinate system identification number
        3 A RS Acceleration vector scale factor
        4 N(3) RS Components of a vector coordinate system defined by CID
        7 MB I Bulk Data Section with CID definition: -1=main, 0=partitioned
        """
        ntotal = 28 * self.factor  # 7*4
        s = Struct(mapfmt(self._endian + b'ii4fi', self.size))
        nentries = (len(data) - n) // ntotal
        for unused_i in range(nentries):
            edata = data[n:n + ntotal]
            out = s.unpack(edata)
            if self.is_debug_file:
                self.binary_debug.write('  GRAV=%s\n' % str(out))
            #(sid, cid, a, n1, n2, n3, mb) = out
            grav = GRAV.add_op2_data(out)
            self._add_load_object(grav)
            n += ntotal
        self.card_count['GRAV'] = nentries
        return n
示例#9
0
    def _read_tstepnl_nx(self, data: bytes,
                         n: int) -> Tuple[int, List[TSTEPNL]]:
        """
        TSTEPNL(3103,31,337) - record 29

        NX 2019.2
        23 KDAMP    I Flags to include differential stiffness to form structural damping
        24 KUPDATE  I Method for dynamic matrix update
        25 KUSTEP   I Number of iterations before the stiffness update
        26 TINTOPT  I Time integration method
        27 GAMMA   RS Amplitude decay factor for 2nd order transient integration

        """
        ntotal = 108 * self.factor  # 27*4
        s = Struct(mapfmt(self._endian + b'iif5i3f3if3i4f 4if', self.size))
        nentries = (len(data) - n) // ntotal
        assert (len(data) - n) % ntotal == 0
        assert nentries > 0, nentries
        tstepnls = []
        for unused_i in range(nentries):
            edata = data[n:n + ntotal]
            out = s.unpack(edata)
            #(sid,ndt,dt,no,kMethod,kStep,maxIter,conv,epsU,epsP,epsW,
            # maxDiv,maxQn,maxLs,fStress,lsTol,maxBisect,adjust,mStep,rb,maxR,uTol,rTolB) = out
            method = out[4]
            if method in [4]:
                self.log.warning('method=4; skipping TSTEPNL=%r' % str(out))
            else:
                tstepnl = TSTEPNL.add_op2_data(out)
                tstepnls.append(tstepnl)
            n += ntotal
        return n, tstepnls
示例#10
0
 def _read_matt3(self, data: bytes, n: int) -> int:
     """
     Word Name Type Description
     1 MID     I Material identification number
     2 TID(15) I entry identification numbers
     """
     ntotal = 64 * self.factor  # 16*4
     s = Struct(mapfmt(self._endian + b'16i', self.size))
     nmaterials = (len(data) - n) // ntotal
     for unused_i in range(nmaterials):
         edata = data[n:n + ntotal]
         out = s.unpack(edata)
         (mid, *tables, a, b, c, d) = out
         if self.is_debug_file:
             self.binary_debug.write('  MATT3=%s\n' % str(out))
         assert a == 0, out
         assert b == 0, out
         assert c == 0, out
         assert d == 0, out
         #mat = MATT3(mid, ex_table=None, eth_table=None, ez_table=None, nuth_table=None,
         #nuxz_table=None, rho_table=None, gzx_table=None,
         #ax_table=None, ath_table=None, az_table=None, ge_table=None,)
         mat = MATT3(mid, *tables, comment='')
         self._add_material_dependence_object(mat, allow_overwrites=False)
         n += ntotal
     self.card_count['MATT3'] = nmaterials
     return n
示例#11
0
    def _read_matt8_19(self, data: bytes, n: int) -> int:
        """
        MATT8 (903, 9, 336)
        (903, 9, 336,
        2, 1, 2, 0, 3, 4, 5, 0, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, xxx)

        Word Name Type Description
        1 MID I
        2 TID(9)  I TABLEMi entry identification numbers
        11 UNDEF None
        12 TID(7) I TABLEMi entry identification numbers
        19 UNDEF None
        """
        ntotal = 76 * self.factor  # 35*4
        s = Struct(mapfmt(self._endian + b'i18i', self.size))
        ndatai = len(data) - n
        nmaterials = ndatai // ntotal
        assert ndatai % ntotal == 0

        matt8s = []
        for unused_i in range(nmaterials):
            edata = data[n:n + ntotal]
            out = s.unpack(edata)
            (mid, e1_table, e2_table, nu12_table, g12_table, g1z_table,
             g2z_table, trho, ta1, ta2, blank, xt_table, xc_table, yt_table,
             yc_table, s_table, ge_table, f12_table, final) = out
            if self.is_debug_file:
                self.binary_debug.write('  MATT8=%s\n' % str(out))
            mat = MATT8(mid,
                        e1_table=e1_table,
                        e2_table=e2_table,
                        nu12_table=nu12_table,
                        g12_table=g12_table,
                        g1z_table=g1z_table,
                        g2z_table=g2z_table,
                        rho_table=trho,
                        a1_table=ta1,
                        a2_table=ta2,
                        xt_table=xt_table,
                        xc_table=xc_table,
                        yt_table=yt_table,
                        yc_table=yc_table,
                        s_table=s_table,
                        ge_table=ge_table,
                        f12_table=f12_table)
            assert blank == 0, f'blank={blank} out={out}'
            assert final == 0, f'final={final} out={out}'
            #assert xc_table == 0, f'xc_table={xc_table} out={out}'
            #assert yt_table == 0, f'yt_table={yt_table} out={out}'
            #assert yc_table == 0, f'yc_table={yc_table} out={out}'
            #assert s_table == 0, f's_table={s_table} out={out}'
            #assert ge_table == 0, f'ge_table={ge_table} out={out}'
            #assert f12_table == 0, f'f12_table={f12_table} out={out}'
            str(mat)
            matt8s.append(mat)
            n += ntotal

        return n, matt8s
示例#12
0
    def junk_read_mat11(self, data: bytes, n: int) -> int:
        """
        Solid element orthotropic material property definition.
        Defines the material properties for a 3-D orthotropic material for
        isoparametric solid elements.

        Word Name Type Description

        1 MID I Material identification number
        2 E1 RS Modulus of elasticity in the longitudinal direction or 1-direction
        3 E2 RS Modulus of elasticity in the lateral direction or 2-direction
        4 E3 RS Modulus of elasticity in the thickness direction or 3-direction
        5 NU12 RS Poisson's ratio (ε2/ε1 for uniaxial loading in the 1-direction)
        6 NU13 RS Poisson's ratio (ε3/ε1 for uniaxial loading in the 1-direction)
        7 NU23 RS Poisson's ratio (ε3/ε2 for uniaxial loading in the 2-direction)
        8 G12 RS In-plane shear modulus
        9 G13 RS Transverse shear modulus for shear in the 1–3 plane
        10 G23 RS Transverse shear modulus for shear in the 2–3 plane
        11 RHO RS Mass density
        12 A1 RS Thermal expansion coefficient in the longitudinal direction
        13 A2 RS Thermal expansion coefficient in the lateral direction
        14 A3 RS Thermal expansion coefficient in the thickness direction
        15 TREF RS Reference temperature for calculation of thermal loads
        16 GE RS Structural damping coefficient
        17 UNDEF(16) None

        """
        ntotal = 128  # 32*4
        struct1 = Struct(mapfmt(self._endian + b'i 15f 4f 12i', self.size))
        nmaterials = (len(data) - n) // ntotal
        for unused_i in range(nmaterials):
            edata = data[n:n + ntotal]
            out = struct1.unpack(edata)
            mid, e1, e2, e3, nu12, nu13, nu23, g12, g13, g23, rho, a1, a2, a3, tref, ge, *other = out
            if self.is_debug_file:
                self.binary_debug.write('  MATT11=%s\n' % str(out))
            print(mid, e1, e2, e3, nu12, nu13, nu23, g12, g13, g23, rho, a1,
                  a2, a3, tref, ge)
            #assert a == 0, out
            #assert b == 0, out
            #assert c == 0, out
            #assert d == 0, out
            #assert e == 0, out
            #MATT9(mid, g11_table=None, g12_table=None, g13_table=None, g14_table=None,
            #g15_table=None, g16_table=None, g22_table=None, g23_table=None,
            #g24_table=None, g25_table=None, g26_table=None, g33_table=None,
            #g34_table=None, g35_table=None, g36_table=None, g44_table=None,
            #g45_table=None, g46_table=None, g55_table=None, g56_table=None,
            #g66_table=None, rho_table=None,
            #a1_table=None, a2_table=None, a3_table=None,
            #a4_table=None, a5_table=None, a6_table=None, ge_table=None, comment='')
            #mat = MATT11(mid, *tc_tables, trho, ta1, ta2, ta3, ta4, ta5, ta6, tge, comment='')
            #self._add_material_dependence_object(mat, allow_overwrites=False)
            n += ntotal
        self.card_count['MAT11'] = nmaterials
        self.log.warning('skipping MAT11 in MPT')
        return n
示例#13
0
    def _read_load(self, data: bytes, n: int) -> int:
        """
        (4551, 61, 84) - the marker for Record 8
        .. todo:: add object
        """
        ntotal = 16 * self.factor  # 4*4
        ntotal2 = 8 * self.factor
        #nentries = (len(data) - n) // ntotal
        #count = 0
        struct_i2fi = Struct(mapfmt(self._endian + b'iffi', self.size))
        struct_fi = Struct(mapfmt(self._endian + b'fi', self.size))

        nentries_actual = 0
        while (len(data) - n) >= ntotal:
            edata = data[n:n + ntotal]
            n += ntotal
            out = struct_i2fi.unpack(edata)
            (sid, s, si, l1) = out
            if self.is_debug_file:
                self.binary_debug.write('  LOAD=%s\n' % str(out))
            Si = [si]
            L1 = [l1]
            while 1:
                edata = data[n:n + ntotal2]
                n += ntotal2
                (si, l1) = struct_fi.unpack(edata)
                si_test, = self.struct_i.unpack(edata[0:4])

                if [si_test, l1] == [-1, -1]:
                    break
                Si.append(si)
                L1.append(l1)
                if self.is_debug_file:
                    self.binary_debug.write('       [%s,%s]\n' % (si, l1))

            load = LOAD(sid, s, Si, L1)
            self._add_load_combination_object(load)
            nentries_actual += 1
            #count += 1
            #if count > 1000:
            #raise RuntimeError('Iteration limit...probably have a bug.')
        self.card_count['LOAD'] = nentries_actual
        return n
示例#14
0
文件: dit.py 项目: yqliaohk/pyNastran
    def _read_table4(self, cls, slot, add_method, data, n, table_name):
        """
        1 ID I Table identification number
        2 X1 RS X-axis shift
        3 X2 RS X-axis normalization
        4 X3 RS X value when x is less than X3
        5 X4 RS X value when x is greater than X4
        6 UNDEF(3 ) None
        9 A RS
        Word 9 repeats until End of Record (-1)
        """
        n0 = n
        nentries = 0
        ndata = len(data)
        size = self.size
        struct1 = Struct(mapfmt(self._endian + b'i 4f 3i f i', size))
        struct_i = self.struct_i if size == 4 else self.struct_q
        struct_f = Struct(self._endian +
                          b'f') if size == 4 else Struct(self._endian + b'd')
        ntotal1 = 40 * self.factor
        ntotal2 = 36 * self.factor
        try:
            while ndata - n >= ntotal1:
                edata = data[n:n + ntotal1]
                out = struct1.unpack(edata)
                (tid, x1, x2, x3, x4, unused_a, unused_b, unused_c, x,
                 test_minus1) = out
                data_in = [tid, x1, x2, x3, x4, x]
                n += ntotal2
                if test_minus1 == -1:
                    n += size
                else:
                    while 1:
                        xint, = struct_i.unpack(data[n:n + size])
                        x, = struct_f.unpack(data[n:n + size])

                        n += size
                        if xint == -1:
                            break
                        else:
                            data_in.append(x)
                table = cls.add_op2_data(data_in)
                add_method(table)
                nentries += 1
        except struct_error:
            self.log.error('failed parsing %s' % table_name)
            self.show_data(data[n0:], 'if')
            self.show_data(edata, 'if')
            #n = n0 + ndata
            raise
        self.increase_card_count(table_name, nentries)
        return n
示例#15
0
    def _read_nlparm(self, data: bytes, n: int) -> int:
        """
        NLPARM(3003,30,286) - record 27

        NX 2019.2
        Word Name Type Description
        1 SID       I Set identification number
        2 NINC      I Number of increments
        3 DT       RS Incremental time interval for creep analysis
        4 KMETHOD   I Method for controlling stiffness updates
        5 KSTEP     I Number of iterations before the stiffness update
        6 MAXITER   I Limit on number of iterations for each load increment
        7 CONV      I Flags to select convergence criteria
        8 INTOUT    I Intermediate output flag
        9 EPSU     RS Error tolerance for displacement U criterion
        10 EPSP    RS Error tolerance for displacement P criterion
        11 EPSW    RS Error tolerance for displacement W criterion
        12 MAXDIV   I Limit on probable divergence conditions
        13 MAXQN    I Maximum number of quasi-Newton correction vectors
        14 MAXLS    I Maximum number of line searches
        15 FSTRESS RS Fraction of effective stress
        16 LSTOL   RS Line search tolerance
        17 MAXBIS   I Maximum number of bisections
        18 MAXR    RS Maximum ratio for the adjusted arc-length increment
        19 RTOLB   RS Maximum value of incremental rotation

        ndata = 80:
                  sid nic dt   km ks max con int  epu   epp   epw   mx mx  mx fstr  lso  mx mx    rtolb
        ints    = (1, 10, 0,   1, 5, 25, -1, 0,   0.01, 0.01, 0.01, 3, 25, 4, 0.20, 0.5, 5, 20.0, 20.0, 0)
        floats  = (1, 10, 0.0, 1, 5, 25, -1, 0.0, 0.01, 0.01, 0.01, 3, 25, 4, 0.20, 0.5, 5, 20.0, 20.0, 0.0)
        """
        #print(len(data[12:]))
        #self.show_data(data[12:], types='if')
        ntotal = 76 * self.factor  # 19*4
        s = Struct(mapfmt(self._endian + b'iif5i3f3iffiff', self.size))
        ndatai = len(data) - n
        nentries = ndatai // ntotal
        assert nentries > 0
        #assert ndatai % ntotal == 0
        for unused_i in range(nentries):
            edata = data[n:n + ntotal]
            out = s.unpack(edata)
            #(sid,ninc,dt,kMethod,kStep,maxIter,conv,intOut,epsU,epsP,epsW,
            # maxDiv,maxQn,maxLs,fStress,lsTol,maxBisect,maxR,rTolB) = out
            if self.is_debug_file:
                self.binary_debug.write('  NLPARM=%s\n' % str(out))
            self._add_nlparm_object(NLPARM.add_op2_data(out))
            n += ntotal
        self.card_count['NLPARM'] = nentries
        return n
示例#16
0
    def _read_tstepnl_msc(self, data: bytes,
                          n: int) -> Tuple[int, List[TSTEPNL]]:
        """
        TSTEPNL(3103,31,337) - record 29

        MSC 2005.2
        1 SID       I Set identification number
        2 NDT       I Number of time steps of value DT
        3 DT       RS Time increment
        4 NO        I Time step interval for output
        5 METHOD    I Method for dynamic matrix update
        6 KSTEP     I Time step interval or number of converged bisections
        7 MAXITER   I Limit on number of iterations
        8 CONV      I Flags to select convergence criteria
        9 EPSU     RS Error tolerance for displacement U criterion
        10 EPSP    RS Error tolerance for displacement P criterion
        11 EPSW    RS Error tolerance for displacement W criterion
        12 MAXDIV   I Limit on probable divergence conditions
        13 MAXQN    I Maximum number of quasi-Newton correction vectors
        14 MAXLS    I Maximum number of line searches
        15 FSTRESS RS Fraction of effective stress
        16 MAXBIS   I Maximum number of bisections
        17 ADJUST   I Time step skip factor for automatic time step adjustment
        18 MSTEP    I Number of steps to obtain the dominant period response
        19 RB      RS Define bounds for maintaining the same time step
        20 MAXR    RS Maximum ratio for the adjusted arc-length increment
        21 UTOL    RS Tolerance on displacement or temperature increment
        22 RTOLB   RS Maximum value of incremental rotation

        """
        ntotal = 88 * self.factor  # 22*4
        s = Struct(mapfmt(self._endian + b'iif5i3f3if3i4f', self.size))
        nentries = (len(data) - n) // ntotal
        assert (len(data) - n) % ntotal == 0
        assert nentries > 0, nentries
        tstepnls = []
        for unused_i in range(nentries):
            edata = data[n:n + ntotal]
            out = s.unpack(edata)
            #(sid,ndt,dt,no,kMethod,kStep,maxIter,conv,epsU,epsP,epsW,
            # maxDiv,maxQn,maxLs,fStress,lsTol,maxBisect,adjust,mStep,rb,maxR,uTol,rTolB) = out
            method = out[4]
            if method in [4]:
                self.log.warning('method=4; skipping TSTEPNL=%r' % str(out))
            else:
                tstepnl = TSTEPNL.add_op2_data(out)
                tstepnls.append(tstepnl)
            n += ntotal
        return n, tstepnls
示例#17
0
 def _read_matt9(self, data: bytes, n: int) -> int:
     """
     Word Name Type Description
     1 MID    I Material identification number
     2 TC(21) I TABLEMi identification numbers for material property matrix
     23 TRHO  I TABLEMi identification number for mass density
     24 TA(6) I TABLEMi identification numbers for thermal expansion coefficients
     30 UNDEF None
     31 TGE   I TABLEMi identification number for structural damping coefficient
     32 UNDEF(4) None
     """
     ntotal = 140 * self.factor  # 35*4
     s = Struct(mapfmt(self._endian + b'35i', self.size))
     nmaterials = (len(data) - n) // ntotal
     for unused_i in range(nmaterials):
         edata = data[n:n + ntotal]
         out = s.unpack(edata)
         (mid, *tc_tables, trho, ta1, ta2, ta3, ta4, ta5, ta6, a, tge, b, c,
          d, e) = out
         if self.is_debug_file:
             self.binary_debug.write('  MATT9=%s\n' % str(out))
         assert a == 0, out
         assert b == 0, out
         assert c == 0, out
         assert d == 0, out
         assert e == 0, out
         #MATT9(mid, g11_table=None, g12_table=None, g13_table=None, g14_table=None,
         #g15_table=None, g16_table=None, g22_table=None, g23_table=None,
         #g24_table=None, g25_table=None, g26_table=None, g33_table=None,
         #g34_table=None, g35_table=None, g36_table=None, g44_table=None,
         #g45_table=None, g46_table=None, g55_table=None, g56_table=None,
         #g66_table=None, rho_table=None,
         #a1_table=None, a2_table=None, a3_table=None,
         #a4_table=None, a5_table=None, a6_table=None, ge_table=None, comment='')
         mat = MATT9(mid,
                     *tc_tables,
                     trho,
                     ta1,
                     ta2,
                     ta3,
                     ta4,
                     ta5,
                     ta6,
                     tge,
                     comment='')
         self._add_material_dependence_object(mat, allow_overwrites=False)
         n += ntotal
     self.card_count['MATT9'] = nmaterials
     return n
示例#18
0
 def _read_mat4(self, data: bytes, n: int) -> int:
     """
     MAT4(2103,21,234) - record 5
     """
     ntotal = 44 * self.factor
     s = Struct(mapfmt(self._endian + b'i10f', self.size))
     nmaterials = (len(data) - n) // ntotal
     for unused_i in range(nmaterials):
         out = s.unpack(data[n:n + ntotal])
         #(mid, k, cp, rho, h, mu, hgen, refenth, tch, tdelta, qlat) = out
         mat = MAT4.add_op2_data(out)
         self._add_thermal_material_object(mat, allow_overwrites=False)
         n += ntotal
     self.card_count['MAT4'] = nmaterials
     return n
示例#19
0
 def _read_rforce(self, data: bytes, n: int) -> int:
     ntotal = 40 * self.factor  # 10*4
     nentries = (len(data) - n) // ntotal
     struc = Struct(mapfmt(self._endian + b'3i 4f ifi', self.size))
     for unused_i in range(nentries):
         edata = data[n:n + ntotal]
         out = struc.unpack(edata)
         if self.is_debug_file:
             self.binary_debug.write('  RFORCE=%s\n' % str(out))
         #(sid, nid, scale_factor) = out
         load = RFORCE.add_op2_data(out)
         self._add_load_object(load)
         n += ntotal
     self.card_count['RFORCE'] = nentries
     return n
示例#20
0
 def _read_mat1(self, data: bytes, n: int) -> int:
     """
     MAT1(103,1,77) - record 2
     """
     ntotal = 48 * self.factor  # 12*4
     s = Struct(mapfmt(self._endian + b'i10fi', self.size))
     nmaterials = (len(data) - n) // ntotal
     for unused_i in range(nmaterials):
         edata = data[n:n + ntotal]
         out = s.unpack(edata)
         #(mid, E, G, nu, rho, A, tref, ge, St, Sc, Ss, mcsid) = out
         mat = MAT1.add_op2_data(out)
         self.add_op2_material(mat)
         n += ntotal
     self.card_count['MAT1'] = nmaterials
     return n
示例#21
0
 def _read_mat8(self, data: bytes, n: int) -> int:
     """
     MAT8(2503,25,288) - record 7
     """
     ntotal = 76 * self.factor
     s = Struct(mapfmt(self._endian + b'i18f', self.size))
     nmaterials = (len(data) - n) // ntotal
     for unused_i in range(nmaterials):
         out = s.unpack(data[n:n + ntotal])
         #(mid, E1, E2, nu12, G12, G1z, G2z, rho, a1, a2,
         # tref, Xt, Xc, Yt, Yc, S, ge, f12, strn) = out
         mat = MAT8.add_op2_data(out)
         self.add_op2_material(mat)
         n += ntotal
     self.card_count['MAT8'] = nmaterials
     return n
示例#22
0
 def _read_pload1(self, data: bytes, n: int) -> int:
     """
     PLOAD1(6909, 69, 198) - the marker for Record 17
     """
     ntotal = 32 * self.factor  # 8*4
     s = Struct(mapfmt(self._endian + b'4i4f', self.size))
     nentries = (len(data) - n) // ntotal
     for unused_i in range(nentries):
         edata = data[n:n + ntotal]
         out = s.unpack(edata)
         if self.is_debug_file:
             self.binary_debug.write('  PLOAD1=%s\n' % str(out))
         #(sid, eid, load_type, scale, x1, p1, x2, p2) = out
         load = PLOAD1.add_op2_data(out)
         self._add_load_object(load)
         n += ntotal
     self.card_count['PLOAD1'] = nentries
     return n
示例#23
0
 def _read_cord2x_13(self, data: bytes, n: int,
                     coord_name: str,
                     coord_cls: Union[CORD2R, CORD2C, CORD2S],
                     flags: Tuple[int, int]) -> int:
     ntotal = 52 * self.factor # 13*4
     s = Struct(mapfmt(self._endian + b'4i9f', self.size))
     nentries = (len(data) - n) // ntotal
     for unused_i in range(nentries):
         edata = data[n:n + ntotal]
         out = s.unpack(edata)
         (cid, sixty5, eight, rid, a1, a2, a3, b1, b2, b3, c1, c2, c3) = out
         data_in = [cid, rid, a1, a2, a3, b1, b2, b3, c1, c2, c3]
         if self.is_debug_file:
             self.binary_debug.write(f'  {coord_name}={out}\n')
         coord = coord_cls.add_op2_data(data_in)
         self._add_coord_object(coord, allow_overwrites=False)
         n += ntotal
     self.increase_card_count(coord_name, nentries)
     return n
示例#24
0
 def _read_matt4(self, data, n):
     """
     MATT4(2303,23,237)
     checked NX-10.1, MSC-2016
     """
     struct_7i = Struct(mapfmt(self._endian + b'7i', self.size))
     ntotal = 28 * self.factor  # 7*4
     ncards = (len(data) - n) // ntotal
     for unused_i in range(ncards):
         edata = data[n:n + ntotal]
         out = struct_7i.unpack(edata)
         if self.is_debug_file:
             self.binary_debug.write('  MATT4=%s\n' % str(out))
         #(mid, tk, tcp, null, th, tmu, thgen) = out
         mat = MATT4.add_op2_data(out)
         self._add_material_dependence_object(mat)
         n += ntotal
     self.increase_card_count('MATT4', ncards)
     return n
示例#25
0
    def _read_tstepnl(self, data, n):
        """TSTEPNL(3103,31,337) - record 29"""
        ntotal = 88 * self.factor  # 19*4
        s = Struct(mapfmt(self._endian + b'iif5i3f3if3i4f', self.size))
        nentries = (len(data) - n) // ntotal
        for unused_i in range(nentries):
            edata = data[n:n + ntotal]
            out = s.unpack(edata)
            #(sid,ndt,dt,no,kMethod,kStep,maxIter,conv,epsU,epsP,epsW,
            # maxDiv,maxQn,maxLs,fStress,lsTol,maxBisect,adjust,mStep,rb,maxR,uTol,rTolB) = out
            method = out[4]
            if method in [4]:
                self.log.warning('method=4; skipping TSTEPNL=%r' % str(out))
            else:
                self._add_tstepnl_object(TSTEPNL.add_op2_data(out))

            n += ntotal
        self.card_count['TSTEPNL'] = nentries
        return n
示例#26
0
 def _read_cord2s(self, data, n):
     """
     (2201,22,10) - the marker for Record 6
     """
     ntotal = 52 * self.factor # 13*4
     s = Struct(mapfmt(self._endian + b'4i9f', self.size))
     nentries = (len(data) - n) // ntotal
     for unused_i in range(nentries):
         edata = data[n:n + ntotal]
         out = s.unpack(edata)
         (cid, sixty5, eight, rid, a1, a2, a3, b1, b2, b3, c1, c2, c3) = out
         data_in = [cid, rid, a1, a2, a3, b1, b2, b3, c1, c2, c3]
         if self.is_debug_file:
             self.binary_debug.write('  CORD2S=%s\n' % str(out))
         coord = CORD2S.add_op2_data(data_in)
         self._add_coord_object(coord, allow_overwrites=False)
         n += ntotal
     self.increase_card_count('CORD2S', nentries)
     return n
示例#27
0
 def _read_tempd(self, data: bytes, n: int) -> int:
     """
     TEMPD(5641,65,98) - the marker for Record 33
     .. todo:: add object
     """
     ntotal = 8 * self.factor  # 2*4
     nentries = (len(data) - n) // ntotal
     struct_if = Struct(mapfmt(self._endian + b'if', self.size))
     for unused_i in range(nentries):
         edata = data[n:n + ntotal]
         out = struct_if.unpack(edata)
         if self.is_debug_file:
             self.binary_debug.write('  TEMPD=%s\n' % str(out))
         #(sid, T) = out
         load = TEMPD.add_op2_data(out)
         self._add_tempd_object(load)
         n += ntotal
     self.card_count['TEMPD'] = nentries
     return n
示例#28
0
 def _read_creep(self, data: bytes, n: int) -> int:
     """
     CREEP(1003,10,245) - record 1
     """
     ntotal = 64 * self.factor
     nmaterials = (len(data) - n) // ntotal
     s = Struct(mapfmt(self._endian + b'i2f4ifi7f', self.size))
     for unused_i in range(nmaterials):
         edata = data[n:n + ntotal]
         out = s.unpack(edata)
         #(mid, T0, exp, form, tidkp, tidcp, tidcs, thresh,
         #Type, ag1, ag2, ag3, ag4, ag5, ag6, ag7) = out
         if self.is_debug_file:
             self.binary_debug.write('  CREEP=%s\n' % str(out))
         mat = CREEP.add_op2_data(out)
         self._add_creep_material_object(mat, allow_overwrites=False)
         n += ntotal
     self.card_count['CREEP'] = nmaterials
     return n
示例#29
0
 def _read_matt1(self, data: bytes, n: int) -> int:
     """
     MATT1(703,7,91)
     checked NX-10.1, MSC-2016
     """
     s = Struct(mapfmt(self._endian + b'12i', self.size))
     ntotal = 48 * self.factor  # 12*4
     ncards = (len(data) - n) // ntotal
     for unused_i in range(ncards):
         edata = data[n:n + ntotal]
         out = s.unpack(edata)
         if self.is_debug_file:
             self.binary_debug.write('  MATT1=%s\n' % str(out))
         #(mid, tableid, ...., None) = out
         mat = MATT1.add_op2_data(out)
         self._add_material_dependence_object(mat)
         n += ntotal
     self.increase_card_count('MATT1', ncards)
     return n
示例#30
0
 def _read_cord2x_13(self, data: bytes, n: int, coord_name: str,
                     coord_cls: Union[CORD2R, CORD2C, CORD2S],
                     flags: Tuple[int, int]) -> int:
     ntotal = 52 * self.factor  # 13*4
     s = Struct(mapfmt(self._endian + b'4i9f', self.size))
     ndatai = len(data) - n
     nentries = ndatai // ntotal
     assert ndatai % ntotal == 0
     coords = []
     for unused_i in range(nentries):
         edata = data[n:n + ntotal]
         out = s.unpack(edata)
         (cid, sixty5, eight, rid, a1, a2, a3, b1, b2, b3, c1, c2, c3) = out
         data_in = [cid, rid, a1, a2, a3, b1, b2, b3, c1, c2, c3]
         if self.is_debug_file:
             self.binary_debug.write(f'  {coord_name}={out}\n')
         coord = coord_cls.add_op2_data(data_in)
         coords.append(coord)
         n += ntotal
     return n, coords