CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (http://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Problems with cellSets and their contents (http://www.cfd-online.com/Forums/openfoam-post-processing/66097-problems-cellsets-their-contents.html)

bfa July 6, 2009 05:49

Problems with cellSets and their contents
 
Hi All,

I have a mesh generated with polyDualMesh and checkMesh identifies lots of wrongOrientedFaces. I got the impression that it has to do with the geometry of my domain. To prove this, I want to write all the owner cells of the wrongOrientedFaces into a cellSet and transform this to VTK.
So far, so easy. I wrote the following code:

Code:

faceSet woFaces(mesh, "wrongOrientedFaces", mesh.nFaces()/100 + 1);
cellSet concaveCells(mesh, "concaveCells", mesh.nCells()/100 + 1); // more than enough
    if (mesh.checkFacePyramids(false, -SMALL, &woFaces))
    {
      forAll(woFaces, faceI) {
          concaveCells.insert(mesh.faceOwner[faceI]);
      }
      concaveCells.write();
    }

That looks quite right to me, but unfortunately the results in the concaveCell-file are just numbers from 0 to woFaces.size(). The entries have nothing to do with the actual owner-labels i thought i was putting into the set.

I tried and added mesh.faceOwner[faceI] to a labelList instead of a cellSet and *magic* it worked there.
So how do i insert values into a cellSet (or a labelHashSet to be specific)??

Help would be appreciated. Maybe you could try out the code snippet.
Regards,
Bjoern

bfa July 6, 2009 10:55

OK,
after browsing FOAM source code for some time I discovered the true functionality of a labelHashList. The correct version of above code uses no forAll loop, but a constant list iterator:

Code:

for(faceSet::const_iterator faceI = woFaces.begin(); faceI != woFaces.end(); faceI++) {
      concaveCells.insert(mesh.faceOwner()[faceI.key()]);
}
concaveCells.write();

I noticed, that polyDualMesh does not yield very good results (i.e. "pac-man"-shaped polyhedra) if you have acute angles in the geometry, but I'm trying to find a solution for that.

Bjoern


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