CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   operators in openfoam (

openfoammaofnepo August 12, 2013 17:20

operators in openfoam
Hi All,

When I add the following lines in fireFoam.C:

if(x > length)

I failed to compiled it successfully. The error message is:

mo match for 'operator>' in x > length

If I indeed would like this condition in if statements, how can modify the source file fireFoam.C? Can anybody help me ? My C++ skill is a little low.

Thank you in advance!

fumiya August 12, 2013 21:14


If you want to find the cells whose x-coordinates are greater than the value "length", you can use the following:


forAll(mesh.cells(), cellI) //Loop over the cells
if(mesh.C()[cellI].x() > length) //Compare the x-coordinate of the cellI's center with the scalar length

Hope this helps,

All times are GMT -4. The time now is 18:17.