Extract PointData from d3plot files

Options

Hi,

I would like to understand the correct method for extracting LSDyna results from our d3plot files and adapting them for a web application.
Specifically, we are attempting to extract PointData and create VTK objects to display in our Dash app.
Currently, we have successfully extracted the FieldsContainer, but we are uncertain about how to correctly extract the data.
The provided code represents our best attempt.
We believe that we have successfully extracted the correct PointData, but unfortunately, the data seems to be in the wrong order.
It appears as though all the PointData is misordered, leading to wronged colors in the visual when we attempt to recreate it.

ds = dpf.DataSources()
ds.set_result_file_path(resultFilePath, "d3plot")
model = dpf.Model(ds)
metadata = model.metadata

opVM = dpf.operators.result.stress_von_mises()
opVM.inputs.requested_location.connect("Nodal")
opVM.inputs.data_sources.connect(ds)
opVM.inputs.time_scoping.connect(liste_times_simu.tolist())
vm_fields_container = opVM.outputs.fields_container()

# We believe that this extracts the good data, but it is definitly not in the good order
GOOD_PT_DATA_NOT_WELL_ORDERED = vm_fields_container[21].data[field._data_pointer_as_list]

My questions are:

  • Where and how can I properly extract the PointData from a Field object?
  • Is there an easier way to create objects for our Dash application?
  • Is there a way to directly create HTML elements from our FieldsContainer?

Our best solution so far is creating a VTK file for each frame and then extracting the PointData.
Is there a better solution?

vtkExporter = dpf.operators.serialization.vtk_export()
vtkExporter.inputs.file_path.connect(r'frame21.vtk')
vtkExporter.inputs.fields1.connect(opVM.outputs.fields_container())
vtkExporter.inputs.mesh.connect(metadata.meshed_region)
vtkExporter.run()

However, this approach requires too much space, as we would need to generate over 100 files in our case.

Thank you very much!

Tagged:

Answers

  • Chris Harrold
    Chris Harrold Member, Administrator, Employee Posts: 183
    100 Comments 5 Answers First Anniversary Ansys Employee
    admin

    @BRusu - this is VERY old now, but @Ramdane would be a good resource for asking this (if you've not already gotten an answer) So sorry this sat for so long, and I will keep an eye out to see if you get an answer.

  • larski
    larski Member Posts: 1
    First Comment Name Dropper
    **

    @BRusu - I know I am too late by ages, but this might help others that stumble across this topic...just like I did. For our own in-house tooling we've implemented a file converter from d3plot databases to hdf5. It is called d3plot2hdf5 and it spits out xdmf, too. All d3plot data is bundled into a single hdf5 file. The hdf5 file can easily be processed with widely available tools like, e.g., Python, Matlab, Octave, and others (find an example here). Or, if you want to handle the data more in a vtk-like manner, you can directly parse it using the vtkXdmfReader as it comes with the vtk libraries. Accessing the PointData for all frames is then straightforward. If you are willing to take this slight detour, it may be worth a try...