Exemplo n.º 1
0
    def __init__(self, card=None, data=None, comment=''):
        if comment:
            self._comment = comment
        self.sid = integer(card, 1, 'sid')
        self.nid0 = integer(card, 2, 'nid0')
        self.c = components(card, 3, 'components_0')
        self.b0 = double_or_blank(card, 4, 'b0', 0.)
        self.b1 = double_or_blank(card, 5, 'b1', 0.)
        self.b2 = double_or_blank(card, 6, 'b2', 0.)

        nfields = len(card) - 9
        nrows = nfields // 8
        if nfields % 8 > 0:
            nrows += 1

        self.grids1 = []
        self.components1 = []
        self.a = []
        for irow in range(nrows):
            j = irow * 8 + 9
            ifield = (irow + 1)
            grid1 = integer(card, j, 'grid_%i' % (irow + 1))
            component1 = components(card, j + 1, 'components_%i' % (irow + 1))
            a0 = double_or_blank(card, j + 2, 'a0_%i' % (irow + 1), 0.)
            a1 = double_or_blank(card, j + 3, 'a1_%i' % (irow + 1), 0.)
            a2 = double_or_blank(card, j + 4, 'a2_%i' % (irow + 1), 0.)
            self.grids1.append(grid1)
            self.components1.append(component1)
            self.a.append([a0, a1, a2])
        assert len(self.grids1) > 0, len(self.grids1)
Exemplo n.º 2
0
 def add_card(cls, card, comment=''):
     conid = integer(card, 1, 'conid')
     rid = integer(card, 2, 'rid')
     hid = integer(card, 3, 'hid')
     c = components(card, 4, 'c')
     d = double(card, 5, 'd')
     return SPCAX(conid, rid, hid, c, d, comment=comment)
Exemplo n.º 3
0
    def add_card(cls, card, comment=''):
        sid = integer(card, 1, 'sid')
        method = string_or_blank(card, 2, 'method')

        L1 = double(card, 3, 'L1')
        L2 = double(card, 4, 'L2')

        nep = integer_or_blank(card, 5, 'nep', 0)
        ndp = integer_or_blank(card, 6, 'ndp', 3 * nep)
        ndn = integer_or_blank(card, 7, 'ndn', 3 * nep)

        norm = string_or_blank(card, 9, 'norm', 'MAX')
        if norm == 'POINT':
            G = integer(card, 10, 'G')
            C = components(card, 11, 'C')
        else:
            G = integer_or_blank(card, 10, 'G')
            C = components_or_blank(card, 11, 'C')
        assert len(card) <= 12, 'len(EIGB card) = %i\ncard=%s' % (len(card),
                                                                  card)
        return EIGB(sid,
                    method,
                    L1,
                    L2,
                    nep,
                    ndp,
                    ndn,
                    norm,
                    G,
                    C,
                    comment=comment)
Exemplo n.º 4
0
 def add_card(cls, card, comment=''):
     conid = integer(card, 1, 'conid')
     rid = integer(card, 2, 'rid')
     hid = integer(card, 3, 'hid')
     c = components(card, 4, 'c')
     d = double(card, 5, 'd')
     return SPCAX(conid, rid, hid, c, d, comment=comment)
Exemplo n.º 5
0
    def add_card(cls, card, comment=''):
        sid = integer(card, 1, 'sid')
        method = string_or_blank(card, 2, 'method', 'LAN')

        f1 = double_or_blank(card, 3, 'f1')
        f2 = double_or_blank(card, 4, 'f2')
        ne = integer_or_blank(card, 5, 'ne')

        if method not in cls.allowed_methods:
            msg = 'method=%s; allowed_methods=[%s]' % (method, ', '.join(
                cls.allowed_methods))
            raise ValueError(msg)

        if method == 'SINV':
            nd = integer_or_blank(card, 6, 'nd', 600)
        elif method == 'INV':
            nd = integer_or_blank(card, 6, 'nd', 3 * ne)
        elif method in ['GIV', 'MGIV', 'HOU', 'MHOU']:
            nd = integer_or_blank(card, 6, 'nd', 0)
        else:
            nd = integer(card, 6, 'nd')
        norm = string_or_blank(card, 9, 'norm', 'MASS')

        if method == 'POINT':
            G = integer(card, 10, 'G')
            C = components(card, 11, 'C')
        else:
            G = blank(card, 10, 'G')
            C = blank(card, 11, 'C')
        assert len(card) <= 12, 'len(EIGR card) = %i\ncard=%s' % (len(card),
                                                                  card)
        return EIGR(sid, method, f1, f2, ne, nd, norm, G, C, comment=comment)
Exemplo n.º 6
0
    def add_card(cls, card, comment=''):
        sid = integer(card, 1, 'sid')
        method = string_or_blank(card, 2, 'method', 'LAN')

        f1 = double_or_blank(card, 3, 'f1')
        f2 = double_or_blank(card, 4, 'f2')
        ne = integer_or_blank(card, 5, 'ne')

        if method not in cls.allowed_methods:
            msg = 'method=%s; allowed_methods=[%s]' % (
                method, ', '.join(cls.allowed_methods))
            raise ValueError(msg)

        if method == 'SINV':
            nd = integer_or_blank(card, 6, 'nd', 600)
        if method == 'INV':
            nd = integer_or_blank(card, 6, 'nd', 3 * ne)
        elif method in ['GIV', 'MGIV', 'HOU', 'MHOU']:
            nd = integer_or_blank(card, 6, 'nd', 0)
        else:
            nd = integer(card, 6, 'nd')
        norm = string_or_blank(card, 9, 'norm', 'MASS')

        if method == 'POINT':
            G = integer(card, 10, 'G')
            C = components(card, 11, 'C')
        else:
            G = blank(card, 10, 'G')
            C = blank(card, 11, 'C')
        assert len(card) <= 12, 'len(EIGR card) = %i\ncard=%s' % (len(card), card)
        return EIGR(sid, method, f1, f2, ne, nd, norm, G, C, comment=comment)
Exemplo n.º 7
0
def get_spc1_constraint(card):
    constraint_id = integer(card, 1, 'constraint_id')
    dofs = components(card, 2, 'constraints')  # 246 = y; dx, dz dir

    node_ids = card.fields(3)
    node_ids = expand_thru(node_ids)

    assert isinstance(constraint_id, int), constraint_id
    return constraint_id, dofs, node_ids
Exemplo n.º 8
0
    def _add_column(self, card, comment=''):
        load_seq = integer(card, 2, 'load_seq')

        g1 = integer(card, 5, 'nid1')
        c1 = components(card, 6, 'c1')
        x1 = double(card, 7, 'x1')
        assert len(card) <= 8, 'len=%s card=%s' % (len(card), card)

        gcx = [g1, c1, x1]
        self.load_sequences[load_seq] = [gcx]
Exemplo n.º 9
0
    def _add_column(self, card, comment=''):
        load_seq = integer(card, 2, 'load_seq')

        g1 = integer(card, 5, 'nid1')
        c1 = components(card, 6, 'c1')
        x1 = double(card, 7, 'x1')
        assert len(card) <= 8, 'len=%s card=%s' % (len(card), card)

        gcx = [g1, c1, x1]
        self.load_sequences[load_seq] = [gcx]
Exemplo n.º 10
0
    def add_card(self, card, comment=''):
        #if comment:
            # self.comment = comment
        constraint_id = integer(card, 1, 'conid')
        dofs = components(card, 2, 'constraints')  # 246 = y; dx, dz dir
        node_ids = card.fields(3)

        assert isinstance(constraint_id, int), constraint_id
        self.constraint_id = constraint_id
        self.components[dofs] += node_ids
        self.n += 1
Exemplo n.º 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')
Exemplo n.º 12
0
    def __init__(self, card=None, data=None, comment=''):
        Set.__init__(self, card, data)
        if comment:
            self._comment = comment

        #:  Identifiers of grids points. (Integer > 0)
        self.IDs = []
        self.components = []

        nterms = len(card) // 2
        for n in range(nterms):
            i = n * 2 + 1
            ID = integer(card, i, 'ID' + str(n))
            component = components(card, i + 1, 'component' + str(n))
            self.IDs.append(ID)
            self.components.append(component)
Exemplo n.º 13
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.)
            #: apparently it can also be blank...
            self.method = string_or_blank(card, 2, 'method')

            if self.method not in ['INV', 'SINV', None]:
                msg = 'method must be INV or SINV.  method=|%s|' % self.method
                raise RuntimeError(msg)

            #: Eigenvalue range of interest. (Real, L1 < L2)
            self.L1 = double(card, 3, 'L1')
            self.L2 = double(card, 4, 'L2')
            if not self.L1 < self.L2:
                msg = 'L1=%s L2=%s; L1<L2 is requried' % (self.L1, self.L2)
                raise RuntimeError(msg)

            #: Estimate of number of roots in positive range not used for
            #: METHOD = 'SINV'. (Integer > 0)
            self.nep = integer_or_blank(card, 5, 'nep', 0)

            #: Desired number of positive and negative roots.
            #: (Integer>0; Default = 3*NEP)
            self.ndp = integer_or_blank(card, 6, 'ndp', 3 * self.nep)
            self.ndn = integer_or_blank(card, 7, 'ndn', 3 * self.nep)

            #: Method for normalizing eigenvectors.
            #: ('MAX' or 'POINT';Default='MAX')
            self.norm = string_or_blank(card, 9, 'norm', 'MAX')
            if self.norm == 'POINT':
                self.G = integer(card, 10, 'G')
                self.C = components(card, 11, 'C')
            else:
                self.G = integer_or_blank(card, 10, 'G')
                self.C = components_or_blank(card, 11, 'C')
            assert len(card) <= 12, 'len(EIGB card) = %i' % len(card)
        else:
            raise NotImplementedError('EIGB')
Exemplo n.º 14
0
    def __init__(self, card=None, data=None, comment=''):
        Set.__init__(self, card, data)
        if comment:
            self._comment = comment

        self.name = string(card, 1, 'name')

        #:  Identifiers of grids points. (Integer > 0)
        self.components = []
        self.IDs = []

        nsets = (len(card) - 1) // 2
        for n in range(nsets):
            i = n * 2 + 2
            ID = integer(card, i, 'node_id' + str(n))
            component = components(card, i + 1, 'component' + str(n))
            self.components.append(component)
            self.IDs.append(ID)
Exemplo n.º 15
0
    def __init__(self, card=None, data=None, comment=''):
        Set.__init__(self, card, data)
        if comment:
            self._comment = comment

        #:  Identifiers of grids points. (Integer > 0)
        self.IDs = []
        if string_or_blank(card, 2, 'C') == 'ALL':
            self.components = '123456'
        else:
            self.components = components(card, 1, 'components')

        IDs2 = []
        ii = 1
        for ifield in range(2, len(card)):
            integer_or_string(card, ifield, 'ID' % ii)
            ii += 1
        self.IDs = expand_thru(IDs2)
