ansys/pymapdl-reader

Bug located in ...pymapdl_reader

Closed this issue Β· 6 comments

πŸ€“ Before submitting the issue

πŸ” Description of the bug

Eexception thrown out sometimes is
" longint = struct.pack(">I", inth) + struct.pack(">I", intl) struct.error: required argument is not an integer" while reading rst file by code results = pymapdl_reader.read_binary("job.rst") .

or sometimes is
" File "C:\Users\86189\Desktop\JOB\Code\pyAnsysDemo\CZ_FATRES_ansysReader.py", line 6, in
result = pymapdl_reader.read_binary(r"job.rst")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\software\Python3.12\Lib\site-packages\ansys\mapdl\reader\common.py", line 173, in read_binary
result = Result(filename, read_mesh=False, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\software\Python3.12\Lib\site-packages\ansys\mapdl\reader\rst.py", line 145, in init
self._resultheader = self._read_result_header()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\software\Python3.12\Lib\site-packages\ansys\mapdl\reader\rst.py", line 235, in _read_result_header
header = parse_header(self.read_record(103), result_header_keys)
^^^^^^^^^^^^^^^^^^^^^
File "C:\software\Python3.12\Lib\site-packages\ansys\mapdl\reader\common.py", line 110, in read_record
record = self._cfile.read_record(pointer, return_bufsize)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ansys\mapdl\reader\cython\_binary_reader.pyx", line 251, in ansys.mapdl.reader._binary_reader.AnsysFile.read_record
File "ansys\mapdl\reader\cython\_binary_reader.pyx", line 367, in ansys.mapdl.reader._binary_reader.wrap_array
File "ansys\mapdl\reader\cython\_binary_reader.pyx", line 158, in ansys.mapdl.reader._binary_reader.ArrayWrapper.array
ValueError: negative dimensions are not allowed"

The rst file can be open by both ansys workbench and HyperView. So it seems a bug for pymapdl reader.

πŸ•΅οΈ Steps To Reproduce

from ansys.mapdl import reader as pymapdl_reader
results = pymapdl_reader.read_binary("job.rst")
I don't know how to upload the rst file here, anyone who know it please tell me.

πŸ’» Which Operating System are you using?

Windows

🐍 Which Python version are you using?

3.12

πŸ“ PyMAPDL Report

Show the Report!

PyMAPDL Software and Environment Report

Packages Requirements


Core packages

ansys.mapdl.core : 0.67.0
numpy : 1.26.4
platformdirs : 4.2.0
scipy : 1.13.0
grpc : Package not found
ansys.api.mapdl.v0 : Package not found
ansys.mapdl.reader : 0.53.0
google.protobuf : Package not found

Optional packages

matplotlib : 3.8.4
pyvista : 0.43.5
pyiges : 0.3.1
tqdm : 4.66.2

Ansys Installation


Unable to locate any Ansys installations

Ansys Environment Variables


πŸ“ Installed packages

ansys-api-fluent==0.3.12
ansys-api-mapdl==0.5.1
ansys-api-mechanical==0.1.0
ansys-api-meshing-prime==0.1.1
ansys-api-platform-instancemanagement==1.0.0
ansys-api-pyensight==0.3.0
ansys-api-sherlock==0.1.14
ansys-api-systemcoupling==0.1.0
ansys-corba==0.1.1
ansys-dpf-composites==0.2.0
ansys-dpf-core==0.8.1
ansys-dpf-gate==0.3.1
ansys-dpf-gatebin==0.4.1
ansys-dpf-post==0.4.0
ansys-dynamicreporting-core==0.4.0
ansys-fluent-core==0.14.0
ansys-grantami-bomanalytics==1.1.3
ansys-grantami-bomanalytics-openapi==1.0.0
ansys-grantami-recordlists==1.0.0
ansys-grantami-serverapi-openapi==1.0.0
ansys-grpc-dpf==0.8.1
ansys-mapdl-core==0.64.1
ansys-mapdl-reader==0.53.0
ansys-math-core==0.1.1
ansys-mechanical-core==0.8.0
ansys-meshing-prime==0.4.1
ansys-motorcad-core==0.1.3
ansys-openapi-common==1.2.1
ansys-optislang-core==0.2.1
ansys-platform-instancemanagement==1.1.1
ansys-pyensight-core==0.5.3
ansys-pythonnet==3.1.0rc1
ansys-seascape==0.2.0
ansys-sherlock-core==0.2.0
ansys-systemcoupling-core==0.1.3

πŸ“ Logger output file

Show the logger output file.

===============================================================================
       NEW SESSION - 04/05/2024, 14:32:40
===============================================================================
LEVEL - INSTANCE NAME - MODULE - FUNCTION - MESSAGE
DEBUG - pymapdl_global -  launcher - launch_mapdl - No IP address was supplied. Using the default IP address: 127.0.0.1
DEBUG - pymapdl_global -  launcher - launch_mapdl - Using default port 50052
DEBUG - pymapdl_global -  launcher - launch_mapdl - Using 'start_instance' equal to True
DEBUG - pymapdl_global -  launcher - launch_mapdl - Using default executable.

Hi @luckboat

To upload the file, you could rename it to txt and upload it. If it is too big, you might want to upload it to a cloud service (mega, google drive, etc), and share the link here.

Also, this is a pymapdl-reader (ansys-mapdl-reader) issue, so I'm tranfering it to its repo.

Thank you very much for your kindly help, Germa89. The link for the rst file is shown below
https://drive.google.com/file/d/11zBayl1cWJB3gddvswISJ6AwC1iGgsZ2/view?usp=drive_link. Please let me know, if you can't download it. @germa89

The file is asking to request access. Can you make it public? Available to everybody?

@germa89 I am appreciate your help, now it is public. And I re-attach the link below:
https://drive.google.com/file/d/11zBayl1cWJB3gddvswISJ6AwC1iGgsZ2/view?usp=drive_link for your convenience.

Ran into this the other day when working with a cyclic result from 2022R2 that was ~16GB. Issue seems to be we still don't handle compression correctly in all cases, and it's not something that I'll be able to fix within this repo.

However, you can work around this by disabling compression with:

FINISH
/FCOMP,RST,0

Note that this increased the result size from 16GB to 21GB.