整体刚度矩阵有限元法中的错误值

2024-09-27 20:20:16 发布

您现在位置:Python中文网/ 问答频道 /正文

因此,我在硕士论文中使用有限元法,并被要求制作一个脚本,组装“局部”刚度矩阵(每个元素有4个节点,每个节点只有1个自由度)。下面是“本地”和“全局”系统的示例,供我分析:

Local and global systems

因此,假设两个单元的局部刚度矩阵相同,由下式得出:

Local stiffness matrix

我做了一个脚本,在这个例子中,组装了两个元素的刚度矩阵:

def stiff_mat_assemble(mesh, stiff_mat_ele): #stiff_mat_ele is the "local stiffness matrix"
'''
mesh - tuple of the mesh created
mesh[0] is a n*2 array (n - total number of nodes), and stores the coordinates of each node
mesh[1] is a 4*4 array, stores the nodes of each element
'''
global_stiff_mat = np.zeros((mesh[0].shape[0],mesh[0].shape[0])) #Gives a matrix n*n, n being the number of nodes in each direction

for element in mesh[1]: #cycles through all elements
    for i in element: #i global
        for j in element: #j global
           i_index = get_index_int(element, i) #gives the local index of "i"
           j_index = get_index_int(element, j) #gives the local index of "j"
           global_stiff_mat[i,j] += stiff_mat_ele[i_index, j_index] 

return global_stiff_mat

其结果是全局刚度矩阵:

Global stiffness matrix

问题是我得到了这个矩阵的逆的非常奇怪的值:

Global stiffness matrix Inverse

根据我读到的,这个矩阵的逆矩阵,应该等于原始矩阵:(K^-1)^-1=K。这就是为什么我认为我在那个脚本中犯了一个错误,但是我不知道错误是什么。。。我还是个乞丐,如果有人能帮我一把,我将不胜感激! 提前谢谢


Tags: ofthein脚本indexis矩阵element

热门问题