PucklaJ / dynareadout

High-Performance C/C++ library for parsing binary output files and key files of LS Dyna (d3plot, binout, input deck)
zlib License
16 stars 5 forks source link

Unable to post-process the MATSUM section of a BINOUT file #42

Closed mdor30 closed 5 months ago

mdor30 commented 5 months ago

Dear PucklaJ,

Thank you for this library! I am using it on Python.

I have some trouble to post-process the MATSUM section of my binout file. When I tried to access any component of the MATSUM file (i.e. the kinetic_energy), I get a Runtime error "RuntimeError: The structure of variable "/matsum/kinetic_energy" is invalid. Time Step 14 differs from the first time step".

I have checked that the components were well included in the MATSUM section. I have no problem to access to the MATSUM section with LSPrePost. I have no problem to post-process the GLSTAT section or the NODOUT section with your library.

Could you help me on that?

The binout file can be accessed with: https://filesender.renater.fr/?s=download&token=e96f1f74-74b7-4dba-b541-f6b41b395f98

PucklaJ commented 5 months ago

Hello mdor30,

i am having a look at it. Thank you for sending me the binout file this makes it easier to find the error.

PucklaJ commented 5 months ago

I fixed the bug. It was caused by brick_id suddenly appearing in time step 14 and then disturbing the structure. My code assumed that kinetic_energy stays at the same place. The fix will be added in the next release. For the time being here is a workaround:

from dynareadout import Binout

binout = Binout("matsum/binout")

time_steps = binout.get_num_timesteps("matsum")
kinetic_energy = []

for t in range(time_steps):
  d_folder = f"d{t+1:06d}"
  data = binout.read(f"matsum/{d_folder}/kinetic_energy")
  kinetic_energy.append(data)

print(kinetic_energy)
mdor30 commented 5 months ago

Thank you for your help!