Beispiel #1
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')
            #: Material ID
            self.mid1 = integer_or_blank(card, 2, 'mid1', 0)
            self.t1 = double_or_blank(card, 3, 't1')

            self.mid2 = integer(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)
Beispiel #2
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')
            #: 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)
Beispiel #3
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)
Beispiel #4
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)
Beispiel #5
0
 def __init__(self, card=None, data=None, comment=''):
     if comment:
         self._comment = comment
     self.nlparm_id = integer(card, 1, 'nlparm_id')
     self.Type = string_or_blank(card, 2, 'Type', 'CRIS')
     self.minalr = double_or_blank(card, 3, 'minalr', 0.25)
     self.maxalr = double_or_blank(card, 4, 'maxalr', 4.0)
     self.scale = double_or_blank(card, 5, 'scale', 0.0)
     blank(card, 6, 'blank')
     self.desiter = double_or_blank(card, 7, 'minalr', 12)
     self.mxinc = integer_or_blank(card, 8, 'minalr', 20)
Beispiel #6
0
    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')
        #: 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
Beispiel #7
0
 def __init__(self, card=None, data=None, comment=''):
     if comment:
         self._comment = comment
     self.nlparm_id = integer(card, 1, 'nlparm_id')
     self.Type = string_or_blank(card, 2, 'Type', 'CRIS')
     self.minalr = double_or_blank(card, 3, 'minalr', 0.25)
     self.maxalr = double_or_blank(card, 4, 'maxalr', 4.0)
     self.scale = double_or_blank(card, 5, 'scale', 0.0)
     blank(card, 6, 'blank')
     self.desiter = double_or_blank(card, 7, 'minalr', 12)
     self.mxinc = integer_or_blank(card, 7, 'minalr', 20)
Beispiel #8
0
    def add_cquad4(self, card=None, data=None, comment=''):
        #QuadShell.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            eid = integer(card, 1, 'eid')
            pid = integer(card, 2, 'pid')
            nids = [integer(card, 3, 'n1'),
                    integer(card, 4, 'n2'),
                    integer(card, 5, 'n3'),
                    integer(card, 6, 'n4')]
            thetaMcid = integer_double_or_blank(card, 7, 'thetaMcid', 0.0)
            zOffset = double_or_blank(card, 8, 'zOffset', 0.0)
            blank(card, 9, 'blank')
            TFlag = integer_or_blank(card, 10, 'TFlag', 0)
            T1 = double_or_blank(card, 11, 'T1', 1.0)
            T2 = double_or_blank(card, 12, 'T2', 1.0)
            T3 = double_or_blank(card, 13, 'T3', 1.0)
            T4 = double_or_blank(card, 14, 'T4', 1.0)
            assert len(card) <= 15, 'len(CQUAD4 card) = %i' % len(card)
        else:
            eid = data[0]
            pid = data[1]
            nids = data[2:6]

            thetaMcid = data[6]
            zOffset = data[7]
            TFlag = data[8]
            T1 = data[9]
            T2 = data[10]
            T3 = data[11]
            T4 = data[12]
            if T1 == -1.0:
                T1 = 1.0
            if T2 == -1.0:
                T2 = 1.0
            if T3 == -1.0:
                T3 = 1.0
            if T4 == -1.0:
                T4 = 1.0

        #self.prepareNodeIDs(nids)
        assert len(nids) == 4, 'CQUAD4'

        self._eidmap[eid] = self._ncquad4
        self.eid.append(eid)
        self.pid.append(pid)
        self.nodes.append(nids)
        self.thetaMcid.append(thetaMcid)
        self.zOffset.append(zOffset)
        self.TFlag.append(TFlag)
        self.T.append([T1, T2, T3, T4])

        self._ncquad4 += 1
Beispiel #9
0
    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
Beispiel #10
0
    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')

            #: Method of eigenvalue extraction. (Character: 'INV' for inverse
            #: power method or 'SINV' for enhanced inverse power method.)
            self.method = string_or_blank(card, 2, 'method', 'LAN')
            assert self.method in [
                'LAN', 'AHOU', 'INV', 'SINV', 'GIV', 'MGIV', 'HOU', 'MHOU',
                'AGIV'
            ], 'method=%s' % self.method

            #: Frequency range of interest
            self.f1 = double_or_blank(card, 3, 'f1')
            self.f2 = double_or_blank(card, 4, 'f2')

            #: Estimate of number of roots in range (Required for
            #: METHOD = 'INV'). Not used by 'SINV' method.
            self.ne = integer_or_blank(card, 5, 'ne')

            #: Desired number of roots (default=600 for SINV 3*ne for INV)
            if self.method in ['SINV']:
                self.nd = integer_or_blank(card, 6, 'nd', 600)
            if self.method in ['INV']:
                self.nd = integer_or_blank(card, 6, 'nd', 3 * self.ne)
            elif self.method in ['GIV', 'MGIV', 'HOU', 'MHOU']:
                self.nd = integer_or_blank(card, 6, 'nd', 0)
            else:
                self.nd = integer(card, 6, 'nd')
            #: Method for normalizing eigenvectors. ('MAX' or 'POINT';
            #: Default='MAX')
            self.norm = string_or_blank(card, 9, 'norm', 'MASS')
            assert self.norm in ['POINT', 'MASS', 'MAX']

            if self.method == 'POINT':
                #: Grid or scalar point identification number. Required only if
                #: NORM='POINT'. (Integer>0)
                self.G = integer(card, 10, 'G')

                #: Component number. Required only if NORM='POINT' and G is a
                #: geometric grid point. (1<Integer<6)
                self.C = components(card, 11, 'C')
            else:
                self.G = blank(card, 10, 'G')
                self.C = blank(card, 11, 'C')
            assert len(card) <= 12, 'len(EIGR card) = %i' % len(card)
        else:
            raise NotImplementedError('EIGR')
