Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow length greater than 10m #11

Merged
merged 2 commits into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion beambending/beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def _plot_analytical(self, ax: plt.axes, sym_func, title: str = "", maxmin_hline
:return: a matplotlib.Axes object representing the plotted data.

"""
x_vec = np.linspace(self._x0, self._x1, min(int((self.length) * 1000 + 1), 1e4))
x_vec = np.linspace(self._x0, self._x1, int(self.length * 1000 + 1))
y_lam = lambdify(x, sym_func, "numpy")
y_vec = np.array([y_lam(t) for t in x_vec])

Expand Down
28 changes: 28 additions & 0 deletions examples/example_4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
"""Example 4: Similar to example 1.
"""
import os
from beambending import Beam, DistributedLoadV, PointLoadH, PointLoadV, x

def example_4():
"""Run example 4"""
beam = Beam(20) # Initialize a Beam object of length 9 m
beam.pinned_support = 2 # x-coordinate of the pinned support
beam.rolling_support = 18 # x-coordinate of the rolling support
beam.add_loads((
PointLoadH(10, 3), # 10 kN pointing right, at x=3 m
PointLoadV(-20, 15), # 20 kN downwards, at x=3 m
DistributedLoadV(-10, (0, 20)), # 10 kN/m, downwards, for 0 m <= x <= 20 m
DistributedLoadV(-20 + x**2, (0, 11)), # variable load, for 0 <= x <= 11 m
))
fig = beam.plot()

# save the png and add it to the documentation
mod_path = os.path.dirname(os.path.abspath(__file__)) # current module
save_name = os.path.basename(__file__).replace('.py', '.png') # file name
save_path = os.path.join(mod_path, save_name)
fig.savefig(save_path, transparent=True)


if __name__ == '__main__': # call function when run as script
example_4()