Lorenzo Lazzari

Thanks for your answer!

I was using clear("var1", "var2", ...), erasing specific variables and not the loop counters; I got rid of this command now anyways. The simulation is actually working as expected - from the point of view of the results -, but crashes as described in the post.

Inspired by your advice, I noticed I was re-initializing the data arrays any time the internal cycle was concluded (so after the saving stage), and I changed it to initialize them only once before starting the first loops. However, the simulation crashed as before.

I also tried to build 3D matrices containing all the data, to be saved at the very end of the loop. Unfortunately, nothing changed even in this configuration... and no data was saved before the crash.

Any other idea that might help? Thanks again!