CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Problems with cellSets and their contents

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 6, 2009, 06:49
Default Problems with cellSets and their contents
  #1
bfa
Member
 
Björn Fabritius
Join Date: Mar 2009
Location: Freiberg, Germany
Posts: 31
Rep Power: 17
bfa is on a distinguished road
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

Last edited by bfa; July 6, 2009 at 11:56.
bfa is offline   Reply With Quote

Old   July 6, 2009, 11:55
Lightbulb
  #2
bfa
Member
 
Björn Fabritius
Join Date: Mar 2009
Location: Freiberg, Germany
Posts: 31
Rep Power: 17
bfa is on a distinguished road
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
bfa is offline   Reply With Quote

Reply

Tags
cellsets, checkmesh


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 Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 02:48.