ansys / pymapdl-reader

Legacy binary interface to MAPDL binary files.
https://reader.docs.pyansys.com
MIT License
43 stars 20 forks source link

An error occurred in reading the cdb file of the model with cracks #450

Open planestress opened 1 week ago

planestress commented 1 week ago

πŸ” Before submitting the issue

🐞 Description of the bug

I used archive=pymapdl_reader.Archive('static.cdb')command to read elements and nodes informations from the cdb file,where "static.cdb" is a file produced by software FRANC3D,an error occurred as

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\31142\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ansys\mapdl\reader\archive.py", line 124, in __init__
    self._raw = _reader.read(
                ^^^^^^^^^^^^^
  File "ansys\\mapdl\\reader\\cython\\_reader.pyx", line 375, in ansys.mapdl.reader._reader.read
ValueError: invalid literal for int() with base 10: b'SOLID'

If I use this command read other uncracked models' cdb file it worked.

πŸ“ Steps to reproduce

Creat a uncracked model and caculate with ANSYS and import it into FRANC3D,then introduce a crack to the model and save the file,there will be a cdb file generated.Next,read this cdb file with pymapdl_reaader.Archivecommand,the error will occur.

πŸ’» Which operating system are you using?

Windows

πŸ“€ Which ANSYS version are you using?

19.2

🐍 Which Python version are you using?

3.11

πŸ“¦ Installed packages

ansys-api-mapdl==0.5.1
ansys-api-platform-instancemanagement==1.0.0
ansys-corba==0.1.1
ansys-mapdl-core==0.67.0
ansys-mapdl-reader==0.53.0
ansys-math-core==0.1.3
ansys-platform-instancemanagement==1.1.2
ansys-tools-path==0.5.1
appdirs==1.4.4
certifi==2024.2.2
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
contourpy==1.1.1
cycler==0.12.1
fonttools==4.50.0
geomdl==5.3.1
grpcio==1.62.1
idna==3.6
importlib-metadata==4.13.0
importlib_resources==6.4.0
kiwisolver==1.4.5
matplotlib==3.7.5
numpy==1.24.4
packaging==24.0
pandas==2.0.3
pillow==10.3.0
platformdirs==4.2.0
pooch==1.8.1
protobuf==3.20.3
psutil==5.9.8
pyansys-tools-versioning==0.4.0
pyiges==0.3.1
pyparsing==3.1.2
python-dateutil==2.9.0.post0
pytz==2024.1
pyvista==0.43.5
requests==2.31.0
scipy==1.10.1
scooby==0.9.2
six==1.16.0
tqdm==4.66.2
tzdata==2024.1
urllib3==2.2.1
vtk==9.3.0
zipp==3.18.1
planestress commented 1 week ago

@germa89 @mikerife Please help me.

mikerife commented 1 week ago

@planestress Can you share the static.cdb file?

planestress commented 1 week ago

@planestress Can you share the static.cdb file?

Of course,here it is. static.zip

mikerife commented 6 days ago

Hi @planestress @germa89 Thanks for sharing the cdb file. So there are a few things wrong with the file that the PyMAPDL Reader Archive reader expects. I don't have access to FRANC3D so I don't know if you can change the settings there to address these issues or not.

1 The file is not really a CDB file, it is an input file. I diffrentiate between an 'cdb' file and an 'input' file in the content. This cdb file has APDL to run a solution and post-processing. True cdb files have just the FEM. It should not make a difference to the PyMAPDL Reader but if you read the cdb into MAPDL then you need to know this...well if you don't want to do the solve etc.

If you do want to import into MAPDL you may want to edit out the commands that change the working directory and the filename in the cdb file.

2 PyMAPDL Reader expects the NBLOCK and EBLOCK commands to have the max entity number and the count on the lines. You can find the help on the cdb commands here.

3 The nodes in the NBLOCK should be in ascending order, for PyMAPDL Reader, but the last node defined in the file is not the node with the largest ID.

Mike