CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   OppositeCellFace how to use (https://www.cfd-online.com/Forums/openfoam-solving/58210-oppositecellface-how-use.html)

nikwin December 11, 2008 03:49

Hi All, How can oppositeCel
 
Hi All,

How can oppositeCellFace.C found in the doxygen manual be used? I would like to find the face opposite to a known face on the boundary to be able to calculate snGrad for that face.

Thanks in advance
/NW

nikwin December 12, 2008 03:06

Please, anyone?
 
Please, anyone?

kbr December 12, 2008 05:32

Hi Niklas, why don't you us
 
Hi Niklas,

why don't you use

<name>.boundaryField()[patchID].snGrad()

where 'name' is the name of the field you need snGrad for and patchID is the ID of the patch which can be found using

patchID = mesh.boundaryMesh().findPatchID("name")

where name is the name of patch, e.g. inlet?

Or did I misunderstand you?

Kerstin

nikwin December 12, 2008 08:05

Hi, Thanks for the reply!
 
Hi,

Thanks for the reply!
I've tried <name>.boundaryField()[patchID].snGrad(). The problem is that if the BC for PatchID is e.g. set to zeroGradient as in my case the answer it gives is only zero. And my aim is to check the actual boundary condition "value".

But, I found that the following line can be used to find the opposite face, a lot of trixing with doxygen,

faceList oppFace=mesh.cells()[cellI].opposingFaceLabel(c[i],mesh.faces());

Correct me if I'm wrong, please!

So, now snGrad on oppFace is needed!?
All the Best
/NW

nikwin December 12, 2008 08:25

Sorry, label or labelList not
 
Sorry, label or labelList not faceList!
/NW

kbr December 12, 2008 08:28

Hi Niklas, if you want to k
 
Hi Niklas,

if you want to know the value of the field at the boundary than try

scalarField valueOnPatch = <name>.boundaryField()[patchID];

for any scalar or

vectorField valueOnPatch = <name>.boundaryField()[patchID];

for any vector. Then you get a field containing the values of the variable "name" on patch with ID "patchID". I think using oppositeCellFace is not a good choice to compute snGrad. Think about using polyhedras! Which is the opposite face in that case? Have a look in "oppositeCellFace.C". There's a comment written concerning that problem.

By the way, snGrad for a zeroGradient-BC gives you "zero" and that's right beause snGrad is the surface normal gradient and setting BC to zeroGradient you define your surface normal gradient to be zero.

Kerstin


All times are GMT -4. The time now is 08:28.