Closed kahilah closed 3 years ago
@kahilah ... this is indeed not implemented at the moment. While the method names are the same, the objects that are saved to HDF are quite different. In a nutshell, the onedim
variant converts each of the domains that constitute the object to a SolutionArray
, which are saved together. As the original intent was to recreate the onedim
object, other columns are not necessary. Please also note that the to_solution_array
method picks only one of the three domains, I.e. the generated HDF files are not equivalent.
It would help to know what you’d like to accomplish by adding the cols
parameter. It’s likely not a major change though ...
Thanks for clarification. When I noticed this, I was after saving a pressure variable in the domain (or on boundary) and at that time I realized that it was not available, while temperature and density were available as they are hard-coded. Of course, pressure does not change accross the flame in this example but I wanted to include information on P to later e.g. plot a bunch of flames run with different pressure levels.
Thanks for the background - in that case I'd recommend to just code the pressure into the group name. Pressure can of course be easily obtained from a onedim
object after it is restored ... while I wrote the HDF export/import, I'll let the maintainers chime in as I don't view the current behavior as a bug.
I agree with you, this is not a bug as such but more like a note about inconsistency. And indeed the easiest way ist to write new groups/datasets whenever required.
Dear developers and community members.
I noticed inconsistent behavior when using write_hdf function for one-dimensional flame objects. By default, the function writes density, temperature and molar fractions into an hdf5 file. However, while for the SolutionArray object one can give extra columns ( cols=('T', 'P', 'X')) as an argument, this is not accepted when write_hdf is called for a flame object.
Below an example which shows the failure. On the last lines I have also added working examples via solution array approach.
I think this is a matter of re-defining the function argument behavior in
onedim.py
Below an example which reproduces the error, i.e. use of cols=[] argument in f.write_hdf() is not recognized as it is done in the SolutionArray variant.
System information