Ejemplo n.º 1
0
    def test_cord2c_01(self):
        lines = [
            'CORD2C*                3               0              0.              0.',
            '*                     0.              0.              0.              1.*',
            '*                     1.              0.              1.'
        ]
        model = BDF(debug=False)
        card = model.process_card(lines)
        card = BDFCard(card)
        card = CORD2C(card)
        model.add_coord(card)

        lines = [
            'CORD2R         4       3     10.      0.      5.     10.     90.      5.',
            '             10.      0.      6.'
        ]
        card = model.process_card(lines)
        card = BDFCard(card)
        card = CORD2R(card)
        model.add_coord(card)
        model.cross_reference()

        cord2r = model.Coord(3)
        self.assertEquals(cord2r.Cid(), 3)
        self.assertEquals(cord2r.Rid(), 0)

        cord2r = model.Coord(4)
        self.assertEquals(cord2r.Cid(), 4)
        self.assertEquals(cord2r.Rid(), 3)

        self.assertTrue(allclose(cord2r.i, array([0., 0., 1.])))
        delta = cord2r.j - array([1., 1., 0.]) / 2**0.5
        self.assertTrue(allclose(cord2r.j, array([1., 1., 0.]) / 2**0.5), str(delta))
        delta = cord2r.k - array([-1., 1., 0.]) / 2**0.5
        self.assertTrue(allclose(cord2r.k, array([-1., 1., 0.]) / 2**0.5), str(delta))
Ejemplo n.º 2
0
    def test_cord2c_01(self):
        lines = [
            'CORD2C*                3               0              0.              0.',
            '*                     0.              0.              0.              1.*',
            '*                     1.              0.              1.'
        ]
        model = BDF(debug=False)
        card = model.process_card(lines)
        cardi = BDFCard(card)
        coord = CORD2C.add_card(cardi)
        model.add_coord(coord)

        lines = [
            'CORD2R         4       3     10.      0.      5.     10.     90.      5.',
            '             10.      0.      6.'
        ]
        card = model.process_card(lines)
        cardi = BDFCard(card)
        coord = CORD2R.add_card(cardi)
        model.add_coord(coord)
        model.cross_reference()

        cord2r = model.Coord(3)
        self.assertEqual(cord2r.Cid(), 3)
        self.assertEqual(cord2r.Rid(), 0)

        cord2r = model.Coord(4)
        self.assertEqual(cord2r.Cid(), 4)
        self.assertEqual(cord2r.Rid(), 3)

        self.assertTrue(allclose(cord2r.i, array([0., 0., 1.])))
        delta = cord2r.j - array([1., 1., 0.]) / 2**0.5
        self.assertTrue(allclose(cord2r.j, array([1., 1., 0.]) / 2**0.5), str(delta))
        delta = cord2r.k - array([-1., 1., 0.]) / 2**0.5
        self.assertTrue(allclose(cord2r.k, array([-1., 1., 0.]) / 2**0.5), str(delta))
Ejemplo n.º 3
0
    def test_loads_sum_radial_01(self):
        model = BDF(debug=False)
        model.nodes[1] = GRID(1, cp=1, xyz=[0., 0., 0.], cd=0, ps='', seid=0,
                              comment='')
        cid = 1
        origin = [0., 0., 0.]
        zaxis = [0., 0., 1.]
        xaxis = [1., 0., 0.]
        model.coords[1] = CORD2C(cid, rid=0, origin=origin, zaxis=zaxis,
                                 xzplane=xaxis, comment='')
        sid = 1
        node = 1
        cid = 1
        mag = 1.1
        xyz = [1., 0., 0.]
        radial_force = FORCE(sid, node, mag, cid=cid, xyz=xyz, comment='')
        model.add_card_class(radial_force)

        sid = 2
        xyz = [1., 90., 0.]
        mag = 2.2
        theta_force = FORCE(sid, node, mag, cid=cid, xyz=xyz, comment='')
        model.add_card_class(theta_force)
        model.cross_reference()

        p0 = 1
        eids = None
        nids = None

        loadcase_id = 1
        F, M = model.sum_forces_moments(p0, loadcase_id, include_grav=False,
                                        xyz_cid0=None)
        F2, M2 = model.sum_forces_moments_elements(p0, loadcase_id, eids, nids,
                                                   include_grav=False,
                                                   xyz_cid0=None)
        assert np.allclose(F, F2), 'F=%s F2=%s' % (F, F2)
        assert np.allclose(M, M2), 'M=%s M2=%s' % (M, M2)

        F1_expected = np.array([1.1, 0., 0.])
        M1_expected = np.array([0., 0., 0.])
        self.assertTrue(allclose(F1_expected, F), 'loadcase_id=%s F_expected=%s F=%s' % (loadcase_id, F1_expected, F))
        self.assertTrue(allclose(M1_expected, M), 'loadcase_id=%s M_expected=%s M=%s' % (loadcase_id, M1_expected, M))

        loadcase_id = 2
        F, M = model.sum_forces_moments(p0, loadcase_id, include_grav=False,
                                        xyz_cid0=None)
        F2, M2 = model.sum_forces_moments_elements(p0, loadcase_id, eids, nids,
                                                   include_grav=False,
                                                   xyz_cid0=None)
        assert np.allclose(F, F2), 'F=%s F2=%s' % (F, F2)
        assert np.allclose(M, M2), 'M=%s M2=%s' % (M, M2)
        F2_expected = np.array([0., 2.2, 0.])
        M2_expected = np.array([0., 0., 0.])
        self.assertTrue(allclose(F2_expected, F), 'loadcase_id=%s F_expected=%s F=%s' % (loadcase_id, F2_expected, F))
        self.assertTrue(allclose(M2_expected, M), 'loadcase_id=%s M_expected=%s M=%s' % (loadcase_id, M2_expected, M))
Ejemplo n.º 4
0
    def test_cord2c_01(self):
        """simple CORD2R/CORD2C input/output test"""
        lines = [
            'CORD2C*                3               0              0.              0.',
            '*                     0.              0.              0.              1.*',
            '*                     1.              0.              1.'
        ]
        model = BDF(debug=False)
        card = model.process_card(lines)
        cardi = BDFCard(card)
        cord2c = CORD2C.add_card(cardi)
        model._add_coord_object(cord2c)

        lines = [
            'CORD2R         4       3     10.      0.      5.     10.     90.      5.',
            '             10.      0.      6.'
        ]
        card = model.process_card(lines)
        cardi = BDFCard(card)
        cord2r = CORD2R.add_card(cardi)
        model._add_coord_object(cord2r)
        model.cross_reference()

        cord2r_b = model.Coord(3)
        self.assertEqual(cord2r_b.Cid(), 3)
        self.assertEqual(cord2r_b.Rid(), 0)

        cord2r_c = model.Coord(4)
        self.assertEqual(cord2r_c.Cid(), 4)
        self.assertEqual(cord2r_c.Rid(), 3)

        self.assertTrue(allclose(cord2r_c.i, array([0., 0., 1.])))
        delta = cord2r_c.j - array([1., 1., 0.]) / 2**0.5
        self.assertTrue(allclose(cord2r_c.j,
                                 array([1., 1., 0.]) / 2**0.5), str(delta))
        delta = cord2r_c.k - array([-1., 1., 0.]) / 2**0.5
        self.assertTrue(allclose(cord2r_c.k,
                                 array([-1., 1., 0.]) / 2**0.5), str(delta))