CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

problems with pow(scalar, double)

Register Blogs Community New Posts Updated Threads Search

Like Tree13Likes
  • 12 Post By mathieu
  • 1 Post By cdunn6754

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 14, 2009, 14:02
Default problems with pow(scalar, double)
  #1
Member
 
Sven Degner
Join Date: Mar 2009
Location: Zürich
Posts: 55
Rep Power: 17
sven82 is on a distinguished road
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?

Thanks
Sven
sven82 is offline   Reply With Quote

Old   October 14, 2009, 14:25
Default
  #2
Member
 
Mathieu Olivier
Join Date: Mar 2009
Location: Quebec City, Canada
Posts: 77
Rep Power: 17
mathieu is on a distinguished road
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
Pagoda, vigneshTG, EhsanM and 9 others like this.
mathieu is offline   Reply With Quote

Old   October 15, 2009, 05:50
Default
  #3
Member
 
Sven Degner
Join Date: Mar 2009
Location: Zürich
Posts: 55
Rep Power: 17
sven82 is on a distinguished road
Thanks Mathieu,

it works
sven82 is offline   Reply With Quote

Old   December 13, 2017, 14:28
Default
  #4
New Member
 
Clint
Join Date: Sep 2015
Posts: 10
Rep Power: 11
cdunn6754 is on a distinguished road
Fixed my problem too thank you! But I'm a little confused. Does this mean that there are other pow() functions outside of the Foam namespace that also take those parameter types (scalar, double)?
rarnaunot likes this.
cdunn6754 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
New densitybased solver AeroFoam giulio_romanelli OpenFOAM Running, Solving & CFD 48 January 15, 2016 09:20
Missing math.h header Travis FLUENT 4 January 15, 2009 12:48
Parallel rasInterFoam openfoam_user OpenFOAM Running, Solving & CFD 4 November 1, 2008 05:14
what's wrong about my code for 2d burgers equation morxio Main CFD Forum 3 April 27, 2007 11:38
REAL GAS UDF brian FLUENT 6 September 11, 2006 09:23


All times are GMT -4. The time now is 13:44.