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/)
-   -   Sample utility bug? For many cloud points in the sampleDict, some are neglected! (https://www.cfd-online.com/Forums/openfoam-post-processing/141503-sample-utility-bug-many-cloud-points-sampledict-some-neglected.html)

brandius September 9, 2014 11:42

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

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:
Code:

setFormat raw;

surfaceFormat raw;

formatOptions
{
    ensight
    {
        format  ascii;
    }
}

interpolationScheme cellPoint;

fields
(
    p
    U
);

sets
(
    REPoints
    {
        type    cloud;
        axis    xyz;
        points  (
MANY POINTS HERE, like:
(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.



PS:
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.

Code:

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


james.conger September 14, 2014 16:09

Missing output from sample utility
 
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.

brandius September 25, 2014 10:55

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!

Bye
Marcus

gigilentini8 January 19, 2015 15:11

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

duongquaphim January 20, 2015 02:50

Hi,

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.

Duong

kingjewel1 November 27, 2015 09:11

Has anyone worked out what's going on with this yet? All I want is a uniformly distributed line of points. Sometimes some are missing but they're almost always unordered. Is there a workaround?

R.Mah July 15, 2016 05:35

Hallo, does any one had found the solution , I´m still struggling on that

gigilentini8 July 15, 2016 08:13

not sure if this has been solved in the new versions.
anybody checked?
if the problem is still there, the only option is to dig into the code to understand when the missing points are removed

any clue?

saakwave October 9, 2017 10:02

sampling issue reasons
 
I have noted that missing of sampling points happens in two cases:

1. Round off errors of coordinates near the end of model. If the coordinates given in ccx, ccy and ccz (which already seem to have a minor round-off error) are close to the end regions of the geometry (like wall of a pipe) this almost always happens and the coordinates have to be adjusted a little. You may reduce the coordinate magnitudes by some small amount to ensure everything is within the geometry.

2. Copying data between different applications like excel or other sometimes gives this issue.

gigilentini8 October 10, 2017 05:00

from what I remember the problem was more serious and happened also in the internal part of the mesh, very likely when points are close to faces.
it would be interesting to know if this has been solved in the new versions...

michael3000 August 22, 2022 09:56

Just ran into this problem as well.

Basically, I created a list of points and expect a matching list of samples, which is not the case. So I really don't know how I can match the samples with the points. Or is there a rule which points are dropped? Maybe some outside of the domain?


All times are GMT -4. The time now is 18:24.