Finite Element Analysis of 3D Structures using Python

Finite Element Analysis of 3D Structures using Python

Build your own complete 3D structural analysis software in Python using the Direct Stiffness Method.

⏰ 13 h 18 min | 73 lessons
Published: March 2021, (updated 2 years ago)
After completing this course...
You’ll have developed a complete 3D finite element analysis solver to simulate structures consisting of beam and axially loaded bar elements.
You’ll have the skills to efficiently build detailed structural models in Blender and export these for analysis in your own Python solver
You’ll understand how to expand the Direct Stiffness Method to full 12 degree of freedom beam elements in 3D space.
You’ll have the tools, knowledge and confidence to expand your code even further beyond what we cover in the course.
COURSE OVERVIEW

In this course we’re going to dive deep into the world of 3D structural analysis by building a 3D structural analysis programme using Python.

After completing this course you’ll have built your own 3D finite element solver and have a workflow you can use to model and analyse complex 3D structures that would otherwise require expensive commercial software packages.

Building on a family of Python-based structural analysis courses, this course will take your level of ability and self-reliance in structural analysis to yet another level by expanding to consider full 3-dimensional beam bending. In this 13.5 hour video course, we go beyond axially loaded 3D space frame structures covered previously, to build out a feature rich, general 3D solver that can simulate:

  • Interaction between 6 degree of freedom axially loaded bar elements and 12 degree of freedom beam elements.
  • Localised rotational releases in the form of pins.
  • Structural response to both point and distributed loading.

You DO NOT need to be a Python programming guru to take this course.

If you’ve taken any of the prerequisite courses – or even if you’re just familiar with basic programming ideas like functions, loops and variables that will be plenty to get you started. 👍

The structural analysis tool you build in this course will give you the ability to analyse 3D frame structures, complete with axially loaded bracing elements and even rotational releases in the form of pins. Not only will you have a valuable tool to deploy, but you’ll have the knowledge and understanding that can only come from building it yourself!

Bending moment diagram for a 3D frame structure
Shear force diagram for a 3D frame structure
Bending moment diagram for a 3D frame structure
Shear force diagram for a 3D frame structure

When building computational models of real-world structures quite often the best starting point is a simplified 2D model. This greatly simplifies our analysis and if careful judgement is used in building the model, in many cases we lose very little accuracy by compressing from 3 down to 2 dimensions.

However, 2D structural analysis has its limitations. As the geometry of our structures becomes more complex the degree to which they can be accurately represented with planar models diminishes. As a result, the accuracy of our models deteriorates and model output drifts further and further from reality. At this point, it can help to expand into the third dimension.

Tied arch bridge quarter view

To put our finished structural analysis solver through its paces, we’ll model and analyse this 3D tied-arch footbridge. Now we certainly could carry out an approximate 2D analysis of this structure. And in fact this wouldn’t be a bad starting point to get a sense of the forces and moments that develop within the structure. But after completing this course, you’ll be able to build a high-fidelity 3D structural model and complete the analysis in minutes. This will allow you to get a much clearer picture of how the structure responds to loading.

Tied arch bridge showing deflection

This course build on the popular series of EngineeringSkills stiffness method courses. In particular we will build on what we learned in the study of Beam & Frame Analysis using the Direct Stiffness Method in Python. We’ll expand the code developed in that course to accommodate 3D frame structures.

Unlike the expansion from 2D trusses to 3D space frames, which was relatively simple due to the axially loaded nature of the elements, moving from 2D to 3D frame analysis is a little more involved.

In this course we’ll work through the process step-by-step laying the foundation with theory before implementing what we’ve learned in code. Once complete, you’ll be rewarded with a huge sense of satisfaction (and a pretty nice 3D analysis tool!)

It’s a good idea to cover the prerequisite courses before diving into this one, check out the bundle discount at the bottom of this page. In particular consider working through Beam & Frame Analysis using the Direct Stiffness Method in Python.

