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

Bug located in PyMAPDL plotting #232

Open
4 tasks done
jgd10 opened this issue Mar 22, 2023 · 7 comments
Open
4 tasks done

Bug located in PyMAPDL plotting #232

jgd10 opened this issue Mar 22, 2023 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@jgd10
Copy link
Contributor

jgd10 commented Mar 22, 2023

Before submitting the issue

  • I have visited the Troubleshooting section.
  • I have searched among the existing issues.
  • I am using a Python virtual environment.
  • I have a fully updated virtual environment (i.e. pip install --upgrade --upgrade-strategy eager ansys-mapdl-core)

Description of the bug

PyMAPDL plots asymmetric data for a simple symmetric problem using BEAM188 elements.

Steps To Reproduce

from ansys.mapdl.core import launch_mapdl
from ansys.mapdl.reader.rst import Result


# start mapdl and clear it
mapdl = launch_mapdl()
mapdl.clear() # optional as MAPDL just started
mapdl.units("SI") # SI - International system (m, kg, s, K).
mapdl.prep7()

mapdl.antype("STATIC")
mapdl.et(1, "BEAM188")
mapdl.sectype(1, "BEAM", "RECT")
mapdl.secdata(0.01, 0.01)


mapdl.mp("EX", 1, 10.e9)
mapdl.mp("PRXY", 0.33)

nodes = [mapdl.n(1, 0, 0, 0), mapdl.n(2, 0.1, 0, 0), mapdl.n(3, 0.2, 0, 0),
         mapdl.n(4, 0.3, 0, 0), mapdl.n(5, 0.4, 0, 0), mapdl.n(6, 0.5, 0, 0),
         mapdl.n(7, 0.6, 0, 0), mapdl.n(8, 0.7, 0, 0), mapdl.n(9, 0.8, 0, 0),
         mapdl.n(10, 0.9, 0, 0), mapdl.n(11, 1.0, 0, 0),
         mapdl.n(12, 0, -0.1, 0), mapdl.n(13, 1.0, -0.1, 0)]


elements = [mapdl.e(1, 2), mapdl.e(2, 3), mapdl.e(3, 4), mapdl.e(4, 5),
            mapdl.e(5, 6), mapdl.e(6, 7), mapdl.e(7, 8), mapdl.e(8, 9),
            mapdl.e(9, 10), mapdl.e(10, 11), mapdl.e(12, 2), mapdl.e(13, 10)]


# constrain nodes at fixed end
mapdl.nsel("ALL")
for n in [1, 12, 11, 13]:
    mapdl.d(n, "ALL") 
    mapdl.f(5, "FY", -20)
    mapdl.f(6, "FY", -20)
    mapdl.f(7, "FY", -20)

mapdl.finish()

mapdl.run("/SOLU")
mapdl.solve()
mapdl.finish()
mapdl.post1()

simulation_result = mapdl.result # type: Result

simulation_result.plot_principal_nodal_stress(
    0,
    "SEQV",
    show_edges=True,
    cmap="viridis",
    cpos="xy",
    render_lines_as_tubes=True,
    line_width=20.
)

mapdl.finish()
mapdl.exit() 

Which Operating System are you using?

Windows

Which Python version are you using?

3.10

PyMAPDL Report

Show the Report!

-------------------------------------------------------------------------------


PyMAPDL Software and Environment Report


Packages Requirements
*********************

Core packages
-------------
ansys.mapdl.core    : 0.64.0
numpy               : 1.24.2
appdirs             : 1.4.4
scipy               : 1.10.1
grpc                : Package not found
ansys.api.mapdl.v0  : Package not found
ansys.mapdl.reader  : 0.52.11
google.protobuf     : Package not found

Optional packages
-----------------
matplotlib          : 3.7.1
pyvista             : 0.38.4
pyiges              : 0.2.1
tqdm                : 4.65.0


Ansys Installation
******************
Version   Location
------------------
222       C:\Program Files\ANSYS Inc\v222


Ansys Environment Variables
***************************
AWP_ROOT222                    C:\Program Files\ANSYS Inc\v222
ANSYS222_DIR                   C:\Program Files\ANSYS Inc\v222\ANSYS
CADOE_LIBDIR222                C:\Program Files\ANSYS Inc\v222\CommonFiles\Language\en-us
ANSYSLIC_DIR                   C:\Program Files\ANSYS Inc\Shared Files\Licensing


