Thanks for this. I will start looking into it as well.
The data format for normal OpenFOAM output is standard. It can also be converted to VTK but still you get the entire internal field and usually we can’t write all that data with high frequency due to disk space limitations.
Normally we only need the pressure fields on a specific structure (defined as a patch in OF). This can then be directly extracted during a run by defining it as a sampling surface using libsampling.so. For example
nameOfTheFuntionObject
{
type surfaces;
libs (“libsampling.so”);
enabled true;
writeControl runTime;
timeStart 10;
writeInterval 0.5;
surfaceFormat vtk;
formatOptions
{
vtk
{
legacy true;
format ascii;
}
}
fields (p);
interpolationScheme cellPoint;
surfaces
( a_patch_name {type patch; patches (patch_name); interpolate true;} );
}
OF support writing the surface data with the following formats (see surfaceFormat above): foam or foamFile depending on version, VTK, raw, stl, ensight, starcd, nastran
I think probably makes sense to start with “foam” and “VTK”,
foam format writes: points, faces, values files
VTK: VTK ASCII format this will write the newer VTP files by default but can be converted to VTK using formatOptions {
vtk {
legacy true.;
format ascii; }
In the corresponding function object dictionary.
These however, won’t be written to the case directory. The VTK format files will be saved under
CaseDirectory/postProcessing/nameOfTheFuntionObject/time_lable
So probably need some input from the user to find the correct files rather than just reading an empty .foam file.
I tried writing a sample dataset with “foam” format but could not load them in PrePoMax so probably some small changed would still be required but I imagine the available OpenFoamFileReader could be used.
The “VTK” format extracted from a simulation can be downloaded here. Foam format is available here. Note that the directory structure is a bit different and the data is stored with the following structure:
CaseDirectory/postProcessing/nameOfTheFuntionObject/time_lable/a_patch_name/
under a_patch_name there are faceCentres, faces, points files and a directory called scalarField which contains a file names “p” as defined by “fields (p)” in the function object dictionary (see the example).
Thanks
Sha