Esempio n. 1
0
    def _read_qvol(self, data, n):
        """
        Record 30 -- QVOL(2309,23,416)

        1 SID      I Load set identification number
        2 QVOL    RS Power input per unit volume produced by a
                     conduction element
        3 CNTRLND  I Control point used for controlling heat
                     generation
        4 EID      I Element identification number
        """
        ntotal = 16  # 4*4
        nentries = (len(data) - n) // ntotal
        struc = Struct(b(self._endian + 'if2i'))
        for i in range(nentries):
            edata = data[n:n + ntotal]
            out = struc.unpack(edata)
            if self.is_debug_file:
                self.binary_debug.write('  QVOL=%s\n' % str(out))
            #(sid, qvol, cntrlnd, eid) = out
            load = QVOL.add_op2_data(out)
            self._add_load_object(load)
            n += ntotal
        self.card_count['TEMPP1'] = nentries
        return n
Esempio n. 2
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