Open ebranlard opened 1 year ago
Do we need the uncompressed binaries? Could we instead use the compressed versions for the regression tests now that the tests compare values a little differently? Or is there another use case for the uncompressed files?
Compressed binaries can perform poorly for signals that have a large range, typically during initial transients that are slightly unphysical. This can be avoided by starting the output after the transients, or using a steady state solve, or having better initial conditions. Since not so many people use this format, I think it's a small change to add the channel length as an extra field in this file format. Below is an example from a CFD simulation (in log scale) where the compressed binary does not work well for the Cp because it takes large values at initialization: We could also bound these coefficients between -10 and 10 for instance...
I've seen something similar in the Cp output in some of the extreme wind-direction change cases, but I've also been trying to bound that coefficient in my code. If 10^4 was a valid value, then the differences in those smaller values due to compression wouldn't matter. :)
It's not a huge deal to add another format in OpenFAST, it's just more bookkeeping on the file reading side. There tend to be a bunch of different post-processors where the change would need to be made.
Main issue Uncompressed binaries use only 10 characters for the channel names when
OutFmt = 4
i.e.FileID = FileFmtID_NoCompressWithoutTime = 3
, see e.g:https://github.com/OpenFAST/openfast/blob/df840357b903877309eaa4d35e8b2529de3ab1d8/modules/nwtc-library/src/NWTC_IO.f90#L5011
https://github.com/OpenFAST/openfast/blob/df840357b903877309eaa4d35e8b2529de3ab1d8/modules/nwtc-library/src/NWTC_IO.f90#L6883
Suggested solution The maximum number of characters for the channel length should be written to the file to have a similar behavior for compressed and uncompressed binaries, and ASCII files.
Since uncompressed binaries are not too commonly used at the moment, I suggest that when
OutFmt = 4
OpenFAST writes an uncompressed binary file with one extra field for the channel length (similar to what is done forFileFmtID_ChanLen_In
). For backward compatbility, we can introduce a new "FileID" in the binary file, e.g.FileID = FileFmtID_NoCompressWithoutTime_ChanLen_In=5
.