本篇代码需要numpy支持。不过目前发现个问题:numpy-1.19.4-cp38和numpy-1.19.4-cp39兼容性有问题。果然是不讲"武德"。还是用numpy-1.19.2-cp38
对于如图所示的桁架,建立材料对象、节点对象、单元对象以及结构对象:
mat1 = Material( 29.5e4 ) # 材料对象
# 节点对象
nd1 = TrussNode2D( 1, 0, 0, 0, 0, 0, 0 )
nd2 = TrussNode2D( 2, 400, 0, 1, 0, 20000, 0 )
nd3 = TrussNode2D( 3, 400, 300, 1, 1, 0, -25000 )
nd4 = TrussNode2D( 3, 0, 300, 0, 0, 0, 0 )
listNode = [nd1, nd2, nd3, nd4]
# 单元对象
el1 = TrussElement2D( 1, 100, mat1, nd1, nd2 )
el2 = TrussElement2D( 2, 100, mat1, nd3, nd2 )
el3 = TrussElement2D( 3, 100, mat1, nd1, nd3 )
el4 = TrussElement2D( 4, 100, mat1, nd4, nd3 )
listElem = [el1, el2, el3, el4]
# 结构对象
fm = FEModel(listNode, listElem)
完整python代码: