Skip to content

Error when trying to generate stress field animation of LS-Dyna result (d3plot) #1615

@Rfaelv

Description

@Rfaelv

Before submitting the issue

  • I have checked for Compatibility issues
  • I have searched among the existing issues
  • I am using a Python virtual environment

Description of the bug

Hi, everyone,

Whe I've reproduced the 06-animate_results.py example for my Ls-Dyna result (.d3plot) to animate the stress field I got the following error on my end:

Traceback (most recent call last):
  File "d:\Programacao\LS-Dyna\image_gerenator.py", line 55, in <module>
    stress_fields.animate()
  File "D:\Programacao\LS-Dyna\env\Lib\site-packages\ansys\dpf\core\fields_container.py", line 610, in animate
    return anim.animate(
           ^^^^^^^^^^^^^
  File "D:\Programacao\LS-Dyna\env\Lib\site-packages\ansys\dpf\core\animator.py", line 284, in animate
    return self._internal_animator.animate_workflow(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programacao\LS-Dyna\env\Lib\site-packages\ansys\dpf\core\animator.py", line 146, in animate_workflow
    render_frame(0)
  File "D:\Programacao\LS-Dyna\env\Lib\site-packages\ansys\dpf\core\animator.py", line 98, in render_frame
    self.add_field(
  File "D:\Programacao\LS-Dyna\env\Lib\site-packages\ansys\dpf\core\plotter.py", line 265, in add_field
    overall_data[ind] = field.data[mask]
                        ~~~~~~~~~~^^^^^^
IndexError: boolean index did not match indexed array along dimension 0; dimension is 46284 but corresponding boolean dimension is 15428

For the displacement field the animation was generated well.

Can anyone, please, help me solve this problem?

Steps To Reproduce

  • Download my LS-Dyna results (d3plot):
    test.zip
  • Run the following code:
from ansys.dpf import core as dpf


ds = dpf.DataSources()
ds.set_result_file_path("test\d3plot", "d3plot")
model = dpf.Model(ds)

mesh_scoping = dpf.mesh_scoping_factory.nodal_scoping(model.metadata.meshed_region.nodes.scoping)
time_scoping = dpf.time_freq_scoping_factory.scoping_on_all_time_freqs(model)
stress_op = model.results.stress
stress_op = stress_op.on_time_scoping(time_scoping)
stress_op = stress_op.on_mesh_scoping(mesh_scoping)

stress_fields = stress_op.eval()
stress_fields.animate()

Which Operating System causes the issue?

Windows

Which DPF/Ansys version are you using?

Ansys 2023 R2

Which Python version causes the issue?

3.11

Installed packages

ansys-dpf-core 0.12.2
cachetools 5.3.3
certifi 2024.6.2
charset-normalizer 3.3.2
colorama 0.4.6
contourpy 1.2.1
cycler 0.12.1
fonttools 4.53.0
google-api-core 2.19.0
google-api-python-client 2.133.0
google-auth 2.30.0
google-auth-httplib2 0.2.0
googleapis-common-protos 1.63.1
grpcio 1.64.1
httplib2 0.22.0
idna 3.7
imageio 2.34.1
importlib_metadata 7.1.0
kiwisolver 1.4.5
matplotlib 3.9.0
numpy 1.26.4
packaging 24.1
pillow 10.3.0
pip 23.2.1
platformdirs 4.2.2
pooch 1.8.2
proto-plus 1.23.0
protobuf 4.25.3
psutil 5.9.8
pyasn1 0.6.0
pyasn1_modules 0.4.0
pyparsing 3.1.2
python-dateutil 2.9.0.post0
pyvista 0.43.9
requests 2.32.3
rsa 4.9
scooby 0.10.0
setuptools 65.5.0
six 1.16.0
tqdm 4.66.4
uritemplate 4.1.1
urllib3 2.2.1
vtk 9.3.0
zipp 3.19.2

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions