You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
###############################################################################
# Start MAPDL
# ~~~~~~~~~~~
from ansys.mapdl.core import launch_mapdl
# Start mapdl and clear it.
mapdl = launch_mapdl()
mapdl.clear()
# Enter verification example mode and the pre-processing routine.
mapdl.verify()
mapdl.prep7()
###############################################################################
# Define Element Type
# ~~~~~~~~~~~~~~~~~~~
# Set up the element type (a beam-type).
# Type of analysis: Static.
mapdl.antype("STATIC")
# Element type: BEAM188.
mapdl.et(1, "BEAM188")
# Special Features are defined by keyoptions of beam element:
# KEYOPT(3)
# Shape functions along the length:
# Cubic
mapdl.keyopt(1, 3, 3) # Cubic shape function
# KEYOPT(9)
# Output control for values extrapolated to the element
# and section nodes:
# Same as KEYOPT(9) = 1 plus stresses and strains at all section nodes
mapdl.keyopt(1, 9, 3)
###############################################################################
# Define Material
# ~~~~~~~~~~~~~~~
# Set up the material.
mapdl.mp("EX", 1, 30E6)
mapdl.mp("PRXY", 1, 0.3)
###############################################################################
# Define Section
# ~~~~~~~~~~~~~~
# Set up the cross-section properties for a beam element.
w_f = 1.048394965
w_w = 0.6856481
sec_num = 1
mapdl.sectype(sec_num, "BEAM", "I", "ISection")
mapdl.secdata(15, 15, 28 + (2 * w_f), w_f, w_f, w_w)
###############################################################################
# Define Geometry:
# ~~~~~~~~~~~~~~~~
# Set up the nodes and elements. Create nodes then creating elements
# bewtween nodes.
# Define nodes
for node_num in range(1, 6):
mapdl.n(node_num, (node_num - 1) * 120, 0, 0)
# Define one node for the orientation of the beam cross-section
orient_node = mapdl.n(6, 60, 1)
# Print the list of the created nodes.
print(mapdl.nlist())
# Define elements
for elem_num in range(1, 5):
mapdl.e(elem_num, elem_num + 1, orient_node)
# Print the list of the created elements.
print(mapdl.elist())
# Display elements with their nodes numbers.
# mapdl.eplot(show_node_numbering=True, line_width=5, cpos="xy")
###############################################################################
# Define Boundary Conditions
# ~~~~~~~~~~~~~~~~~~~~~~~~~~
# Application of boundary conditions.
# BC for the beams seats
mapdl.d(2, "UX", lab2="UY")
mapdl.d(4, "UY")
# BC for all nodes of the beam
mapdl.nsel("S", "LOC", "Y", 0)
mapdl.d("ALL", "UZ")
mapdl.d("ALL", "ROTX")
mapdl.d("ALL", "ROTY")
mapdl.nsel("ALL")
###############################################################################
# Define Distributed Loads
# ~~~~~~~~~~~~~~~~~~~~~~~~
# Apply a distributed force of :math:`w = (10000/12) lb/in`
# in the y-direction.
# Parametrization of the distributed load.
w = 10000 / 12
# Application of the surface load to the beam element.
mapdl.sfbeam(1, 1, "PRES", w)
mapdl.sfbeam(4, 1, "PRES", w)
mapdl.finish()
###############################################################################
# Solve
# ~~~~~
# Enter solution mode and solve the system.
mapdl.run("/SOLU")
out = mapdl.solve()
mapdl.finish()
print(out)
###############################################################################
# Post-processing
# ~~~~~~~~~~~~~~~
# Enter post-processing. To get the stress and deflection results
# from the middle node and cross-section of the beam we can use
# mapdl.get().
# Enter the post-processing routine and select the first load step.
mapdl.post1()
mapdl.set(1)
mapdl.post_processing.plot_nodal_displacement("Y")
CRITICAL - - logging - handle_exception - Uncaught exception
Traceback (most recent call last):
File "C:\Program Files\Python38\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 3, in <module>
File "C:\python_projects\project_1\venv\lib\site-packages\ansys\mapdl\core\post.py", line 362, in plot_nodal_displacement
return self._plot_point_scalars(
File "C:\python_projects\project_1\venv\lib\site-packages\ansys\mapdl\core\post.py", line 371, in _plot_point_scalars
surf = self._mapdl.mesh._surf
File "C:\python_projects\project_1\venv\lib\site-packages\ansys\mapdl\reader\mesh.py", line 67, in _surf
self._surf_cache = self._grid.extract_surface()
File "C:\python_projects\project_1\venv\lib\site-packages\ansys\mapdl\core\mesh_grpc.py", line 438, in _grid
self._grid_cache = self._parse_vtk(force_linear=True)
File "C:\python_projects\project_1\venv\lib\site-packages\ansys\mapdl\reader\mesh.py", line 160, in _parse_vtk
grid.point_data['ansys_node_num'] = nnum
File "C:\python_projects\project_1\venv\lib\site-packages\pyvista\core\datasetattributes.py", line 218, in __setitem__
self.set_array(value, name=key)
File "C:\python_projects\project_1\venv\lib\site-packages\pyvista\core\datasetattributes.py", line 597, in set_array
vtk_arr = self._prepare_array(data, name, deep_copy)
File "C:\python_projects\project_1\venv\lib\site-packages\pyvista\core\datasetattributes.py", line 751, in _prepare_array
raise ValueError(f'data length of ({data.shape[0]}) != required length ({array_len})')
ValueError: data length of (6) != required length (14)
The text was updated successfully, but these errors were encountered:
mapdl.post_processing.plot_nodal_displacement() doesn't work with element Beam188
In Post-Processing Procedure, I have got an issue with plotting of the nodal displacements
after the static simulation with element beam188.
However, if you got to the Verification Manual Example Number 4 (VM4), https://mapdldocs.pyansys.com/examples/06-verif-manual/vm-004-deflection_of_a_hinged_support.html#sphx-glr-examples-06-verif-manual-vm-004-deflection-of-a-hinged-support-py, this example was done with elements LINK180, there
To Reproduce
Steps to reproduce the behavior:
System Information:
Additional context
Run a PyMAPDL code
The text was updated successfully, but these errors were encountered: