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

Cell Handeling

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 2, 2012, 05:34
Default Cell Handeling
  #1
New Member
 
yudhast
Join Date: Mar 2011
Posts: 12
Rep Power: 6
udiitm is on a distinguished road
Hi,

I want to collect the cell information and the pressure at nearby cells with their x and y co-ordinates as follows:

Co- ordnates(X Y) ... Cell Value (Pressure)(P).... neighboring cells(Pressure)(p1,p1,p3,p4)



Please tell me how to extract these information?

Thanks & Regards,
Yudhast
udiitm is offline   Reply With Quote

Old   April 2, 2012, 05:39
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,619
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
Hi Yudhast

You can use the cellCells() member function in fvMesh, which returns the indices for the neighbouring cells.

E.g.

Code:
label cellI( 0 ); // The cell you are considering
const labelList & cellCells( mesh.cellCells()[cellI] );

// Pressure, p, in neighbouring cells:
forAll(cellCells, celli )
{
    Info << p[cellCells[celli]] << endl;
}
Kind regards,

Niels
ngj is offline   Reply With Quote

Old   April 2, 2012, 06:27
Default
  #3
New Member
 
yudhast
Join Date: Mar 2011
Posts: 12
Rep Power: 6
udiitm is on a distinguished road
Quote:
Originally Posted by ngj View Post
Hi Yudhast

You can use the cellCells() member function in fvMesh, which returns the indices for the neighbouring cells.

E.g.

Code:
label cellI( 0 ); // The cell you are considering
const labelList & cellCells( mesh.cellCells()[cellI] );

// Pressure, p, in neighbouring cells:
forAll(cellCells, celli )
{
    Info << p[cellCells[celli]] << endl;
}
Kind regards,

Niels
Hi Niels,
Thanks for your reply..
Suppose I have to put a condition on the cell eg.

For all the cells
if X != 0
where X=interface.sigmaK()*fvc::grad(alpha1)

How to do this??

Regards,
Yudhast
udiitm is offline   Reply With Quote

Old   October 3, 2012, 20:42
Default east and north cell values
  #4
Member
 
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 5
hawkeye321 is an unknown quantity at this point
Is there any way (any function) to get the value of a parameter at the east and north of a specific cell?
hawkeye321 is offline   Reply With Quote

Old   April 10, 2013, 08:49
Default
  #5
abe
Member
 
ABE
Join Date: Jul 2012
Posts: 37
Rep Power: 5
abe is on a distinguished road
Hi Niels,

I would be thankful if you could help me. I want to add a loop right after solving the pressure equation to calculate a new pressure field based on:
newP(cell)=(30*P(cell) + p(neighbours) )/(30+No.neighbours)
Does the following work for it?


const vectorField& cCentre = mesh.C();
const labelListList& neighbour = mesh.cellCells();
double pTemp=0.0;
int i=0;

forAll(cCentre, celli)
{
labelList nCellID = neighbour[celli];

pTemp=0.0;
i=0;
forAll(nCellID,cellNe)
{
pTemp+=p[cellNe];
i+=1;
}

pTemp+=30*p[celli];
p[celli]=pTemp/(30+i);

}

Thank you in advance...
abe is offline   Reply With Quote

Old   April 10, 2013, 09:51
Default
  #6
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,619
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
Hi Abe,

Yes, it does look like it would produce the thing you are after; sort of!

First of all you are putting the computed value back into the field, which you are using as a source, so the final weighting cannot be predicted.

Secondly, this will only work for serial computations, as the weighting does not take the neighbouring cells on other processors into account.

Thirdly, the cellCells are only returning the cells, which have a face in common with the cell of interest. If you want all of the cells connected to the cell, i.e. also connected through a common point, then you would need to use pointCells and make a unique list of connected cells. Unique, because the pointCells information will give you multiple occurrences of the connected cell labels.

Fourthly. Are you really sure that this is what you want? Changing the pressure after its solution will essential/potentially ruin the pressure-velocity coupling.

Good luck,

Niels
ngj is offline   Reply With Quote

Old   April 10, 2013, 10:22
Default
  #7
abe
Member
 
ABE
Join Date: Jul 2012
Posts: 37
Rep Power: 5
abe is on a distinguished road
thank you for your complete answer.
I am going to simulate cavitation in a complex geometry, and I just want to create a smoother pressure field in first few iterations.
PS: thanks for your hint about parallel issue...


ABE
abe is offline   Reply With Quote

Reply

Tags
cell data, openfoam, pressure

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cells with t below lower limit Purushothama CD-adapco 2 May 31, 2010 21:58
How to determine the direction of cell face vectors on processor patches sebastian_vogl OpenFOAM Running, Solving & CFD 0 October 27, 2009 09:47
How to determine the direction of cell face vectors on processor patches sebastian_vogl OpenFOAM Programming & Development 0 October 26, 2009 13:10
Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 2 July 15, 2005 04:15
Warning 097- AB CD-adapco 6 November 15, 2004 05:41


All times are GMT -4. The time now is 01:07.