Sampling refers to collecting the relevant flow quantities for input into the wall model. The main parameter here is the distance to the point where the sampling occurs, \(h\). The library provides means for setting the value of the distance individually for each wall face.
Selecting the Sampler
The library provides two samplers, which are selected using the
sampler keyword in the wall model’s dictionary.
The alternatives are
Crawling, the former being the default setting.
Tree sampler uses the
indexedOctree class available in OpenFOAM in order to search for the cell
containing any given point.
For each face, the point to search for is computed by following the face normal for a distance \(h\) prescribed by
the user for this face.
The advantage of the
Tree sampler is that it does not rely on mesh structure in any way.
Tree sampler is known to crash
cyclicAMI boundaries are present
in the case.
Crawling sampler, by contrast, relies on the presence of prismatic mesh layers adjacent to the wall.
Starting from the wall face, it searches for the opposite face within the current cell, and continues going
in the wall-normal direction cell by cell, until the cell centre of the cell it is currently in is located at a distance
Crawling sampler is the recommended choice if prismatic layers are present in the mesh, because it is
significantly faster for large cases, and allows more flexibility in how to prescribe \(h\), see next section for
There is one situation in which the
Crawling samplers behave inconsistently: when the distance
\(h\) sampler will revert to using the wall-adjacent cell in this case.
Crawling sampler will simply continue to crawl up cell by cell until it it hits a patch (typically a boundary
between processors) and then take the last valid cell’s centre to use for sampling.
When solution data is written to disk, the library will write out a field called
SamplingCells, which can be
examined in order to see, which cells are used for sampling.
The default value of this field is -1, but the cells, which are used for sampling the value will be set to the index of
the corresponding patch.
We encourage the users to examine
SamplingCells to confirm that the cell selection worked as expected.
The values of \(h\) should be set in a field called
The setting of appropriate values is done in the same way as for any other solution field.
To that end, at the wall boundaries, the boundary condition for
hSampler should be set to
The desired values are then either set for the whole patch using the
uniform keyword or alternatively prescribed
on a face-by-face basis using an OpenFOAM list.
On other boundaries of type
zeroGradient boundary condition can be used.
Tree sampler is used, the values in the
hSampler will be interpreted as the desired distance to the
Note, that the value 0 is reserved for sampling from the wall-adjacent cell.
By default, the same will be done by the
Crawling sampler, however alternatively one can let the sampler interpret
the set values as the index of the consecutive off-wall cell, from which to do the sampling.
So, for example,
hSampler equal to 2 will refer to sampling from the second off-wall cell.
In order to do this, the
hIsIndex keyword should be set to
yes in the dictionary of the wall model in
By default, the wall model input will be sampled from the cell center of the cell found by the sampler. This means that if \(h\) is prescribed as distance, the actual sampling distance may be different. To avoid that, it is possible to interpolate the field values within the cell. This functionality is built into OpenFOAM, and several interpolation algorithms are available. See also This OpenFOAM Wiki article. Perhaps the most suitable choice is cellPointFace and also cellPoint. Note that interpolation within the wall-adjacent cell is not possible.
A summary of the parameters pertaining to sampling are given below.
1sampler Tree; //Crawling 2hIsIndex 0; // 1 3interpolation cell; // cellPoint, cellPointFace ...