Beispiel #11
0
    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')

            #: Method of eigenvalue extraction. (Character: 'INV' for inverse
            #: power method or 'SINV' for enhanced inverse power method.)
            self.method = string_or_blank(card, 2, 'method', 'LAN')
            assert self.method in ['LAN', 'AHOU', 'INV', 'SINV', 'GIV', 'MGIV', 'HOU', 'MHOU', 'AGIV'], 'method=%s' % self.method

            #: Frequency range of interest
            self.f1 = double_or_blank(card, 3, 'f1')
            self.f2 = double_or_blank(card, 4, 'f2')

            #: Estimate of number of roots in range (Required for
            #: METHOD = 'INV'). Not used by 'SINV' method.
            self.ne = integer_or_blank(card, 5, 'ne')

            #: Desired number of roots (default=600 for SINV 3*ne for INV)
            if self.method in ['SINV']:
                self.nd = integer_or_blank(card, 6, 'nd', 600)
            if self.method in ['INV']:
                self.nd = integer_or_blank(card, 6, 'nd', 3 * self.ne)
            elif self.method in ['GIV', 'MGIV', 'HOU', 'MHOU']:
                self.nd = integer_or_blank(card, 6, 'nd', 0)
            else:
                self.nd = integer(card, 6, 'nd')
            #: Method for normalizing eigenvectors. ('MAX' or 'POINT';
            #: Default='MAX')
            self.norm = string_or_blank(card, 9, 'norm', 'MASS')
            assert self.norm in ['POINT', 'MASS', 'MAX']

            if self.method == 'POINT':
                #: Grid or scalar point identification number. Required only if
                #: NORM='POINT'. (Integer>0)
                self.G = integer(card, 10, 'G')

                #: Component number. Required only if NORM='POINT' and G is a
                #: geometric grid point. (1<Integer<6)
                self.C = components(card, 11, 'C')
            else:
                self.G = blank(card, 10, 'G')
                self.C = blank(card, 11, 'C')
            assert len(card) <= 12, 'len(EIGR card) = %i' % len(card)
        else:
            raise NotImplementedError('EIGR')
Beispiel #12
0
    def getDamper(self, card, iStart):
        self.damperType = string_or_blank(card, iStart + 1, 'damperType')
        self.damperIDT = integer(card, iStart + 2, 'damperIDT')
        if self.damperType == 'TABLE':
            self.damperIDC = blank(card, iStart + 3, 'damperIDC')
            self.damperIDTDV = blank(card, iStart + 4, 'damperIDTDV')
            self.damperIDCDV = blank(card, iStart + 5, 'damperIDCDV')
        elif self.damperType == 'EQUAT':
            self.damperIDC = integer_or_blank(card, iStart + 3, 'damperIDC')
            self.damperIDTDV = integer(card, iStart + 4, 'damperIDTDV')
            self.damperIDCDV = integer_or_blank(card, iStart + 5, 'damperIDCDV', self.damperIDTDV)
        else:
            raise RuntimeError('Invalid springType=|%s| on card\n%s' %(self.springType, card))

        self.vars.append('DAMPER')
Beispiel #13
0
    def getDamper(self, card, iStart):
        self.damperType = string_or_blank(card, iStart + 1, 'damperType')
        self.damperIDT = integer(card, iStart + 2, 'damperIDT')
        if self.damperType == 'TABLE':
            self.damperIDC = blank(card, iStart + 3, 'damperIDC')
            self.damperIDTDV = blank(card, iStart + 4, 'damperIDTDV')
            self.damperIDCDV = blank(card, iStart + 5, 'damperIDCDV')
        elif self.damperType == 'EQUAT':
            self.damperIDC = integer_or_blank(card, iStart + 3, 'damperIDC')
            self.damperIDTDV = integer(card, iStart + 4, 'damperIDTDV')
            self.damperIDCDV = integer_or_blank(card, iStart + 5, 'damperIDCDV', self.damperIDTDV)
        else:
            raise RuntimeError('Invalid springType=|%s| on card\n%s' %(self.springType, card))

        self.vars.append('DAMPER')
Beispiel #14
0
    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
Beispiel #15
0
    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)
Beispiel #16
0
    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
Beispiel #17
0
    def __init__(self, card=None, data=None, comment=''):
        if comment:
            self._comment = comment
        if card:
            self.name = string(card, 1, 'name')
            #zero

            #: 4-Lower Triangular; 5=Upper Triangular; 6=Symmetric; 8=Identity (m=nRows, n=m)
            self.ifo = integer(card, 3, 'ifo')
            #: 1-Real, Single Precision; 2=Real,Double Precision; 3=Complex, Single; 4=Complex, Double
            self.tin = integer(card, 4, 'tin')
            #: 0-Set by cell precision
            self.tout = integer_or_blank(card, 5, 'tout', 0)

            self.polar = integer_or_blank(card, 6, 'polar')
            if self.ifo == 9:
                self.ncol = integer(card, 8, 'ncol')
            else:
                self.ncol = blank(card, 8, 'ncol')
        else:
            raise NotImplementedError(data)

        self.GCj = []
        self.GCi = []
        self.Real = []
        if self.isComplex():
            self.Complex = []
Beispiel #18
0
    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)
Beispiel #19
0
    def __init__(self, card=None, data=None, comment=''):
        if comment:
            self._comment = comment
        if card:
            self.name = string(card, 1, 'name')
            #zero

            #: 4-Lower Triangular; 5=Upper Triangular; 6=Symmetric; 8=Identity (m=nRows, n=m)
            self.ifo = integer(card, 3, 'ifo')
            #: 1-Real, Single Precision; 2=Real,Double Precision; 3=Complex, Single; 4=Complex, Double
            self.tin = integer(card, 4, 'tin')
            #: 0-Set by cell precision
            self.tout = integer_or_blank(card, 5, 'tout', 0)

            self.polar = integer_or_blank(card, 6, 'polar')
            if self.ifo == 9:
                self.ncol = integer(card, 8, 'ncol')
            else:
                self.ncol = blank(card, 8, 'ncol')
        else:
            raise NotImplementedError(data)

        self.GCj = []
        self.GCi = []
        self.Real = []
        if self.isComplex():
            self.Complex = []
Beispiel #20
0
    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)
