JesseBonanno / IndeterminateBeam

A solver for 1D indeterminate beams
MIT License
62 stars 17 forks source link

Speed #26

Open haphaeu opened 2 years ago

haphaeu commented 2 years ago

Nice solver for beam! Well built and easy to use.

However noticed it is extremely slow for large number of supports. I'm using your code as a benchmark for a FEM solver I'm building to model a beam supported by elastic soil. The soil properties vary rapidly so I have around 200 segments and 200 soil springs in my model, plus point loads and constraints. The typical FEM implementation runs in a fraction of a second, while IndeterminateBeam takes several minutes.

By profiling the code, seems that the culprit is SymPy. As a quick speed up fix, suggest to try to add support for SymEngine which uses C compiled libraries intead of Python code for the symbolic manipulations. Worth noting that I haven't tested that.

JesseBonanno commented 2 years ago

Hi Rafael,

Thank you for looking into this!

I have looked into this issue before and SymPy integration is definitely the culprit. It used to take a lot longer until i changed the distributed load types from all being Piecewise into SingularityFunctions. I just tried reading the SymEngine documentation although it wasnt clear to me how to integrate it. Maybe you or someone else who sees this thread will understand how to integrate it into the code.

Speed also isn't a critical issue for me at the moment. I think the speed is okay for 99% of use cases. In cases like yours the speed issue becomes a lot more noticeable.

Jesse