I just need to know what does i, j represent in K(i,j) other than representing the row and column of the Sparse Matrix K?

4 views (last 30 days)
for elx = 1:nelx
for ely = 1:nely
n1 = (nely+1)*(elx-1)+ely;
n2 = (nely+1)* elx +ely;
edof = [2*n1-1; 2*n1; 2*n2-1; 2*n2; 2*n2+1; 2*n2+2; 2*n1+1; 2*n1+2];
K(edof,edof) = K(edof,edof) + x(ely,elx)^penal*KE;
end
end
As we are feeding the K here the whole dof matrix containing the degree of freedom of all the node of an element at once. How is it creating? Like for 1st element, the node numbers will be 1, 5, 6 and 2 in a cloclwise way from top left to right, where n1 and n2 represt 1 and 5, and 2 and 6 respectively?
  2 Comments
Voss
Voss on 15 Apr 2022
Construct a similar/simpler case on the command line or in another script, and see what happens
K = magic(6)
K = 6×6
35 1 6 26 19 24 3 32 7 21 23 25 31 9 2 22 27 20 8 28 33 17 10 15 30 5 34 12 14 16 4 36 29 13 18 11
n1 = 1;
n2 = 2;
edof = [2*n1-1; 2*n1; 2*n2-1; 2*n2; 2*n2+1; 2*n2+2; 2*n1+1; 2*n1+2]
edof = 8×1
1 2 3 4 5 6 3 4
K(edof,edof)
ans = 8×8
35 1 6 26 19 24 6 26 3 32 7 21 23 25 7 21 31 9 2 22 27 20 2 22 8 28 33 17 10 15 33 17 30 5 34 12 14 16 34 12 4 36 29 13 18 11 29 13 31 9 2 22 27 20 2 22 8 28 33 17 10 15 33 17
Rohan Nathiya
Rohan Nathiya on 16 Apr 2022
I get this, but I am more concerned about what
i, j in K(i,j)
actually represent in this particular 99 line code of Topology Optimization, like F(m,n) in this very code gives force at a particular node and m is the dof and n represents the node number.
Thank You

Sign in to comment.

Answers (1)

Shivam
Shivam on 27 Nov 2023
Hi,
From the code snippet provided, I understand that you want to know the meaning of indices 'i' and 'j' while indexing into the global stiffness sparse matrix, K.
In the Finite Element Method context, the global stiffness matrix K is a sparse matrix that stores the relationship between the applied forces and resulting nodal displacement in the system. The entry K(i, j) represents the force at the degree of freedom 'i' due to displacement at the degree of freedom 'j,' while all other displacements are zero.
I hope it helps.

Categories

Find more on Sparse Matrices in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!