ansys / pymapdl

Pythonic interface to MAPDL
https://mapdl.docs.pyansys.com
MIT License
428 stars 120 forks source link

Connection closed by the remote host while reading a *.rst file #1264

Closed Clemoreau closed 2 years ago

Clemoreau commented 2 years ago

Before submitting the issue

Description of the bug

I am using this piece of code which causes this strange error : [[WinError 10054] An existing connection was forcibly closed by the remote host]

from ansys.mapdl.reader import read_binary
rst_path = "C:/.../file.rst"
result = read_binary(rst_path)
result.nodal_solution(10)

I precise that I only have the problem with a specific .rst file. I can't reproduce it with the example .rst file available in the repository. The problem occurs when reading the "nodal solution"

Steps To Reproduce

from ansys.mapdl.reader import read_binary
rst_path = "C:/.../file.rst"
result = read_binary(rst_path)
result.nodal_solution(10)

But I can't share the *.rst file as it is confidential...

Which Operating System are you using?

Windows

Which Python version are you using?

3.8

Installed packages

aiohttp==3.8.1 aiosignal==1.2.0 alabaster==0.7.12 ansys-dpf-core==0.3.0 ansys-dpf-post==0.2.0 ansys-grpc-dpf==0.3.0 ansys-mapdl-reader==0.51.5 appdirs==1.4.4 argon2-cffi==20.1.0 arrow==1.0.3 astroid==2.5.3 asttokens==2.0.5 astunparse==1.6.3 async-generator==1.10 async-timeout==4.0.1 atomicwrites==1.4.0 attrs==20.3.0 auto-py-to-exe==2.10.1 autobahn==21.3.1 autograd==1.4 Automat==20.2.0 autopep8==1.5.6 Babel==2.9.0 backcall==0.2.0 bcrypt==3.2.0 binaryornot==0.4.4 black==22.3.0 bleach==3.3.0 bottle==0.12.19 bottle-websocket==0.2.9 Brotli==1.0.9 cachetools==4.2.2 certifi==2020.12.5 cffi==1.14.5 chardet==4.0.0 charset-normalizer==2.0.7 click==8.1.3 cloudpickle==1.6.0 cma==2.7.0 colorama==0.4.4 commonmark==0.9.1 constantly==15.1.0 cpylog==1.5.0 cycler==0.10.0 dash==2.3.1 dash-core-components==2.0.0 dash-html-components==2.0.0 dash-table==5.0.0 ddt==1.4.2 deap==1.3.1 debugpy==1.5.0 decorator==4.4.2 defusedxml==0.7.1 Deprecated==1.2.13 diff-match-patch==20200713 docopt-ng==0.7.2 docutils==0.16 Eel==0.12.4 entrypoints==0.3 et-xmlfile==1.0.1 executing==0.7.0 ezdxf==0.14.2 flake8==3.9.1 Flask==2.1.1 Flask-Compress==1.11 fonttools==4.33.3 frozenlist==1.2.0 future==0.18.2 geomdl==5.3.1 gevent==21.8.0 gevent-websocket==0.10.1 gmsh==4.8.4 google-api-core==1.31.1 google-api-python-client==2.15.0 google-auth==1.34.0 google-auth-httplib2==0.1.0 googleapis-common-protos==1.53.0 greenlet==1.1.2 grpcio==1.39.0 helpdev==0.7.1 httplib2==0.19.1 hyperlink==21.0.0 idna==2.10 imageio==2.9.0 imagesize==1.2.0 importlib-metadata==3.10.1 incremental==21.3.0 inflection==0.5.1 iniconfig==1.1.1 intervaltree==3.1.0 ipykernel==5.5.3 ipython==7.22.0 ipython-genutils==0.2.0 isort==5.8.0 itsdangerous==2.1.2 jedi==0.17.2 Jinja2==3.1.2 jinja2-time==0.2.0 joblib==1.0.1 jsonschema==3.2.0 jupyter-client==6.1.12 jupyter-contrib-core==0.3.3 jupyter-contrib-nbextensions==0.5.1 jupyter-core==4.7.1 jupyter-highlight-selected-word==0.2.0 jupyter-latex-envs==1.4.6 jupyter-nbextensions-configurator==0.4.1 jupyterlab-pygments==0.1.2 keyring==23.0.1 kiwisolver==1.3.1 lazy-object-proxy==1.6.0 lxml==4.6.3 manatee==0.0.0 MarkupSafe==2.1.1 matplotlib==3.3.4 mccabe==0.6.1 meshio==4.4.6 mistune==0.8.4 mock==4.0.3 mpmath==1.2.1 multidict==5.2.0 mypy==0.812 mypy-extensions==0.4.3 nbclient==0.5.3 nbconvert==6.0.7 nbformat==5.1.3 ndim==0.1.4 nest-asyncio==1.5.1 notebook==6.3.0 nptyping==1.4.4 npx==0.0.24 numpy==1.21.4 numpydoc==1.1.0 openpyxl==3.0.7 openseespy==3.2.2.10 openseespywin==3.2.2.10 orthopy==0.9.6 packaging==20.9 pandas==1.2.4 pandocfilters==1.4.3 paramiko==2.7.2 parso==0.7.0 pathspec==0.9.0 pefile==2021.9.3 pexpect==4.8.0 pickleshare==0.7.5 Pillow==8.2.0 pixelmatch==0.2.3 pkginfo==1.7.0 platformdirs==2.5.2 plotly==5.7.0 pluggy==0.13.1 poyo==0.5.0 prettytable==2.4.0 progressbar2==3.53.1 prometheus-client==0.10.1 prompt-toolkit==3.0.18 protobuf==3.17.3 psutil==5.8.0 ptyprocess==0.7.0 pure-eval==0.2.1 py==1.10.0 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycodestyle==2.6.0 pycparser==2.20 pydocstyle==6.0.0 pyDOE2==1.3.0 pyecharts==1.9.1 pyflakes==2.2.0 Pygments==2.8.1 pygmsh==7.1.17 pyiges==0.2.0 pyinstaller==4.5.1 pyinstaller-hooks-contrib==2021.3 pylint==2.7.4 pyls-black==0.4.6 pyls-spyder==0.3.2 pymoo==0.5.0 PyNaCl==1.4.0 pyNastran==1.3.3 pyparsing==2.4.7 pypiwin32==223 pyqtgraph==0.12.1 pyrsistent==0.17.3 PySide2==5.15.2 python-dateutil==2.8.1 python-jsonrpc-server==0.4.0 python-language-server==0.36.2 python-slugify==4.0.1 python-utils==2.5.6 pytz==2021.1 pyuff==1.25 pyvista==0.31.3 pyvistaqt==0.5.0 pywin32==300 pywin32-ctypes==0.2.0 pywinpty==0.5.7 PyYAML==5.4.1 pyzmq==22.0.3 QDarkStyle==2.8.1 qstylizer==0.1.10 QtAwesome==1.0.2 qtconsole==5.2.2 QtPy==1.11.2 quadpy==0.16.15 readme-renderer==29.0 regex==2021.4.4 requests==2.25.1 requests-toolbelt==0.9.1 rfc3986==1.5.0 rich==12.4.1 rope==0.18.0 rsa==4.7.2 scikit-learn==0.24.2 scipy==1.8.1 scooby==0.5.7 Send2Trash==1.5.0 shiboken2==5.15.2 simplejson==3.17.6 six==1.15.0 smoot==0.1.0 smt==1.2.0 snowballstemmer==2.1.0 sortedcontainers==2.3.0 Sphinx==3.5.4 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==1.0.3 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.4 spyder==4.2.5 spyder-kernels==1.10.3 swat-em==0.6.3 sympy==1.10.1 tenacity==8.0.1 terminado==0.9.4 testpath==0.4.4 text-unidecode==1.3 textdistance==4.2.1 threadpoolctl==2.1.0 three-merge==0.1.1 tinycss==0.4 toml==0.10.2 tomli==2.0.1 tomli-w==1.0.0 tompy==0.1.5 toolz==0.11.2 tornado==6.1 tqdm==4.61.0 traitlets==5.1.1 transforms3d==0.3.1 twine==3.4.1 Twisted==21.7.0 twisted-iocpsupport==1.0.2 txaio==21.2.1 typed-ast==1.4.3 typing-extensions==4.2.0 typish==1.9.3 ujson==4.0.2 uritemplate==3.0.1 urllib3==1.26.4 varname==0.7.1 vedo==2021.0.6 vega-datasets==0.9.0 vtk==9.0.3 watchdog==1.0.2 wcwidth==0.2.5 webencodings==0.5.1 Werkzeug==2.0.3 whichcraft==0.6.1 wrapt==1.12.1 wslink==1.1.0 x21==0.2.16 xlrd==2.0.1 XlsxWriter==1.4.3 xlwt==1.3.0 yapf==0.31.0 yarl==1.7.2 zipp==3.4.1 zope.event==4.5.0 zope.interface==5.4.0

