Plotting nodal displacements not working #3426
Replies: 3 comments 4 replies
-
To give some context, the code I'm using to call the plot_nodal_displacement is the following: result = mapdl.result print(result) mapdl.post1() ) |
Beta Was this translation helpful? Give feedback.
-
Hi @thiesblaak I guess there is some elements there which are not compatible with PyMAPDL reader. Can you post a minimal working example of the model? |
Beta Was this translation helpful? Give feedback.
-
Hi @thiesblaak line 858 tells what happened; nodal displacements are being plotted for a thermal analysis. In which case there are no displacements. Mike |
Beta Was this translation helpful? Give feedback.
-
Dear all,
I'm trying to perform a static structural analysis in which I would like to plot the displaced results. On one of my models it works fine and I can choose at which time step I want to plot. My other model only works if I set show_displacedment to False in the plot_nodal_displacement() function. The error I recieve is the following:
ValueError Traceback (most recent call last)
Cell In[7], line 9
5 print(result)
8 mapdl.post1()
----> 9 result.plot_nodal_displacement(
10 result_set,
11 background = 'w',
12 cpos="xy",
13 displacement_factor=10,
14 show_displacement=True,
15 # show_edges=False,
16 # show_axes=False,
17 show_scalar_bar = False,
18 add_text=False,
19 color = 'red',
20 text_color="k",
21
22 )
File ~\anaconda3\envs\Ansys\Lib\site-packages\ansys\mapdl\reader\rst.py:860, in Result.plot_nodal_displacement(self, *args, **kwargs)
856 if self._is_thermal:
857 raise AttributeError(
858 "Thermal solution does not contain nodal " "displacement results"
859 )
--> 860 return self.plot_nodal_solution(*args, **kwargs)
File ~\anaconda3\envs\Ansys\Lib\site-packages\ansys\mapdl\reader\rst.py:840, in Result.plot_nodal_solution(self, rnum, comp, show_displacement, displacement_factor, node_components, element_components, sel_type_all, treat_nan_as_zero, **kwargs)
837 grid = self.grid
839 kwargs.setdefault("scalar_bar_args", {"title": f"{comp}\n{label}\n"})
--> 840 return self._plot_point_scalars(
841 scalars,
842 rnum=rnum,
843 grid=grid,
844 show_displacement=show_displacement,
845 displacement_factor=displacement_factor,
846 node_components=node_components,
847 element_components=element_components,
848 sel_type_all=sel_type_all,
849 treat_nan_as_zero=treat_nan_as_zero,
850 **kwargs,
851 )
File ~\anaconda3\envs\Ansys\Lib\site-packages\ansys\mapdl\reader\rst.py:3021, in Result._plot_point_scalars(self, scalars, rnum, grid, show_displacement, displacement_factor, add_text, animate, n_frames, overlay_wireframe, node_components, element_components, sel_type_all, movie_filename, treat_nan_as_zero, progress_bar, **kwargs)
3019 new_points[:, :-1] += disp
3020 else:
-> 3021 new_points = disp + grid.points
3022 grid = grid.copy()
3023 grid.points = new_points
ValueError: operands could not be broadcast together with shapes (711,3) (1335,3)
Has anyone ever experienced something similar before? Or does anyone maybe know what is going wrong?
With kind regards,
Thies
Beta Was this translation helpful? Give feedback.
All reactions