Beispiel #21
0
    def __init__(self, card=None, data=None, comment=''):
        QuadShell.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: 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'),
                integer(card, 6, 'n4')
            ]
            self.thetaMcid = integer_double_or_blank(card, 7, 'thetaMcid', 0.0)
            self.zOffset = double_or_blank(card, 8, 'zOffset', 0.0)
            blank(card, 9, 'blank')
            self.TFlag = integer_or_blank(card, 10, '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)
            self.T4 = double_or_blank(card, 14, 'T4', 1.0)
            assert len(card) <= 15, 'len(CQUAD4 card) = %i' % len(card)
        else:
            self.eid = data[0]
            self.pid = data[1]
            nids = data[2:6]

            self.thetaMcid = data[6]
            self.zOffset = data[7]
            self.TFlag = data[8]
            self.T1 = data[9]
            self.T2 = data[10]
            self.T3 = data[11]
            self.T4 = data[12]
            if self.T1 == -1.0:
                self.T1 = 1.0
            if self.T2 == -1.0:
                self.T2 = 1.0
            if self.T3 == -1.0:
                self.T3 = 1.0
            if self.T4 == -1.0:
                self.T4 = 1.0

        self.prepareNodeIDs(nids)
        assert len(self.nodes) == 4, 'CQUAD4'
Beispiel #22
0
    def __init__(self, card=None, data=None, comment=''):
        QuadShell.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: 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'),
                    integer(card, 6, 'n4')]
            self.thetaMcid = integer_double_or_blank(card, 7, 'thetaMcid', 0.0)
            self.zOffset = double_or_blank(card, 8, 'zOffset', 0.0)
            blank(card, 9, 'blank')
            self.TFlag = integer_or_blank(card, 10, '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)
            self.T4 = double_or_blank(card, 14, 'T4', 1.0)
            assert len(card) <= 15, 'len(CQUAD4 card) = %i' % len(card)
        else:
            self.eid = data[0]
            self.pid = data[1]
            nids = data[2:6]

            self.thetaMcid = data[6]
            self.zOffset = data[7]
            self.TFlag = data[8]
            self.T1 = data[9]
            self.T2 = data[10]
            self.T3 = data[11]
            self.T4 = data[12]
            if self.T1 == -1.0:
                self.T1 = 1.0
            if self.T2 == -1.0:
                self.T2 = 1.0
            if self.T3 == -1.0:
                self.T3 = 1.0
            if self.T4 == -1.0:
                self.T4 = 1.0

        self.prepareNodeIDs(nids)
        assert len(self.nodes) == 4, 'CQUAD4'
Beispiel #23
0
    def getSpring(self, card, iStart):
        self.springType = string_or_blank(card, iStart + 1, 'springType')
        self.springIDT = integer(card, iStart + 2, 'springIDT')

        if self.springType == 'TABLE':
            self.springIDC = blank(card, iStart + 3, 'springIDC')
            self.springIDTDU = blank(card, iStart + 4, 'springIDTDU')
            self.springIDCDU = blank(card, iStart + 5, 'springIDCDU')
        elif self.springType == 'EQUAT':
            self.springIDC = integer_or_blank(card, iStart + 3,
                                              'springIDC', self.springIDT)
            self.springIDTDU = integer(card, iStart + 4, 'springIDTDU')
            self.springIDCDU = integer_or_blank(card, iStart + 5,
                                                'springIDCDU', self.springIDTDU)
        else:
            raise RuntimeError('Invalid springType=|%s| on card\n%s' %(self.springType, card))

        self.vars.append('SPRING')
Beispiel #24
0
    def getSpring(self, card, iStart):
        self.springType = string_or_blank(card, iStart + 1, 'springType')
        self.springIDT = integer(card, iStart + 2, 'springIDT')

        if self.springType == 'TABLE':
            self.springIDC = blank(card, iStart + 3, 'springIDC')
            self.springIDTDU = blank(card, iStart + 4, 'springIDTDU')
            self.springIDCDU = blank(card, iStart + 5, 'springIDCDU')
        elif self.springType == 'EQUAT':
            self.springIDC = integer_or_blank(card, iStart + 3,
                                              'springIDC', self.springIDT)
            self.springIDTDU = integer(card, iStart + 4, 'springIDTDU')
            self.springIDCDU = integer_or_blank(card, iStart + 5,
                                                'springIDCDU', self.springIDTDU)
        else:
            raise RuntimeError('Invalid springType=|%s| on card\n%s' %(self.springType, card))

        self.vars.append('SPRING')
Beispiel #25
0
    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:
            #: 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)
Beispiel #26
0
    def build(self):
        cards = self._cards
        ncards = len(cards)
        self.n = ncards
        if ncards:
            float_fmt = self.model.float
            #: Element ID
            self.element_id = zeros(ncards, 'int32')
            #: Property ID
            self.property_id = zeros(ncards, 'int32')
            #: Node IDs
            self.node_ids = zeros((ncards, 3), 'int32')

            self.zoffset = zeros(ncards, 'int32')
            self.t_flag = zeros(ncards, 'int32')
            self.thickness = zeros((ncards, 3), float_fmt)

            for i, card in enumerate(cards):
                self.element_id[i] = integer(card, 1, 'elemeent_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')]

                #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.TFlag = integer_or_blank(card, 10, '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)
            i = self.element_id.argsort()
            self.element_id = self.element_id[i]
            self.property_id = self.property_id[i]
            self.node_ids = self.node_ids[i, :]
            self._cards = []
            self._comments = []
Beispiel #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, 'n1'),
                integer(card, 4, 'n2'),
                integer(card, 5, 'n3')]

        #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), ]
        self.i += 1
Beispiel #28
0
    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)
Beispiel #29
0
    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)
    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')

            j = 1
            self.phi = []
            for i in range(11, len(card)):
                phii = double(card, i, 'phi' % j)
                self.phi.append(phii)
                j += 1
        else:
            raise NotImplementedError(data)
Beispiel #31
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')
            #: 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')

            j = 1
            self.phi = []
            for i in range(11, len(card)):
                phii = double(card, i, 'phi' % j)
                self.phi.append(phii)
                j += 1
        else:
            raise NotImplementedError(data)
