CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

snappyHexMesh: cell lower corner instead of cell centre

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 5, 2013, 12:03
Default snappyHexMesh: cell lower corner instead of cell centre
  #1
Senior Member
 
Andrea Pasquali
Join Date: Sep 2009
Location: Germany
Posts: 142
Rep Power: 17
andrea.pasquali is on a distinguished road
Hi all,

I would like to change the criterion that snappyHexMesh uses to keep cells into the domain during the refinement stage (cast). I would like to keep in the domain all the cells that have not the cell centre but the cell lower corner into the domain.
I am trying to modify the code in the file "src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C". At line 75 there is the cell centres vector definition:
Quote:
const pointField& cellCentres = mesh_.cellCentres();
I would like to obtain the cell lower corner vector as follows:
Quote:
forAll(mesh_.points(), nodeI)
{
forAll(mesh_.cellPoints(), cellI)
{
if (mesh_.cellPoints()[cellI][0] == nodeI)
{
Info << mesh_.points()[nodeI] << endl; // this is right
const vector& cellLowerCorners = mesh_.points()[nodeI];
}
}
}
My problem is that the vector "cellLowerCorners" that I am trying to write "works" just inside the if statments. I am not able to append the values to the vector each iteration of the "for" loop.
I think I am not writing/initializing the vector correctly. Does anyone have any suggesstion?

Thanks in advance

Andrea
__________________
Andrea Pasquali
andrea.pasquali is offline   Reply With Quote

Old   February 7, 2013, 09:07
Default
  #2
Senior Member
 
Andrea Pasquali
Join Date: Sep 2009
Location: Germany
Posts: 142
Rep Power: 17
andrea.pasquali is on a distinguished road
Hi All,

I solved the problem using a Dynamic Vector. This is fine and I have all the cell-lower-corner in a vector.
If I am understanding correctly, OpenFOAM selects the cells that have to be deleted according to an index defined in cellRegion:
Code:
    regionSplit cellRegion(mesh_);

    DynamicList<label> cellsToRemove(mesh_.nCells());
    forAll(cellRegion, cellI)
    {
        if (cellRegion[cellI] != regionI)
        {
            cellsToRemove.append(cellI);
        }
    }
    cellsToRemove.shrink();
I guess this index is 0 when the cell-centre is in the keepPoint region and 1 when outside.
I would like to change this: no cell-centre criterion but cell-lower-corner.
Does anyone know which is the file I have to look for?

Thanks for any help

Andrea
__________________
Andrea Pasquali
andrea.pasquali is offline   Reply With Quote

Old   February 7, 2013, 11:53
Default
  #3
Senior Member
 
Andrea Pasquali
Join Date: Sep 2009
Location: Germany
Posts: 142
Rep Power: 17
andrea.pasquali is on a distinguished road
Now I am able to change the vector:
Code:
    cellsToRemove
with a new vector where I have only the cells with the lover corner into the stl. I called it:
Code:
    cellToRemoveLowerCorner
But I got problem some lines below:
Code:
    labelList exposedFaces(cellRemover.getExposedFaces(cellsToRemoveLowerCorner));

    if (exposedFaces.size())
    {
        FatalErrorIn
        (
            "meshRefinement::splitMeshRegions(const point&)"
        )   << "Removing non-reachable cells should only expose boundary faces"
            << nl
            << "ExposedFaces:" << exposedFaces << abort(FatalError);
    }
The error I got when I run snappyHexMesh is:
Quote:
--> FOAM FATAL ERROR:
Removing non-reachable cells should only expose boundary faces
ExposedFaces:8(475 477 479 481 483 485 487 488)

From function meshRefinement::splitMeshRegions(const point&)
in file autoHexMesh/meshRefinement/meshRefinement.C at line 1970.

FOAM aborting
Why now changing only the "cellsToRemove" vector I have these ExposedFaces while not before?

Thanks
Andrea
__________________
Andrea Pasquali
andrea.pasquali is offline   Reply With Quote

Old   February 11, 2013, 07:21
Default
  #4
Senior Member
 
Andrea Pasquali
Join Date: Sep 2009
Location: Germany
Posts: 142
Rep Power: 17
andrea.pasquali is on a distinguished road
Hi All,
finally I have it.
I changed the "edge" definition into meshRefinement.C file
__________________
Andrea Pasquali
andrea.pasquali is offline   Reply With Quote

Old   February 11, 2013, 07:22
Default
  #5
Senior Member
 
Andrea Pasquali
Join Date: Sep 2009
Location: Germany
Posts: 142
Rep Power: 17
andrea.pasquali is on a distinguished road
Hi All,
finally I have it. I changed the "edge" definition into the meshRefinement.C file

Andrea
__________________
Andrea Pasquali
andrea.pasquali is offline   Reply With Quote

Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
FvMatrix coefficients shrina OpenFOAM Running, Solving & CFD 10 October 3, 2013 15:38
Xcoordinate of cell centre in volScalarField pda OpenFOAM Running, Solving & CFD 7 July 18, 2007 10:01
Warning 097- AB Siemens 6 November 15, 2004 05:41
cell to cell relation CMB Siemens 1 December 4, 2003 05:05
CELL CENTRE OUTSIDE OF THE CELL rogeha Siemens 0 May 23, 2002 06:41


All times are GMT -4. The time now is 12:35.