Generating 3D model data manually can be a real pain, so we’ll be making use of Blender in this course. Blender is a powerful open-source 3D modelling tool. By getting to grips with only a handful of Blender’s modelling tools, we open the door to analysing the behaviour of any structure. We are limited only by our imagination! With its intuitive 3D modelling workflow and Python API, Blender is an excellent compliment to our structural analysis solver.

If you’ve ever tried to manually generate 3D frame data in some of the big name structural analysis packages, you’ll know it can be grindingly slow – you won’t look back after using our modelling and data export workflow.

Tied arch bridge showing deflection

After familiarising ourselves with how to generate structural models in Blender, we’ll develop some simple scripts that allow us to easily transfer model data back and forth between Blender and our structural analysis Jupyter notebook.

We’ll develop our Python code using the versatile Jupyter development environment. When you complete this course you will have a standalone 3D analysis Jupyter Notebook to deploy on your own projects. The code developed within each section of the course is also provided for download as a reference.

Course Breakdown

Section 1: Welcome and Preliminaries

In section one we’ll get our bearings and take a look at what the journey ahead looks like. This will give you a good idea of what to expect and how our solver will take shape. As this course is the fourth in a series, I’ll also say a few words on prerequisites and what you should consider covering before working through the course. Both of the short lectures in this section can be watched below before enrolling – take a look.

Section 2: The 3D Beam Stiffness Matrix

In this section we get right into the thick of it and start to work out how we’re going to model our 3D beam elements. By the end of this section we will have fully derived the 12×12 beam element stiffness matrix. We’ll start by briefly reviewing the 2D beam element before tackling the additional degrees of freedom in our 3D element.

Section 3: Location and Rotation in 3D Space

If there is one thing that has the potential to confuse you when trying to perform 3D frame analysis it’s how to deal with rotations in 3D space. Understanding how to handle element orientation, rotations and transitions between reference frames is critical. We’re going to tackle this head-on in this section. By the end of the section you will understand exactly how we’re capturing the orientation of our beam elements. The output at the end of this section will be our element transformation matrix.

Section 4: Generating frame data in Blender

In this section we take a break from theory and dive into Blender for some light relief. In this section we’ll generate our structural model and use Blender’s subdivide tools to easily ‘mesh’ our structure. By the end of this section we’ll have all of our model data loaded up inside our Jupyter Notebook and be ready to start writing our solver.

Section 5: Building the Transformation Matrix

In this section we’re going to focus on capturing the orientation of each element within our structure. This is one example of something that we didn’t need to spend too much time on for purely axially loaded 3D members. But for 3D beam elements, whether they bend about a major or minor axis has a huge impact on their behaviour. We’ll start by defining a default orientation for all members. Once we have a predictable orientation for each member, we’ll work out a strategy for calculating and storing each member’s transformation matrix.

Section 6: Building and Solving the Stiffness Matrix

At this point in our development, we have a lot of the necessary foundation work done. In this section we can actually solve the structure. If you’ve covered any of the prerequisite courses, you will be on familiar ground in this section. By the end of this section, our structure will be solved and all of our data will be just waiting to be visualised which we’ll take care of in the next section.

Section 7: Visualising Results in 3D

All of the data in the world is of no value to us unless we can visualise it and ultimately interpret it. This section is going to focus on building the standard plots you would expect to see in any structural analysis software. Once this section is complete we will have a fully functioning solver and a complete workflow where we build our models in Blender, import them and analyse them in our Jupyter Notebook solver and optimally review the deflections back in Blender. The next sections in the course are focused on implementing features that enhance the usability of our solver and turn it into a versatile and valuable analysis tool.

Section 8: Implementing Bar Bracing elements:

In this section we’re going to focus on implementing purely axially loaded elements within our code. We’ll refer to these as bar elements, as opposed to beam elements that also resist shear, bending and torsion. We typically encounter these types of elements as bracing members within structures. The portal frame structure we’ve been working on up to now is a classic example of a structure that would use this as a lateral stability system. After this section is complete, our solver will be capable of handling some of the most common forms of framed structure.