Beispiel #32
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, 'n1'),
            integer(card, 4, 'n2'),
            integer(card, 5, 'n3')
        ]

        #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),
        ]
        self.i += 1
Beispiel #33
0
 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)
Beispiel #34
0
    def __init__(self, card=None, data=None, comment=''):
        if comment:
            self._comment = comment
        #: Grid point coordinate system
        blank(card, 1, 'blank')
        self.cp = integer_or_blank(card, 2, 'cp', 0)
        blank(card, 3, 'blank')
        blank(card, 4, 'blank')
        blank(card, 5, 'blank')

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

        #: Default SPC constraint on undefined nodes
        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(GRDSET card) = %i' % len(card)
Beispiel #35
0
    def __init__(self, card=None, data=None, comment=''):
        """
        Creates the GRDSET card

        :param self:
          the GRDSET object pointer
        :param card:
          a BDFCard object
        :type card:
          BDFCard
        :param data:
          a list with the GRDSET fields defined in OP2 format
        :type data:
          LIST
        :param comment:
          a comment for the card
        :type comment:
          string
        """
        if comment:
            self._comment = comment

        #: Grid point coordinate system
        blank(card, 1, 'blank')

        #: Output Coordinate System
        self.cp = integer_or_blank(card, 2, 'cp', 0)
        blank(card, 3, 'blank')
        blank(card, 4, 'blank')
        blank(card, 5, 'blank')

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

        #: Default SPC constraint on undefined nodes
        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(GRDSET card) = %i' % len(card)
Beispiel #36
0
    def __init__(self, card=None, data=None, comment=''):
        """
        Creates the GRDSET card

        :param self:
          the GRDSET object pointer
        :param card:
          a BDFCard object
        :type card:
          BDFCard
        :param data:
          a list with the GRDSET fields defined in OP2 format
        :type data:
          LIST
        :param comment:
          a comment for the card
        :type comment:
          string
        """
        if comment:
            self._comment = comment

        #: Grid point coordinate system
        blank(card, 1, 'blank')

        #: Output Coordinate System
        self.cp = integer_or_blank(card, 2, 'cp', 0)
        blank(card, 3, 'blank')
        blank(card, 4, 'blank')
        blank(card, 5, 'blank')

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

        #: Default SPC constraint on undefined nodes
        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(GRDSET card) = %i' % len(card)
Beispiel #37
0
    def __init__(self,
                 card=None,
                 data=None,
                 comment=''):  # this card has missing fields
        """
        Creates the RINGAX card
        :param self:
          the RINGAX object pointer
        :param card:
          a BDFCard object
        :type card:
          BDFCard
        :param data:
          a list with the RINGAX fields defined in OP2 format
        :type data:
          LIST
        :param comment:
          a comment for the card
        :type comment:
          string
        """
        Ring.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Node ID
            self.nid = integer(card, 1, 'nid')
            blank(card, 2, 'blank')

            #: Radius
            self.R = double(card, 3, 'R')
            self.z = double(card, 4, 'z')
            blank(card, 5, 'blank')
            blank(card, 6, 'blank')

            #: local SPC constraint
            self.ps = integer_or_blank(card, 7, 'ps')
            assert len(card) <= 8, 'len(RINGAX card) = %i' % len(card)
        else:  # hasn't been validated
            self.nid = data[0]
            self.R = data[1]
            self.z = data[2]
            self.ps = data[3]
            assert len(data) == 4, data
Beispiel #38
0
    def __init__(self, card=None, data=None, comment=''):  # this card has missing fields
        """
        Creates the RINGAX card
        :param self:
          the RINGAX object pointer
        :param card:
          a BDFCard object
        :type card:
          BDFCard
        :param data:
          a list with the RINGAX fields defined in OP2 format
        :type data:
          LIST
        :param comment:
          a comment for the card
        :type comment:
          string
        """
        Ring.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Node ID
            self.nid = integer(card, 1, 'nid')
            blank(card, 2, 'blank')

            #: Radius
            self.R = double(card, 3, 'R')
            self.z = double(card, 4, 'z')
            blank(card, 5, 'blank')
            blank(card, 6, 'blank')

            #: local SPC constraint
            self.ps = integer_or_blank(card, 7, 'ps')
            assert len(card) <= 8, 'len(RINGAX card) = %i' % len(card)
        else:  # hasn't been validated
            self.nid = data[0]
            self.R = data[1]
            self.z = data[2]
            self.ps = data[3]
            assert len(data) == 4, data
    def test_blank(self):
        """
        value = integer(card, n, fieldname)
        """
        # integer
        with self.assertRaises(SyntaxError):
            blank(BDFCard([1]), 0, "field")
        with self.assertRaises(SyntaxError):
            blank(BDFCard(["1"]), 0, "field")

        # float
        with self.assertRaises(SyntaxError):
            blank(BDFCard([1.0]), 0, "field")
        with self.assertRaises(SyntaxError):
            blank(BDFCard(["1."]), 0, "field")

        # string
        with self.assertRaises(SyntaxError):
            blank(BDFCard(["a"]), 0, "field")
        with self.assertRaises(SyntaxError):
            blank(BDFCard(["1b"]), 0, "field")

        # blank
        val = blank(BDFCard([""]), 0, "field")
        self.assertEqual(val, None)
        val = blank(BDFCard([None]), 0, "field")
        self.assertEqual(val, None)
        val = blank(BDFCard([None]), 0, "field", "default")
        self.assertEqual(val, "default")
