CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   How can I access cells located in the centerline of a channel/pipe (http://www.cfd-online.com/Forums/openfoam/80840-how-can-i-access-cells-located-centerline-channel-pipe.html)

Edy October 8, 2010 06:37

How can I access cells located in the centerline of a channel/pipe
 
Hi Foamers,

For my geometry, i will consider :
- either a channel, i.e water flowing between two plane walls, 2D problem
- or a pipe, 3D problem

I am modeling subcooled nucleate boiling, and for each cell in contact with the walls (that are uniformly heated), i need to access and retrieve parameters of a corresponding cell, located in the bulk liquid (roughly around the centerline of my channel/pipe) but at the same axial location.

I created a patch to identify cells in contact with the walls but i dont know how to access the corresponding cell.

If possible I would like to do it in such a way that it is mesh-independent.
Any help welcome.

Thanks a lot!

/Edouard

jaswi October 8, 2010 10:50

Hi Edouard

In my opinion, once you know the axial position of your cell, the radial location depends upon the geometry. considering you have a pipe (implies radial symmetry), you can find the location of your centreline by using mesh bounds.
member function mesh.bounds( ) gives you the (minX, minY, minZ) and (maxX, maxY, maxZ). You can use these coordinates to evaluate the location of centreLine .

With the centreLine location known (in 2D y coordinate, in 3d (y,z) coordinate known), you can then utilize the mesh.findCell(const point&) to find the cell label according to your location along the x-axis i.e. your axial direction.

This way your coding will be mesh independent but not geometry independent.

Hope this helps

Regards
jaswi

Edy October 11, 2010 05:21

Hi Jaswi,

Thank you for your message. Your solution seems quite appropriate to what i want to do. I'll try it and come back to this thread if I encounter problems.
Thanks again.

Best

/Edouard

Edy October 11, 2010 06:24

Hi Jaswi,

Could you tell me if this is correct.

// For all the faces in contact with the wall, i.e in my patch thePatchItself
forAll(thePatchItself,iFace)
{
// identify the cell corresponding to the face in contact with the wall
label iCell = thePatchItself.faceCells()[iFace];

//access the cell center point of this cell
vector iCellCentre = mesh.cellCentres()[iCell];

//get the point at the same axial position but located in the center line
vector bulkPoint(0,iCellCentre.y(),0);

// create a label corresponding to this point
label bulkCell = mesh.findCell(bulkPoint);



I think it s correct but I am not yet very familiar with OpenFOAM so i d like to have your opinion.

Thanks in advance

Best

/Edouard


All times are GMT -4. The time now is 09:47.