CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   File structure of surfaceScalarField in output (https://www.cfd-online.com/Forums/openfoam-post-processing/169464-file-structure-surfacescalarfield-output.html)

elmo555 April 11, 2016 03:09

File structure of surfaceScalarField in output
 
Hey,

I need to do some custom post-processing and would like to read the output files with a script.

In this case, I have a 2D simulation with a mesh, let's say 20x20, resulting in 400 cells. I can easily read a volScalarField file with 400 lines between
Code:

internalField  nonuniform List<scalar>
400
(
>> all my data <<
);

and assign each line to cell (i,j) in the order (1,1), (1,2), ... (1,20),(2,1),...,(20,20).

A surfaceScalarField has 760 entries: all internal faces without the boundary faces. How are the faces stored in this file? E.g. how can I relate a line in the file to the horizonal/vertical face of cell (i,j)? I tried various approaches, but none seems to work.

Any help is appreciated :)

elmo555 April 11, 2016 05:15

After asking this question, I figured it out myself...

Each row of the n*m mesh (constant i-coordinate) contains n+m-1 faces, e.g. n x-faces and m-1 y-faces, in an alternating fashion (x y x y ... x).

The last row contains just y-faces.

This is also the order in which the faces are stored in the file:
(x11, y11, x12, y12, ..., x1(n-1), y1(n-1), x1n, x21, y21, ..., x2n, ...,x(m-1)n, ym1, ym2, ..., ymn)

Interpreting the file like that works nicely and gives the expected results. Maybe this will be helpful for somebody else in the future.


All times are GMT -4. The time now is 09:33.