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

Inserting a node to existing element causes a key error because that element is deleted. #308

Open
thisisapple opened this issue Sep 1, 2024 · 1 comment
Labels

Comments

@thisisapple
Copy link

thisisapple commented Sep 1, 2024

I am testing the library. In my codes, there are just two standard elements. When I use insert_node() method to insert a new to the second element, the original element will split into two new elements. I can add a point load to the new node. However, the model will can not pass validation. You cannot solve the numerical problem.

I do not know how to fix this error. If I directly define three standard elements with the same properties, the same error will not occur.

from anastruct import SystemElements
structure = SystemElements(EA=15000, EI=5000, mesh=101)

# define elements
structure.add_element(location=[[0,0],[10,4]])
# structure.add_element(location=[[10,4],[10,3]])
structure.add_element(location=[[10,4],[10,0]])

# define support
structure.add_support_hinged(node_id=1)
structure.add_support_hinged(node_id=3)

# define loads
structure.q_load(q=5, element_id=1,direction='element')
structure.point_load(node_id=2, Fx=4, Fy=0)
structure.insert_node(element_id=2,factor=0.25) # insert a node
structure.point_load(node_id=4, Fx=8, Fy=0) # define a point load at the new node

# solve the numerical problem
structure.solve()

Below is the error message:

{
"name": "KeyError",
"message": "2",
"stack": "---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[5], line 2
1 # solve the numerical problem
----> 2 structure.solve()

@thisisapple
Copy link
Author

I think the solution is to revalidate the whole structure object after inserting a node. I don't see any current API to do it elegantly.

@thisisapple thisisapple changed the title Inserting a node to existing element causes validation error Inserting a node to existing element causes a key error because that element is deleted. Sep 2, 2024
@smith120bh smith120bh added the bug label Sep 21, 2024
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