Exemplo n.º 16
0
    def add_card(cls, card, comment=''):
        sid = integer(card, 1, 'sid')
        method = string(card, 2, 'method')
        assert method in ['ARNO', 'INV', 'HESS', 'CLAN', 'ISRR', 'IRAM'], (
            'method=%s is not ARNO, INV, HESS, CLAN, ISRR, IRAM' % method)

        norm = string_or_blank(card, 3, 'norm')
        if norm == 'POINT':
            G = integer(card, 4, 'G')
            C = components(card, 5, 'C')
        else:
            G = blank(card, 4, 'G')
            C = blank(card, 5, 'C')

        E = double_or_blank(card, 6, 'E')
        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:]]

        alphaAjs = []
        omegaAjs = []
        nfields = len(fields)
        nrows = nfields // 8
        if nfields % 8 > 0:
            nrows += 1
        #if nrows == 0:
            #msg = 'invalid row count=0; nfields=%s \ncard=%s\nfields=%s' % (
                #nfields, card, fields)
            #raise RuntimeError(msg)

        if method == 'CLAN':
            alphaAjs, omegaAjs, mblkszs, iblkszs, ksteps, NJIs = cls._load_clan(nrows, card)
        elif method in ['HESS', 'INV']:  # HESS, INV
            cls._load_hess_inv(nrows, method, card)
        elif method == 'ISRR':
            cls._load_isrr(nrows, card)
        else:
            msg = 'invalid EIGC method...method=%r' % method
            raise RuntimeError(msg)
        #assert card.nFields() < 8, 'card = %s' % card
        return EIGC(sid, method, norm, G, C, E, ndo, comment=comment)
Exemplo n.º 17
0
    def add_card(cls, card, comment=''):
        sid = integer(card, 1, 'sid')
        method = string_or_blank(card, 2, 'method')

        L1 = double(card, 3, 'L1')
        L2 = double(card, 4, 'L2')

        nep = integer_or_blank(card, 5, 'nep', 0)
        ndp = integer_or_blank(card, 6, 'ndp', 3 * nep)
        ndn = integer_or_blank(card, 7, 'ndn', 3 * nep)

        norm = string_or_blank(card, 9, 'norm', 'MAX')
        if norm == 'POINT':
            G = integer(card, 10, 'G')
            C = components(card, 11, 'C')
        else:
            G = integer_or_blank(card, 10, 'G')
            C = components_or_blank(card, 11, 'C')
        assert len(card) <= 12, 'len(EIGB card) = %i\ncard=%s' % (len(card), card)
        return EIGB(sid, method, L1, L2, nep, ndp, ndn, norm, G, C,
                    comment=comment)
Exemplo n.º 18
0
 def __init__(self, card=None, data=None, comment=''):
     """
     Defines values for the initial conditions of variables used in
     structural transient analysis. Both displacement and velocity values
     may be specified at independent degrees-of-freedom. This entry may not
     be used for heat transfer analysis.
     """
     Table.__init__(self, card, data)
     if comment:
         self.comment = comment
     if card:
         self.sid = integer(card, 1, 'sid')
         self.G = integer(card, 2, 'G')
         assert self.G > 0
         self.C = components(card, 3, 'C')
         self.U0 = double(card, 4, 'U0')
         self.V0 = double(card, 5, 'V0')
     else:
         self.sid = data[0]
         self.G = data[1]
         self.C = data[2]
         self.U0 = data[3]
         self.V0 = data[4]
Exemplo n.º 19
0
 def __init__(self, card=None, data=None, comment=''):
     """
     Defines values for the initial conditions of variables used in
     structural transient analysis. Both displacement and velocity values
     may be specified at independent degrees-of-freedom. This entry may not
     be used for heat transfer analysis.
     """
     Table.__init__(self, card, data)
     if comment:
         self._comment = comment
     if card:
         self.sid = integer(card, 1, 'sid')
         self.G = integer(card, 2, 'G')
         assert self.G > 0
         self.C = components(card, 3, 'C')
         self.U0 = double(card, 4, 'U0')
         self.V0 = double(card, 5, 'V0')
     else:
         self.sid = data[0]
         self.G = data[1]
         self.C = data[2]
         self.U0 = data[3]
         self.V0 = data[4]
    def test_components(self):
        # single ints
        val = components(BDFCard([0]), 0, 'field')
        self.assertEqual(val, '0')

        val = components(BDFCard([1]), 0, 'field')
        self.assertEqual(val, '1')

        # single strings
        val = components(BDFCard(['0']), 0, 'field')
        self.assertEqual(val, '0')

        val = components(BDFCard(['1']), 0, 'field')
        self.assertEqual(val, '1')

        # double ints
        val = components(BDFCard(['123']), 0, 'field')
        self.assertEqual(val, '123')

        val = components(BDFCard([123]), 0, 'field')
        self.assertEqual(val, '123')

        val = components(BDFCard([321]), 0, 'field')
        self.assertEqual(val, '123')

        # embedded whiteshape
        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['12 3']), 0, 'field')

        # all numbers
        val = components(BDFCard(['123456']), 0, 'field')
        self.assertEqual(val, '123456')

        # invalid 0's defined with numbers
        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['0123456']), 0, 'field')

        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['01']), 0, 'field')

        # doubles
        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['4524']), 0, 'field')

        # only 0 to 6
        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['7']), 0, 'field')

        with self.assertRaises(SyntaxError):
            val = components(BDFCard([7]), 0, 'field')

        # dumb input
        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['4.0']), 0, 'field')

        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['-4.0']), 0, 'field')

        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['asdf']), 0, 'field')

        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['-1']), 0, 'field')
Exemplo n.º 21
0
    def test_components(self):
        # single ints
        val = components(BDFCard([0]), 0, 'field')
        self.assertEqual(val, '0')

        val = components(BDFCard([1]), 0, 'field')
        self.assertEqual(val, '1')

        # single strings
        val = components(BDFCard(['0']), 0, 'field')
        self.assertEqual(val, '0')

        val = components(BDFCard(['1']), 0, 'field')
        self.assertEqual(val, '1')

        # double ints
        val = components(BDFCard(['123']), 0, 'field')
        self.assertEqual(val, '123')

        val = components(BDFCard([123]), 0, 'field')
        self.assertEqual(val, '123')

        val = components(BDFCard([321]), 0, 'field')
        self.assertEqual(val, '123')

        # embedded whiteshape
        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['12 3']), 0, 'field')

        # all numbers
        val = components(BDFCard(['123456']), 0, 'field')
        self.assertEqual(val, '123456')

        # invalid 0's defined with numbers
        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['0123456']), 0, 'field')

        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['01']), 0, 'field')

        # doubles
        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['4524']), 0, 'field')

        # only 0 to 6
        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['7']), 0, 'field')

        with self.assertRaises(SyntaxError):
            val = components(BDFCard([7]), 0, 'field')

        # dumb input
        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['4.0']), 0, 'field')

        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['-4.0']), 0, 'field')

        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['asdf']), 0, 'field')

        with self.assertRaises(SyntaxError):
            val = components(BDFCard(['-1']), 0, 'field')
Exemplo n.º 22
0
    def add_card(cls, card, comment=''):
        sid = integer(card, 1, 'sid')
        method = string(card, 2, 'method')
        assert method in [
            'ARNO', 'INV', 'HESS', 'CLAN', 'ISRR', 'IRAM'
        ], ('method=%s is not ARNO, INV, HESS, CLAN, ISRR, IRAM' % method)

        norm = string_or_blank(card, 3, 'norm')
        if norm == 'POINT':
            G = integer(card, 4, 'G')
            C = components(card, 5, 'C')
        else:
            G = blank(card, 4, 'G')
            C = blank(card, 5, 'C')

        E = double_or_blank(card, 6, 'E')
        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:]]

        #-------CLAN--------------
        mblkszs = []
        iblkszs = []
        ksteps = []
        NJIs = []
        #-------CLAN--------------

        #-------HESS--------------
        alphaAjs = []
        alphaBjs = []
        omegaAjs = []
        omegaBjs = []
        mblkszs = []
        iblkszs = []
        ksteps = []
        LJs = []
        NEJs = []
        NDJs = []
        #-------HESS--------------

        #-------ISRR--------------
        shift_r1 = 0.0
        shift_i1 = 0.0
        isrr_flag = 0
        nd1 = None
        #-------ISRR--------------
        nfields = len(fields)
        nrows = nfields // 8
        if nfields % 8 > 0:
            nrows += 1
        #if nrows == 0:
        #msg = 'invalid row count=0; nfields=%s \ncard=%s\nfields=%s' % (
        #nfields, card, fields)
        #raise RuntimeError(msg)

        if method == 'CLAN':
            alphaAjs, omegaAjs, mblkszs, iblkszs, ksteps, NJIs = cls._load_clan(
                nrows, card)
        elif method in ['HESS', 'INV']:  # HESS, INV
            alphaAjs, omegaAjs, alphaBjs, omegaBjs, LJs, NEJs, NDJs = cls._load_hess_inv(
                nrows, method, card)
        elif method == 'ISRR':
            shift_r1, shift_i1, isrr_flag, nd1 = cls._load_isrr(nrows, card)
        else:
            msg = 'invalid EIGC method...method=%r' % method
            raise RuntimeError(msg)
        #assert card.nFields() < 8, 'card = %s' % card
        return EIGC(
            sid,
            method,
            norm,
            G,
            C,
            E,
            ndo,
            mblkszs,
            iblkszs,
            ksteps,
            NJIs,  # CLAN
            alphaAjs,
            omegaAjs,
            alphaBjs,
            omegaBjs,
            LJs,
            NEJs,
            NDJs,  # HESS/INV
            shift_r1,
            shift_i1,
            isrr_flag,
            nd1,  # ISRR
            comment=comment)
Exemplo n.º 23
0
    def add_card(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
Exemplo n.º 24
0
 def add_card(cls, card, comment=''):
     conid = integer(card, 1, 'conid')
     constraints = components(card, 2, 'constraints')  # 246 = y; dx, dz dir
     nodes = card.fields(3)
     return SPC1(conid, constraints, nodes, comment=comment)
Exemplo n.º 25
0
 def add_card(cls, card, comment=''):
     conid = integer(card, 1, 'conid')
     constraints = components(card, 2, 'constraints')  # 246 = y; dx, dz dir
     nodes = card.fields(3)
     return SPC1(conid, constraints, nodes, comment=comment)
Exemplo n.º 26
0
    def add_card(cls, card, comment=''):
        eid = integer(card, 1, 'eid')
        blank(card, 2, 'blank')
        refgrid = integer(card, 3, 'refgrid')
        refc = components_or_blank(card, 4, 'refc')

        fields = [field.upper() if isinstance(field, string_types) else field for field in card[5:]]
        ioffset = 5
        iwt_max = len(fields) + ioffset
        try:
            ialpha = fields.index('ALPHA') + ioffset
            iwt_max = ialpha  # the index to start parsing UM
            ium_stop = ialpha  # the index to stop  parsing UM
        except ValueError:
            ialpha = None
            ium_stop = iwt_max

        try:
            ium = fields.index('UM') + ioffset
            iwt_max = ium
        except ValueError:
            ium = None

        i = ioffset
        n = 1
        weights = []
        comps = []
        Gijs = []
        while i < iwt_max:
            Gij = []
            wtname = 'wt' + str(n)
            wt = double_or_blank(card, i, wtname)
            if wt is not None:
                cname = 'c'+str(n)
                compi = components_or_blank(card, i + 1, cname)

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

                j = 0
                while isinstance(gij, int) and i < iwt_max:
                    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
                assert compi is not None
                assert len(Gij) > 0, Gij
                assert Gij[0] is not None, Gij
                weights.append(wt)
                comps.append(compi)
                Gijs.append(Gij)
                #print('----finished a group=%r----' % weight_cg_group)
            else:
                i += 1

        Gmi = []
        Cmi = []
        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, ium_stop, 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)

        if ialpha:
            alpha = double_or_blank(card, ialpha + 1, 'alpha')
        else:
            #: thermal expansion coefficient
            alpha = 0.0
        return RBE3(eid, refgrid, refc, weights, comps, Gijs,
                    Gmi=Gmi, Cmi=Cmi, alpha=alpha, comment=comment)
