Exemplo n.º 1
0
 def readQBDY2(self, data):
     """
     QBDY2(4909,49,240) - the marker for Record 25
     """
     #print "reading QBDY2"
     n = 0
     nEntries = len(data) // 40  # 10*4
     for i in range(nEntries):
         eData = data[n:n + 40]
         out = unpack('iiffffffff', eData)
         (sid, eid, q1, q2, q3, q4, q5, q6, q7, q8) = out
         load = QBDY2(None, out)
         self.add_thermal_load(load)
         n += 40
     data = data[n:]
Exemplo n.º 2
0
 def _readQBDY2(self, data, n):
     """
     QBDY2(4909,49,240) - the marker for Record 25
     """
     #print "reading QBDY2"
     ntotal = 40  # 10*4
     nEntries = (len(data) - n) // ntotal
     for i in xrange(nEntries):
         eData = data[n:n + 40]
         out = unpack('iiffffffff', eData)
         (sid, eid, q1, q2, q3, q4, q5, q6, q7, q8) = out
         load = QBDY2(None, out)
         self.add_thermal_load(load)
         n += 40
     self.card_count['QBDY2'] = nEntries
     return n
Exemplo n.º 3
0
 def _read_qbdy2(self, data, n):
     """
     QBDY2(4909,49,240) - the marker for Record 25
     """
     ntotal = 40  # 10*4
     nentries = (len(data) - n) // ntotal
     for i in range(nentries):
         edata = data[n:n + 40]
         out = unpack('ii8f', edata)
         if self.is_debug_file:
             self.binary_debug.write('  QBDY2=%s\n' % str(out))
         (sid, eid, q1, q2, q3, q4, q5, q6, q7, q8) = out
         load = QBDY2.add_op2_data(out)
         self._add_thermal_load_object(load)
         n += 40
     self.card_count['QBDY2'] = nentries
     return n
Exemplo n.º 4
0
 def _read_qbdy2(self, data, n):
     """
     QBDY2(4909,49,240) - the marker for Record 25
     """
     ntotal = 40  # 10*4
     nentries = (len(data) - n) // ntotal
     for i in range(nentries):
         edata = data[n:n + 40]
         out = unpack('ii8f', edata)
         if self.is_debug_file:
             self.binary_debug.write('  QBDY2=%s\n' % str(out))
         (sid, eid, q1, q2, q3, q4, q5, q6, q7, q8) = out
         load = QBDY2.add_op2_data(out)
         self.add_thermal_load(load)
         n += 40
     self.card_count['QBDY2'] = nentries
     return n
Exemplo n.º 5
0
 def _read_qbdy2(self, data: bytes, n: int) -> int:
     """
     QBDY2(4909,49,240) - the marker for Record 25
     """
     ntotal = 40  # 10*4
     nentries = (len(data) - n) // ntotal
     struct_2i8f = Struct(self._endian + b'ii8f')
     for unused_i in range(nentries):
         edata = data[n:n + 40]
         out = struct_2i8f.unpack(edata)
         if self.is_debug_file:
             self.binary_debug.write('  QBDY2=%s\n' % str(out))
         #(sid, eid, q1, q2, q3, q4, q5, q6, q7, q8) = out
         load = QBDY2.add_op2_data(out)
         self._add_thermal_load_object(load)
         n += 40
     self.card_count['QBDY2'] = nentries
     return n
Exemplo n.º 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