ACCESS THE COMPLETE LIBRARY OF COURSES & TUTORIALS โžก๏ธ
48. Primary and Structure Stiffness matrices
Building a Generalised Truss Solver in Python
๐Ÿ“‚ Please log in or enroll to access resources

Summary

In this lecture, we'll cover:

  • How to use an existing function to calculate a memberโ€™s global stiffness matrix
  • How to determine the total number of degrees of freedom programmatically
  • How to initialise and build the primary stiffness matrix
  • How to assemble the global structure by looping through all members
  • How to reduce the primary stiffness matrix to the structure stiffness matrix by removing restrained degrees of freedom

In this lecture, we focus on assembling the global stiffness matrices for a structure in a fully programmatic way. We begin by importing a previously developed function that calculates the global stiffness matrix for an individual member and returns its four quadrants. We then determine the total number of degrees of freedom by extracting the maximum node number from the members array and multiplying by two, allowing the code to work for arbitrary structures rather than relying on hard-coded values. With this information, we initialise the primary stiffness matrix as a zero matrix of appropriate size.

We then construct a for loop to iterate through every member in the structure. For each member, we compute its global stiffness matrix, determine the associated node numbers and corresponding global indices, and add the four stiffness matrix quadrants into their correct positions within the primary stiffness matrix. Finally, we reduce the primary stiffness matrix to the structure stiffness matrix by removing rows and columns corresponding to restrained degrees of freedom using previously developed code. This completes the automated assembly process.

Next up:

In the next lecture, we solve for displacements, reactions, and member forces in a fully automated loop, completing the core of the generalised solver.

Tags

global stiffness matrixprimary stiffness matrix assemblydegree of freedom indexingboundary condition reduction

Please log in or enroll to continue

If you've already enrolled, please log in to continue.

The Direct Stiffness Method for Truss Analysis with Python

Build your own finite element truss analysis software using Python and tackle large scale structures.

After completing this course...

  • Youโ€™ll understand how to use the Direct Stiffness Method to build complete structural models that can be solved using Python.
  • Youโ€™ll have your own analysis programme to identify displacements, reactions and internal member forces for any truss.
  • Youโ€™ll understand how common models of elastic behaviour such as plane stress and plane strain apply to real-world structures.
Next Lesson
49. Displacements, reactions and member forces