Beispiel #40
0
    def __init__(self, card=None, data=None, comment=''):
        MaterialDependence.__init__(self, card, data)
        if comment:
            self._comment = comment

        if card:
            #: Identification number of a MAT1, MAT2, or MAT9 entry.
            self.mid = integer(card, 1, 'mid')
            #: Identification number of a TABLES1 or TABLEST entry. If H is
            #: given, then this field must be blank.
            self.tid = integer_or_blank(card, 2, 'tid')
            #: Type of material nonlinearity. ('NLELAST' for nonlinear elastic
            #: or 'PLASTIC' for elastoplastic.)
            self.Type = string(card, 3, 'Type')

            if self.Type not in ['NLELAST', 'PLASTIC']:
                raise ValueError('MATS1 Type must be [NLELAST, PLASTIC]; Type=%r' % self.Type)
            if self.Type == 'NLELAST':
                self.h = blank(card, 4, 'h')
                self.hr = blank(card, 6, 'hr')
                self.yf = blank(card, 5, 'yf')
                self.limit1 = blank(card, 7, 'yf')
                self.limit2 = 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
                self.h = double_or_blank(card, 4, 'H')

                #: Yield function criterion, selected by one of the following
                #: values (1) Von Mises (2) Tresca (3) Mohr-Coulomb
                #: (4) Drucker-Prager
                self.yf = 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 = integer_or_blank(card, 6, 'hr', 1)
                #: Initial yield point
                self.limit1 = double(card, 7, 'limit1')

                if self.yf == 3 or self.yf == 4:
                    #: Internal friction angle, measured in degrees, for the
                    #: Mohr-Coulomb and Drucker-Prager yield criteria
                    self.limit2 = double(card, 8, 'limit2')
                else:
                    #self.limit2 = blank(card, 8, 'limit2')
                    self.limit2 = None
            assert len(card) <= 9, 'len(MATS1 card) = %i' % len(card)
        else:
            (mid, tid, Type, h, yf, hr, limit1, limit2) = data
            self.mid = mid
            self.tid = tid
            if Type == 1:
                self.Type = 'NLELAST'
            elif Type == 2:
                self.Type = 'PLASTIC'
            else:
                raise RuntimeError('Invalid Type:  Type=%s; must be 1=NLELAST '
                                   'or 2=PLASTIC' % (Type))
            self.h = h
            self.yf = yf
            self.hr = hr
            self.limit1 = limit1
            self.limit2 = limit2
Beispiel #41
0
    def test_blank(self):
        """
        value = integer(card, n, fieldname)
        """
        # integer
        with self.assertRaises(SyntaxError):
            blank(BDFCard([1]  ), 0, 'field')
        with self.assertRaises(SyntaxError):
            blank(BDFCard(['1']), 0, 'field')

        # float
        with self.assertRaises(SyntaxError):
            blank(BDFCard([1.]  ), 0, 'field')
        with self.assertRaises(SyntaxError):
            blank(BDFCard(['1.']), 0, 'field')

        # string
        with self.assertRaises(SyntaxError):
            blank(BDFCard(['a'] ), 0, 'field')
        with self.assertRaises(SyntaxError):
            blank(BDFCard(['1b']), 0, 'field')

        # blank
        val = blank(BDFCard(['']   ), 0, 'field')
        self.assertEquals(val, None)
        val = blank(BDFCard([None] ), 0, 'field')
        self.assertEquals(val, None)
        val = blank(BDFCard([None] ), 0, 'field', 'default')
        self.assertEquals(val, 'default')
Beispiel #42
0
    def __init__(self, card=None, data=None, comment=''):
        """
        .. todo::
            support solution 600 default
            do a check for mid -> MAT1      for structural
            do a check for mid -> MAT4/MAT5 for thermal

        +------+-----+-----+-----+----+----+----+-----+
        | PBAR | PID | MID | A   | I1 | I2 | J  | NSM |
        +------+-----+-----+-----+----+----+----+-----+-----+
        |      | C1  | C2  | D1  | D2 | E1 | E2 | F1  | F2  |
        +------+-----+-----+-----+----+----+----+-----+-----+
        |      | K1  | K2  | I12 |
        +------+-----+-----+-----+
        """
        LineProperty.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: property ID -> use Pid()
            self.pid = integer(card, 1, 'pid')
            #: material ID -> use Mid()
            self.mid = integer(card, 2, 'mid')
            #: Area -> use Area()
            self.A = double_or_blank(card, 3, 'A', 0.0)
            #: I1 -> use I1()
            self.i1 = double_or_blank(card, 4, 'I1', 0.0)
            #: I2 -> use I2()
            self.i2 = double_or_blank(card, 5, 'I2', 0.0)

            #: Polar Moment of Inertia J -> use J()
            #: default=1/2(I1+I2) for SOL=600, otherwise 0.0
            #: .. todo:: support SOL 600 default
            self.j = double_or_blank(card, 6, 'J', 0.0)
            #: nonstructral mass -> use Nsm()
            self.nsm = double_or_blank(card, 7, 'nsm', 0.0)

            self.C1 = double_or_blank(card, 9, 'C1', 0.0)
            self.C2 = double_or_blank(card, 10, 'C2', 0.0)
            self.D1 = double_or_blank(card, 11, 'D1', 0.0)
            self.D2 = double_or_blank(card, 12, 'D2', 0.0)
            self.E1 = double_or_blank(card, 13, 'E1', 0.0)
            self.E2 = double_or_blank(card, 14, 'E2', 0.0)
            self.F1 = double_or_blank(card, 15, 'F1', 0.0)
            self.F2 = double_or_blank(card, 16, 'F2', 0.0)

            if self.i1 < 0.:
                raise RuntimeError('I1=%r must be greater than or equal to 0.0' % self.i1)
            if self.i2 < 0.:
                raise RuntimeError('I2=%r must be greater than or equal to 0.0' % self.i2)
            if self.j < 0.:
                raise RuntimeError('J=%r must be greater than or equal to 0.0' % self.j)

            #: I12 -> use I12()
            self.i12 = double_or_blank(card, 19, 'I12', 0.0)

            if self.A == 0.0:
                # K1/K2 must be blank
                #: default=infinite; assume 1e8
                self.K1 = blank(card, 17, 'K1')
                #: default=infinite; assume 1e8
                self.K2 = blank(card, 18, 'K2')
            elif self.i12 != 0.0:
                # K1 / K2 are ignored
                self.K1 = None
                self.K2 = None
            else:
                #: default=infinite; assume 1e8
                self.K1 = double_or_blank(card, 17, 'K1', 1e8)
                #: default=infinite; assume 1e8
                self.K2 = double_or_blank(card, 18, 'K2', 1e8)

            assert len(card) <= 20, 'len(PBAR card) = %i' % len(card)
        else:
            self.pid = data[0]
            self.mid = data[1]
            self.A = data[2]
            self.i1 = data[3]
            self.i2 = data[4]
            self.j = data[5]

            self.nsm = data[6]
            #self.fe  = data[7] #: .. todo:: not documented....
            self.C1 = data[8]
            self.C2 = data[9]
            self.D1 = data[10]
            self.D2 = data[11]
            self.E1 = data[12]
            self.E2 = data[13]
            self.F1 = data[14]
            self.F2 = data[15]
            self.K1 = data[16]
            self.K2 = data[17]
            self.i12 = data[18]
Beispiel #43
0
    def test_blank(self):
        """
        value = integer(card, n, fieldname)
        """
        # integer
        with self.assertRaises(SyntaxError):
            blank(BDFCard([1]), 0, 'field')
        with self.assertRaises(SyntaxError):
            blank(BDFCard(['1']), 0, 'field')

        # float
        with self.assertRaises(SyntaxError):
            blank(BDFCard([1.]), 0, 'field')
        with self.assertRaises(SyntaxError):
            blank(BDFCard(['1.']), 0, 'field')

        # string
        with self.assertRaises(SyntaxError):
            blank(BDFCard(['a']), 0, 'field')
        with self.assertRaises(SyntaxError):
            blank(BDFCard(['1b']), 0, 'field')

        # blank
        blank(BDFCard(['']), 0, 'field')
        blank(BDFCard([None]), 0, 'field')
Beispiel #44
0
    def __init__(self, card=None, data=None, comment=''):
        """
        eid
        refgrid
        refc
        WtCG_groups = [wt,ci,Gij]
        Gmi
        Cmi
        alpha
        """
        RigidElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        self.eid = integer(card, 1, 'eid')
        blank(card, 2, 'blank')
        self.refgrid = integer(card, 3, 'refgrid')
        self.refc = components_or_blank(card, 4, 'refc')
        #iUM = fields.index('UM')

        fields = [field.upper() if isinstance(field, string_types) else field for field in card[5:]]
        iOffset = 5
        iWtMax = len(fields) + iOffset
        try:
            iAlpha = fields.index('ALPHA') + iOffset
            iWtMax = iAlpha  # the index to start parsing UM
            iUmStop = iAlpha  # the index to stop  parsing UM
        except ValueError:
            iAlpha = None
            iUmStop = iWtMax
        #print("iAlpha = %s" % iAlpha)
        try:
            iUm = fields.index('UM') + iOffset
            iWtMax = iUm
        except ValueError:
            iUm = None
        #print("iAlpha=%s iUm=%s" % (iAlpha, iUm))
        #print("iAlpha=%s iWtMax=%s" % (iAlpha, iWtMax))

        #print("iUM = ", iUM)
        self.WtCG_groups = []

        i = iOffset
        n = 1
        while i < iWtMax:
            Gij = []
            wtname = 'wt' + str(n)
            wt = double_or_blank(card, i, wtname)
            if wt is not None:
                cname = 'c'+str(n)
                ci = components_or_blank(card, i + 1, cname)

                #print("%s=%s %s=%s" % (wtname, wt, cname, ci))
                i += 2
                gij = 0

                j = 0
                while isinstance(gij, int) and i < iWtMax:
                    j += 1
                    gij_name = 'g%s,%s' % (n, j)
                    gij = integer_double_or_blank(card, i, gij_name)
                    if isinstance(gij, float):
                        break
                    #print("%s = %s" % (gij_name, gij))
                    if gij is not None:
                        Gij.append(gij)
                    i += 1
                wtCG_group = [wt, ci, Gij]
                self.WtCG_groups.append(wtCG_group)
                #print('----finished a group=%r----' % wtCG_group)
            else:
                i += 1

        self.Gmi = []
        self.Cmi = []
        #print("")
        if iUm:
            #print('UM = %s' % card.field(iUm))  # UM
            i = iUm + 1
            n = 1
            #print("i=%s iUmStop=%s" % (i, iUmStop))
            for j in range(i, iUmStop, 2):

                gm_name = 'gm' + str(n)
                cm_name = 'cm' + str(n)
                gmi = integer_or_blank(card, j, gm_name)
                if gmi is not None:
                    cmi = components(card, j + 1, cm_name)
                    #print "gmi=%s cmi=%s" % (gmi, cmi)
                    self.Gmi.append(gmi)
                    self.Cmi.append(cmi)

        if iAlpha:
            self.alpha = double_or_blank(card, iAlpha + 1, 'alpha')
        else:
            #: thermal expansion coefficient
            self.alpha = 0.0
