-
Notifications
You must be signed in to change notification settings - Fork 25
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
save_as_vtk fails for RST file (ansys.mapdl.reader) #240
Comments
I just had a closer look at the model. The model is a shell & beam model where the orientation of the beams is defined via orieantation nodes. In total there are 161176 nodes, yet only 151877 nodes are active nodes (aka no orientation nodes). The remaining nodes are inactive nodes (orientation nodes) which can be selected via NSLE,S,INACTIVE. For these inactive (orientation) nodes there are no nodal results. Any idea how to make the export working? |
Interesting.... can you share the model? So I can have a better look at the issue? |
Can I send you the link to the model privately`If so please let me know how. Thx. |
I just created a reduced test case which contains 10955 nodes and some elements In this model 949 nodes are inactive nodes (orientation nodes) and 10077 nodes are active nodes which contribute to the DOF count. The result set contains one load set only. Running this model with the code from above gives an error as follows: ValueError: data length of (10077) != required length (10955) Is there an option to unselect the orientation nodes before writing to vtk? You can find the result file here: |
Hi @MichaelZimmermannMNE & @germa89 MichaelZ - the PyMAPDL Reader is a stand-alone tool. Meaning that it is not interacting with an MAPDL instance like PyMAPDL does. So it cannot respect the nsel,u,inactive command. And as far as I can tell PyVista does not have an "beam" object type like most FEA programs do. I.E. a line defined by its end points, some 3rd point defining an orientation, and a cross-section definition. The line in PyVista is a true 2 point line. VTK is just huge...I tried to slog my way through the documentation and I don't think it has a FEA style beam object either. Now the PyMAPDL mesh.grid method can save the vtk data but it kind of outsmarts itself. In the function it selects all the nodes defining the elements (APDL command). So even though generally speaking we can work with sub-sets of elements and nodes with the mesh method, issuing that nsel,u,inactive prior to creating the vtk object would be undone by the internal logic. Since I'm self-learning Python and working with PyMAPDL quite a bit (not a developer though!) I was sketching out an idea of how to write out a solid element representation of a FEA beam. But the results are making my brain sweat. The cross section corner nodes results can be written to the result file. The order is an internal solution order and not the as defined by the cross section mesh order. So not trivial (to me) to get the mapping of node numbers right. Sorry I don't really have a good answer for you. Mike |
This is not very straight forward to solve if there is no vtk element for a quadratic beam element. I have seen there is a polyline object: We might be able to adapt it to our needs with minimal changes. I have also seen this: Leaving it here for (maybe) future references. |
Recently, I resolved the issue through another approach. My model includes three types of elements: beam, shell, and solid, with a total of over 200 parts. First, I export the corresponding dat files for each part based on the mechanical API. Then, I convert the dat files into vtu files by mapdl.reader.Finally, utilize the Python vtk library to read the vtu files and transform them into vtu objects (perhaps it's possible to skip the file step and directly convert to vtu memory objects), and use the vtkAppendFilter class in vtk to merge all the vtu files. |
Before submitting the issue
pip install --upgrade --upgrade-strategy eager ansys-mapdl-core
)Description of the bug
I have a rst file (size approx 2 GB) for which I would like to export the results to VTK/VTU file format. The rst file contains 4 static loadcases which where solved with Ansys MAPDL 18.x.
I can read the RST file and plot results. Yet, result.save_as_vtk() leads to an exception in PyVista as follows:
ValueError: data length of (151876) != required length (161175)
The demo files provided by PyAnsys work well and export the data to VTK/VTU format as expected.
Steps To Reproduce
Code as follows:
leads to the following error:
Which Operating System are you using?
Windows
Which Python version are you using?
3.9
PyMAPDL Report
Show the Report!
Installed packages
Show the installed packages!
Logger output file
No response
The text was updated successfully, but these errors were encountered: