コード例 #1
0
ファイル: bars.py プロジェクト: sukhbinder/cyNastran
 def initX_G0(self, card):
     field5 = integer_double_or_blank(card, 5, 'g0_x1', 0.0)
     if isinstance(field5, int):
         self.g0 = field5
         self.x1 = None
         self.x2 = None
         self.x3 = None
     elif isinstance(field5, float):
         self.g0 = None
         self.x1 = field5
         self.x2 = double_or_blank(card, 6, 'x2', 0.0)
         self.x3 = double_or_blank(card, 7, 'x3', 0.0)
         if norm([self.x1, self.x2, self.x3]) == 0.0:
             msg = 'G0 vector defining plane 1 is not defined.\n'
             msg += 'G0 = %s\n' % self.g0
             msg += 'X1 = %s\n' % self.x1
             msg += 'X2 = %s\n' % self.x2
             msg += 'X3 = %s\n' % self.x3
             raise RuntimeError(msg)
     else:
         msg = ('field5 on %s (G0/X1) is the wrong type...id=%s field5=%s '
                'type=%s' %(self.type, self.eid, field5, type(field5)))
         raise RuntimeError(msg)
         self.g0 = None
         self.x1 = 0.
         self.x2 = 0.
         self.x3 = 0.
コード例 #2
0
ファイル: shell.py プロジェクト: anick107/von_mises_rms
    def __init__(self, card=None, data=None, comment=''):
        TriShell.__init__(self, card, data)
        if comment:
            self._comment = comment
        #: Element ID
        self.eid = integer(card, 1, 'eid')
        #: Property ID
        self.pid = integer(card, 2, 'pid')

        nids = [integer(card, 3, 'n1'),
                integer(card, 4, 'n2'),
                integer(card, 5, 'n3')]

        self.prepareNodeIDs(nids)
        assert len(self.nodes) == 3

        self.thetaMcid = integer_double_or_blank(card, 6, 'thetaMcid', 0.0)
        self.zOffset = double_or_blank(card, 7, 'zOffset', 0.0)
        blank(card, 8, 'blank')
        blank(card, 9, 'blank')
        blank(card, 10, 'blank')

        self.TFlag = integer_or_blank(card, 11, 'TFlag', 0)
        self.T1 = double_or_blank(card, 11, 'T1', 1.0)
        self.T2 = double_or_blank(card, 12, 'T2', 1.0)
        self.T3 = double_or_blank(card, 13, 'T3', 1.0)
        assert len(card) <= 14, 'len(CTRIAR card) = %i' % len(card)
コード例 #3
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]
コード例 #4
0
    def add(self, card=None, data=None, comment=''):
        if self.n == 1:
            raise RuntimeError('only one CBAROR is allowed')
        self.n = 1
        if comment:
            self._comment = comment

        self.property_id = integer_or_blank(card, 2, 'pid')

        #---------------------------------------------------------
        # x / g0
        field5 = integer_double_or_blank(card, 5, 'g0_x1', 0.0)
        if isinstance(field5, int):
            self.is_g0 = True
            self.g0 = field5
            self.x = [0., 0., 0.]
        elif isinstance(field5, float):
            self.is_g0 = False
            self.g0 = None
            self.x = array([
                field5,
                double_or_blank(card, 6, 'x2', 0.0),
                double_or_blank(card, 7, 'x3', 0.0)
            ],
                           dtype='float64')
        self.offt = string_or_blank(card, 8, 'offt', 'GGG')
        assert len(card) <= 9, 'len(CBAROR card) = %i' % len(card)
コード例 #5
0
    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)
コード例 #6
0
ファイル: optimization.py プロジェクト: umvarma/pynastran
    def __init__(self, card=None, data=None, comment=''):
        """
        Design Sensitivity Equation Response Quantities
        Defines equation responses that are used in the design, either as
        constraints or as an objective.
        """
        if comment:
            self._comment = comment
        self.oid = integer(card, 1, 'oid')
        self.label = string(card, 2, 'label')
        self.eqidFunc = integer_or_string(card, 3, 'eqid_Func')
        self.region = integer_or_blank(card, 4, 'region')
        self.method = string_or_blank(card, 5, 'method', 'MIN')
        self.c1 = double_or_blank(card, 6, 'c1', 100.)
        self.c2 = double_or_blank(card, 7, 'c2', 0.005)
        self.c3 = double_or_blank(card, 8, 'c3')  #: .. todo:: or blank?

        i = 0
        fields = [interpret_value(field) for field in card[9:]]
        key = '$NULL$'  # dummy key
        self.params = {key: []}
        valueList = []
        for (i, field) in enumerate(fields):
            if i % 8 == 0 and field is not None:
                self.params[key] = valueList
                key = field
                valueList = []
            elif field is not None:
                valueList.append(field)
            #else:
            #    pass

        self.params[key] = valueList
        del self.params['$NULL$']
コード例 #7
0
ファイル: optimization.py プロジェクト: sukhbinder/cyNastran
    def __init__(self, card=None, data=None, comment=''):
        """
        Design Sensitivity Equation Response Quantities
        Defines equation responses that are used in the design, either as
        constraints or as an objective.
        """
        if comment:
            self._comment = comment
        self.oid = integer(card, 1, 'oid')
        self.label = string(card, 2, 'label')
        self.eqidFunc = integer_or_string(card, 3, 'eqid_Func')
        self.region = integer_or_blank(card, 4, 'region')
        self.method = string_or_blank(card, 5, 'method', 'MIN')
        self.c1 = double_or_blank(card, 6, 'c1', 100.)
        self.c2 = double_or_blank(card, 7, 'c2', 0.005)
        self.c3 = double_or_blank(card, 8, 'c3') #: .. todo:: or blank?

        i = 0
        fields = [interpret_value(field) for field in card[9:] ]
        key = '$NULL$'  # dummy key
        self.params = {key: []}
        valueList = []
        for (i, field) in enumerate(fields):
            if i % 8 == 0 and field is not None:
                self.params[key] = valueList
                key = field
                valueList = []
            elif field is not None:
                valueList.append(field)
            #else:
            #    pass

        self.params[key] = valueList
        del self.params['$NULL$']
コード例 #8
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)
コード例 #9
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)
コード例 #10
0
    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
コード例 #11
0
ファイル: cards.py プロジェクト: umvarma/pynastran
    def __init__(self, card, comment=''):
        self.pid = integer(card, 1, 'property_id')
        self.sets = []
        self.Types = []
        self.gammas = []
        self._cps = []
        #self.set = integer(card, 2, 'set_id')
        #self.Type = string(card, 3, 'Type')
        #if self.Type not in ['NEWTON','PRANDTL-MEYER', 'CP']:
        #    raise RuntimeError('Type=%r' % Type)
        #self.gamma = double_or_blank(card, 4, 'gamma', 1.4)

        i = 2
        while i < len(card):
            self.sets.append(integer(card, i, 'set_id'))
            Type = string(card, i+1, 'Type')
            self.Types.append(Type)
            #if self.Type not in ['NEWTON','PRANDTL-MEYER', 'CP']:
                #raise RuntimeError('Type=%r' % Type)
            self.gammas.append(double_or_blank(card, i+2, 'gamma', 1.4))

            _cp = None
            if Type == 'CP':
                _cp = double(card, i+3, 'Cp')
            elif Type == 'NEWTON':
                _cp = double_or_blank(card, i+3, 'Cp_nominal', 2.0)
            self._cps.append(_cp)
            i += 7
コード例 #12
0
    def __init__(self, card=None, data=None, comment=''):
        Constraint.__init__(self, card, data)

        if comment:
            self._comment = comment
        if card:
            self.conid = integer(card, 1, 'sid')
            self.gids = [integer(card, 2, 'G1'), integer_or_blank(card, 5, 'G2')]
            # :0 if scalar point 1-6 if grid
            self.constraints = [components_or_blank(card, 3, 'C1', 0),
                                components_or_blank(card, 6, 'C2', 0)]
            self.enforced = [double_or_blank(card, 4, 'D1', 0.0),
                             double_or_blank(card, 7, 'D2', 0.0)]

            # reduce the size if there are duplicate Nones
            nConstraints = max(len(self.gids),
                               len(self.constraints),
                               len(self.enforced))
            self.gids = self.gids[0:nConstraints]
            self.constraints = self.constraints[0:nConstraints]
            self.enforced = self.enforced[0:nConstraints]
        else:
            self.conid = data[0]
            self.gids = [data[1]]
            self.constraints = [data[2]]
            self.enforced = [data[3]]
コード例 #13
0
    def __init__(self, card=None, nPELAS=0, data=None, comment=''):
        SpringProperty.__init__(self, card, data)
        if comment:
            self._comment = comment
        nOffset = nPELAS * 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]
コード例 #14
0
ファイル: thermal.py プロジェクト: ClaesFredo/pyNastran
    def __init__(self, card=None, data=None, comment=""):
        ThermalElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Surface element ID
            self.eid = integer(card, 1, "eid")

            #: PHBDY property entry identification numbers. (Integer > 0)
            self.pid = integer(card, 2, "pid")
            assert self.pid > 0

            self.Type = string(card, 3, "Type")
            # print("self.Type = %s" % self.Type)
            # msg = 'CHBDYP Type=%r' % self.Type
            # assert self.Type in ['POINT','LINE','ELCYL','FTUBE','TUBE'], msg

            #: A VIEW entry identification number for the front face.
            self.iViewFront = integer_or_blank(card, 4, "iViewFront", 0)

            #: A VIEW entry identification number for the back face.
            self.iViewBack = integer_or_blank(card, 5, "iViewBack", 0)

            #: Grid point identification numbers of grids bounding the surface.
            #: (Integer > 0)
            self.g1 = integer(card, 6, "g1")
            #: Grid point identification numbers of grids bounding the surface.
            #: (Integer > 0)
            if self.Type != "POINT":
                self.g2 = integer(card, 7, "g2")
            else:
                self.g2 = blank(card, 7, "g2")

            #: Orientation grid point. (Integer > 0; Default = 0)
            self.g0 = integer_or_blank(card, 8, "g0", 0)

            #: RADM identification number for front face of surface element.
            #: (Integer > 0)
            self.radMidFront = integer_or_blank(card, 9, "radMidFront", 0)

            #: RADM identification number for back face of surface element.
            #: (Integer > 0)
            self.radMidBack = integer_or_blank(card, 10, "radMidBack", 0)

            #: Grid point identification number of a midside node if it is used
            #: with the line type surface element.
            self.gmid = integer_or_blank(card, 11, "gmid")
            #: Coordinate system for defining orientation vector.
            #: (Integer > 0; Default = 0
            self.ce = integer_or_blank(card, 12, "ce", 0)

            #: Components of the orientation vector in coordinate system CE.
            #: The origin of the orientation vector is grid point G1.
            #: (Real or blank)
            self.e1 = double_or_blank(card, 13, "e3")
            self.e2 = double_or_blank(card, 14, "e3")
            self.e3 = double_or_blank(card, 15, "e3")
            assert len(card) <= 16, "len(CHBDYP card) = %i" % len(card)
        else:
            raise NotImplementedError(data)
コード例 #15
0
ファイル: thermal.py プロジェクト: afcarl/cyNastran
    def __init__(self, card=None, data=None, comment=''):
        ThermalElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Surface element ID
            self.eid = integer(card, 1, 'eid')

            #: PHBDY property entry identification numbers. (Integer > 0)
            self.pid = integer(card, 2, 'pid')
            assert self.pid > 0

            self.Type = string(card, 3, 'Type')
            #print "self.Type = ",self.Type
            # msg = 'CHBDYP Type=|%s|' (self.Type)
            #assert self.Type in ['POINT','LINE','ELCYL','FTUBE','TUBE'], msg

            #: A VIEW entry identification number for the front face.
            self.iViewFront = integer_or_blank(card, 4, 'iViewFront', 0)

            #: A VIEW entry identification number for the back face.
            self.iViewBack = integer_or_blank(card, 5, 'iViewBack', 0)

            #: Grid point identification numbers of grids bounding the surface.
            #: (Integer > 0)
            self.g1 = integer(card, 6, 'g1')
            #: Grid point identification numbers of grids bounding the surface.
            #: (Integer > 0)
            if self.Type != 'POINT':
                self.g2 = integer(card, 7, 'g2')
            else:
                self.g2 = blank(card, 7, 'g2')

            #: Orientation grid point. (Integer > 0; Default = 0)
            self.g0 = integer_or_blank(card, 8, 'g0', 0)

            #: RADM identification number for front face of surface element.
            #: (Integer > 0)
            self.radMidFront = integer_or_blank(card, 9, 'radMidFront', 0)

            #: RADM identification number for back face of surface element.
            #: (Integer > 0)
            self.radMidBack = integer_or_blank(card, 10, 'radMidBack', 0)

            #: Grid point identification number of a midside node if it is used
            #: with the line type surface element.
            self.gmid = integer_or_blank(card, 11, 'gmid')
            #: Coordinate system for defining orientation vector.
            #: (Integer > 0; Default = 0
            self.ce = integer_or_blank(card, 12, 'ce', 0)

            #: Components of the orientation vector in coordinate system CE.
            #: The origin of the orientation vector is grid point G1.
            #: (Real or blank)
            self.e1 = double_or_blank(card, 13, 'e3')
            self.e2 = double_or_blank(card, 14, 'e3')
            self.e3 = double_or_blank(card, 15, 'e3')
            assert len(card) <= 16, 'len(CHBDYP card) = %i' % len(card)
        else:
            raise NotImplementedError(data)
コード例 #16
0
    def __init__(self, card=None, data=None, comment=''):
        """
        Multiple Design Variable Linking
        Relates one design variable to one or more other design variables.::

          DLINK ID DDVID C0 CMULT IDV1 C1 IDV2 C2
                IDV3 C3 -etc.-
        """
        if comment:
            self._comment = comment
        if card:
            self.oid = integer(card, 1, 'oid')
            self.ddvid = integer(card, 2, 'ddvid')
            self.c0 = double_or_blank(card, 3, 'c0', 0.)
            self.cmult = double_or_blank(card, 4, 'cmult', 1.)

            nfields = len(card) - 4
            n = nfields // 2
            self.IDv = []
            self.Ci = []

            for i in range(n):
                j = 2 * i + 5
                IDv = integer(card, j, 'IDv' + str(i))
                Ci = double(card, j + 1, 'Ci' + str(i))
                self.IDv.append(IDv)
                self.Ci.append(Ci)
        else:
            raise RuntimeError(data)
コード例 #17
0
ファイル: mat1.py プロジェクト: sukhbinder/cyNastran
    def set_E_G_nu(self, i, card):
        r"""
        \f[ G = \frac{E}{2 (1+\nu)} \f]
        """
        E = double_or_blank(card, 2, 'E')
        G = double_or_blank(card, 3, 'G')
        nu = double_or_blank(card, 4, 'nu')

        if G is None and E is None:  # no E,G
            raise RuntimeError('G=%s E=%s cannot both be None' % (G, E))
        elif E is not None and G is not None and nu is not None:
            pass
        elif E is not None and nu is not None:
            G = E / 2. / (1 + nu)
        elif G is not None and nu is not None:
            E = 2 * (1 + nu) * G
        elif G is not None and E is not None:
            nu = E / (2 * G) - 1.
        elif G is None and nu is None:
            G = 0.0
            nu = 0.0
        elif E is None and nu is None:
            E = 0.0
            nu = 0.0
        else:
            msg = 'G=%s E=%s nu=%s' % (G, E, nu)
            raise RuntimeError(msg)
        #print 'G =', G
        self.E[i] = E
        self.G[i] = G
        self.nu[i] = nu
コード例 #18
0
ファイル: methods.py プロジェクト: sukhbinder/cyNastran
    def loadHESS_INV(self, nRows, card):
        alphaOmega_default = None
        LJ_default = None
        if self.method == 'INV':
            alphaOmega_default = 0.0
            LJ_default = 1.0

        for iRow in xrange(nRows):
            NEj = integer(card, 9 + 7 * iRow + 5, 'NE%s' + str(iRow))
            NDJ_default = None
            if self.method == 'INV':
                NDJ_default = 3 * NEj

            i = 9 + 8 * iRow
            self.alphaAjs.append(
                double_or_blank(card, i,     'alphaA' + str(iRow), alphaOmega_default))
            self.omegaAjs.append(
                double_or_blank(card, i + 1, 'omegaA' + str(iRow), alphaOmega_default))
            self.alphaBjs.append(
                double_or_blank(card, i + 2, 'alphaB' + str(iRow), alphaOmega_default))
            self.omegaBjs.append(
                double_or_blank(card, i + 3, 'omegaB' + str(iRow), alphaOmega_default))
            self.LJs.append(
                double_or_blank(i + 4, LJ_default))
            self.NEJs.append(
                integer(card, i + 5, 'NEJ' + str(iRow)))
            self.NDJs.append(
                integer_or_blank(card, i + 6, 'NDJ' + str(iRow), NDJ_default))
コード例 #19
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)
コード例 #20
0
ファイル: nodes.py プロジェクト: ClaesFredo/pyNastran
    def __init__(self, card=None, data=None, comment=''):
        """
        Creates the GRID card

        :param self:
          the GRID object pointer
        :param card:
          a BDFCard object
        :type card:
          BDFCard
        :param data:
          a list with the GRID fields defined in OP2 format
        :type data:
          LIST
        :param comment:
          a comment for the card
        :type comment:
          string
        """
        if comment:
            self._comment = comment
        Node.__init__(self, card, data)

        if card:
            #: Node ID
            self.nid = integer(card, 1, 'nid')

            #: Grid point coordinate system
            self.cp = integer_or_blank(card, 2, 'cp', 0)

            #: node location in local frame
            self.xyz = array([
                double_or_blank(card, 3, 'x1', 0.),
                double_or_blank(card, 4, 'x2', 0.),
                double_or_blank(card, 5, 'x3', 0.)], dtype='float64')

            #: Analysis coordinate system
            self.cd = integer_or_blank(card, 6, 'cd', 0)

            #: SPC constraint
            self.ps = str(integer_or_blank(card, 7, 'ps', ''))

            #: Superelement ID
            self.seid = integer_or_blank(card, 8, 'seid', 0)
            assert len(card) <= 9, 'len(GRID card) = %i' % len(card)
        else:
            self.nid = data[0]
            self.cp = data[1]
            self.xyz = array(data[2:5])
            self.cd = data[5]
            self.ps = data[6]
            self.seid = data[7]
            if self.ps == 0:
                self.ps = ''
            assert len(self.xyz) == 3

        assert self.nid > 0, 'nid=%s' % (self.nid)
        assert self.cp >= 0, 'cp=%s' % (self.cp)
        assert self.cd >= -1, 'cd=%s' % (self.cd)
        assert self.seid >= 0, 'seid=%s' % (self.seid)
コード例 #21
0
 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)
コード例 #22
0
ファイル: mat1.py プロジェクト: ClaesFredo/pyNastran
    def set_E_G_nu(self, i, card):
        r"""
        \f[ G = \frac{E}{2 (1+\nu)} \f]
        """
        E = double_or_blank(card, 2, "E")
        G = double_or_blank(card, 3, "G")
        nu = double_or_blank(card, 4, "nu")

        if G is None and E is None:  # no E,G
            raise RuntimeError("G=%s E=%s cannot both be None" % (G, E))
        elif E is not None and G is not None and nu is not None:
            pass
        elif E is not None and nu is not None:
            G = E / 2.0 / (1 + nu)
        elif G is not None and nu is not None:
            E = 2 * (1 + nu) * G
        elif G is not None and E is not None:
            nu = E / (2 * G) - 1.0
        elif G is None and nu is None:
            G = 0.0
            nu = 0.0
        elif E is None and nu is None:
            E = 0.0
            nu = 0.0
        else:
            msg = "G=%s E=%s nu=%s" % (G, E, nu)
            raise RuntimeError(msg)
        # self.model.log.debug('G = %s' % G)
        self.E[i] = E
        self.G[i] = G
        self.nu[i] = nu
コード例 #23
0
 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)
コード例 #24
0
    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)
コード例 #25
0
ファイル: bush.py プロジェクト: afcarl/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
コード例 #26
0
    def loadHESS_INV(self, nRows, card):
        alphaOmega_default = None
        LJ_default = None
        if self.method == 'INV':
            alphaOmega_default = 0.0
            LJ_default = 1.0

        for iRow in range(nRows):
            NEj = integer(card, 9 + 7 * iRow + 5, 'NE%s' + str(iRow))
            NDJ_default = None
            if self.method == 'INV':
                NDJ_default = 3 * NEj

            i = 9 + 8 * iRow
            self.alphaAjs.append(
                double_or_blank(card, i, 'alphaA' + str(iRow),
                                alphaOmega_default))
            self.omegaAjs.append(
                double_or_blank(card, i + 1, 'omegaA' + str(iRow),
                                alphaOmega_default))
            self.alphaBjs.append(
                double_or_blank(card, i + 2, 'alphaB' + str(iRow),
                                alphaOmega_default))
            self.omegaBjs.append(
                double_or_blank(card, i + 3, 'omegaB' + str(iRow),
                                alphaOmega_default))
            self.LJs.append(double_or_blank(i + 4, LJ_default))
            self.NEJs.append(integer(card, i + 5, 'NEJ' + str(iRow)))
            self.NDJs.append(
                integer_or_blank(card, i + 6, 'NDJ' + str(iRow), NDJ_default))
コード例 #27
0
    def add(self, card, comment=''):
        i = self.i
        self.element_id[i] = integer(card, 1, 'element_id')
        self.property_id[i] = integer(card, 2, 'property_id')

        self.node_ids[i] = [
            integer(card, 3, 'node_id1'),
            integer(card, 4, 'node_id2'),
            integer(card, 5, 'node_id3'),
            integer_or_blank(card, 6, 'node_id4', 0),
            integer_or_blank(card, 7, 'node_id5', 0),
            integer_or_blank(card, 8, 'node_id6', 0)
        ]

        #self.thetaMcid[i] = integer_double_or_blank(card, 9, 'thetaMcid', 0.0)
        self.offset[i] = double_or_blank(card, 10, 'zOffset', 0.0)

        self.thickness[i] = [
            double_or_blank(card, 11, 'T1', 1.0),
            double_or_blank(card, 12, 'T2', 1.0),
            double_or_blank(card, 13, 'T3', 1.0),
        ]
        self.t_flag[i] = integer_or_blank(card, 14, 'TFlag', 0)
        assert len(card) <= 15, 'len(CTRIA6 card) = %i' % len(card)
        self.i += 1
コード例 #28
0
ファイル: shell.py プロジェクト: EPeterE/von_mises_rms
 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]
コード例 #29
0
ファイル: bars.py プロジェクト: umvarma/pynastran
    def __init__(self, card=None, data=None, comment=''):
        LineProperty.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.pid = integer(card, 1, 'pid')
            self.mid = integer(card, 2, 'mid')

            self.A = double(card, 3, 'A')
            self.iz = double(card, 4, 'Iz')
            self.iy = double(card, 5, 'Iy')
            self.iyz = double_or_blank(card, 6, 'Iyz', 0.0)
            self.j = double_or_blank(card, 7, 'J', self.iy + self.iz)
            self.nsm = double_or_blank(card, 8, 'nsm', 0.0)

            self.cy = double(card, 9, 'cy')
            self.cz = double(card, 10, 'cz')
            self.dy = double(card, 11, 'dy')
            self.dz = double(card, 12, 'dz')
            self.ey = double(card, 13, 'ey')
            self.dz = double(card, 14, 'ez')
            self.fy = double(card, 15, 'fy')
            self.fz = double(card, 16, 'fz')
            # more...
        else:
            raise NotImplementedError(data)
コード例 #30
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
コード例 #31
0
ファイル: constraints.py プロジェクト: umvarma/pynastran
    def __init__(self, card=None, data=None, comment=''):
        Constraint.__init__(self, card, data)

        if comment:
            self._comment = comment
        if card:
            self.conid = integer(card, 1, 'sid')
            self.gids = [integer(card, 2, 'G1'), integer_or_blank(card, 5, 'G2')]
            # :0 if scalar point 1-6 if grid
            self.constraints = [components_or_blank(card, 3, 'C1', 0),
                                components_or_blank(card, 6, 'C2', 0)]
            self.enforced = [double_or_blank(card, 4, 'D1', 0.0),
                             double_or_blank(card, 7, 'D2', 0.0)]

            # reduce the size if there are duplicate Nones
            nConstraints = max(len(self.gids),
                               len(self.constraints),
                               len(self.enforced))
            self.gids = self.gids[0:nConstraints]
            self.constraints = self.constraints[0:nConstraints]
            self.enforced = self.enforced[0:nConstraints]
        else:
            self.conid = data[0]
            self.gids = [data[1]]
            self.constraints = [data[2]]
            self.enforced = [data[3]]
コード例 #32
0
ファイル: optimization.py プロジェクト: umvarma/pynastran
    def __init__(self, card=None, data=None, comment=''):
        """
        Multiple Design Variable Linking
        Relates one design variable to one or more other design variables.::

          DLINK ID DDVID C0 CMULT IDV1 C1 IDV2 C2
                IDV3 C3 -etc.-
        """
        if comment:
            self._comment = comment
        self.oid = integer(card, 1, 'oid')
        self.ddvid = integer(card, 2, 'ddvid')
        self.c0 = double_or_blank(card, 3, 'c0', 0.)
        self.cmult = double_or_blank(card, 4, 'cmult', 1.)

        nfields = len(card) - 4
        n = nfields // 2
        self.IDv = []
        self.Ci = []

        for i in range(n):
            j = 2 * i + 5
            IDv = integer(card, j, 'IDv' + str(i))
            Ci = double(card, j + 1, 'Ci' + str(i))
            self.IDv.append(IDv)
            self.Ci.append(Ci)
コード例 #33
0
    def __init__(self, card=None, data=None, comment=''):
        PointMassElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.eid = integer(card, 1, 'eid')
            self.nid = integer(card, 2, 'nid')
            self.cid = integer_or_blank(card, 3, 'cid', 0)
            self.mass = double_or_blank(card, 4, 'mass', 0.)
            self.X = 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)])

            self.I = array([double_or_blank(card, 9, 'I11', 0.0),
                            double_or_blank(card, 10, 'I21', 0.0),
                            double_or_blank(card, 11, 'I22', 0.0),
                            double_or_blank(card, 12, 'I31', 0.0),
                            double_or_blank(card, 13, 'I32', 0.0),
                            double_or_blank(card, 14, 'I33', 0.0)])
            assert len(card) <= 15, 'len(CONM2 card) = %i' % len(card)
        else:
            self.eid = data[0]
            self.nid = data[1]
            self.cid = data[2]
            self.mass = data[3]
            self.X = data[4:7]
            self.I = data[7:]
コード例 #34
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
コード例 #35
0
ファイル: cards.py プロジェクト: ClaesFredo/pyNastran
    def __init__(self, card, comment=''):
        self.pid = integer(card, 1, 'property_id')
        self.sets = []
        self.Types = []
        self.gammas = []
        self._cps = []
        #self.set = integer(card, 2, 'set_id')
        #self.Type = string(card, 3, 'Type')
        #if self.Type not in ['NEWTON','PRANDTL-MEYER', 'CP']:
        #    raise RuntimeError('Type=%r' % Type)
        #self.gamma = double_or_blank(card, 4, 'gamma', 1.4)

        i = 2
        while i < len(card):
            self.sets.append(integer(card, i, 'set_id'))
            Type = string(card, i+1, 'Type')
            self.Types.append(Type)
            #if self.Type not in ['NEWTON','PRANDTL-MEYER', 'CP']:
                #raise RuntimeError('Type=%r' % Type)
            self.gammas.append(double_or_blank(card, i+2, 'gamma', 1.4))

            _cp = None
            if Type == 'CP':
                _cp = double(card, i+3, 'Cp')
            elif Type == 'NEWTON':
                _cp = double_or_blank(card, i+3, 'Cp_nominal', 2.0)
            self._cps.append(_cp)
            i += 7
コード例 #36
0
ファイル: mat8.py プロジェクト: umvarma/pynastran
    def set_E_G_nu(self, i, card):
        r"""
        \f[ G = \frac{E}{2 (1+\nu)} \f]
        """
        E = double_or_blank(card, 2, 'E')
        G = double_or_blank(card, 3, 'G')
        nu = double_or_blank(card, 4, 'nu')

        if G is None and E is None:  # no E,G
            raise RuntimeError('G=%s E=%s cannot both be None' % (G, E))
        elif E is not None and G is not None and nu is not None:
            pass
        elif E is not None and nu is not None:
            G = E / 2. / (1 + nu)
        elif G is not None and nu is not None:
            E = 2 * (1 + nu) * G
        elif G is not None and E is not None:
            nu = E / (2 * G) - 1.
        elif G is None and nu is None:
            G = 0.0
            nu = 0.0
        elif E is None and nu is None:
            E = 0.0
            nu = 0.0
        else:
            msg = 'G=%s E=%s nu=%s' % (G, E, nu)
            raise RuntimeError(msg)
        #self.model.log.debug('G = %s' % G)
        self.E[i] = E
        self.G[i] = G
        self.nu[i] = nu
コード例 #37
0
ファイル: bars.py プロジェクト: ClaesFredo/pyNastran
    def __init__(self, card=None, data=None, comment=''):
        LineElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.eid = integer(card, 1, 'eid')
            self.pid = integer_or_blank(card, 2, 'pid', self.eid)
            self.ga = integer(card, 3, 'ga')
            self.gb = integer(card, 4, 'gb')
            x1Go = integer_double_or_blank(card, 5, 'x1_g0', 0.0)
            if isinstance(x1Go, integer_types):
                self.g0 = x1Go
                self.x = None
            elif isinstance(x1Go, float):
                self.g0 = None
                self.x = 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)], dtype='float64')
                if norm(self.x) == 0.0:
                    msg = 'G0 vector defining plane 1 is not defined.\n'
                    msg += 'G0 = %s\n' % self.g0
                    msg += 'X  = %s\n' % self.x
                    raise RuntimeError(msg)
            else:
                raise ValueError('invalid x1Go=|%s| on CBEND' % x1Go)
            self.geom = integer(card, 8, 'geom')

            assert len(card) == 9, 'len(CBEND card) = %i' % len(card)
            assert self.geom in [1, 2, 3, 4], 'geom is invalid geom=|%s|' % self.geom
        else:
            raise NotImplementedError(data)

        if self.g0 in [self.ga, self.gb]:
            msg = 'G0=%s cannot be GA=%s or GB=%s' % (self.g0, self.ga, self.gb)
            raise RuntimeError(msg)
コード例 #38
0
    def __init__(self, card=None, data=None, comment=''):
        Constraint.__init__(self, card, data)

        if comment:
            self._comment = comment
        if card:
            self.conid = integer(card, 1, 'sid')
            if card.field(5) in [None, '']:
                self.gids = [integer(card, 2, 'G1'),]
                self.constraints = [components_or_blank(card, 3, 'C1', 0)]
                self.enforced = [double_or_blank(card, 4, 'D1', 0.0)]
            else:
                self.gids = [
                    integer(card, 2, 'G1'),
                    integer_or_blank(card, 5, 'G2'),
                ]
                # :0 if scalar point 1-6 if grid
                self.constraints = [components_or_blank(card, 3, 'C1', 0),
                                    components_or_blank(card, 6, 'C2', 0)]
                self.enforced = [double_or_blank(card, 4, 'D1', 0.0),
                                 double_or_blank(card, 7, 'D2', 0.0)]
        else:
            self.conid = data[0]
            self.gids = [data[1]]
            self.constraints = [data[2]]
            self.enforced = [data[3]]
コード例 #39
0
ファイル: cquad8.py プロジェクト: umvarma/pynastran
    def add(self, card, comment=''):
        i = self.i
        self.element_id[i] = integer(card, 1, 'element_id')

        self.property_id[i] = integer(card, 2, 'property_id')

        self.node_ids[i, :] = [
            integer(card, 3, 'n1'),
            integer(card, 4, 'n2'),
            integer(card, 5, 'n3'),
            integer(card, 6, 'n4'),
            integer_or_blank(card, 7, 'n5', 0),
            integer_or_blank(card, 8, 'n6', 0),
            integer_or_blank(card, 9, 'n7', 0),
            integer_or_blank(card, 10, 'n8', 0)]

        self.thickness[i, :] = [
            double_or_blank(card, 11, 'T1', 1.0),
            double_or_blank(card, 12, 'T2', 1.0),
            double_or_blank(card, 13, 'T3', 1.0),
            double_or_blank(card, 14, 'T4', 1.0), ]

        #self.thetaMcid[i] = integer_double_or_blank(card, 15, 'thetaMcid', 0.0)
        self.zoffset[i] = double_or_blank(card, 16, 'zOffset', 0.0)
        self.t_flag[i] = integer_or_blank(card, 17, 'TFlag', 0)
        self.i += 1
コード例 #40
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]
コード例 #41
0
ファイル: cquad4.py プロジェクト: ClaesFredo/pyNastran
    def add(self, card, comment=''):
        i = self.i
        self.element_id[i] = integer(card, 1, 'eid')

        self.property_id[i] = integer(card, 2, 'pid')

        self.node_ids[i, :] = [
            integer(card, 3, 'n1'),
            integer(card, 4, 'n2'),
            integer(card, 5, 'n3'),
            integer(card, 6, 'n4')
        ]

        #self.thetaMcid = integer_double_or_blank(card, 6, 'thetaMcid', 0.0)
        #self.zOffset = double_or_blank(card, 7, 'zOffset', 0.0)
        #blank(card, 8, 'blank')
        #blank(card, 9, 'blank')

        self.t_flag[i] = integer_or_blank(card, 10, 'TFlag', 0)
        self.thickness[i, :] = [
            double_or_blank(card, 11, 'T1', 1.0),
            double_or_blank(card, 12, 'T2', 1.0),
            double_or_blank(card, 13, 'T3', 1.0),
            double_or_blank(card, 14, 'T4', 1.0),
        ]
        self.i += 1
コード例 #42
0
    def add(self, card, comment=''):
        cp0 = self.model.grdset.cp
        cd0 = self.model.grdset.cd
        ps0 = self.model.grdset.ps
        seid0 = self.model.grdset.seid

        i = self.i
        #: Node ID
        self.node_id[i] = integer(card, 1, 'nid')

        #: Grid point coordinate system
        self.cp[i] = integer_or_blank(card, 2, 'cp', cp0)

        x = double_or_blank(card, 3, 'x1', 0.)
        y = double_or_blank(card, 4, 'x2', 0.)
        z = double_or_blank(card, 5, 'x3', 0.)
        #: node location in local frame
        self.xyz[i] = [x, y, z]

        #: Analysis coordinate system
        self.cd[i] = integer_or_blank(card, 6, 'cd', cd0)

        #: SPC constraint
        self.ps[i] = integer_or_blank(card, 7, 'ps', ps0)

        #: Superelement ID
        self.seid[i] = integer_or_blank(card, 8, 'seid', seid0)
        self.i += 1
コード例 #43
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
コード例 #44
0
    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)))
コード例 #45
0
ファイル: thermal.py プロジェクト: anick107/von_mises_rms
    def __init__(self, card=None, data=None, comment=''):
        ThermalElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Surface element ID
            self.eid = integer(card, 1, 'eid')

            #: PHBDY property entry identification numbers. (Integer > 0)
            self.pid = integer(card, 2, 'pid')
            assert self.pid > 0

            self.Type = string(card, 3, 'Type')
            #print "self.Type = ",self.Type
            # msg = 'CHBDYP Type=|%s|' (self.Type)
            #assert self.Type in ['POINT','LINE','ELCYL','FTUBE','TUBE'], msg

            #: A VIEW entry identification number for the front face.
            self.iViewFront = integer_or_blank(card, 4, 'iViewFront', 0)

            #: A VIEW entry identification number for the back face.
            self.iViewBack = integer_or_blank(card, 5, 'iViewBack', 0)

            #: Grid point identification numbers of grids bounding the surface.
            #: (Integer > 0)
            self.g1 = integer(card, 6, 'g1')
            #: Grid point identification numbers of grids bounding the surface.
            #: (Integer > 0)
            if self.Type != 'POINT':
                self.g2 = integer(card, 7, 'g2')
            else:
                self.g2 = blank(card, 7, 'g2')

            #: Orientation grid point. (Integer > 0; Default = 0)
            self.g0 = integer_or_blank(card, 8, 'g0', 0)

            #: RADM identification number for front face of surface element.
            #: (Integer > 0)
            self.radMidFront = integer_or_blank(card, 9, 'radMidFront', 0)

            #: RADM identification number for back face of surface element.
            #: (Integer > 0)
            self.radMidBack = integer_or_blank(card, 10, 'radMidBack', 0)

            #: Grid point identification number of a midside node if it is used
            #: with the line type surface element.
            self.gmid = integer_or_blank(card, 11, 'gmid')
            #: Coordinate system for defining orientation vector.
            #: (Integer > 0; Default = 0
            self.ce = integer_or_blank(card, 12, 'ce', 0)

            #: Components of the orientation vector in coordinate system CE.
            #: The origin of the orientation vector is grid point G1.
            #: (Real or blank)
            self.e1 = double_or_blank(card, 13, 'e3')
            self.e2 = double_or_blank(card, 14, 'e3')
            self.e3 = double_or_blank(card, 15, 'e3')
            assert len(card) <= 16, 'len(CHBDYP card) = %i' % len(card)
        else:
            raise NotImplementedError(data)
コード例 #46
0
    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)
コード例 #47
0
ファイル: shell.py プロジェクト: EPeterE/von_mises_rms
    def __init__(self, card=None, data=None, comment=''):
        TriShell.__init__(self, card, data)
        if comment:
            self._comment = comment
        #: Element ID
        self.eid = integer(card, 1, 'eid')
        #: Property ID
        self.pid = integer(card, 2, 'pid')

        nids = [
            integer(card, 3, 'n1'),
            integer(card, 4, 'n2'),
            integer(card, 5, 'n3')
        ]

        self.prepareNodeIDs(nids)
        assert len(self.nodes) == 3

        self.thetaMcid = integer_double_or_blank(card, 6, 'thetaMcid', 0.0)
        self.zOffset = double_or_blank(card, 7, 'zOffset', 0.0)
        blank(card, 8, 'blank')
        blank(card, 9, 'blank')
        blank(card, 10, 'blank')

        self.TFlag = integer_or_blank(card, 11, 'TFlag', 0)
        self.T1 = double_or_blank(card, 11, 'T1', 1.0)
        self.T2 = double_or_blank(card, 12, 'T2', 1.0)
        self.T3 = double_or_blank(card, 13, 'T3', 1.0)
        assert len(card) <= 14, 'len(CTRIAR card) = %i' % len(card)
コード例 #48
0
    def build(self):
        """
        :param self: the CONM2 object
        """
        cards = self._cards
        ncards = len(cards)
        #assert ncards > 0, cards
        self.n = ncards
        #assert self.n > 0
        print('CONM2 self.n=%s' % self.n)
        if ncards:
            print "CONM2", self.n
            float_fmt = self.model.float

            #: Element ID
            self.element_id = zeros(ncards, 'int32')
            #: Property ID
            self.property_id = zeros(ncards, 'int32')
            self.node_id = zeros(ncards, 'int32')
            self.coord_id = zeros(ncards, 'int32')
            self.mass = zeros(ncards, float_fmt)
            self.x = zeros((ncards, 3), float_fmt)
            self.I = zeros((ncards, 6), float_fmt)

            for i, card in enumerate(cards):
                self.element_id[i] = integer(card, 1, 'element_id')
                self.node_id[i] = integer(card, 2, 'node_id')
                self.coord_id[i] = integer_or_blank(card, 3, 'coord_id', 0)
                self.mass[i] = double_or_blank(card, 4, 'mass', 0.)
                self.x[i, :] = [
                    double_or_blank(card, 5, 'x1', 0.0),
                    double_or_blank(card, 6, 'x2', 0.0),
                    double_or_blank(card, 7, 'x3', 0.0)
                ]

                self.I[i, :] = [
                    double_or_blank(card, 9, 'I11', 0.0),
                    double_or_blank(card, 10, 'I21', 0.0),
                    double_or_blank(card, 11, 'I22', 0.0),
                    double_or_blank(card, 12, 'I31', 0.0),
                    double_or_blank(card, 13, 'I32', 0.0),
                    double_or_blank(card, 14, 'I33', 0.0)
                ]
                assert len(card) <= 15, 'len(CONM2 card) = %i' % len(card)

            i = self.element_id.argsort()
            #print "iconm2", i, type(i)
            self.element_id = self.element_id[i]
            self.node_id = self.node_id[i]
            self.coord_id = self.coord_id[i]
            self.mass = self.mass[i]
            self.x = self.x[i, :]
            self.I = self.I[i, :]

            unique_eids = unique(self.element_id)
            if len(unique_eids) != len(self.element_id):
                raise RuntimeError('There are duplicate CONM2 IDs...')
            self._cards = []
            self._comments = []
コード例 #49
0
    def __init__(self, card=None, data=None, comment=''):
        """
        Creates the POINT card

        :param self:
          the POINT object pointer
        :param card:
          a BDFCard object
        :type card:
          BDFCard
        :param data:
          a list with the POINT fields defined in OP2 format
        :type data:
          LIST
        :param comment:
          a comment for the card
        :type comment:
          string
        """
        if comment:
            self._comment = comment
        Node.__init__(self, card, data)

        if card:
            #: Node ID
            self.nid = integer(card, 1, 'nid')

            #: Grid point coordinate system
            self.cp = integer_or_blank(card, 2, 'cp', 0)

            #: node location in local frame
            self.xyz = array([
                double_or_blank(card, 3, 'x1', 0.),
                double_or_blank(card, 4, 'x2', 0.),
                double_or_blank(card, 5, 'x3', 0.)
            ],
                             dtype='float64')

            #: Analysis coordinate system
            self.cd = blank(card, 6, 'cd', 0)

            #: SPC constraint
            self.ps = blank(card, 7, 'ps', '')

            #: Superelement ID
            self.seid = blank(card, 8, 'seid', 0)
            assert len(card) <= 9, 'len(POINT card) = %i' % len(card)
        else:
            self.nid = data[0]
            self.cp = data[1]
            self.xyz = array(data[2:5])
            assert len(self.xyz) == 3
            self.ps = ''
            self.seid = 0
            self.cd = 0

        assert self.nid > 0, 'nid=%s' % (self.nid)
        assert self.cp >= 0, 'cp=%s' % (self.cp)
コード例 #50
0
ファイル: dynamic.py プロジェクト: EPeterE/von_mises_rms
 def __init__(self, card=None, data=None, comment=''):
     if comment:
         self._comment = comment
     self.sid = integer(card, 1, 'sid')
     self.f1 = double_or_blank(card, 2, 'f1', 0.0)
     self.f2 = double_or_blank(card, 3, 'f2', 1.e20)
     self.fspd = double_or_blank(card, 4, 'fspd', 0.1)
     self.nfm = integer_or_blank(card, 5, 'nfm', 3)
     assert len(card) <= 6, 'len(FREQ card) = %i' % len(card)
コード例 #51
0
ファイル: bush.py プロジェクト: afcarl/cyNastran
    def getRCV(self, card, iStart):
        # Flag indicating that the next 1 to 4 fields are stress or strain
        # coefficients. (Character)
        #self.rcv = string(card, iStart, 'rcv')

        self.sa = double_or_blank(card, iStart + 1, 'sa', 1.)
        self.st = double_or_blank(card, iStart + 2, 'st', 1.)
        self.ea = double_or_blank(card, iStart + 3, 'ea', 1.)
        self.et = double_or_blank(card, iStart + 4, 'et', 1.)
        self.vars.append('RCV')