Installed packages

Show the installed packages!

ansys-api-mapdl==0.5.1
ansys-api-platform-instancemanagement==1.0.0b3
ansys-mapdl-core==0.64.0
ansys-mapdl-reader==0.52.11
ansys-platform-instancemanagement==1.0.3
appdirs==1.4.4
certifi==2022.12.7
charset-normalizer==3.1.0
click==8.1.3
colorama==0.4.6
contourpy==1.0.7
cycler==0.11.0
fonttools==4.39.0
geomdl==5.3.1
googleapis-common-protos==1.58.0
grpcio==1.51.3
idna==3.4
imageio==2.26.0
importlib-metadata==6.0.0
kiwisolver==1.4.4
matplotlib==3.7.1
numpy==1.24.2
packaging==23.0
Pillow==9.4.0
platformdirs==3.1.1
pooch==1.7.0
protobuf==3.20.3
protoc-gen-swagger==0.1.0
pyansys-tools-versioning==0.3.3
pyiges==0.2.1
pyparsing==3.0.9
python-dateutil==2.8.2
pyvista==0.38.4
requests==2.28.2
scipy==1.10.1
scooby==0.7.1
six==1.16.0
tqdm==4.65.0
urllib3==1.26.15
vtk==9.2.6
zipp==3.15.0

Logger output file

Show the logger output file.

# PASTE HERE THE CONTENT OF THE LOGGER OUTPUT FILE.

@jgd10 jgd10 added the bug Something isn't working label Mar 22, 2023
@jgd10
Copy link
Contributor Author

jgd10 commented Mar 22, 2023

image

@jgd10
Copy link
Contributor Author

jgd10 commented Mar 22, 2023

image

when plotted with mapdl:

mapdl.set('LAST')
mapdl.view(1, 1, 1, 1)
mapdl.graphics("power")
mapdl.eshape(1, 1)
mapdl.show("PNG")
mapdl.plnsol('S', 'EQV')
mapdl.replot()

@germa89
Copy link
Contributor

germa89 commented Mar 22, 2023

Pinging also @RGPATCHI for visibility

@germa89
Copy link
Contributor

germa89 commented Mar 22, 2023

I'm trying to make post_processing module to return something meaningful, but I need first to sort out which are the MAPDL commands.

As mentioned in the documentation, most of the post_processing methods rely on parsing the PRNSOL output.
Hence, ideally we would like to get that one first. However,

>>> mapdl.prnsol("s","prin")
'PRINT S    NODAL SOLUTION PER NODE

 *** WARNING ***                         CP =      15.958   TIME= 12:30:38
 BEAM/PIPE elements are detected in the selected element set.  They are  
 ignored in the nodal averaging.                                         

 *** WARNING ***                         CP =      15.964   TIME= 12:30:38
 No data is available for the selected model or data location            
 specifications.

Which is surprising because I can still plot the MAPDL nodal solution as @jgd10 showed using mapdl.plnsol.

Pinging @RGPATCHI and @mikerife for inputs

@germa89
Copy link
Contributor

germa89 commented Mar 23, 2023

By the way, the error here comes from MAPDL-reader. Transferring...

@germa89 germa89 transferred this issue from ansys/pymapdl Mar 23, 2023
@mikerife
Copy link

mikerife commented Apr 26, 2023

@germa89 Beam elements break the rules - the section nodes are not nodes that define the element in the traditional sense. So the results are presented in a differing manner as well. If you issue a presol,s,prin you should get a element by element listing of the principal stresses for each section node of the element. The order is in the result order, not necessarily in the modeling order. Mike

p.s. I need to double check the section node order listing for results. I'm pretty sure it is in result order and not modeling order.

@mikerife
Copy link

mikerife commented Apr 26, 2023

Hi @jgd10 @germa89
Regarding visualizing beam elements with the actual cross section:

Can you please take a look at the following example and let me know if it is worth pursuing as an actual project. I'm afraid the second loop, to loop over all beam elements, will cause the performance to be so bad, it may not be of practical use. Right now the model has just four beam element with five section cells.

MIke

BeamSectionPlot.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants