6 posts / 3 projects
Interested in civil engineering, programming language design and game development. From Austria.
Jam Submission - Structure Analysis Program
Edited by progfix on

I worked on a simple structural analysis program. I am working in civil engineering where you would use structural analysis to model for example a bridge or a steel structure to calculate the internal forces and displacements that will occur on them for a given load.

Internal forces and displacements are the basis for further calculations like what type of concrete should be used or how thick a beam should be built.

To be more specific, the program is performing a finite element analysis on a simple beam-joint model (2 degrees of freedom) which is the simplest form of a finite element analysis.

Unfortunately I was only able to finish the calculations of the displacements. Calculating the internal forces from that should be trivial though.

I was planing to make a program where you could draw models, but I was only able to finish a simple viewer for the model (which is loaded from an input-text-file) and the calculated displacements.

Here see it in action: 2021-10-03 22-56-37.mp4

The things I had to do were:

• Design a file format for the input model
• Parse that file
• Write a system of equations solver (Gauss-Elimination-Method)
• Graph data structure for the model (I overengineered that a bit)
• Build the system of equations from the graph data
• GUI for viewing the model and the displacements

It was super fun! I learned how to do a finite element analysis, I learned how to use raylib and I learned to love Halts rectangle-cutting-ui-layouting (https://halt.software/dead-simple-layouts/ ).

I want to finish this program and do more complicated FEM programs in the future (maybe with Proctor, my CAD + Spreadsheet program that I showcased a couple of times).

Here are the binaries (Windows 64bit only):

fem_hmn_jam2021_windows.zip

Usage: Just drag and drop the file from the 'examples' folder into the window! Play around with the variables in the file in your editor of choice. Saving the file will update the model in the viewer.

Simon Anciaux
1352 posts
Jam Submission - Structure Analysis Program

Not much to say since I don't need this tool, but I tested it:

• the default window was too big on a 1080p monitor, and after resizing it the model was partially out of the screen;
• When using middle mouse button to drag the view around, it feels a bit laggy (CPU usage ~17%, GPU usage 4%).
6 posts / 3 projects
Interested in civil engineering, programming language design and game development. From Austria.
Jam Submission - Structure Analysis Program
Edited by progfix on
Replying to mrmixer (#25286)

Thanks for the feedback!

I tested the program on an older Windows 7 PC. There are some issues with loading the model file. Raylib gives me gibberish instead of the dropped file name. I won't spend time fixing it, so Windows 10 is now a requirement :)

Ben Visness
109 posts / 9 projects
Jam Submission - Structure Analysis Program

This looks really nice! Do you intend to keep the input file format, or is that just a stopgap until you have some kind of UI?

Also, out of curiosity, how quickly can it calculate the displacements from the forces? It looks very snappy in the video, but does it get slower as more forces are involved?

6 posts / 3 projects
Interested in civil engineering, programming language design and game development. From Austria.
Jam Submission - Structure Analysis Program
Replying to bvisness (#25345)

I think I will keep the input file format because I can easily add new stuff and try things out without having to implement an UI / interaction first.

The displacement calculation is just a gauss elimination on an up to 6x6 matrix + a matrix multiplication. So it is instant.

If I do more advanced calculations in the future the matrix size will grow significantly. But as far as I know there are some special techniques to speed up the equation solving and multiplications (because the system stiffness matrix has the form of a band matrix).

6 posts / 3 projects
Interested in civil engineering, programming language design and game development. From Austria.
Jam Submission - Structure Analysis Program
Edited by progfix on

I updated the app slightely (the versions + example I showed on the Jam Recap stream):

fem_hmn_jam2021_windows-02.zip

New shortcuts:
S ... Show the system stiffness matrix in the terminal window
N ... Zoom out
M ... Zoom in

Benjamin Pedersen
46 posts
Mathematician
Jam Submission - Structure Analysis Program

You forgot to include raylib.dll in your newest post.

6 posts / 3 projects
Interested in civil engineering, programming language design and game development. From Austria.
Jam Submission - Structure Analysis Program
Replying to Benjipede (#25402)

Thanks for telling me! I updated the files.