From OpenFOAMWiki
Revision as of 03:59, 13 March 2006 by Afjoxf (Talk | contribs)

Sampling values from a simulation and writing them to a file is done by editing the sampleDict file into the system folder of the case you run.

An example of such a file is provided at the end of this article.

One must specify:

  1. An interpolationScheme choosed in:
    • cell for a sampling-value equal to the one in the cell-center (which is considered constant over the whole cell)
    • cellPoint for a sampling-value interpolated according to the cell-center's value and to the vertices values (which are determinated by neighbouring-cell's centers values)
    • cellPointFace is the same as the one before with the interpolation including also the faces' values (which are determined by the current face interpolation scheme for the field (linear, gamma, ...)
  2. A writeFormat choosed in:
    • xmgr for
    • jplot for
    • gnuplot for the OpenSource program Gnuplot (which is almost a raw format)
    • raw for a raw format file
  3. A description of how to sample in the sampleSets subset, i.e. which points of the system being simulated must be sampled. One can describe thoose points directly by using the cloud method or, maybe smarter, by selecting one of the methods further described.
    Please note that the methods described belows all share 2 attributes that must be provided with the ones needed for the desired method:
    • name which will be used to refer to the sampling with the current method and also for the filename produced
    • axis which will be used do determine how to write the point's coordinate. Ways of doing it are the following:
      • x (or y or z) if you only want the x-coordinate to be reported #**xyz if you want both coordinates to be reported
      • distance for the distance to point (0,0,0) to be reportedThe methods are:
    • uniform : used to sample nPoints evenly distributed points on a line, providing its start and end points.
    • face : used to sample points located at the intersections between a line provided by its start and end points and the faces (i.e. faces enclosing cells) of the system being simulated.
    • midPoint : same as face but the sampling point is now the midpoint between 2 faces intersections.
    • midPointAndFace : face and midPoint together
    • curve : the coordinate list points is considered as a curve (i.e. an assembly of segments), the sampling points are the intersections between this curve and the faces (i.e. faces enclosing cells) of the system being simulated.
    • cloud : the points of the coordinate list points are the one that will be sampled.

A description of which field is to be sampled. A field is always a scalar field, meaning that if you must sample a vector/tensor field you must sample all the coordinates separatly (see the sampleDict example at the article's end).


  1. bob
    • bobo
      • bobob