JesseBonanno / IndeterminateBeam

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

Problems when adding horizontal loads #22

Closed nicoguaro closed 3 years ago

nicoguaro commented 3 years ago

If I add a purely horizontal load I get the following error message.

<ipython-input-27-63fbea690f3c> in <module>
      3 beam2.add_supports(Support(0, (1, 1, 1)),
      4                    Support(5, (0, 1, 0)))
----> 5 beam2.analyse()

~/Workspace/IndeterminateBeam/indeterminatebeam/indeterminatebeam.py in analyse(self)
    735         # They might also only be interested in a particular component,
    736         # such as Bending Moment.
--> 737         self._set_plotting_vectors()
    738 
    739     def _set_plotting_vectors(self):

~/Workspace/IndeterminateBeam/indeterminatebeam/indeterminatebeam.py in _set_plotting_vectors(self)
    778 
    779         # create numpy arrays for functions (y vectors)
--> 780         nf = np.array([float(nf_func(t)) for t in x_vec])
    781         sf = np.array([float(sf_func(t)) for t in x_vec])
    782         bm = np.array([float(bm_func(t)) for t in x_vec])

~/Workspace/IndeterminateBeam/indeterminatebeam/indeterminatebeam.py in <listcomp>(.0)
    778 
    779         # create numpy arrays for functions (y vectors)
--> 780         nf = np.array([float(nf_func(t)) for t in x_vec])
    781         sf = np.array([float(sf_func(t)) for t in x_vec])
    782         bm = np.array([float(bm_func(t)) for t in x_vec])

<lambdifygenerated-43> in _lambdifygenerated(x)
      1 def _lambdifygenerated(x):
----> 2     return (-1.0*select([greater(x, 0),True], [1,0], default=nan) + select([greater(x - 10, 0),True], [1,0], default=nan) + SingularityFunction(x, 10, 0))

NameError: name 'SingularityFunction' is not defined

This is the code used

from indeterminatebeam import Beam
from indeterminatebeam import Support
from indeterminatebeam import PointLoad

beam2 = Beam(10)
beam2.add_loads(PointLoad(1, 10, 0))
beam2.add_supports(Support(0, (1, 1, 1)),
                   Support(5, (0, 1, 0)))
beam2.analyse()
JesseBonanno commented 3 years ago

Issue concerned SingularityFunction to Piecewise conversion function.