ACCESS THE COMPLETE LIBRARY OF COURSES & TUTORIALS ➡️
28. Whole structure stiffness matrix
Direct Stiffness Method in Python
📂 Please log in or enroll to access resources

Summary

In this lecture, we'll cover:

  • How to manually assemble the primary (global) stiffness matrix from element global stiffness matrices
  • How individual element quadrants are positioned within the primary stiffness matrix template
  • How to concatenate submatrices in Python to construct the full primary stiffness matrix
  • Why this manual assembly process is not efficient for larger structures
  • How to impose boundary conditions to reduce the primary stiffness matrix to the structure stiffness matrix
  • How to implement displacement constraints in Python by modifying rows and columns

In this lecture, we build the primary stiffness matrix for a simple two-bar structure by directly replicating the manual assembly process previously developed in the slides. We take the quadrants of each element’s global stiffness matrix and place them into the correct positions within a three-by-three primary stiffness matrix template. Particular attention is paid to shared nodes, where contributions from multiple members combine, such as at node 2. We then use NumPy’s concatenation functions to assemble the full primary stiffness matrix from its sub-blocks, demonstrating explicitly how the global matrix is constructed in code.

We then move on to reducing the primary stiffness matrix to the structure stiffness matrix by imposing boundary conditions. To do this safely, we first create a copy of the primary matrix to avoid modifying the original. For each constrained degree of freedom, we enforce zero displacement by setting the corresponding row and column to zero and placing a one on the diagonal. By systematically applying these constraints, we obtain the final structure stiffness matrix, ready for solving in the next lecture. Throughout, we acknowledge that this is a deliberately manual approach intended to build understanding, with more efficient methods to follow later.

Next up:

In the next lecture, we solve for nodal displacements, compute reaction forces, and calculate member axial forces — completing the full analysis in code.

Tags

primary stiffness matrix assemblyboundary condition implementationglobal stiffness matrixfinite element method Pythonmatrix 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
29. Reactions, element forces and nodal displacements