CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   problems with pow(scalar, double) (http://www.cfd-online.com/Forums/openfoam/69187-problems-pow-scalar-double.html)

 sven82 October 14, 2009 13:02

problems with pow(scalar, double)

Hi Foamers,

i got a problem with the mathcalls.h especially with the pow() funktion.
In my case I need a pow(scalar, double) function:

scalar area1 = gSum(mesh.magSf().boundaryField()[0]);//Fläche des Pätches inlet
scalar sumFieldp0 = gSum(mesh.magSf().boundaryField()[0]*p.boundaryField()[0]) / area1;

scalar area2 = gSum(mesh.magSf().boundaryField()[1]);//Fläche eines Pätches outlets
scalar sumFieldp1 = gSum( mesh.magSf().boundaryField()[1] * p.boundaryField()[1] ) / area2;

//Temperatur eines Pätches outlets
scalar Temp2 = gSum( mesh.magSf().boundaryField()[1] * T.boundaryField()[1] ) / area2;

scalar sumField = sumFieldp0 + sumFieldp1;
scalar Gaskonstante = 259.8;//Gaskonstante Luft = 259.8
scalar X = pow(sumField, 0.4);

ERROR
buoyantBoussinesqSimpleFoam_alphak.C: In function 'int main(int, char**)':
buoyantBoussinesqSimpleFoam_alphak.C:103: error: call of overloaded 'pow(Foam::scalar&, double)' is ambiguous
/usr/include/bits/mathcalls.h:154: note: candidates are: double pow(double, double)

The errror seems clear, the pow-function with a scalar and double. But how can I solve it? :confused:

Thanks
Sven

 mathieu October 14, 2009 13:25

Hi Sven,

Let me suggest you something. Replace the line :

scalar X = pow(sumField, 0.4);

by:

scalar X = Foam::pow(sumField, 0.4);

Mathieu

 sven82 October 15, 2009 04:50

Thanks Mathieu,

it works

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