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

Cells at the intersection between a plane and a patch

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

Like Tree1Likes
  • 1 Post By dmoroian

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 18, 2014, 15:41
Default Cells at the intersection between a plane and a patch
  #1
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20
dmoroian is on a distinguished road
Hello,
I would like to be able to access the cells at the intersection between a plane and a boundary. The snippet I'm trying is:
Code:
word patchName = "surf_wall_exterior_wind_shield";
label patchID = mesh.boundaryMesh().findPatchID(patchName);
const fvPatch& cPatch = mesh.boundary()[patchID];
const labelList& patchCells = cPatch.faceCells();
...
const point p0(2.099,-0.714,1.099);
const point p1(2.050,-0.741,1.182);
const point p2(2.768,-0.572,1.474);
plane pl1(p0,(p1-p0)^(p2-p0));
 
cuttingPlane cutPlane(pl1,mesh,true);
const labelList& cutCells = cutPlane.cutCells();
label found = 0;
 
forAll(cutCells,cellI)//loop over the cells intersecting the plane
{
   forAll(patchCells, pCelli)//loop over the cells adjacent to a patch
   {
      if(pCelli == cellI)
      {
          alpha1[cellI] = 0.0;
          found++;
       }
    }
}
But it seems that I don't put the zeros where I actually want. Is there anyone that can identify the error?

Thanks,
Dragos
dmoroian is offline   Reply With Quote

Old   November 19, 2014, 15:13
Default
  #2
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20
dmoroian is on a distinguished road
Ok, I think the error is in the usage of the index. I will test if this is the right way:
Code:
word patchName = "surf_wall_exterior_wind_shield";
label patchID = mesh.boundaryMesh().findPatchID(patchName);
const fvPatch& cPatch = mesh.boundary()[patchID];
const labelList& patchCells = cPatch.faceCells();
...
const point p0(2.099,-0.714,1.099);
const point p1(2.050,-0.741,1.182);
const point p2(2.768,-0.572,1.474);
plane pl1(p0,(p1-p0)^(p2-p0));
 
cuttingPlane cutPlane(pl1,mesh,true);
const labelList& cutCells = cutPlane.cutCells();
label found = 0;
 
forAll(cutCells,cellI)//loop over the cells intersecting the plane
{
   forAll(patchCells, pCelli)//loop over the cells adjacent to a patch
   {
      if(patchCells[pCelli] == cutCells[cellI])
      {
          alpha1[cutCells[cellI]] = 0.0;
          found++;
       }
    }
}
Update: tested and it works as supposed to!
arvindpj likes this.

Last edited by dmoroian; November 20, 2014 at 02:15.
dmoroian is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Gmsh] Problem with Gmsh nishant_hull OpenFOAM Meshing & Mesh Conversion 23 August 5, 2015 03:09
[Gmsh] Conversion Error nuovodna OpenFOAM Meshing & Mesh Conversion 14 October 1, 2010 12:07
[Gmsh] boundaries with gmshToFoam‏ ouafa OpenFOAM Meshing & Mesh Conversion 7 May 21, 2010 13:43
[Gmsh] Import problem ARC OpenFOAM Meshing & Mesh Conversion 0 February 27, 2010 11:56
Poor Residuals at Intersection Between Symmetry Plane and Airfoil Leading Edge TWaung CFX 2 February 16, 2010 09:11


All times are GMT -4. The time now is 22:10.