CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   ID of a faceSet (

r2d2 June 20, 2007 06:52

Hi, Maybe the subject is a bi
Maybe the subject is a bit confusing, or it does not fully describe what I want, but I want to do get the label of a faceSet (that is not a boundary patch) and then use values of some variables onto that face.
For a boundary patch I did:
label mylabel=mesh.boundaryMesh().findPatchID("myname");
const polyPatch &mypatch=mesh.boundaryMesh()[mylabel];
scalarField &p_mypatch=p.boundaryField()[mylabel];
vectorField &vel_mypatch=U.boundaryField()[mylabel];

Info<<mypatch.faceCentres()[fI]<<" "<<p_mypatch[fI]<<endl;

..and I want to do the same but for a faceSet.

gschaider June 20, 2007 09:44

You can't. faceSets are only i
You can't. faceSets are only identified by their name and only loaded when you explicitely ask for them (with a faceSet-constructor). Maybe you are looking for faceZones?

gschaider June 20, 2007 12:08

Hi Radu! You're right about
Hi Radu!

You're right about faceI.key(). The problem is that U and p are vol-Fields. They are only stored on the cells. To get their values on the faces you'll have to interpolate to a surface-Field. Don't know if you'll want to do that (depends on what you want to do)


r2d2 June 21, 2007 04:05

Glad you answered Berhnard.
Glad you answered Berhnard.
What I want to do is to be able, in a coupled solver, to exchange info (U,p,gradients etc) not only between boundary patches but also faceSets. (something like being able to do the coupling operations from your very own readCoupling.H of icoStructFoam (is yours isnīt it?) and then use that "exchange" for passing things from one domain to the other). Maybe wonīt prove very helpful for what I am aiming at (fuell cell "sandwiched" multi-domain simulations) but the way I see it, I would probably like to be able to do that.

BTW linearInterpolate(U)[faceKeI()] or something similar, wonīt do the trick?

gschaider June 25, 2007 14:54

Hi Radu! For "reading" it m
Hi Radu!

For "reading" it might be OK (for instance reading from the faceSet, writing to a patch). For writing (another faceSet instead of the patch) I don't think so.

The linearInterpolate-Thing should work. But create a temporary Variable for it ouside the loop. otherwise the interpolation gets calculated for ALL the faces in the grid for every access to a face in the faceSet)

All times are GMT -4. The time now is 03:14.