CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Post-Processing

Sample utility bug? For many cloud points in the sampleDict, some are neglected!

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   September 9, 2014, 11:42
Default Sample utility bug? For many cloud points in the sampleDict, some are neglected!
New Member
Join Date: May 2014
Posts: 4
Rep Power: 3
brandius is on a distinguished road

Problem description
With a self-written C++/OpenFOAM tool, I am outputting the coordinates of all cellCentres. This is working as expected. I copy those data into the sampleDict. It has the following appearance:
setFormat raw;

surfaceFormat raw;

        format  ascii;

interpolationScheme cellPoint;


        type    cloud;
        axis    xyz;
        points  (
(x_1     y_1     z_1)
} );
This also works as expected. After running "sample -latestTime", however, in the results, the results for some points (0.01-1%) are missing.

Why I need this
I want to write a tool that can make a statement about the grid convergence or, more precisely, about an estimation of the discretisation error.

1. I take one domain with the same boundary conditions, solvers etc. and mesh it once --> that's my base grid, the coarse grid.
2. Then I refine this twice, to get a "medium" grid and a "fine" grid.
3. I calculate all three grid cases till iterative convergence.
4. In order to make a statement on discretisation errors, I need to compare the variable values at the locations of all the cell centres of the coarse grid with the respective variable values at the same location for the medium and the fine grid.
5. I want to display my calculated values with paraFoam. For that, I create a file for a physical quantity (for example the famous "Grid Convergence Index" for all points), fill the "internal domain" with the calculated values, put some values for the boundaries and put it into the latest timeStep of the coarse grid. I can then display it with paraFoam.

The copying into the internal domain, however, is only possible, if the number of sample points is equal to the number of cells in OpenFOAM. Otherwise, some points would be missing and paraFoam rebels! In the recent case, I have over 1.700.000 cell centres and around 150 of them are missed out by sample. Of course, I don't know which ones.

How you could help
You can help me in two ways:
1. Either you have a workaround for sample (maybe it's a known sample problem that can be bypassed).
2. Or you see a more elegant way to suit my needs, without using the utility sample. Maybe there is a more-straightforward C++/OpenFOAM solution for getting the variable values for three different grids on the same coordinates.

In the latest case, I also get a warning during the run time of the sample utility. However, even without this error, the above described swallowing of points happens.

--> FOAM Warning : 
    From function tetIndices polyMeshTetDecomposition::triangleTetIndices(const polyMesh&, label, label, label)
    in file meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C at line 643
    No base point for face 1127060, 6(1862489 1862486 1860125 1860122 1863381 1863375), produces a valid tet decomposition.
brandius is offline   Reply With Quote

Old   September 14, 2014, 16:09
Default Missing output from sample utility
New Member
Jim Conger
Join Date: Jan 2014
Location: California, USA
Posts: 18
Rep Power: 3
james.conger is on a distinguished road
I have run into the same thing. The annoying thing is that the omitted points are missing altogether rather than being listed in the 'sample' output with some sort of 'no data' or -999 flag. I get around the problem to interpolating the missing entries from nearest neighbors when post-processing the 'sample' output. This requires locating all the missing points by comparing the x,y,z location of all of the requested points with that of the 'sample' output. I do this using a bit of Python code.
james.conger is offline   Reply With Quote

Old   September 25, 2014, 10:55
New Member
Join Date: May 2014
Posts: 4
Rep Power: 3
brandius is on a distinguished road
Hi James,

yes, that is certainly an option. I had hoped that there might be a simpler option. It's sad that there seems to be a programming bug somewhere in the sample code. I might program a similar utility to sample if I'll have the time and motivation, using the C++ member functions of OpenFOAM. Otherwise I'll use your workaround.

If anyone else has another idea, I'd be happy to here it!

brandius is offline   Reply With Quote

Old   January 19, 2015, 16:11
New Member
Join Date: Aug 2012
Posts: 16
Rep Power: 4
gigilentini8 is on a distinguished road
same issue here. makes me crazy
Why do some points are not sampled?

Any news on this? Do you think it can be considered a bug?
If so, it's quite serious. Point evaluation are one of the most important thing and, at least without interpolation ("Cell") they shuold always be provided correctly
gigilentini8 is offline   Reply With Quote

Old   January 20, 2015, 03:50
Duong A. Hoang
Join Date: Apr 2009
Location: Delft, Netherlands
Posts: 92
Rep Power: 8
duongquaphim is on a distinguished road
Send a message via Yahoo to duongquaphim

Why dont you use mapFields for your purpose? It can be use to map the result from one mesh to another with similar geometry. Of course, this solution only works if you accept the interpolation error during the process.

duongquaphim is offline   Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
No layers in a small gap bobburnquist OpenFOAM Native Meshers: snappyHexMesh and Others 2 November 25, 2012 09:54
sample utility stops sampling once the line leaves the domain Zymon OpenFOAM 1 May 2, 2012 04:51
interpolation with a cuttingPlane for sample utility lbordier OpenFOAM 1 February 14, 2012 14:53
bug in Rcomponents utility cedric_duprat OpenFOAM Bugs 1 May 7, 2009 02:56
BlockMeshmergePatchPairs hjasak OpenFOAM Native Meshers: blockMesh 11 August 15, 2008 07:36

All times are GMT -4. The time now is 15:08.