ansys / pymapdl

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

Bug located in `cyclic_static.py` example #2255

Closed clatapie closed 11 months ago

clatapie commented 1 year ago

šŸ¤“ Before submitting the issue

šŸ” Description of the bug

When running the cyclic_static.py file on Windows, the following error appears:

CRITICAL - pymapdl_global -  logging - handle_exception - Uncaught exception
Traceback (most recent call last):
  File "d:\repos\pyansys\pymapdl_1\examples\00-mapdl-examples\cyclic_static.py", line 65, in <module>  
    output = mapdl.solve()
  File "D:\repos\pyansys\pymapdl_1\src\ansys\mapdl\core\_commands\solution\analysis_options.py", line 3450, in solve
    return self.run(command, **kwargs)
  File "D:\repos\pyansys\pymapdl_1\src\ansys\mapdl\core\mapdl.py", line 3224, in run
    self._raise_errors(text)
  File "D:\repos\pyansys\pymapdl_1\src\ansys\mapdl\core\mapdl.py", line 4303, in _raise_errors
    self._raise_output_errors(text)
  File "D:\repos\pyansys\pymapdl_1\src\ansys\mapdl\core\mapdl.py", line 4380, in _raise_output_errors  
    raise MapdlRuntimeError(
ansys.mapdl.core.errors.MapdlRuntimeError:

Error in instance GRPC_127.0.0.1:50052

*** ERROR ***                           CP =       0.859   TIME= 17:52:12
There is at least 1 small equation solver pivot term (e.g., at the UZ
degree of freedom of node 423).  Please check for an insufficiently
constrained model.
   *** ELEMENT RESULT CALCULATION TIMES
     TYPE    NUMBER   ENAME      TOTAL CP  AVE CP
        2       210  SOLID185      0.000   0.000000
   *** NODAL LOAD CALCULATION TIMES
     TYPE    NUMBER   ENAME      TOTAL CP  AVE CP
        2       210  SOLID185      0.000   0.000000
*** LOAD STEP     1   SUBSTEP     1  COMPLETED.    CUM ITER =      1
*** TIME =   1.00000         TIME INC =   1.00000      NEW TRIANG MATRIX

šŸ•µļø Steps To Reproduce

python ./cyclic_static.py

šŸ’» Which Operating System are you using?

Windows

šŸ Which Python version are you using?

3.10

šŸ“ PyMAPDL Report

Show the Report! ```text ------------------------------------------------------------------------------- PyAnsys Software and Environment Report ------------------------------------------------------------------------------- Date: Thu Aug 17 12:22:45 2023 Romance Daylight Time OS : Windows CPU(s) : 24 Machine : AMD64 Architecture : 64bit RAM : 63.7 GiB Environment : Python GPU Vendor : Intel GPU Renderer : Intel(R) UHD Graphics 770 GPU Version : 4.5.0 - Build 31.0.101.3358 Python 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)] ansys.mapdl.core : 0.66.dev0 numpy : 1.25.2 platformdirs : 3.10.0 scipy : 1.11.1 grpc : 1.51.1 ansys.api.mapdl.v0 : Version unknown ansys.mapdl.reader : 0.52.20 google.protobuf : 3.20.3 matplotlib : 3.7.2 pyvista : 0.41.1 pyiges : 0.3.1 tqdm : 4.66.1 ansys_sphinx_theme : 0.10.2 ansys.dpf.core : 0.9.0 ansys.dpf.post : Module not found ansys.dpf.gate : Version unknown ansys.fluent.core : Module not found ansys.fluent.visualization : Module not found ansys.fluent.parametric : Module not found ansys.grantami.bomanalytics : Module not found ansys.openapi.common : Module not found ansys.platform.instancemanagement : 1.1.2 ansys.seascape : Module not found ansys.tools.report : 0.6.0 ansys.tools.versioning : 0.4.0 pyaedt : Module not found appdirs : 1.4.4 ------------------------------------------------------------------------------- Ansys Environment Report ------------------------------------------------------------------------------- Ansys Installation ****************** No Ansys installations provided Ansys Environment Variables *************************** ANSYS222_DIR C:\Program Files\ANSYS Inc\v222\ANSYS ANSYS231_DIR C:\Program Files\ANSYS Inc\v231\ANSYS ANSYSLIC_DIR C:\Program Files\ANSYS Inc\Shared Files\Licensing ANSYS_DPF_ACCEPT_LA Y ANSYS_LOCAL True AWP_LOCALE222 en-us AWP_ROOT222 C:\Program Files\ANSYS Inc\v222 AWP_ROOT231 C:\Program Files\ANSYS Inc\v231 CADOE_LIBDIR222 C:\Program Files\ANSYS Inc\v222\CommonFiles\Language\en-us CADOE_LIBDIR231 C:\Program Files\ANSYS Inc\v231\CommonFiles\Language\en-us ```

šŸ“ Installed packages

Show the installed packages! ```text accessible-pygments==0.0.4 aiohttp==3.8.5 aiosignal==1.3.1 alabaster==0.7.13 ansys-api-mapdl==0.5.1 ansys-api-platform-instancemanagement==1.0.0 ansys-dpf-core==0.9.0 ansys-dpf-gate==0.4.1 ansys-dpf-gatebin==0.4.1 ansys-grpc-dpf==0.8.1 -e git+https://github.com/pyansys/pymapdl.git@ff938e7afc0e0ff0a599dd00c1b5c34077256046#egg=ansys_mapdl_core ansys-mapdl-reader==0.52.20 ansys-math-core==0.1.2 ansys-platform-instancemanagement==1.1.2 ansys-sphinx-theme==0.10.2 ansys-tools-path==0.3.1 anyio==3.7.1 appdirs==1.4.4 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 arrow==1.2.3 asttokens==2.2.1 async-lru==2.0.4 async-timeout==4.0.2 attrs==23.1.0 autopep8==2.0.2 Babel==2.12.1 backcall==0.2.0 beautifulsoup4==4.12.2 bleach==6.0.0 cachetools==5.3.1 certifi==2023.7.22 cffi==1.15.1 charset-normalizer==3.2.0 click==8.1.6 colorama==0.4.6 comm==0.1.4 contourpy==1.1.0 coverage==7.2.7 cycler==0.11.0 debugpy==1.6.7.post1 decorator==5.1.1 defusedxml==0.7.1 docutils==0.20.1 exceptiongroup==1.1.2 executing==1.2.0 fastjsonschema==2.18.0 fonttools==4.42.0 fqdn==1.5.1 frozenlist==1.4.0 geomdl==5.3.1 google-api-core==2.11.1 google-api-python-client==2.96.0 google-auth==2.22.0 google-auth-httplib2==0.1.0 googleapis-common-protos==1.60.0 grpcio==1.51.1 httplib2==0.22.0 idna==3.4 imageio==2.31.1 imageio-ffmpeg==0.4.8 imagesize==1.4.1 importlib-metadata==6.8.0 iniconfig==2.0.0 ipydatawidgets==4.3.5 ipykernel==6.25.1 ipython==8.14.0 ipywidgets==8.1.0 isoduration==20.11.0 jedi==0.19.0 Jinja2==3.1.2 json5==0.9.14 jsonpointer==2.4 jsonschema==4.19.0 jsonschema-specifications==2023.7.1 jupyter-events==0.7.0 jupyter-lsp==2.2.0 jupyter-sphinx==0.4.0 jupyter_client==8.3.0 jupyter_core==5.3.1 jupyter_server==2.7.0 jupyter_server_terminals==0.4.4 jupyterlab==4.0.4 jupyterlab-pygments==0.2.2 jupyterlab-widgets==3.0.8 jupyterlab_server==2.24.0 kiwisolver==1.4.4 livereload==2.6.3 MarkupSafe==2.1.3 matplotlib==3.7.2 matplotlib-inline==0.1.6 mistune==3.0.1 multidict==6.0.4 nbclient==0.8.0 nbconvert==7.7.3 nbformat==5.9.2 nest-asyncio==1.5.7 notebook_shim==0.2.3 numpy==1.25.2 numpydoc==1.5.0 overrides==7.4.0 packaging==23.1 pandas==2.0.3 pandocfilters==1.5.0 parso==0.8.3 pickleshare==0.7.5 Pillow==10.0.0 platformdirs==3.10.0 plotly==5.15.0 pluggy==1.2.0 pooch==1.7.0 prometheus-client==0.17.1 prompt-toolkit==3.0.39 protobuf==3.20.3 psutil==5.9.5 pure-eval==0.2.2 pyansys-tools-report==0.6.0 pyansys-tools-versioning==0.4.0 pyasn1==0.5.0 pyasn1-modules==0.3.0 pycodestyle==2.11.0 pycparser==2.21 pydata-sphinx-theme==0.13.3 Pygments==2.16.1 pyiges==0.3.1 pypandoc==1.11 pyparsing==3.0.9 pytest==7.4.0 pytest-cov==4.1.0 pytest-rerunfailures==12.0 pytest-sphinx==0.5.0 python-dateutil==2.8.2 python-json-logger==2.0.7 pythreejs==2.4.2 pytz==2023.3 pyvista==0.41.1 pywin32==306 pywinpty==2.0.11 PyYAML==6.0.1 pyzmq==25.1.1 referencing==0.30.2 requests==2.31.0 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 rpds-py==0.9.2 rsa==4.9 scipy==1.11.1 scooby==0.7.2 Send2Trash==1.8.2 six==1.16.0 sniffio==1.3.0 snowballstemmer==2.2.0 soupsieve==2.4.1 Sphinx==7.1.1 sphinx-autobuild==2021.3.14 sphinx-autodoc-typehints==1.24.0 sphinx-copybutton==0.5.2 sphinx-gallery==0.13.0 sphinx-notfound-page==0.8.3 sphinx-reredirects==0.1.2 sphinx_design==0.5.0 sphinxcontrib-applehelp==1.0.6 sphinxcontrib-devhelp==1.0.4 sphinxcontrib-htmlhelp==2.0.3 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.5 sphinxcontrib-serializinghtml==1.1.7 sphinxcontrib-websupport==1.2.6 sphinxemoji==0.2.0 stack-data==0.6.2 tenacity==8.2.2 terminado==0.17.1 tinycss2==1.2.1 tomli==2.0.1 tornado==6.3.2 tqdm==4.66.1 traitlets==5.9.0 traittypes==0.2.1 trame==3.1.0 trame-client==2.10.0 trame-server==2.11.7 trame-vtk==2.5.8 trame-vuetify==2.3.1 typing_extensions==4.7.1 tzdata==2023.3 uri-template==1.3.0 uritemplate==4.1.1 urllib3==1.26.16 vtk==9.2.6 wcwidth==0.2.6 webcolors==1.13 webencodings==0.5.1 websocket-client==1.6.1 widgetsnbextension==4.0.8 wslink==1.11.1 yarl==1.9.2 zipp==3.16.2 ```

šŸ“ Logger output file

Show the logger output file. ```text # PASTE HERE THE CONTENT OF THE LOGGER OUTPUT FILE. ```
clatapie commented 1 year ago

Pinging @mikerife for visibility.

This issue is not raised when running the file with MacOS and with Ubuntu.

germa89 commented 1 year ago

The first thing will be to check the output.out file in the Linux machine, and see if that error is there too but it is not caught by _raise_errors function.

If it is there.. it is probably a parser issue in the mentioned function.

If it is not, then it is MAPDL... I know it has different configurations for machines and OSs.

germa89 commented 11 months ago

I saw this error while building the docs locally with v231. I think I did check it locally using Mac + v22.2 Ubuntu, and I didn't see that error. So it might be a Windows configuration issue.

germa89 commented 11 months ago

I checked with Mac + v22.2 Ubuntu and Windows + v22.2. And it seems PyMAPDL is passing the same APDL commands in both cases.

Windows APDL LOG

Show log ```apdl ! APDL log script generated using PyMapdl (ansys.mapdl.core 0.66.dev0) /POST26 NUMVAR,200 FINISH, /SHOW,PNG,,, /NERR,,,-1,, /INQUIRE,,DIRECTORY,, /INQUIRE,,DIRECTORY,, /INQUIRE,,DIRECTORY,, /OUT,_input_tmp_phvfkoqsds_.out CDREAD,'DB','C:\Users\gayuso\Others_pymapdls\pymapdl_0\pymapdl\.venv\Lib\site-packages\ansys\mapdl\reader\examples\sector.cdb' /INQUIRE,,DIRECTORY,, __tmpvar__ = wrinqr(1) *GET,__floatparameter__,ELEM,,COUNT,,,,,,, CM,__NODE__, NODE NSLE,S,, __tmpvar__ = wrinqr(1) *GET,__floatparameter__,ELEM,,COUNT,,,,,,, CMSEL,S,__NODE__,NODE /PREP7, CYCLIC,,,,,, MP,NUXY,1,0.31,,,, MP,DENS,1,0.00041408,,,, MP,EX,1,16900000,,,, OMEGA,0,0,1000 CSYS,1 NSEL,S,LOC,X,0.69,0.71,, D,ALL,ALL,,,,,,,,, ALLSEL,, CSYS,0 /SOLU ANTYPE,STATIC,,,, SOLVE, /INQUIRE,,DIRECTORY,, ```

Mac OS + v22.2 Ubuntu docker image

Show log ```apdl ! APDL log script generated using PyMapdl (ansys.mapdl.core 0.66.dev0) /POST26 NUMVAR,200 FINISH, /SHOW,PNG,,, /NERR,,,-1,, /INQUIRE,,DIRECTORY,, /CLE,NOSTART /SYS,ls > __tmp_sys_out_ufcwxnkguf__ /DELETE,__tmp_sys_out_ufcwxnkguf__,,, /OUT,_input_tmp_sdjqntqksk_.out CDREAD,'DB','sector.cdb' /DELETE,_input_tmp_sdjqntqksk_.inp,,, /DELETE,_input_tmp_sdjqntqksk_.out,,, /SYS,ls > __tmp_sys_out_nbuygbtsjm__ /DELETE,__tmp_sys_out_nbuygbtsjm__,,, __tmpvar__ = wrinqr(1) *GET,__floatparameter__,ELEM,,COUNT,,,,,,, CM,__NODE__, NODE NSLE,S,, __tmpvar__ = wrinqr(1) *GET,__floatparameter__,ELEM,,COUNT,,,,,,, CMSEL,S,__NODE__,NODE /PREP7, CYCLIC,,,,,, MP,NUXY,1,0.31,,,, MP,DENS,1,0.00041408,,,, MP,EX,1,16900000,,,, OMEGA,0,0,1000 CSYS,1 NSEL,S,LOC,X,0.69,0.71,, D,ALL,ALL,,,,,,,,, ALLSEL,, CSYS,0 /SOLU ANTYPE,STATIC,,,, SOLVE, ```

And I still get the following error:

MapdlRuntimeError                         Traceback (most recent call last)
Cell In[8], line 46
     44 mapdl.run("/SOLU")
     45 mapdl.antype("STATIC")
---> 46 output = mapdl.solve()

File ~\Others_pymapdls\pymapdl_0\pymapdl\src\ansys\mapdl\core\_commands\solution\analysis_options.py:3450, in AnalysisOptions.solve(self, action, **kwargs)
   3430 """Starts a solution.
   3431
   3432 APDL Command: SOLVE
   (...)
   3447 in the first phase of a linear perturbation analysis.
   3448 """
   3449 command = f"SOLVE,{action}"
-> 3450 return self.run(command, **kwargs)

File ~\Others_pymapdls\pymapdl_0\pymapdl\src\ansys\mapdl\core\mapdl.py:3310, in _MapdlCore.run(self, command, write_to_log, mute, **kwargs)
   3307     return self._response
   3309 if not self.ignore_errors:
-> 3310     self._raise_errors(text)
   3312 # special returns for certain geometry commands
   3313 short_cmd = parse_to_short_cmd(command)

File ~\Others_pymapdls\pymapdl_0\pymapdl\src\ansys\mapdl\core\mapdl.py:4458, in _MapdlCore._raise_errors(self, text)
   4456 # flag errors
   4457 if "*** ERROR ***" in flat_text:
-> 4458     self._raise_output_errors(text)

File ~\Others_pymapdls\pymapdl_0\pymapdl\src\ansys\mapdl\core\mapdl.py:4535, in _MapdlCore._raise_output_errors(self, response)
   4529     continue
   4530 else:
   4531     # We don't need to log exception because they already included in the main logger.
   4532     # logger.error(response)
   4533     # However, exceptions are recorded in the global logger which do not record
   4534     # information of the instances name, hence we edit the error message.
-> 4535     raise MapdlRuntimeError(
   4536         f"\n\nError in instance {self.name}\n\n" + error_message
   4537     )

MapdlRuntimeError:

Error in instance GRPC_127.0.0.1:50052

*** ERROR ***                           CP =       1.672   TIME= 10:19:55
 There is at least 1 small equation solver pivot term (e.g., at the UZ
 degree of freedom of node 423).  Please check for an insufficiently
 constrained model.
   *** ELEMENT RESULT CALCULATION TIMES
     TYPE    NUMBER   ENAME      TOTAL CP  AVE CP
        2       210  SOLID185      0.016   0.000074
   *** NODAL LOAD CALCULATION TIMES
     TYPE    NUMBER   ENAME      TOTAL CP  AVE CP
        2       210  SOLID185      0.000   0.000000
 *** LOAD STEP     1   SUBSTEP     1  COMPLETED.    CUM ITER =      1
 *** TIME =   1.00000         TIME INC =   1.00000      NEW TRIANG MATRIX

It must be a Windows/Linux difference I think.

I did think it was a difference in the mapdl.nsel command, but after go through each line in both cases, the nodes selected are the same.

>>> mapdl.csys(1)  # enter the cyclic coordinate system
>>> mapdl.nsel("S", "loc", "x", 0.69, 0.71)  # radial between 0.69 - 0.71
array([ 59,  76, 146, 163, 737, 754, 824, 841])

So I guess it is an MAPDL issue??

Windows is using default configuration (so I guess it is using DMP) and launched with:

"C:\Program Files\ANSYS Inc\v222\ansys\bin\winx64\ansys222.exe" -j file -np 2  -b -i .__tmp__.inp -o .__tmp__.out  -port 50052 -grpc

in the docker image we have:

$ ps aux | grep ansys
root         1  0.0  0.0 146540  4468 ?        Ss   05:40   0:00 /rosetta/rosetta /bin/bash ansys -grpc
root         7  0.0  0.0 148384  7328 ?        S    05:40   0:00 /rosetta/rosetta /bin/bash /ansys_inc/v222/ansys/bin/mapdl -grpc
root       164  0.0  0.0 150280  4340 ?        S    05:40   0:00 /rosetta/rosetta /bin/sh /ansys_inc/v222/commonfiles/MPI/Intel/2021.6.0/linx64/bin/mpirun -np 1 -env KMP_AFFINITY norespect /ansys_inc/v222/ansys/bin/ansysdis222 -grpc : -np 3 /ansys_inc/v222/ansys/bin/ansysdis222 -grpc
root       169  0.0  0.0 153884  4528 ?        S    05:40   0:00 /rosetta/rosetta /ansys_inc/v222/commonfiles/MPI/Intel/2021.6.0/linx64/bin/mpiexec.hydra -np 1 -env KMP_AFFINITY norespect /ansys_inc/v222/ansys/bin/ansysdis222 -grpc : -np 3 /ansys_inc/v222/ansys/bin/ansysdis222 -grpc
root       170  0.0  0.0 153704  5632 ?        S    05:40   0:00 /rosetta/rosetta /ansys_inc/v222/commonfiles/MPI/Intel/2021.6.0/linx64/bin//hydra_pmi_proxy --usize -1 --auto-cleanup 1 --abort-signal 9
root       173  0.0  0.1 153816  8936 ?        S    05:40   0:00 /rosetta/rosetta /bin/bash /ansys_inc/v222/ansys/bin/ansysdis222 -grpc
root       174  0.0  0.1 153812  8936 ?        S    05:40   0:00 /rosetta/rosetta /bin/bash /ansys_inc/v222/ansys/bin/ansysdis222 -grpc
root       175  0.0  0.1 153812  8936 ?        S    05:40   0:00 /rosetta/rosetta /bin/bash /ansys_inc/v222/ansys/bin/ansysdis222 -grpc
root       176  0.0  0.1 153812  8920 ?        S    05:40   0:00 /rosetta/rosetta /bin/bash /ansys_inc/v222/ansys/bin/ansysdis222 -grpc
root       697  0.0  6.1 8375372 497976 ?      S    05:40   0:07 /rosetta/rosetta /ansys_inc/v222/ansys/bin/linx64/ansys.e -grpc
root       701  0.0  6.1 8375312 497020 ?      S    05:40   0:06 /rosetta/rosetta /ansys_inc/v222/ansys/bin/linx64/ansys.e -grpc
root       703  0.0  6.1 8374804 497632 ?      S    05:40   0:07 /rosetta/rosetta /ansys_inc/v222/ansys/bin/linx64/ansys.e -grpc
root       704  0.2  7.7 10523968 619792 ?     Sl   05:40   0:25 /rosetta/rosetta /ansys_inc/v222/ansys/bin/linx64/ansys.e -grpc
germa89 commented 11 months ago

I would normally add something to fully constrain the model and move on, but the fact that this error is not shown in the ubuntu log bugs me a lot.

germa89 commented 11 months ago

Checking with MAPDL GUI on Windows I get the following nodes constrained:

image