Exemple #1
0
 def readTEMP(self, data):
     """
     TEMP(5701,57,27) - the marker for Record 32
     .. warning:: buggy
     """
     #print "reading TEMP"
     n = 0
     nEntries = len(data) // 12  # 3*4
     for i in range(nEntries):
         eData = data[n:n + 12]
         out = unpack('iif', eData)
         (sid, g, T) = out
         if g < 10000000:
             load = TEMP(None, out)
             self.add_thermal_load(load)
         else:
             self.log.debug('TEMP = %s' % (out))
         n += 12
     data = data[n:]
Exemple #2
0
 def _readTEMP(self, data, n):
     """
     TEMP(5701,57,27) - the marker for Record 32
     .. warning:: buggy
     """
     #print "reading TEMP"
     ntotal = 12  # 3*4
     nEntries = (len(data) - n) // ntotal
     for i in xrange(nEntries):
         eData = data[n:n + 12]
         out = unpack('iif', eData)
         (sid, g, T) = out
         if g < 10000000:
             load = TEMP(None, out)
             self.add_thermal_load(load)
         else:
             self.log.debug('TEMP = %s' % (out))
         n += 12
     self.card_count['TEMP'] = nEntries
     return n
Exemple #3
0
 def _read_temp(self, data, n):
     """
     TEMP(5701,57,27) - the marker for Record 32
     .. warning:: buggy
     """
     ntotal = 12  # 3*4
     nentries = (len(data) - n) // ntotal
     for i in range(nentries):
         edata = data[n:n + 12]
         out = unpack('iif', edata)
         if self.is_debug_file:
             self.binary_debug.write('  TEMP=%s\n' % str(out))
         (sid, g, T) = out
         if g < 10000000:
             load = TEMP.add_op2_data(out)
             self._add_thermal_load_object(load)
         else:
             self.log.debug('TEMP = %s' % (out))
         n += 12
     self.card_count['TEMP'] = nentries
     return n
Exemple #4
0
 def _read_temp(self, data, n):
     """
     TEMP(5701,57,27) - the marker for Record 32
     .. warning:: buggy
     """
     ntotal = 12  # 3*4
     nentries = (len(data) - n) // ntotal
     for i in range(nentries):
         edata = data[n:n + 12]
         out = unpack('iif', edata)
         if self.is_debug_file:
             self.binary_debug.write('  TEMP=%s\n' % str(out))
         (sid, g, T) = out
         if g < 10000000:
             load = TEMP.add_op2_data(out)
             self.add_thermal_load(load)
         else:
             self.log.debug('TEMP = %s' % (out))
         n += 12
     self.card_count['TEMP'] = nentries
     return n
Exemple #5
0
 def _read_temp(self, data: bytes, n: int) -> int:
     """
     TEMP(5701,57,27) - the marker for Record 32
     .. warning:: buggy
     """
     ntotal = 12 * self.factor  # 3*4
     nentries = (len(data) - n) // ntotal
     struct_2if = Struct(mapfmt(self._endian + b'iif', self.size))
     for unused_i in range(nentries):
         edata = data[n:n + ntotal]
         out = struct_2if.unpack(edata)
         if self.is_debug_file:
             self.binary_debug.write('  TEMP=%s\n' % str(out))
         (sid, g, T) = out
         if g < 10000000:
             load = TEMP.add_op2_data(out)
             self._add_thermal_load_object(load)
         else:
             self.log.debug('TEMP = %s' % (out))
         n += ntotal
     self.card_count['TEMP'] = nentries
     return n
Exemple #6
0
def _mirror_loads(model: BDF, nid_offset: int = 0, eid_offset: int = 0):
    """
    Mirrors the loads.  A mirrored force acts in the same direction.

    Considers:
     - PLOAD4
        - no coordinate systems (assumes cid=0)
     - FORCE, FORCE1, FORCE2, MOMENT, MOMENT1, MOMENT2
     - PLOAD, PLOAD2
     - TEMP, QVOL, QHBDY, QBDY1, QBDY2, QBDY3

    """
    for unused_load_id, loads in model.loads.items():
        for load in loads:
            loads_new = []
            load_type = load.type
            if load_type == 'PLOAD4':
                g1 = None
                g34 = None
                if load.g1 is not None:
                    g1 = load.g1 + nid_offset
                if load.g34 is not None:
                    g34 = load.g34 + nid_offset

                eids = [eid + eid_offset for eid in load.eids]
                load = PLOAD4(load.sid,
                              eids,
                              load.pressures,
                              g1,
                              g34,
                              cid=load.cid,
                              nvector=load.nvector,
                              surf_or_line=load.surf_or_line,
                              line_load_dir=load.line_load_dir,
                              comment='')
                loads_new.append(load)

            elif load_type == 'FORCE':
                load = FORCE(load.sid,
                             load.node + nid_offset,
                             load.mag,
                             load.xyz,
                             cid=load.cid,
                             comment='')
                loads_new.append(load)
            elif load_type == 'FORCE1':
                load = FORCE1(load.sid,
                              load.node + nid_offset,
                              load.mag,
                              load.g1 + nid_offset,
                              load.g2 + nid_offset,
                              comment='')
                loads_new.append(load)
            elif load_type == 'FORCE2':
                load = FORCE2(load.sid,
                              load.node + nid_offset,
                              load.mag,
                              load.g1 + nid_offset,
                              load.g2 + nid_offset,
                              load.g3 + nid_offset,
                              load.g4 + nid_offset,
                              comment='')
                loads_new.append(load)

            elif load_type == 'MOMENT':
                load = MOMENT(load.sid,
                              load.node + nid_offset,
                              load.mag,
                              load.xyz,
                              cid=load.cid,
                              comment='')
                loads_new.append(load)
            elif load_type == 'MOMENT1':
                load = MOMENT1(load.sid,
                               load.node + nid_offset,
                               load.mag,
                               load.g1 + nid_offset,
                               load.g2 + nid_offset,
                               comment='')
                loads_new.append(load)
            elif load_type == 'MOMENT2':
                load = MOMENT2(load.sid,
                               load.node + nid_offset,
                               load.mag,
                               load.g1 + nid_offset,
                               load.g2 + nid_offset,
                               load.g3 + nid_offset,
                               load.g4 + nid_offset,
                               comment='')
                loads_new.append(load)

            elif load_type == 'PLOAD':
                nodes = [nid + nid_offset for nid in load.nodes]
                load = PLOAD(load.sid, load.pressure, nodes, comment='')
                loads_new.append(load)
            elif load_type == 'PLOAD2':
                eids = [eid + eid_offset for eid in load.eids]
                load = PLOAD2(load.sid, load.pressure, eids, comment='')
                loads_new.append(load)

            elif load_type == 'QVOL':
                elements = [eid + eid_offset for eid in load.elements]
                load = QVOL(load.sid, load.qvol,
                            nid_offset + load.control_point, elements)
                loads_new.append(load)
            elif load_type == 'QHBDY':
                grids = [nid + nid_offset for nid in load.grids]
                load = QHBDY(load.sid, load.flag, load.q0, grids, af=load.af)
                loads_new.append(load)
            elif load_type == 'QBDY1':
                eids = [eid + eid_offset for eid in load.eids]
                load = QBDY1(load.sid, load.qflux, eids)
                loads_new.append(load)
            elif load_type == 'QBDY2':
                load = QBDY2(load.sid,
                             load.eid + eid_offset,
                             load.qfluxs,
                             comment='')
                loads_new.append(load)
            elif load_type == 'QBDY3':
                eids = [eid + eid_offset for eid in load.eids]
                load = QBDY3(load.sid, load.q0, load.cntrlnd + nid_offset,
                             eids)
                loads_new.append(load)

            elif load_type == 'TEMP':
                temperatures = {}
                for nid, temp in load.temperatures.items():
                    temperatures[nid + nid_offset] = temp
                load = TEMP(load.sid, temperatures)
                loads_new.append(load)
            elif load_type == 'GRAV':
                pass
            else:  # pragma: no cover
                model.log.warning('skipping:\n%s' % load.rstrip())
        if loads_new:
            loads += loads_new