Finite element beam model in Python