CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

A silly question about scalar

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   April 28, 2008, 00:27
Default Dear everyone I made a simp
  #1
Senior Member
 
su_junwei's Avatar
 
su junwei
Join Date: Mar 2009
Location: Xi'an China
Posts: 151
Rep Power: 9
su_junwei is on a distinguished road
Send a message via MSN to su_junwei
Dear everyone

I made a simple test about the class scalar, the code
are listed below


#include "IOstreams.H"
#include "scalar.H"
using namespace Foam;
int main()
{
scalar s=10;
scalar ss=exp(s);
#ifdef DP
Info<<ss<<endl;
#endif
}


but the compiler always complained with message below
test.C:87: error: call of overloaded 'exp(Foam::scalar&)' is ambiguous
/usr/include/bits/mathcalls.h:101: note: candidates are: double exp(double)
/home/sujunwei/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/Scalar.H:179: note: Foam::doubleScalar Foam::exp(Foam::doubleScalar)
/home/sujunwei/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/Scalar.H:179: note: Foam::floatScalar Foam::exp(Foam::floatScalar)

anything wrong ?
but code with
scalar ss=expf(s);
it passed !

it seems that the function macro

#define transFunc(func) \
inline Scalar func(const Scalar s) \
{ \
return ::func##f(s); \
}

in floatScalar.H was activated by default ?

compilation with double precision is default in OpenFOAM ?
su_junwei is offline   Reply With Quote

Old   April 28, 2008, 03:59
Default Modify your code to make sure
  #2
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 15
mattijs is on a distinguished road
Modify your code to make sure you select the Foam one:

scalar ss=Foam::exp(s);
mattijs is offline   Reply With Quote

Old   April 28, 2008, 05:02
Default Thank you!
  #3
Senior Member
 
su_junwei's Avatar
 
su junwei
Join Date: Mar 2009
Location: Xi'an China
Posts: 151
Rep Power: 9
su_junwei is on a distinguished road
Send a message via MSN to su_junwei
Thank you!
su_junwei is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about scalar transport osimonsimon OpenFOAM Running, Solving & CFD 32 August 23, 2014 01:07
User Defined Scalar (UDS) question (units) D FLUENT 0 March 1, 2006 20:04
Scalar problem Dougal McQueen CFX 0 November 21, 2003 07:23
scalar ? pr Main CFD Forum 2 September 1, 2003 00:26
user scalar zhu CFX 0 May 22, 2002 00:38


All times are GMT -4. The time now is 09:36.