コード例 #1
0
ファイル: loads.py プロジェクト: sukhbinder/cyNastran
    def __init__(self, card, data):
        Load.__init__(self, card, data)

        if card:
            #: load ID
            self.sid = integer(card, 1, 'sid')

            #: overall scale factor
            self.scale = double(card, 2, 'scale')

            #: individual scale factors (corresponds to loadIDs)
            self.scaleFactors = []

            #: individual loadIDs (corresponds to scaleFactors)
            self.loadIDs = []

            # alternating of scale factor & load set ID
            nLoads = len(card) - 3
            assert nLoads % 2 == 0
            for i in xrange(nLoads // 2):
                n = 2 * i + 3
                self.scaleFactors.append(double(card, n, 'scaleFactor'))
                self.loadIDs.append(integer(card, n + 1, 'loadID'))
        else:
            self.sid = data[0]
            self.scale = data[1]
            self.scaleFactors = data[2]
            self.loadIDs = data[3]
            assert len(data) == 4, '%s data=%s' % (self.type, data)
コード例 #2
0
ファイル: staticLoads.py プロジェクト: anick107/von_mises_rms
 def __init__(self, card=None, data=None, comment=''):
     if comment:
         self._comment = comment
     if card:
         self.sid = integer(card, 1, 'sid')
         self.eid = integer(card, 2, 'eid')
         self.Type = string(card, 3, 'Type')
         self.scale = string(card, 4, 'scale')
         self.x1 = double(card, 5, 'x1')
         self.p1 = double(card, 6, 'p1')
         self.x2 = double_or_blank(card, 7, 'x2', self.x1)
         self.p2 = double_or_blank(card, 8, 'p2', self.p1)
         assert 0 <= self.x1 <= self.x2
         assert len(card) <= 9, 'len(PLOAD1 card) = %i' % len(card)
     else:
         self.sid = data[0]
         self.eid = data[1]
         self.Type = data[2]
         self.scale = data[3]
         self.x1 = data[4]
         self.p1 = data[5]
         self.x2 = data[6]
         self.p2 = data[7]
     if self.Type not in self.validTypes:
         msg = '%s is an invalid type on the PLOAD1 card' % self.Type
         raise RuntimeError(msg)
     assert self.scale in self.validScales, '%s is an invalid scale on the PLOAD1 card' % (self.scale)
コード例 #3
0
ファイル: tables.py プロジェクト: anick107/von_mises_rms
    def __init__(self, card=None, data=None, comment=''):
        Table.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.tid = integer(card, 1, 'tid')
            self.x1 = double(card, 2, 'x1')
            self.x2 = double(card, 3, 'x2')
            assert self.x2 != 0.0

            nfields = len(card) - 1
            nterms = (nfields - 9) // 2
            xy = []
            for i in range(nterms):
                n = 9 + i * 2
                if card.field(n) == 'ENDT':
                    break
                x = double(card, n, 'x' + str(i + 1))
                y = double(card, n + 1, 'y' + str(i + 1))
                xy += [x, y]
            ENDT = string(card, nfields, 'ENDT')
            isData = False
        else:
            self.tid = data[0]
            self.x1 = data[1]
            self.x2 = data[2]
            xy = data[3:]
            isData = True
        self.parse_fields(xy, nrepeated=2, isData=isData)
コード例 #4
0
ファイル: methods.py プロジェクト: sukhbinder/cyNastran
    def __init__(self, card=None, data=None, comment=''):
        Method.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Set identification number. (Unique Integer > 0)
            self.sid = integer(card, 1, 'sid')

            #: Coordinates of point in complex plane. (Real)
            self.alpha1 = double(card, 2, 'alpha1')
            #: Coordinates of point in complex plane. (Real)
            self.omega1 = double(card, 3, 'omega1')
            #: Multiplicity of complex root at pole defined by point at ALPHAi
            #: and OMEGAi
            self.m1 = integer(card, 4, 'm1')

            #: Coordinates of point in complex plane. (Real)
            self.alpha2 = double(card, 5, 'alpha2')
            #: Coordinates of point in complex plane. (Real)
            self.omega2 = double(card, 6, 'omega2')
            #: Multiplicity of complex root at pole defined by point at ALPHAi
            #: and OMEGAi
            self.m2 = integer(card, 7, 'm2')
            assert len(card) == 8, 'len(EIGP card) = %i' % len(card)
        else:
            raise NotImplementedError('EIGP')
コード例 #5
0
ファイル: mat8.py プロジェクト: ClaesFredo/pyNastran
    def add(self, card, comment=""):
        i = self.i
        # if comment:
        #    self._comment = comment
        self.material_id[i] = integer(card, 1, "material_id")
        self.e11[i] = double(card, 2, "E11")  #: .. todo:: is this the correct default
        self.e22[i] = double(card, 3, "E22")  #: .. todo:: is this the correct default
        self.nu12[i] = double(card, 4, "nu12")  #: .. todo:: is this the correct default

        self.g12[i] = double_or_blank(card, 5, "g12", 0.0)
        self.g1z[i] = double_or_blank(card, 6, "g1z", 1e8)
        self.g2z[i] = double_or_blank(card, 7, "g2z", 1e8)
        self.rho[i] = double_or_blank(card, 8, "rho", 0.0)
        self.a1[i] = double_or_blank(card, 9, "a1", 0.0)
        self.a2[i] = double_or_blank(card, 10, "a2", 0.0)
        self.TRef[i] = double_or_blank(card, 11, "TRef", 0.0)
        self.Xt[i] = double_or_blank(card, 12, "Xt", 0.0)
        self.Xc[i] = double_or_blank(card, 13, "Xc", self.Xt[i])
        self.Yt[i] = double_or_blank(card, 14, "Yt", 0.0)
        self.Yc[i] = double_or_blank(card, 15, "Yc", self.Yt[i])
        self.S[i] = double_or_blank(card, 16, "S", 0.0)
        self.ge[i] = double_or_blank(card, 17, "ge", 0.0)
        self.F12[i] = double_or_blank(card, 18, "F12", 0.0)
        self.strn[i] = double_or_blank(card, 19, "strn", 0.0)
        assert len(card) <= 20, "len(MAT8 card) = %i" % len(card)
        self.i += 1
コード例 #6
0
ファイル: properties.py プロジェクト: anick107/von_mises_rms
 def __init__(self, card=None, data=None, comment=''):
     Property.__init__(self, card, data)
     if comment:
         self._comment = comment
     if card:
         #: Property ID
         self.pid = integer(card, 1, 'pid')
         #: diameter of the fastener
         self.d = double(card, 2, 'd')
         assert self.d > 0
         #: Specifies the element stiffness coordinate system
         self.mcid = integer_or_blank(card, 3, 'mcid', -1)
         assert self.mcid >= -1
         self.mflag = integer_or_blank(card, 4, 'mflag', 0)  # 0-absolute 1-relative
         assert self.mflag in [0, 1]
         #: stiffness values in directions 1-3
         self.kt1 = double(card, 5, 'kt1')
         self.kt2 = double(card, 6, 'kt2')
         self.kt3 = double(card, 7, 'kt3')
         #: Rotational stiffness values in directions 1-3
         self.kr1 = double_or_blank(card, 8, 'kr1', 0.0)
         self.kr2 = double_or_blank(card, 9, 'kr2', 0.0)
         self.kr3 = double_or_blank(card, 10, 'kr3', 0.0)
         #: Lumped mass of fastener
         self.mass = double_or_blank(card, 11, 'mass', 0.0)
         #: Structural damping
         self.ge = double_or_blank(card, 12, 'ge', 0.0)
         assert len(card) <= 13, 'len(PFAST card) = %i' % len(card)
     else:
         raise NotImplementedError(data)
コード例 #7
0
ファイル: bdf_tables.py プロジェクト: ClaesFredo/pyNastran
    def __init__(self, card=None, data=None, comment=''):
        Table.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.tid = integer(card, 1, 'tid')

            nfields = len(card) - 1
            nterms = (nfields - 9) // 2
            if nterms < 0:
                raise SyntaxError('%r card is too short' % self.type)
            xy = []
            for i in range(nterms):
                n = 9 + i * 2
                if card.field(n) == 'ENDT':
                    break
                x = double(card, n, 'x' + str(i + 1))
                y = double(card, n + 1, 'y' + str(i + 1))
                xy += [x, y]
            string(card, nfields, 'ENDT')
            isData = False
        else:
            self.tid = data[0]
            xy = data[1:]
            isData = True
        self.parse_fields(xy, nrepeated=2, isData=isData)
コード例 #8
0
ファイル: bdf_tables.py プロジェクト: ClaesFredo/pyNastran
    def __init__(self, card=None, data=None, comment=''):
        RandomTable.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.tid = integer(card, 1, 'tid')
            self.xaxis = string_or_blank(card, 2, 'xaxis', 'LINEAR')
            self.yaxis = string_or_blank(card, 3, 'yaxis', 'LINEAR')

            nfields = len(card) - 1
            nterms = (nfields - 9) // 2
            if nterms < 0:
                raise SyntaxError('%r card is too short' % self.type)
            xy = []
            for i in range(nterms):
                n = 9 + i * 2
                if card.field(n) == 'ENDT':
                    break
                x = double(card, n, 'x' + str(i + 1))
                y = double(card, n + 1, 'y' + str(i + 1))
                xy += [x, y]
            string(card, nfields, 'ENDT')
            isData = False
        else:
            self.tid = data[0]
            self.xaxis = self.map_axis(data[1])
            self.yaxis = self.map_axis(data[2])
            xy = data[3:]
            isData = True
        assert self.xaxis in ['LINEAR', 'LOG'], 'xaxis=|%s|' % (self.xaxis)
        assert self.yaxis in ['LINEAR', 'LOG'], 'yaxis=|%s|' % (self.yaxis)
        self.parse_fields(xy, nrepeated=2, isData=isData)
コード例 #9
0
ファイル: temp.py プロジェクト: umvarma/pynastran
    def add(self, card, comment=''):
        assert self.n > 0, self.n
        i = self.i
        load_id = integer(card, 1, 'load_id')
        tbar = double(card, 3, 'Tbar')
        tprime = double(card, 4, 'Tprime')
        t1 = double_or_blank(card, 5, 'T1')
        t2 = double_or_blank(card, 6, 'T2')

        self.load_id[i] = load_id
        self.element_id[i] = integer(card, 2, 'element_id')
        self.tbar[i] = tbar
        self.tprime[i] = tprime
        self.temp[i, 0] = t1
        self.temp[i, 1] = t2
        self.i += 1

        if len(card) >= 7:
            # i must be < self.n
            eids = expand_thru(card[9:])
            for eid in eids:
                self.load_id[i] = load_id
                assert isinstance(eid, int), eid
                self.element_id[i] = eid
                self.tbar[i] = tbar
                self.tprime[i] = tprime
                self.temp[i, 0] = t1
                self.temp[i, 1] = t2
                self.i += 1
                assert self.i <= self.n

        assert len(card) <= 7, '%s; n=%s' % (card, len(card))
        #assert len(card) <= 7, len(card)
        self.eids = None
コード例 #10
0
ファイル: bdf_tables.py プロジェクト: umvarma/pynastran
    def __init__(self, card=None, data=None, comment=''):
        Table.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.tid = integer(card, 1, 'tid')
            self.Type = string_or_blank(card, 2, 'Type', 'G')
            assert self.Type in ['G', 'CRIT', 'Q'], 'Type=%r' % self.Type

            nfields = len(card) - 1
            nterms = (nfields - 9) // 2
            if nterms < 0:
                raise SyntaxError('%r card is too short' % self.type)
            xy = []
            for i in range(nterms):
                n = 9 + i * 2
                if card.field(n) == 'ENDT':
                    break
                x = double(card, n, 'x' + str(i + 1))
                y = double(card, n + 1, 'y' + str(i + 1))
                xy += [x, y]
            ENDT = string(card, nfields, 'ENDT')
            isData = False
        else:
            self.tid = data[0]
            self.x1 = data[1]
            self.Type = data[2]
            xy = data[5:]
            isData = True
        self.parse_fields(xy, nrepeated=2, isData=isData)
コード例 #11
0
ファイル: properties.py プロジェクト: sukhbinder/cyNastran
    def __init__(self, card=None, data=None, comment=''):
        Property.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Property ID
            self.pid = integer(card, 1, 'pid')
            #: Material ID
            self.mid1 = integer_or_blank(card, 2, 'mid1', 0)
            self.t1 = double_or_blank(card, 3, 't1')

            self.mid2 = integer_or_blank(card, 4, 'mid2', 0)
            if self.mid2 > 0:
                self.i = double(card, 5, 'i')
                assert self.i > 0.0
            else:
                self.i = blank(card, 5, 'i')

            self.mid3 = integer(card, 6, 0)
            if self.mid3 > 0:
                self.t2 = double(card, 7, 't3')
                assert self.t2 > 0.0
            else:
                self.t2 = blank(card, 7, 't3')

            self.nsm = double(card, 8, 'nsm')
            self.z1 = double(card, 9, 'z1')
            self.z2 = double(card, 10, 'z2')
            self.phi = fields(double, card, 'phi', i=11, j=len(card))
        else:
            raise NotImplementedError(data)
コード例 #12
0
ファイル: mats1.py プロジェクト: ClaesFredo/pyNastran
    def add(self, card=None, comment=''):
        if comment:
            self._comment = comment
        i = self.i
        #: Identification number of a MAT1, MAT2, or MAT9 entry.
        self.material_id[i] = integer(card, 1, 'mid')
        #: Identification number of a TABLES1 or TABLEST entry. If H is
        #: given, then this field must be blank.
        self.table_id[i] = integer_or_blank(card, 2, 'tid', 0)
        #: Type of material nonlinearity. ('NLELAST' for nonlinear elastic
        #: or 'PLASTIC' for elastoplastic.)
        self.Type[i] = string(card, 3, 'Type')

        if self.Type[i] == 'NLELAST':
            self.h[i] = blank(card, 4, 'h')
            self.hr[i] = blank(card, 6, 'hr')
            self.yf[i] = blank(card, 5, 'yf')
            self.limit1[i] = blank(card, 7, 'yf')
            self.limit2[i] = blank(card, 8, 'yf')
        else:
            #: Work hardening slope (slope of stress versus plastic strain) in
            #: units of stress. For elastic-perfectly plastic cases, H=0.0.
            #: For more than a single slope in the plastic range, the
            #: stress-strain data must be supplied on a TABLES1 entry
            #: referenced by TID, and this field must be blank
            h = double_or_blank(card, 4, 'H')
            self.h[i] = h
            if h is None:
                self.hflag[i] = False
            else:
                self.hflag[i] = True

            #: Yield function criterion, selected by one of the following
            #: values (1) Von Mises (2) Tresca (3) Mohr-Coulomb
            #: (4) Drucker-Prager
            self.yf[i] = integer_or_blank(card, 5, 'yf', 1)

            #: Hardening Rule, selected by one of the following values
            #: (Integer): (1) Isotropic (Default) (2) Kinematic
            #: (3) Combined isotropic and kinematic hardening
            self.hr[i] = integer_or_blank(card, 6, 'hr', 1)
            #: Initial yield point
            self.limit1[i] = double(card, 7, 'limit1')

            if self.yf[i] == 3 or self.yf[i] == 4:
                #: Internal friction angle, measured in degrees, for the
                #: Mohr-Coulomb and Drucker-Prager yield criteria
                self.limit2[i] = double(card, 8, 'limit2')
            else:
                #self.limit2[i] = blank(card, 8, 'limit2')
                #self.limit2[i] = None
                pass
        assert len(card) <= 9, 'len(MATS1 card) = %i' % len(card)
        self.i += 1
コード例 #13
0
ファイル: nodes.py プロジェクト: sukhbinder/cyNastran
 def __init__(self, card=None, data=None, comment=''):  # this card has missing fields
     Ring.__init__(self, card, data)
     if comment:
         self._comment = comment
     self.nid = integer(card, 1, 'nid')
     blank(card, 2, 'blank')
     self.R = double(card, 3, 'R')
     self.z = double(card, 4, 'z')
     blank(card, 5, 'blank')
     blank(card, 6, 'blank')
     self.ps = integer_or_blank(card, 7, 'ps')
     assert len(card) <= 8, 'len(RINGAX card) = %i' % len(card)
コード例 #14
0
ファイル: dynamic.py プロジェクト: sukhbinder/cyNastran
    def __init__(self, card=None, data=None, comment=''):
        if comment:
            self._comment = comment
        self.sid = integer(card, 1, 'sid')
        f1 = double(card, 2, 'f1')  # default=0.0 ?
        f2 = double(card, 3, 'f2')
        nf = integer_or_blank(card, 4, 'nf', 1)
        assert len(card) <= 5, 'len(FREQ2 card) = %i' % len(card)

        d = 1. / nf * log(f2 / f1)
        self.freqs = []
        for i in xrange(nf):
            self.freqs.append(f1 * exp(i * d))  # 0 based index
        self.cleanFreqs()
コード例 #15
0
ファイル: staticLoads.py プロジェクト: anick107/von_mises_rms
    def __init__(self, card=None, data=None, comment=''):
        """
        Defines a static concentrated moment at a grid point by specifying a
        magnitude and two grid points that determine the direction.::

          MOMENT1 SID G M G1 G2
        """
        Moment.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.sid = integer(card, 1, 'sid')
            self.node = integer(card, 2, 'node')
            self.mag = double(card, 3, 'mag')
            self.g1 = integer(card, 4, 'g1')
            self.g2 = integer(card, 5, 'g2')
            assert len(card) == 6, 'len(MOMENT1 card) = %i' % len(card)
        else:
            self.sid = data[0]
            self.node = data[1]
            self.mag = data[2]
            self.g1 = data[3]
            self.g2 = data[4]
            self.g3 = data[5]
            self.g4 = data[6]
            xyz = data[7:10]
            raise NotImplementedError('MOMENT1 is probably wrong')

        #assert len(xyz) == 3, 'xyz=%s' % (xyz)
        #self.xyz = array(xyz)
        self.xyz = None
コード例 #16
0
ファイル: staticLoads.py プロジェクト: anick107/von_mises_rms
    def __init__(self, card=None, data=None, comment=''):
        """
        Defines a static concentrated moment at a grid point by specifying a
        scale factor and a vector that determines the direction.::

          MOMENT SID G CID M    N1  N2  N3
          MOMENT 2   5   6 2.9 0.0 1.0 0.0
        """
        Moment.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.sid = integer(card, 1, 'sid')
            self.node = integer(card, 2, 'node')
            self.cid = integer_or_blank(card, 3, 'cid', 0)
            self.mag = double(card, 4, 'mag')

            xyz = array([double_or_blank(card, 5, 'X1', 0.0),
                         double_or_blank(card, 6, 'X2', 0.0),
                         double_or_blank(card, 7, 'X3', 0.0)])
            assert len(card) <= 8, 'len(MOMENT card) = %i' % len(card)
        else:
            raise NotImplementedError(data)
        assert len(xyz) == 3, 'xyz=%s' % xyz
        self.xyz = xyz
コード例 #17
0
ファイル: staticLoads.py プロジェクト: anick107/von_mises_rms
    def __init__(self, card=None, data=None, comment=''):
        """
        ::

          FORCE2 SID G F G1 G2 G3 G4
        """
        Force.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.sid = integer(card, 1, 'sid')
            self.node = integer(card, 2, 'node')
            self.mag = double(card, 3, 'mag')
            self.g1 = integer(card, 4, 'g1')
            self.g2 = integer(card, 5, 'g2')
            self.g3 = integer(card, 6, 'g3')
            self.g4 = integer(card, 7, 'g4')
            assert len(card) == 8, 'len(FORCE2 card) = %i' % len(card)
        else:
            self.sid = data[0]
            self.node = data[1]
            self.mag = data[2]
            self.g1 = data[3]
            self.g2 = data[4]
            self.g3 = data[5]
            self.g4 = data[6]
コード例 #18
0
ファイル: staticLoads.py プロジェクト: anick107/von_mises_rms
    def __init__(self, card=None, data=None, comment=''):
        """
        ::

          FORCE          3       1            100.      0.      0.      1.
        """
        Force.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.sid = integer(card, 1, 'sid')
            self.node = integer(card, 2, 'node')
            self.cid = integer_or_blank(card, 3, 'cid', 0)
            self.mag = double(card, 4, 'mag')
            xyz = array([double_or_blank(card, 5, 'X1', 0.0),
                         double_or_blank(card, 6, 'X2', 0.0),
                         double_or_blank(card, 7, 'X3', 0.0)])
            assert len(card) <= 8, 'len(FORCE card) = %i' % len(card)
        else:
            self.sid = data[0]
            self.node = data[1]
            self.cid = data[2]
            self.mag = data[3]
            xyz = data[4:7]

        assert len(xyz) == 3, 'xyz=%s' % (xyz)
        self.xyz = array(xyz)
コード例 #19
0
ファイル: staticLoads.py プロジェクト: anick107/von_mises_rms
    def __init__(self, card=None, data=None, comment=''):
        if comment:
            self._comment = comment
        if card:
            #: Load set identification number (Integer>0)
            self.sid = integer(card, 1, 'sid')

            #: Coordinate system identification number. (Integer>0: Default=0)
            self.cid = integer_or_blank(card, 2, 'cid', 0)

            #: Acceleration vector scale factor. (Real)
            self.scale = double(card, 3, 'scale')

            #: Components of the acceleration vector measured in coordinate system
            #: CID. (Real; at least one Ni != 0)
            self.N = array([double_or_blank(card, 4, 'N1', 0.0),
                            double_or_blank(card, 5, 'N2', 0.0),
                            double_or_blank(card, 6, 'N3', 0.0)])
            assert max(abs(self.N)) > 0.

            nodes = fields(integer_or_string, card, 'node', i=9, j=len(card))
        else:
            raise NotImplementedError(data)

        #: nodes to apply the acceleration to
        self.nodes = expand_thru_by(nodes)
コード例 #20
0
ファイル: staticLoads.py プロジェクト: anick107/von_mises_rms
    def __init__(self, card=None, data=None, comment=''):
        if comment:
            self._comment = comment
        if card:
            #: Set identification number
            self.sid = integer(card, 1, 'sid')
            #: Coordinate system identification number.
            self.cid = integer_or_blank(card, 2, 'cid', 0)
            #: scale factor
            self.scale = double(card, 3, 'scale')
            #: Acceleration vector components measured in coordinate system CID
            self.N = array([double_or_blank(card, 4, 'N1', 0.0),
                            double_or_blank(card, 5, 'N2', 0.0),
                            double_or_blank(card, 6, 'N3', 0.0)])
            #: Indicates whether the CID coordinate system is defined in the
            #: main Bulk Data Section (MB = -1) or the partitioned superelement
            #: Bulk Data Section (MB = 0). Coordinate systems referenced in the
            #: main Bulk Data Section are considered stationary with respect to
            #: the assembly basic coordinate system. See Remark 10.
            #: (Integer; Default = 0)
            self.mb = integer_or_blank(card, 7, 'mb', 0)
            assert len(card) <= 8, 'len(GRAV card) = %i' % len(card)
        else:
            self.sid = data[0]
            self.cid = data[1]
            self.a = data[2]
            self.N = array(data[3:6])
            self.mb = data[6]
            self.scale = 1.
            assert len(data) == 7

        assert not allclose(max(abs(self.N)), 0.), ('GRAV N is a zero vector, '
                                                   'N=%s' % (str(self.N)))
コード例 #21
0
ファイル: nodes.py プロジェクト: sukhbinder/cyNastran
    def __init__(self, card=None, data=None, comment=''):
        """
        if coming from a BDF object, card is used
        if coming from the OP2, data is used
        """
        if comment:
            self._comment = comment
        Node.__init__(self, card, data)

        if card:
            self.nid = integer(card, 1, 'nid')
            self.phi = double(card, 4, 'phi')
            self.cd = integer(card, 6, 'cd')
            self.ps = integer(card, 7, 'ps')
            self.idf = integer(card, 8, 'idf')
        else:
            self.nid = data[0]
            self.phi = data[1]
            self.cd = data[2]
            self.ps = data[3]
            self.idf = data[4]

        assert self.nid > 0, 'nid=%s' % self.nid
        assert self.phi >= 0, 'phi=%s' % self.phi
        assert self.cd >= 0, 'cd=%s' % self.cd
        assert self.ps >= 0, 'ps=%s' % self.ps
        assert self.idf >= 0, 'idf=%s' % self.idf
コード例 #22
0
ファイル: temp.py プロジェクト: umvarma/pynastran
 def add_tempd(self, card, comment):
     assert (len(card) - 1) % 2 == 0, card
     for i in range(1, len(card), 2):
         temp_id = integer(card, i, 'temp_id')
         temperature = double(card, i+1, 'temperature')
         self._objs[temp_id].add_default(temp_id, temperature, comment)
     self.model.log.debug('TEMPs keys=%s' % self._objs.keys())
コード例 #23
0
ファイル: shell.py プロジェクト: HibernantBear/pyNastran
    def __init__(self, card=None, data=None, comment=''):
        """
        Defines the properties of a shear panel (CSHEAR entry).

        +--------+-----+-----+---+-----+----+----+
        | PSHEAR | PID | MID | T | NSM | F1 | F2 |
        +--------+-----+-----+---+-----+----+----+
        """
        ShellProperty.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Property ID
            self.pid = integer(card, 1, 'pid')
            #: Material ID
            self.mid = integer(card, 2, 'mid')
            self.t = double(card, 3, 't')
            self.nsm = double_or_blank(card, 4, 'nsm', 0.0)
            self.f1 = double_or_blank(card, 5, 'f1', 0.0)
            self.f2 = double_or_blank(card, 6, 'f2', 0.0)
            assert self.t > 0.0
            #assert self.f1 >= 0.0
            #assert self.f2 >= 0.0
            assert len(card) <= 7, 'len(PSHEAR card) = %i' % len(card)
        else:
            #(pid,mid,t,nsm,f1,f2) = out
            self.pid = data[0]
            self.mid = data[1]
            self.t = data[2]
            self.nsm = data[3]
            self.f1 = data[4]
            self.f2 = data[5]
コード例 #24
0
ファイル: springs.py プロジェクト: HibernantBear/pyNastran
    def __init__(self, card=None, icard=0, data=None, comment=''):
        SpringProperty.__init__(self, card, data)
        if comment:
            self._comment = comment
        nOffset = icard * 5
        if card:
            # 2 PELAS properties can be defined on 1 PELAS card
            # these are split into 2 separate cards

            #: Property identification number. (Integer > 0)
            self.pid = integer(card, 1 + nOffset, 'pid')
            #: Ki Elastic property value. (Real)
            self.k = double(card, 2 + nOffset, 'k')

            #: Damping coefficient, . See Remarks 5. and 6. (Real)
            #: To obtain the damping coefficient GE, multiply the
            #: critical damping ratio c/c0 by 2.0.
            self.ge = double_or_blank(card, 3 + nOffset, 'ge', 0.)
            #: Stress coefficient. (Real)
            self.s = double_or_blank(card, 4 + nOffset, 's', 0.)
        else:
            self.pid = data[0]
            self.k = data[1]
            self.ge = data[2]
            self.s = data[3]
コード例 #25
0
ファイル: loads.py プロジェクト: anick107/von_mises_rms
    def __init__(self, card=None, data=None, comment=''):
        ThermalLoad.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Load set identification number. (Integer > 0)
            self.sid = integer(card, 1, 'sid')

            #: Heat flux into element (FLOAT)
            self.qFlux = double(card, 2, 'qFlux')
            eids  = []
            j = 1
            for i in range(3, len(card)):
                eid = integer_or_string(card, i, 'eid%i' % j)
                eids.append(eid)
                j += 1
            #: CHBDYj element identification numbers (Integer)
            assert len(eids) > 0
            
            #: .. todo:: use expand_thru_by ???
            self.eids = expand_thru(eids)
        else:
            self.sid = data[0]
            self.qFlux = data[1]
            self.eids = data[2:]
コード例 #26
0
ファイル: bush.py プロジェクト: sukhbinder/cyNastran
    def getShockA(self, card, iStart):
        self.shockType = string_or_blank(card, iStart + 1, 'shockType')
        self.shockCVT = double(card, iStart + 2, 'shockCVT')
        self.shockCVC = double_or_blank(card, iStart + 3, 'shockCVC')
        self.shockExpVT = double_or_blank(card, iStart + 4, 'shockExpVT', 1.0)
        self.shockExpVC = double_or_blank(card, iStart + 5,
                                          'shockExpVC', self.shockExpVT)

        if self.shockType == 'TABLE':
            pass
            # self.shockIDTS = integer(card, iStart + 6, 'shockIDTS')
            # self.shockIDETS = blank(card, iStart + 9, 'shockIDETS')
            # self.shockIDECS = blank(card, iStart + 10, 'shockIDECS')
            # self.shockIDETSD = blank(card, iStart + 11, 'shockIDETSD')
            # self.shockIDECSD = blank(card, iStart + 12, 'shockIDECSD')
        elif self.shockType == 'EQUAT':
            self.shockIDTS = blank(card, iStart + 6, 'shockIDTS')
            self.shockIDETS = integer(card, iStart + 9, 'shockIDETS')
            self.shockIDECS = integer_or_blank(card, iStart + 10,
                                               'shockIDECS', self.shockIDETS)
            self.shockIDETSD = integer(card, iStart + 11, 'shockIDETSD')
            self.shockIDECSD = integer_or_blank(card, iStart + 11,
                                                'shockIDECSD', self.shockIDETSD)
        else:
            raise RuntimeError('Invalid shockType=|%s| on card\n%s' %(self.shockType, card))

        iStart += 8
        return iStart
コード例 #27
0
ファイル: staticLoads.py プロジェクト: anick107/von_mises_rms
    def __init__(self, card=None, data=None, comment=''):
        """
        Defines a static concentrated moment at a grid point by specification
        of a magnitude and four grid points that determine the direction.::

          MOMENT2 SID G M G1 G2 G3 G4
        """
        Moment.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.sid = integer(card, 1, 'sid')
            self.node = integer(card, 2, 'node')
            self.mag = double(card, 3, 'mag')
            self.g1 = integer(card, 4, 'g1')
            self.g2 = integer(card, 5, 'g2')
            self.g3 = integer(card, 6, 'g3')
            self.g4 = integer(card, 7, 'g4')
            xyz = array([double_or_blank(card, 5, 'X1', 0.0),
                         double_or_blank(card, 6, 'X2', 0.0),
                         double_or_blank(card, 7, 'X3', 0.0)])
            assert len(card) <= 8, 'len(MOMENT2 card) = %i' % len(card)
        else:
            self.sid = data[0]
            self.node = data[1]
            self.mag = data[2]
            self.g1 = data[3]
            self.g2 = data[4]
            self.g3 = data[5]
            self.g4 = data[6]
            xyz = data[7:10]
        assert len(xyz) == 3, 'xyz=%s' % (xyz)
        self.xyz = array(xyz)
コード例 #28
0
    def __init__(self, card=None, data=None, comment=''):
        CrackProperty.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Property ID
            self.pid = integer(card, 1, 'pid')
            #: Material ID
            self.mid = integer(card, 2, 'mid')
            self.thick = double(card, 3, 'thick')
            #: Plane strain or plane stress option.
            #: Use 0 for plane strain; 1 for plane stress. (Integer = 0 or 1)
            self.iPlane = integer(card, 4, 'iPlane')
            if self.iPlane not in [0, 1]:
                raise RuntimeError('Invalid value for iPlane on PRAC2D, can '
                                   'only be 0,1 iPlane=|%s|' % self.iPlane)
            #: Non-structural mass per unit area.(Real >= 0.0; Default = 0)
            self.nsm = double_or_blank(card, 5, 'nsm', 0.)
            #: Exponent used in the displacement field. See Remark 4.
            #: (Real; Default = 0.5)
            self.gamma = double_or_blank(card, 6, 'gamma', 0.5)
            #: Angle (in degrees) relative to the element x-axis along which
            #: stress intensity factors are to be calculated. See Remark 4.
            #: (Real; Default = 180.0)
            self.phi = double_or_blank(card, 7, 'phi', 180.)
            assert len(card) <= 8, 'len(PRAC2D card) = %i' % len(card)

        else:
            raise NotImplementedError(data)
コード例 #29
0
ファイル: loads.py プロジェクト: anick107/von_mises_rms
    def __init__(self, card=None, data=None, comment=''):
        ThermalLoad.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Load set identification number. (Integer > 0)
            self.sid = integer(card, 1, 'eid')

            self.flag = string(card, 2, 'flag')
            assert self.flag in ['POINT', 'LINE', 'REV', 'AREA3', 'AREA4',
                                 'AREA6', 'AREA8']

            #: Magnitude of thermal flux into face. Q0 is positive for heat
            #: into the surface. (Real)
            self.Q0 = double(card, 3, 'Q0')

            #: Area factor depends on type. (Real > 0.0 or blank)
            self.af = double_or_blank(card, 4, 'af')
            nfields = card.nFields()

            #: grids
            self.grids = fields(integer, card, 'grid', i=5, j=nfields)

            #: Grid point identification of connected grid points.
            #: (Integer > 0 or blank)
            self.grids = expand_thru_by(self.grids)
        else:
            self.sid = data[0]
            self.flag = data[1]
            self.Q0 = data[2]
            self.af = data[3]
            self.grids = data[4:]
コード例 #30
0
ファイル: damper.py プロジェクト: ClaesFredo/pyNastran
    def __init__(self, card=None, data=None, comment=''):
        LineDamper.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.eid = integer(card, 1, 'eid')

            #: Value of the scalar damper (Real)
            self.b = double(card, 2, 'b')
            nids = [integer_or_blank(card, 3, 'n1', 0),
                    integer_or_blank(card, 5, 'n2', 0)]

            #: component number
            self.c1 = integer_or_blank(card, 4, 'c1', 0)
            self.c2 = integer_or_blank(card, 6, 'c2', 0)
            assert len(card) <= 7, 'len(CDAMP2 card) = %i' % len(card)
        else:
            self.eid = data[0]
            self.b = data[1]
            nids = [data[2], data[4]]
            self.c1 = data[3]
            self.c2 = data[5]

        self.prepare_node_ids(nids, allow_empty_nodes=True)
        assert len(self.nodes) == 2
        msg = 'on\n%s\n is invalid validComponents=[0,1,2,3,4,5,6]' % str(self)
        assert self.c1 in [0, 1, 2, 3, 4, 5, 6], 'c1=%r %s' % (self.c1, msg)
        assert self.c2 in [0, 1, 2, 3, 4, 5, 6], 'c2=%r %s' % (self.c2, msg)