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

Element not rotating right when using springs at end of elements #144

Open
Jeroen124 opened this issue Apr 14, 2023 · 0 comments
Open

Element not rotating right when using springs at end of elements #144

Jeroen124 opened this issue Apr 14, 2023 · 0 comments
Labels

Comments

@Jeroen124
Copy link

Jeroen124 commented Apr 14, 2023

Please take a look at the following script, it appears that the second bar is not rotating correctly (e.g. the bar becomes longer as it rotates)


# =============================================================================
# Simple code example 
# =============================================================================
from anastruct import SystemElements
import math

gnl = True
w = 1              # m
F1 = 2
k1 = 1             # kNm/rad
k2 = 1             # kNm/rad


# Properties  (mm)
A = 1e3
I = 1e6

# from MPa to kN/m2
E_yougs = 210000 * 1000

# from mm4 to m4
mm4_to_m4 = 1 / 1e12

# from mm2 to m2
mm2_to_m2 = 1 / 1e6

# conversion
EI = E_yougs * I * mm4_to_m4
EA = E_yougs * A * mm2_to_m2

# Add beams to the system.
ss = SystemElements()


ss.add_element(location=[[0, 0], [0, 0.5*w]], EI=EI, EA=EA)
ss.add_element(location=[[0, 0.5*w], [0, w]], EI=EI, EA=EA, spring={1: k1, 2: k2})

# add supports
ss.add_support_fixed(node_id=1)

# add loads
ss.point_load(Fx=-F1, Fy=-0, node_id=3)
ss.show_structure()
ss.solve(geometrical_non_linear=gnl,discretize_kwargs=dict(n=20) , max_iter=500)
ss.show_displacement(factor=1)


# =============================================================================
# Checking rotation
# =============================================================================

n2x =           ss.get_node_displacements(node_id=2)['ux']
n2y = 0.5*w+    ss.get_node_displacements(node_id=2)['uy']
n3x =           ss.get_node_displacements(node_id=3)['ux']
n3y = w+        ss.get_node_displacements(node_id=3)['uy']

length_upper_bar = ((n2x-n3x)**2+(n2y-n3y)**2)**0.5
print('Length upper bar is:',length_upper_bar,' which in reailty is:',0.5*w)


Rotation_anastruct = math.sin((n2x-n3x)/(0.5*w))

print('Rotation is:',Rotation_anastruct,' rad according to anastruct')

# Analytical calculation:
Rotation_hand_calc = (0.5*w*F1)/k1
print('Rotation is:',Rotation_hand_calc,' rad according to simple hand calc')
@smith120bh smith120bh added the bug label Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants