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

ForAllowner faceI looping

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

Reply
 
LinkBack Thread Tools Display Modes
Old   July 16, 2008, 15:42
Default Dear all, For some reason, I
  #1
Member
 
diablo80@web.de
Join Date: Mar 2009
Posts: 93
Rep Power: 8
sampaio is on a distinguished road
Dear all,
For some reason, I need to loop over all faces to do some calculations, that I could not find a way to do with regular field operations.

Then, I decided to do a loop over all owner faces like below, because somehow I needed information from face, owner and neighbour:

Phi is a surfaceScalarField
V is a volScalarField
S is a surfaceScalarField

forAll(owner, f)
{
Phi[f] =
someComplexOperationsWith(V[owner[f]] , V[neighbour[f]], and S[f])
;
}

My first mistake was to assume the boundary faces would be covered in this loop, but later I realized they wouldn't.

My first question is: what happens to processorBoundaryPatches? Are they covered by this loop to garantee that the same code would work for serial and parallel computations? Or do I need to worry about it and do some loop over the boundary like this:

{
const fvPatchList& patches = mesh.boundary();

forAll(patches, patchi)
{
const fvPatch& curPatch = patches[patchi];
const fvPatchVectorField& Up = U.boundaryField()[patchi];

if( isType<processorfvpatchvectorfield>(Up)
)
{

forAll(curPatch, i)
{
label faceCelli = curPatch.faceCells()[i];
DO SOMETHING
}
}
}
}

Second question is: if I have to do this loop (above), and do some similar operations (as in the owner, faceI loop), how do I get the neighbour[f] field (which lies in a different processor).

Finally, is seems that I do not need to worry with cyclic boundary conditions, meaning that the first loop (forAll(owner,f)) includes all faces of patch cyclic. Am I right?

Thanks a lot,
luiz
sampaio is offline   Reply With Quote

Old   July 30, 2008, 06:24
Default Hello Luiz, The first loop
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,763
Rep Power: 21
hjasak will become famous soon enough
Hello Luiz,

The first loop is all fine, and will visit only the internal faces.

The second loop is also fine. You do not want to do anything special on the processor patches, because

if(isType<processorfvpatchvectorfield>(Up)

would be required all over the code.

In parallel, you wil want each side to do its own bit, referring to local faceCells. On any sort of a coupled patch, deltaCoeffs will be the real one (using neighbour - owner distance across processors) and you need not do anything special. Have a look at ...boundaryCoeffs() and ...internalCoeffs() in any sort of a coupled patch.

Enjoy,

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Reply

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
Help! Function not LOOPing xtrios FLUENT 2 July 17, 2008 15:44
looping rr123 FLUENT 1 July 8, 2008 17:49
Looping in UDF!!! safa FLUENT 0 December 11, 2007 09:07
What value is returned for gradUneighbourfaceI if faceI is at a boundary sampaio OpenFOAM Running, Solving & CFD 1 June 1, 2006 13:14
Looping Problem?? KKLAU FLUENT 1 June 5, 2004 05:48


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