Beispiel #45
0
    def add(self, card, comment=''):
        #self.model.log.debug('RBE2.add')
        i = self.i
        #if comment:
            #self._comment = comment
        eid = integer(card, 1, 'element_id')
        #if comment:
            #self._comment = comment
        self.element_id[i] = integer(card, 1, 'eid')
        blank(card, 2, 'blank')
        self.refgrid[i] = integer(card, 3, 'refgrid')
        self.refc[i] = components_or_blank(card, 4, 'refc', 0)
        #iUM = fields.index('UM')

        fields = [field.upper() if isinstance(field, string_types) else field for field in card[5:]]
        iOffset = 5
        iWtMax = len(fields) + iOffset
        try:
            iAlpha = fields.index('ALPHA') + iOffset
            iWtMax = iAlpha  # the index to start parsing UM
            iUmStop = iAlpha  # the index to stop  parsing UM
        except ValueError:
            iAlpha = None
            iUmStop = iWtMax
        #print("iAlpha = %s" % iAlpha)
        try:
            iUm = fields.index('UM') + iOffset
            iWtMax = iUm
        except ValueError:
            iUm = None
        #print("iAlpha=%s iUm=%s" % (iAlpha, iUm))
        #print("iAlpha=%s iWtMax=%s" % (iAlpha, iWtMax))

        #print("iUM = %s" % iUM)
        WtCG_groups = []

        i = iOffset
        n = 1
        while i < iWtMax:
            Gij = []
            wtname = 'wt' + str(n)
            wt = double_or_blank(card, i, wtname)
            if wt is not None:
                cname = 'c'+str(n)
                ci = components_or_blank(card, i + 1, cname)

                #print("%s=%s %s=%s" % (wtname, wt, cname, ci))
                i += 2
                gij = 0

                j = 0
                while isinstance(gij, int) and i < iWtMax:
                    j += 1
                    gij_name = 'g%s,%s' % (n, j)
                    gij = integer_double_or_blank(card, i, gij_name)
                    if isinstance(gij, float):
                        break
                    #print("%s = %s" % (gij_name, gij))
                    if gij is not None:
                        Gij.append(gij)
                    i += 1
                wtCG_group = [wt, ci, Gij]
                WtCG_groups.append(wtCG_group)
                #print('----finished a group=%r----' % wtCG_group)
            else:
                i += 1
        self.WtCG_groups[i] = WtCG_groups
        Gmi = []
        Cmi = []
        #print("")
        if iUm:
            #print('UM = %s' % card.field(iUm))  # UM
            i = iUm + 1
            n = 1
            #print("i=%s iUmStop=%s" % (i, iUmStop))
            for j in range(i, iUmStop, 2):

                gm_name = 'gm' + str(n)
                cm_name = 'cm' + str(n)
                gmi = integer_or_blank(card, j, gm_name)
                if gmi is not None:
                    cmi = components(card, j + 1, cm_name)
                    #print("gmi=%s cmi=%s" % (gmi, cmi))
                    Gmi.append(gmi)
                    Cmi.append(cmi)
        self.Gmi[i] = Gmi
        self.Cmi[i] = Cmi
        if iAlpha:
            alpha = double_or_blank(card, iAlpha + 1, 'alpha', 0.0)
        else:
            alpha = 0.0
        self.alpha[i] = alpha
Beispiel #46
0
    def __init__(self, card=None, data=None, comment=''):
        Method.__init__(self, card, data)
        if comment:
            self._comment = comment
        # CLAN
        self.mblkszs = []
        self.iblkszs = []
        self.ksteps = []
        self.NJIs = []

        # HESS
        self.alphaBjs = []
        self.omegaBjs = []
        self.LJs = []
        self.NEJs = []
        self.NDJs = []

        if card:
            #: Set identification number. (Unique Integer > 0)
            self.sid = integer(card, 1, 'sid')
            #: Method of complex eigenvalue extraction
            self.method = string(card, 2, 'method')
            assert self.method in [
                'INV', 'HESS', 'CLAN'
            ], ('method=%s is not INV, HESS, CLAN' % (self.method))
            #: Method for normalizing eigenvectors
            self.norm = string_or_blank(card, 3, 'norm')
            if self.norm == 'POINT':
                #: Grid or scalar point identification number. Required only if
                #: NORM='POINT'. (Integer>0)
                self.G = integer(card, 4, 'G')

                #: Component number. Required only if NORM='POINT' and G is a
                #: geometric grid point. (1<Integer<6)
                self.C = components(card, 5, 'C')
            else:
                self.G = blank(card, 4, 'G')
                self.C = blank(card, 5, 'C')

            #: Convergence criterion. (Real > 0.0. Default values are:
            #: 10^-4 for METHOD = "INV",
            #: 10^-15 for METHOD = "HESS",
            #: E is machine dependent for METHOD = "CLAN".)
            self.E = double_or_blank(card, 6, 'E')
            self.ndo = integer_double_string_or_blank(card, 7, 'ND0')

            # ALPHAAJ OMEGAAJ ALPHABJ OMEGABJ LJ NEJ NDJ
            fields = card[9:]
            self.alphaAjs = []
            self.omegaAjs = []
            nFields = len(fields)
            nRows = nFields // 8
            if nFields % 7 > 0:
                nRows += 1

            if self.method == 'CLAN':
                self.loadCLAN(nRows, card)
            elif self.method in ['HESS', 'INV']:  # HESS, INV
                self.loadHESS_INV(nRows, card)
            else:
                msg = 'invalid EIGC method...method=|%r|' % (self.method)
                raise RuntimeError(msg)
            #assert card.nFields() < 8, 'card = %s' % card
        else:
            raise NotImplementedError('EIGC')
Beispiel #47
0
    def __init__(self, card=None, data=None, comment=''):
        MaterialDependence.__init__(self, card, data)
        if comment:
            self._comment = comment

        if card:
            #: Identification number of a MAT1, MAT2, or MAT9 entry.
            self.mid = integer(card, 1, 'mid')
            #: Identification number of a TABLES1 or TABLEST entry. If H is
            #: given, then this field must be blank.
            self.tid = integer_or_blank(card, 2, 'tid')
            #: Type of material nonlinearity. ('NLELAST' for nonlinear elastic
            #: or 'PLASTIC' for elastoplastic.)
            self.Type = string(card, 3, 'Type')

            if self.Type not in ['NELAST', 'PLASTIC']:
                raise ValueError(
                    'MATS1 Type must be [NELAST, PLASTIC]; Type=%r' %
                    self.Type)
            if self.Type == 'NLELAST':
                self.h = blank(card, 4, 'h')
                self.hr = blank(card, 6, 'hr')
                self.yf = blank(card, 5, 'yf')
                self.limit1 = blank(card, 7, 'yf')
                self.limit2 = 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
                self.h = double_or_blank(card, 4, 'H')

                #: Yield function criterion, selected by one of the following
                #: values (1) Von Mises (2) Tresca (3) Mohr-Coulomb
                #: (4) Drucker-Prager
                self.yf = 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 = integer_or_blank(card, 6, 'hr', 1)
                #: Initial yield point
                self.limit1 = double(card, 7, 'limit1')

                if self.yf == 3 or self.yf == 4:
                    #: Internal friction angle, measured in degrees, for the
                    #: Mohr-Coulomb and Drucker-Prager yield criteria
                    self.limit2 = double(card, 8, 'limit2')
                else:
                    #self.limit2 = blank(card, 8, 'limit2')
                    self.limit2 = None
            assert len(card) <= 9, 'len(MATS1 card) = %i' % len(card)
        else:
            (mid, tid, Type, h, yf, hr, limit1, limit2) = data
            self.mid = mid
            self.tid = tid
            if Type == 1:
                self.Type = 'NLELAST'
            elif Type == 2:
                self.Type = 'PLASTIC'
            else:
                raise RuntimeError('Invalid Type:  Type=%s; must be 1=NLELAST '
                                   'or 2=PLASTIC' % (Type))
            self.h = h
            self.yf = yf
            self.hr = hr
            self.limit1 = limit1
            self.limit2 = limit2
Beispiel #48
0
    def __init__(self, card=None, data=None, comment=''):
        """
        eid
        refgrid
        refc
        WtCG_groups = [wt,ci,Gij]
        Gmi
        Cmi
        alpha
        """
        RigidElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        self.eid = integer(card, 1, 'eid')
        blank(card, 2, 'blank')
        self.refgrid = integer(card, 3, 'refgrid')
        self.refc = components_or_blank(card, 4, 'refc')
        #iUM = fields.index('UM')

        fields = [
            field.upper() if isinstance(field, string_types) else field
            for field in card[5:]
        ]
        iOffset = 5
        iWtMax = len(fields) + iOffset
        try:
            iAlpha = fields.index('ALPHA') + iOffset
            iWtMax = iAlpha  # the index to start parsing UM
            iUmStop = iAlpha  # the index to stop  parsing UM
        except ValueError:
            iAlpha = None
            iUmStop = iWtMax
        #print("iAlpha = %s" % iAlpha)
        try:
            iUm = fields.index('UM') + iOffset
            iWtMax = iUm
        except ValueError:
            iUm = None
        #print("iAlpha=%s iUm=%s" % (iAlpha, iUm))
        #print("iAlpha=%s iWtMax=%s" % (iAlpha, iWtMax))

        #print("iUM = ", iUM)
        self.WtCG_groups = []

        i = iOffset
        n = 1
        while i < iWtMax:
            Gij = []
            wtname = 'wt' + str(n)
            wt = double_or_blank(card, i, wtname)
            if wt is not None:
                cname = 'c' + str(n)
                ci = components_or_blank(card, i + 1, cname)

                #print("%s=%s %s=%s" % (wtname, wt, cname, ci))
                i += 2
                gij = 0

                j = 0
                while isinstance(gij, int) and i < iWtMax:
                    j += 1
                    gij_name = 'g%s,%s' % (n, j)
                    gij = integer_double_or_blank(card, i, gij_name)
                    if isinstance(gij, float):
                        break
                    #print("%s = %s" % (gij_name, gij))
                    if gij is not None:
                        Gij.append(gij)
                    i += 1
                wtCG_group = [wt, ci, Gij]
                self.WtCG_groups.append(wtCG_group)
                #print('----finished a group=%r----' % wtCG_group)
            else:
                i += 1

        self.Gmi = []
        self.Cmi = []
        #print("")
        if iUm:
            #print('UM = %s' % card.field(iUm))  # UM
            i = iUm + 1
            n = 1
            #print("i=%s iUmStop=%s" % (i, iUmStop))
            for j in range(i, iUmStop, 2):

                gm_name = 'gm' + str(n)
                cm_name = 'cm' + str(n)
                gmi = integer_or_blank(card, j, gm_name)
                if gmi is not None:
                    cmi = components(card, j + 1, cm_name)
                    #print "gmi=%s cmi=%s" % (gmi, cmi)
                    self.Gmi.append(gmi)
                    self.Cmi.append(cmi)

        if iAlpha:
            self.alpha = double_or_blank(card, iAlpha + 1, 'alpha')
        else:
            #: thermal expansion coefficient
            self.alpha = 0.0
Beispiel #49
0
    def __init__(self, card=None, data=None, comment=''):
        Method.__init__(self, card, data)
        if comment:
            self._comment = comment
        # CLAN
        self.mblkszs = []
        self.iblkszs = []
        self.ksteps = []
        self.NJIs = []

        # HESS
        self.alphaBjs = []
        self.omegaBjs = []
        self.LJs = []
        self.NEJs = []
        self.NDJs = []

        if card:
            #: Set identification number. (Unique Integer > 0)
            self.sid = integer(card, 1, 'sid')
            #: Method of complex eigenvalue extraction
            self.method = string(card, 2, 'method')
            assert self.method in ['INV', 'HESS', 'CLAN'],(
                    'method=%s is not INV, HESS, CLAN' % (self.method))
            #: Method for normalizing eigenvectors
            self.norm = string_or_blank(card, 3, 'norm')
            if self.norm == 'POINT':
                #: Grid or scalar point identification number. Required only if
                #: NORM='POINT'. (Integer>0)
                self.G = integer(card, 4, 'G')

                #: Component number. Required only if NORM='POINT' and G is a
                #: geometric grid point. (1<Integer<6)
                self.C = components(card, 5, 'C')
            else:
                self.G = blank(card, 4, 'G')
                self.C = blank(card, 5, 'C')

            #: Convergence criterion. (Real > 0.0. Default values are:
            #: 10^-4 for METHOD = "INV",
            #: 10^-15 for METHOD = "HESS",
            #: E is machine dependent for METHOD = "CLAN".)
            self.E = double_or_blank(card, 6, 'E')
            self.ndo = integer_double_string_or_blank(card, 7, 'ND0')

            # ALPHAAJ OMEGAAJ ALPHABJ OMEGABJ LJ NEJ NDJ
            fields = [interpret_value(field) for field in card[9:] ]
            self.alphaAjs = []
            self.omegaAjs = []
            nFields = len(fields)
            nRows = nFields // 8
            if nFields % 7 > 0:
                nRows += 1

            if self.method == 'CLAN':
                self.loadCLAN(nRows, card)
            elif self.method in ['HESS', 'INV']:  # HESS, INV
                self.loadHESS_INV(nRows, card)
            else:
                msg = 'invalid EIGC method...method=|%r|' % (self.method)
                raise RuntimeError(msg)
            #assert card.nFields() < 8, 'card = %s' % card
        else:
            raise NotImplementedError('EIGC')