CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   faceI was not declared in this scope (

lindstroem May 31, 2011 08:42

faceI was not declared in this scope
Hi everyone,

I am working on the dynamicAlphaContactAngle implementation. I got a modified version by a colleague which i tried to compile. I get the error: ‘faceI’ was not declared in this scope. He works in OF 1.7.1 and I tried to compile it in both, OF 1.6-ext and OF 1.7.1 - both did not work and stopped with the same error.

I also checked the header-files he includes, but there is no difference.. I also tried to include the faceI.H but then I get errors because of multiple defintions for some variables.

Is there anyone who might has an idea? Are there any information missing?


marupio May 31, 2011 09:11

Contact your colleague: the code is incomplete. faceI is not a class, but it is typically used as a label variable when cycling through all the faces in the mesh. e.g.:


forAll(mesh.faces(), faceI)
    // Do something

lindstroem May 31, 2011 09:35

Hi David,

thanks for your answer. The variable is used for a loop in a similar way as you wrote, thats correct. But what he send me is exactly what he implemented.
How would you get access to this variable if you would set up a "new" modification. To be more concrete: I am using the interFoam solver and the dynamicAlphaContactAngle BC. In the dynAlpCA implementation after the calculation of uwall I want to get the velocity gradient normal to the wall of the first cell. Therefore my colleague implemented a fct which he uses in a loop

forAll(gradUP, faceI) {etc}
where gradUP is

tensorField gradUP(size(), tensor::zero)
maybe this helps? Thank you very much in advance!

marupio May 31, 2011 09:50

Hmmm... that's strange. The forAll() command is actually a macro, which does this:

forAll(objectName, indexName)
// is short for:
for (label indexName(0); indexName < objectName.size(); indexName++)

... so you see, the definition of faceI is inherent in the macro. I suspect you are not loading the header that contains the macro (UList.H, I think), or you have circular dependency in your include files.

lindstroem May 31, 2011 10:09

Hi David,

thanks again for the quick answer! I'll try to find the mistake but you already helped me a lot! Maybe I'll come back with new questions :)

happy foaming!

All times are GMT -4. The time now is 16:15.