# Difference between revisions of "Sample"

From OpenFOAMWiki

m |
|||

Line 1: | Line 1: | ||

− | Sampling values from a simulation and writing them to a file is done by editing the | + | Sampling values from a simulation and writing them to a file is done by editing the <tt>sampleDict</tt> file into the <tt>system</tt> folder of the case you run. |

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

Line 5: | Line 5: | ||

One must specify: | One must specify: | ||

− | An | + | #An <tt>interpolationScheme</tt> choosed in: |

+ | #*<tt>cell</tt> for a sampling-value equal to the one in the cell-center (which is considered constant over the whole cell) | ||

+ | #*<tt>cellPoint</tt> 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) | ||

+ | #*<tt>cellPointFace</tt> 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, ...) | ||

+ | #A <tt>writeFormat</tt> choosed in: | ||

+ | #*<tt>xmgr</tt> for | ||

+ | #*<tt>jplot</tt> for | ||

+ | #*<tt>gnuplot</tt> for the OpenSource program Gnuplot (which is almost a raw format) | ||

+ | #*<tt>raw</tt> for a raw format file | ||

+ | #A description of how to sample in the <tt>sampleSets</tt> subset, i.e. which points of the system being simulated must be sampled. One can describe thoose points directly by using the <tt>cloud</tt> method or, maybe smarter, by selecting one of the methods further described.<br>Please note that the methods described belows all share 2 attributes that must be provided with the ones needed for the desired method: | ||

+ | #*<tt>name</tt> which will be used to refer to the sampling with the current method and also for the filename produced | ||

+ | #*<tt>axis</tt> which will be used do determine how to write the point's coordinate. Ways of doing it are the following: | ||

+ | #**<tt>x</tt> (or <tt>y</tt> or <tt>z</tt>) if you only want the x-coordinate to be reported #**<tt>xyz</tt> if you want both coordinates to be reported | ||

+ | #**<tt>distance</tt> for the distance to point <tt>(0,0,0)</tt> to be reportedThe methods are: | ||

+ | #*<tt>uniform</tt> : used to sample <tt>nPoints</tt> evenly distributed points on a line, providing its <tt>start</tt> and <tt>end</tt> points. | ||

+ | #*<tt>face</tt> : used to sample points located at the intersections between a line provided by its <tt>start</tt> and <tt>end</tt> points and the faces (i.e. faces enclosing cells) of the system being simulated. | ||

+ | #*<tt>midPoint</tt> : same as <tt>face</tt> but the sampling point is now the midpoint between 2 faces intersections. | ||

+ | #*<tt>midPointAndFace</tt> : <tt>face</tt> and <tt>midPoint</tt> together | ||

+ | #*<tt>curve</tt> : the coordinate list <tt>points</tt> 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. | ||

+ | #*<tt>cloud</tt> : the points of the coordinate list <tt>points</tt> are the one that will be sampled. | ||

− | |||

− | |||

− | |||

− | |||

− | |||

− | |||

− | |||

− | |||

− | A description of | + | 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). |

+ | |||

− | |||

− | |||

− | |||

− | |||

− | |||

− | |||

− | |||

+ | THIS ARTICLE IS BEING WRITTEN... | ||

− | + | #bob | |

− | + | #*bobo | |

+ | #**bobob<br>yes |

## Revision as of 01:05, 16 August 2005

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:

- 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, ...)

- 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

- 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).

THIS ARTICLE IS BEING WRITTEN...

- bob
- bobo
- bobob

yes

- bobob

- bobo