Section 9: Implementing Pinned Members:

In this section we’ll implement the ability to model a new type of element – beam elements that have a pin at node i or node j. These pins will act as rotational releases for major and minor axis bending at the respective node. Practically these pins allow our solver to handle simply supported or simply restrained structural members within our models. A practical example of this might be a beam that has a simple fin-plate shear connection on one or both ends. We wouldn’t want to model moment transmission through these connections. After completing this section we will be able to model the required rotational releases.

Section 10: Implementing Distributed Loading:

The ability to handle distributed loading is probably the last big omission in our solver, so we’ll put that right in this section. As usual we’ll start in Blender and identify and export the members within our model that we want to apply uniformly distributed loading to. In contrast to the manual process of determining equivalent nodal actions when we did this for 2D frames, we’ll automate the process here making for a much smoother workflow. Once this section is complete, we’ll have a well rounded solver to put to work.

Section 11: Bridge Model Case Study:

The purpose of this is to take a non-standard structure, unlike what we’ve been modelling up to this point – and see how to approach its modelling and analysis using the tools we’ve developed. One of the benefits of doing this is that we’ll identify good opportunities to further improve our solver – which you should consider doing when you’ve finished this course! I’ll also demonstrate how to make use of some of Blender’s fantastic mesh editing tools that make our lives so much easier!

Who this course is for

  • Students and professional engineers who’ve studied matrix analysis methods but never explored the 3D potential of this analysis technique.
  • Students and professional engineers who’ve taken some or all of our previous direct stiffness method courses (see bundle discount at the bottom of this page) and want to continue learning and expanding their abilities.
  • Anyone who wants to leverage programming as a tool for structural analysis or within their day-to-day study or work.

The codes developed in this course are for educational purposes only and are not tested or certified for use beyond the educational scope of this course. Always employ your own engineering judgement first and foremost, regardless of what the computer says!