mikerife commented 2 years ago

Hi @Clemoreau Since this is using PyMAPDL-Reader you may want to post this to its Github page here: https://github.com/pyansys/pymapdl-reader

In the mean time can you either recreate the issue with a model/rst that you can share? Or give us the general description of the model. Size of the model; physics solved; element type(s); material model(s); size of the rst; etc.

Have you tried to open the rst in MAPDL interactive and if so what happens?

Mike

Clemoreau commented 2 years ago

Hello @mikerife

Indeed, thank you for redirecting me to the right page, I'll repost the issue.

I cannot reproduce the issue with another model since I don't know where the problem comes from. That's the first time it happens and I used the piece of code several times with similar files and without any error. Moreover, I don't know which part of the code/file is problematic since the error is quite mysterious : An existing connection was forcibly closed by the remote host]

The error occurs when using the nodal_solution() method, to access one eigenvector.

Here you can find some details about the model: it's a modal analysis, the file is 13Go (I have already read a 14Go rst file without any problem), and the element types are 'Miscellaneous'. image

Finally, the guy who sent me the file, told me that he was able to open it with the APDL interface and to read it properly.

mikerife commented 2 years ago

Hi @Clemoreau ok...so there are no "miscellaneous" element types in MAPDL. And can you open the rst in MAPDL interactive and plot the first eigenvector? Perhaps something happened to the rst on the transfer from him to you.

