anaStruct
anaStruct copied to clipboard
ValueError: max() arg is an empty sequence in anastruct
Hi @ritchie46 & @lukaszlaba & @rodrigo1392 ,
I worked on two days about this issue. Can you please help me. This is very important. How to fix this Value error. When we using reaction force this value error came. axial, bending, deflection forces working. Can you please help me. show_reaction_force(show=True) is working when we did not used load combinations.
from anastruct.fem.system import SystemElements
from anastruct.fem.util.load import LoadCase, LoadCombination
import matplotlib.pyplot as plt
ss = SystemElements(EA=14000, EI=5.36)
ss.add_element(location=[[0, 0], [6, 0]])
ss.discretize(n=6)
ss.add_support_fixed(node_id=1)
ss.add_support_fixed(node_id=7)
lc_dead = LoadCase('dead')
lc_dead.q_load(q=-10, element_id=2)
lc_dead.point_load(Fx=30, Fy=-50, node_id=2)
combination1 = LoadCombination('SLS')
combination1.add_load_case(lc_dead, factor=1.0)
results1 = combination1.solve(ss)
for k, ss in results1.items():
if k == 'combination':
results1[k].show_reaction_force(show=True)
results1[k].show_bending_moment(show=True)
results1[k].show_displacement(show=True)
results1[k].show_axial_force(show=True)
File "E:/main/fem_analysis/l_profile.py", line 72, in l_profile_loads
results1[k].show_reaction_force(show=True)
File "E:\models\fem_model\fem\system.py", line 910, in show_reaction_force
return self.plotter.reaction_force(figsize, verbosity, scale, offset, show)
File "E:\models\fem_model\fem\plotter\mpl.py", line 669, in reaction_force
max_force = max(
ValueError: max() arg is an empty sequence
Notes from investigating this: This is closely related to the fact that get_element_results()
on the "combination" results works correctly, but get_nodal_results_system()
just gives you a bunch of zeros for everything.
Basically, in a normal solve without load cases and combinations, anaStruct creates an initial set of nodes that it uses to create the FEA matrices, and then the solver overwrites those nodes with new ones once it has results. That is for example, before you solve node.Fx
represents applied loads, but after the solve, nodes.Fx
represents loads or reactions.
When anaStruct calculates the "combination" results, it's not doing a solve - it's just adding together load cases - which means that that overwriting the nodes step never happens correctly. I need to dig more, but I think there are correct results in system.element_map[].node_map[]
. However, that node_map is separate from the system.node_map[]
which is what the nodal results are actually pulled from by the postprocessing code.
This took way too long, but now finally fixed in PR #113 !