Section 2
The 3D Beam Stiffness Matrix
3. Section 2 overview
01:13 (Preview)
4. Review of the 2D stiffness matrix
16:20
5. 3D beam elements 📂
07:43 (Preview)
6. Minor axis bending and transverse shear
11:20
7. Torsion & completing the stiffness matrix 📂
05:01
Section 3
Location and Rotation in 3D Space
8. Section 3 overview
01:12 (Preview)
9. An introduction to 3D reference frames
12:11
10. Recap of direction cosines & the 3D bar transformation matrix
06:51
11. Building the 3D beam transformation matrix
16:53
Section 4
Generating frame data in Blender
12. Section 4 overview
02:43 (Preview)
13. Building and exporting a basic frame 📂
10:53
14. Exporting frame data from Blender
19:39
15. Exporting structural supports
17:19
16. Exporting point load data
07:31
17. Importing our frame data 📂
26:37
18. Building the force vector
08:41
19. Visualising our structure with matplotlib
17:47
Section 5
Building the Transformation Matrix
20. Section 5 overview
01:14 (Preview)
21. Defining a default member orientation 📂
14:49
22. How to define a local member reference frame
17:03
23. Building the local member reference frame
18:57
24. Calculating member reference frames and lengths
09:56
Section 6
Building and Solving the Stiffness Matrix
25. Section 6 overview
01:06 (Preview)
26. Building the global element stiffness matrix 📂
13:09
27. Building the primary stiffness matrix
09:05
28. Extracting the structure stiffness matrix
04:20
29. Solving for displacements and reactions
08:24
30. Solving for member actions
17:28
Section 7
Visualising Results in 3D
31. Section 7 overview
02:34 (Preview)
32. Plotting the deflected shape 📂
12:53
33. Plotting the axial force heat map
25:57
34. Build the local BMD
13:19
35. Plotting the 3D bending moment diagram 📂
26:34
36. Build the local SFD
04:59
37. Plotting the 3D shear force diagram
14:14
38. Generating detailed text output
20:37
39. Exporting deflections to Blender 📂
15:47
Section 8
Implementing Bar Bracing Elements
40. Section 8 overview 📂
01:55 (Preview)
41. Identifying and exporting bar elements from Blender 📂
13:04
42. Identifying rotational releases in our code
21:00
43. Assigning different areas to bar elements
04:00
44. Building the bar element stiffness matrix
05:58
45. Adding bar elements to the primary stiffness matrix
07:25
46. Extracting the structure stiffiness matrix
15:37
47. Solving for axial forces in bar elements
12:40
Section 9
Implementing Pinned Members
48. Section 9 overview
02:43 (Preview)
49. Constructing a fixed-pinned stiffness matrix
09:32
50. Identifying and exporting pinned elements from Blender 📂
06:36
51. Identifying pinned members in our code 📂
14:32
52. Element stiffness matrix with pin at node i
10:26
53. Element stiffness matrix with pin at node j
05:03
54. Adding pinned elements to the primary stiffness matrix
06:51
55. Solving for member actions in pinned elements
17:07
Section 10
Implementing Distributed Loading
56. Section 10 overview
02:46 (Preview)
57. Identifying distributed loads in Blender 📂
04:37
58. Importing distributed loading information 📂
03:54
59. Calculating equivalent nodal actions - Part 1
20:25
60. Calculating equivalent nodal actions - Part 2
11:19
61. Updating the global force vector
07:47
62. Removing ENA from reactions
03:12
63. Removing ENA from member actions
15:47
Section 11
Bridge Model Case Study
64. Section 11 overview
03:43 (Preview)
65. Reviewing the bridge structure
14:01
66. Building the structural bridge model 📂
27:26
67. Data export/import 📂
10:20
68. Review of results
07:59
69. Course wrap up and debrief
03:10
Section 12
Course Updates
70. Self-weight part 1 - bar elements 📂
14:27
71. Self-weight part 1 - beam elements
11:19
72. Member rotations part 1 - Identifying members to rotate 📂
08:51
73. Member rotations part 2 - Implementing rotation overrides
23:14
Completion certificate
Completion certificate
  • Download your personalised Certificate of Completion once you’ve finished all course lectures.

  • Applying for jobs? Use your Certificate of Completion to show prospective employers what you’ve been doing to improve your capabilities.

  • Independently completing an online course is an achievement. Let people know about it by posting your Certificate of Completion on your Linkedin profile or workplace CPD portfolio.

Ready to get started?
Very professional. Excellent explanation, both, in engineering and programming.
Alexander Vailant da Silva
getting-started
Dr Seán Carroll
BEng (Hons), MSc, PhD, CEng MIEI, FHEA
Hi, I’m Seán, the founder of EngineeringSkills.com (formerly DegreeTutors.com). I hope you found this tutorial helpful. After spending 10 years as a university lecturer in structural engineering, I started this site to help more people understand engineering and get as much enjoyment from studying it as I do. Feel free to get in touch or follow me on any of the social accounts.

Do you have some knowledge or expertise you'd like to share with the EngineeringSkills community?
Check out our guest writer programme - we pay for every article we publish.
You Might Also be Interested In...
Beam and Frame Analysis using the Direct Stiffness Method in Python
Beam and Frame Analysis using the Direct Stiffness Method in Python
Build a sophisticated structural analysis software tool that models beams and frames using Python.
3D Space Frame Analysis using Python and Blender
3D Space Frame Analysis using Python and Blender
Imagine, build and analyse 3D space frames using the Direct Stiffness Method in Python

The 2D and 3D Beam and Frame Analysis Course Bundle

Go beyond the basics and build a complete moment frame analysis program with Python.

  • Beam and Frame Analysis using the Direct Stiffness Method in Python
  • Finite Element Analysis of 3D Structures using Python

Frequently asked questions