Mike

Clemoreau commented 2 years ago

Hi @mikerife ok I thought that 'ELMISC' was for miscellaneous elements. image

I didn't know MAPDL interactive but I understand that an Ansys executable is needed to use it and I don't have Ansys on my computer. I just want to extract the results (nodal displacements) from my colleague's rst file.

Indeed, my first assumption was that the file was damaged during the transfer but's it's strange because I still can read the mesh wihtout any problem, it's only when it comes to the nodal_solution(). I asked to my colleague to open its file with python to see if he gets the same problem.

Thanks for your help

akaszynski commented 2 years ago

Hi @mikerife ok I thought that 'ELMISC' was for miscellaneous elements. image

I didn't know MAPDL interactive but I understand that an Ansys executable is needed to use it and I don't have Ansys on my computer. I just want to extract the results (nodal displacements) from my colleague's rst file.

Indeed, my first assumption was that the file was damaged during the transfer but's it's strange because I still can read the mesh wihtout any problem, it's only when it comes to the nodal_solution(). I asked to my colleague to open its file with python to see if he gets the same problem.

Thanks for your help

I think your best bet would be using DPF instead of the legacy reader to access these results.

@germa89, let's make sure we focus on getting full DPF integration up and running so as to avoid these issues in the future. The legacy reader just isn't able to keep up with these requests.

mikerife commented 2 years ago

Hi @Clemoreau @akaszynski gives really great advice. Since you don't have MAPDL installed, and so won't be using PyMAPDL, try out DPF-Post instead. See the documentation here;

https://postdocs.pyansys.com/

Mike

Clemoreau commented 2 years ago

Thanks for the suggestion. However, DPF-Post also needs Ansys installed on the computer, right ? I got this message when using it : image

Do all the pyansys libraries need an Ansys installation ? I didn't realize that in a first place...

akaszynski commented 2 years ago

Do all the pyansys libraries need an Ansys installation ? I didn't realize that in a first place...

Ideally, DPF wouldn't. We're working on that.

For now, use the legacy reader until this can be fixed.

Pinging @anslpa and @PProfizi for visibility.

mikerife commented 2 years ago

Hi @Clemoreau Sorry about that - apparently my notes are horribly out of date! You can use DPF-Core but will need to use it through Docker: https://dpfdocs.pyansys.com/getting_started/docker.html

The PyABCD packages that are solvers, i.e. PyMAPDL, PyFluent, etc, do need the solvers installed. Which makes sense.

And Alex commented while writing this...ok good to hear about DPF dependencies.

Mike

Clemoreau commented 2 years ago

Hi, so I used mapdl-reader through Docker. It was a bit complicated to set up since I didn't know neither Docker nor Linux, but it works now. And the nodal_solution() command is also working !

As I understand it, pyansys (whether it be dpf, mapdl, ...) is running through a local server. When I run it on Windows, the connection to the server seems unstable and sometimes this conenction is lost, so my python script crashes. But when I run it though Docker, with DPF image and the associated container, the connection to the server looks more stable and is never lost.

How do you explain that ? Is it due to the difference of OS ? Also, why are you using a local server ?

Thanks again for your help

akaszynski commented 2 years ago

Hi, so I used mapdl-reader through Docker. It was a bit complicated to set up since I didn't know neither Docker nor Linux, but it works now.

That's awesome news! Well done. Docker is a great tool and it's always a helpful skill to have.

But when I run it though Docker, with DPF image and the associated container, the connection to the server looks more stable and is never lost.

There are known stability issues on Windows, and it's something we're working on addressing in the next release. Much of it comes from merely recording the output of each command. Believe it or not, we have to write out the output of each command to disk(!) on both OSes due to the limitations of MAPDL, but Windows is quite a bit more unstable in this regard due to how they handle file caching.

As for why we're using a local server, it's about how we're trying to separate out individual components/services to make Ansys's products more applicable for large scale deployments and automation.

Clemoreau commented 2 years ago

Ok I see, interesting! It's not really my field but I understand

Thanks again for your help and contributions, I close the issue