qd-cae / qd-cae-python

qd python library for CAE (currently mostly LS-Dyna)
http://www.qd-eng.de/
Other
134 stars 39 forks source link

D3plot does not read all the time steps #38

Closed hzoghi closed 6 years ago

hzoghi commented 6 years ago

Reading a d3plot file with D3plot object and it looks like the class is not able to automatically read the entire series because the naming convention changes from numeric to alphabetic.

The file names are x.d3plot x.d3plot01 x.d3plot02 x.d3plot03 x.d3plot04 x.d3plot05 and then the names change slightly to: x.d3plotab x.d3plotac ... x.d3plotal

and the D3plot class is reading the time steps up to x.d3plot05 and when misses the rest, if you open the d3plot with LSPre-Post you will see the simulation has 16 time steps while D3plot shows only 5.

1.zip 2.zip 3.zip 4.zip

Thanks for the good work by the way.

codie3611 commented 6 years ago

Hey, yeah this was intended when I coded it. I always thought there would be only numbers in the rear, especially since mine usually have four digits which is more than enough. Is this default behavior by the solver?

hzoghi commented 6 years ago

Yes, I used LS-PrePost to setup the simulation. Here is the explanation from LSTC:

"Total output data can amount to several gigabytes or more depending on the model size. For ls-dyna runs with mesh adaptivity, the root name has a two letter appendage for each adapted mesh. Starting from ‘aa’ through ‘az’, then ‘ba’ through ‘bz’ and continuing up to ‘zz’, this gives a maximum of 676 possible adaptions. For example if the root name is ‘d3plot’ the subsequent files related to the original mesh are ‘d3plot01’, d3plot02, …, after adaption the new mesh and undeformed geometry is put in ‘d3plotaa’ and the subsequent files for the new mesh are: ‘d3plotaa01’, d3plotaa02, … The next adapted mesh will be in file ‘d3plotab’ and so on. A set of files at a particular adaption can be read separately by giving the root name with appendage, as the base file name".

Look at page 5 in: LS-DYNA Database Binary Output

It's a little tricky, because when you have letters, it also indicates that the nodes and the elements have changed and possibly you have more nodes than what you had in the beginning. I don't know how qd.cae.D3plot can handle this, because right now you get a single set of nodes from the d3plot file while if you have mesh adaptivity, you have a different story at every step and this is quite common in large deformation problems.

Let me know if I can help and keep up the good work.

codie3611 commented 6 years ago

Hmmm the major purpose of the library was to give data access, changing the data inbetween (like changing the mesh) is not intended by the datastructure (though possible). A file currently holds one mesh, managing several would not only complicate internals, it would also complicate the API much more, which Iam more worried about. Can't you simply load each of these different meshes separately with the D3plot class? From the description it should work if there are numbers behind the letters.

hzoghi commented 6 years ago

It might be possible but I don't know how to do that, When I try to read a file which is not the first one in the d3plot family:

from qd.cae.dyna import D3plot
address = r'1_stage1_forming\1_stage1_forming.d3plotab'
d3_adaptive = D3plot(address)

I get this error message:

RuntimeError: Anticipated file ending wrong in geometry section. Maybe if you have a class to read each d3plot file separately this could have been handled.

codie3611 commented 6 years ago

Hmm either it took the wrong file for reading the geometry or an inconsistency happened in case of mesh refinement. Are the files you provided an entire run? If I understood you correctly in a refinement you get e.g. d3plotaa, d3plotaa01, ... if you can also give me these files from the first refinement step then I can take a look at it.

hzoghi commented 6 years ago

The ones that I have included in my original post do not have files like d3plotaa01, In my original senario, the mesh changes after d3plot ab to ac and so on, in other terms once mesh adaptivity starts there aren't two consecutive d3plot files with the same mesh. In general, as long as the difference between the d3plot files are only the numbers the mesh is the same, when letter are added or changed it indicates that the mesh has changed.

I have another simulation that has something similar to what you are asking but the d3plot family is very bulky. So I am attaching the keyword files that you need to run the simulation and generate the d3plot files. opl-data-backup.zip You just need to open the "master.bat" file and modify the paths to where you have your solver files installed on your machine. Just make sure not to mix the single precision and double precision. Once you have modified the batch file just run it and the simulation will start. Let me know if you need my help again.

The last two files in the d3plot family ( .d3plotao and .d3plotao1) should be of interest to you. Plus the first page of the intoduction of LSTC's D3plot format documentation, clearly explains the naming convention when there is adaptivity/refinement. I suggest you take a look at that too: http://ftp.lstc.com/anonymous/outgoing/trent001/manuals/ls-dyna_database.pdf

hzoghi commented 6 years ago

I just noticed when you are solving the above with newer versions of DYNA you do not get the desired .d3plotao and .d3plotao01 so you might not get what you are looking for from the above simulation. If you definitely need to have such an example I'll try my best to generate one but because I cannot directly control the results this might be a little difficult. Sorry for the inconvenience.

codie3611 commented 6 years ago

Kk yeah don't fight it too much, I will try some stuff myself then.

codie3611 commented 6 years ago

It may be a coincidence but another person has a similar issue in https://github.com/qd-cae/qd-cae-python/issues/31. It might be the same problem (the error is similar during file reading), maybe it is related to using a newer solver version

hzoghi commented 6 years ago

It's possible, I am reading the d3plot documentation released by LSTC and I might even be able to create a json file defining the existing values and addresses accordingly, I'll pass it on if it is successful.

codie3611 commented 6 years ago

don't wanna spoil your motivation but we tried that in the past ... the problem is there are many (confusing) conditionals in the text. Some even undocumented. JSON can not handle conditionals. We also tried to "scrape" the documentation with python and get stuff automatically but especially due to the conditionals it failed. We were really desperate enough to try a lot ^^

I will let you know when there is some progress.

codie3611 commented 6 years ago

It seems the part names section was the issue. After the two fixes I can read the files without problem.

image

I pre-compiled 0.8.2 windows wheels in the dev branch dist folder. If you are on Linux simply clone the dev branch and compile it yourself.

hzoghi commented 6 years ago

Thanks buddy, I'll check this out.

hzoghi commented 6 years ago

It's working now, great. Thanks