Exemplo n.º 27
0
 def add_card(cls, card, comment=''):
     conid = integer(card, 1, 'sid')
     component = components(card, 2, 'components')
     entity = string(card, 3, 'entity')
     entity_id = integer(card, 4, 'entity_id')
     return GMSPC(conid, component, entity, entity_id, comment=comment)
Exemplo n.º 28
0
 def add_card(cls, card, comment=''):
     conid = integer(card, 1, 'sid')
     component = components(card, 2, 'components')
     entity = string(card, 3, 'entity')
     entity_id = integer(card, 4, 'entity_id')
     return GMSPC(conid, component, entity, entity_id, comment=comment)
Exemplo n.º 29
0
    def add_card(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
Exemplo n.º 30
0
    def add_card(cls, card, comment=''):
        eid = integer(card, 1, 'eid')
        blank(card, 2, 'blank')
        refgrid = integer(card, 3, 'refgrid')
        refc = components_or_blank(card, 4, 'refc')

        fields = [
            field.upper() if isinstance(field, string_types) else field
            for field in card[5:]
        ]
        ioffset = 5
        iwt_max = len(fields) + ioffset
        try:
            ialpha = fields.index('ALPHA') + ioffset
            iwt_max = ialpha  # the index to start parsing UM
            ium_stop = ialpha  # the index to stop  parsing UM
        except ValueError:
            ialpha = None
            ium_stop = iwt_max

        try:
            ium = fields.index('UM') + ioffset
            iwt_max = ium
        except ValueError:
            ium = None

        i = ioffset
        n = 1
        weights = []
        comps = []
        Gijs = []
        while i < iwt_max:
            Gij = []
            wtname = 'wt' + str(n)
            wt = double_or_blank(card, i, wtname)
            if wt is not None:
                cname = 'c' + str(n)
                compi = components_or_blank(card, i + 1, cname)

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

                j = 0
                while isinstance(gij, int) and i < iwt_max:
                    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
                assert compi is not None
                assert len(Gij) > 0, Gij
                assert Gij[0] is not None, Gij
                weights.append(wt)
                comps.append(compi)
                Gijs.append(Gij)
                #print('----finished a group=%r----' % weight_cg_group)
            else:
                i += 1

        Gmi = []
        Cmi = []
        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, ium_stop, 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)

        if ialpha:
            alpha = double_or_blank(card, ialpha + 1, 'alpha')
        else:
            #: thermal expansion coefficient
            alpha = 0.0
        return RBE3(eid,
                    refgrid,
                    refc,
                    weights,
                    comps,
                    Gijs,
                    Gmi=Gmi,
                    Cmi=Cmi,
                    alpha=alpha,
                    comment=comment)
Exemplo n.º 31
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
            #:   MSC 2014 = [INV, HESS, CLAN, IRAM]
            #:   NX 8.5 = [INV, HESS, CLAN, ISRR]
            #:   Autodesk 2015 = [ARNO, HESS, CLAN]
            self.method = string(card, 2, 'method')
            assert self.method in ['ARNO', 'INV', 'HESS', 'CLAN', 'ISRR', 'IRAM'], (
                'method=%s is not ARNO, INV, HESS, CLAN, ISRR, IRAM' % 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^-8 for METHOD = "CLAN",
            #: 10^-8 for METHOD = "ISRR",
            #: 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 % 8 > 0:
                nrows += 1
            #if nrows == 0:
                #raise RuntimeError('invalid row count=0; nfields=%s \ncard=%s\nfields=%s' % (nfields, card, fields))

            if self.method == 'CLAN':
                self.loadCLAN(nrows, card)
            elif self.method in ['HESS', 'INV']:  # HESS, INV
                self.loadHESS_INV(nrows, card)
            elif self.method == 'ISRR':
                self._load_isrr(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')