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

mapdl.post_processing.plot_nodal_displacement() doesn't work with element Beam188 #751

Closed
RomanIlchenko1308 opened this issue Nov 30, 2021 · 0 comments · Fixed by #755
Closed

Comments

@RomanIlchenko1308
Copy link
Contributor

RomanIlchenko1308 commented Nov 30, 2021

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:

  1. Your version of Python should between 3.7 up to 3.9
  2. PyMAPDL should be installed, if not, go through the steps: https://mapdldocs.pyansys.com/getting_started/index.html
  3. Copy and run all code.
  4. See error and compare an error.

System Information:

  • OS: [Windows 10 enterprise]
  • Ansys version (E.g. 2021R2)
  • PyMAPDL version (E.g. 0.60.2)

Additional context

Run a PyMAPDL code

###############################################################################
# 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)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant