当前位置: 首页>>代码示例>>Python>>正文


Python BDF.coords[1]方法代码示例

本文整理汇总了Python中pyNastran.bdf.bdf.BDF.coords[1]方法的典型用法代码示例。如果您正苦于以下问题:Python BDF.coords[1]方法的具体用法?Python BDF.coords[1]怎么用?Python BDF.coords[1]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyNastran.bdf.bdf.BDF的用法示例。


在下文中一共展示了BDF.coords[1]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_loads_sum_radial_01

# 需要导入模块: from pyNastran.bdf.bdf import BDF [as 别名]
# 或者: from pyNastran.bdf.bdf.BDF import coords[1] [as 别名]
    def test_loads_sum_radial_01(self):
        model = BDF()
        from pyNastran.bdf.bdf import CORD2C, GRID, FORCE
        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, cid, mag, xyz, comment='')
        model.add_card_class(radial_force)

        sid = 2
        xyz = [1., 90., 0.]
        mag = 2.2
        theta_force = FORCE(sid, node, cid, mag, 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))
开发者ID:EmanueleCannizzaro,项目名称:pyNastran,代码行数:58,代码来源:test_sum_loads.py


注:本文中的pyNastran.bdf.bdf.BDF.coords[1]方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。