本文整理汇总了Python中mbwind.System.assemble方法的典型用法代码示例。如果您正苦于以下问题:Python System.assemble方法的具体用法?Python System.assemble怎么用?Python System.assemble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mbwind.System
的用法示例。
在下文中一共展示了System.assemble方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_assemble
# 需要导入模块: from mbwind import System [as 别名]
# 或者: from mbwind.System import assemble [as 别名]
def test_assemble(self):
# Test system:
#
# /-- m2
# m1 -----conn----|
# \-- m3
s = System()
m1 = RigidBody('m1', 1.3)
m2 = RigidBody('m2', 3.4)
m3 = RigidBody('m3', 7.5)
conn = RigidConnection('conn')
s.add_leaf(conn)
s.add_leaf(m1)
conn.add_leaf(m2)
conn.add_leaf(m3)
s.setup()
# Check starting mass matrices of elements are as expected
assert_aae(np.diag(m1.mass_vv[:3, :3]), 1.3)
assert_aae(np.diag(m2.mass_vv[:3, :3]), 3.4)
assert_aae(np.diag(m3.mass_vv[:3, :3]), 7.5)
# Initially make system matrix empty for testing
s.lhs[:, :] = 0
assert_aae(s.lhs, 0)
# After assembly, the mass matrices are put in the correct places:
# 0:6 -> m1 node
# 6:12 -> conn constraints
# 12:18 -> m2 node
# 12:18 -> m3 node
s.assemble()
M = s.lhs.copy()
# Subtract expected mass
M[0:6, 0:6] -= m1.mass_vv
M[12:18, 12:18] -= m2.mass_vv + m3.mass_vv
# Subtract expected constraints
M[0:6, 6:12] -= conn.F_vp
M[6:12, 0:6] -= conn.F_vp
M[12:18, 6:12] -= conn.F_vd
M[6:12, 12:18] -= conn.F_vd
assert_aae(M, 0)