CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

control reaches end of non-void function

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 25, 2013, 20:28
Default control reaches end of non-void function
  #1
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Torino, Italy
Posts: 675
Rep Power: 8
sharonyue is on a distinguished road
Hi,

I want to modify the "muf" and "nuf"'s function in twoPhaseMixture.C. The function is this:
Code:
"muf",
            rho2_*fvc::interpolate(nuModel2_->nu())
            + (rho1_*fvc::interpolate(nuModel1_->nu())
              - 
               rho2_*fvc::interpolate(nuModel2_->nu()))
            *(exp(128*alpha1f)-1)
            /exp(2)
When I wmake libso, it said:

Code:
cfd@cfd:~/myCase/mylib/incompressibleTwoPhaseMixture/incompressible$ wmake libso
Making dependency list for source file incompressibleTwoPhaseMixture/twoPhaseMixture.C
SOURCE=incompressibleTwoPhaseMixture/twoPhaseMixture.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I.. -I/opt/openfoam220/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam220/src/OpenFOAM/lnInclude -I/opt/openfoam220/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/twoPhaseMixture.o
incompressibleTwoPhaseMixture/twoPhaseMixture.C: In member function ‘Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > Foam::twoPhaseMixture::muf() const’:
incompressibleTwoPhaseMixture/twoPhaseMixture.C:160:19: error: call of overloaded ‘exp(int)’ is ambiguous
incompressibleTwoPhaseMixture/twoPhaseMixture.C:160:19: note: candidates are:
In file included from /opt/openfoam220/src/OpenFOAM/lnInclude/floatScalar.H:78:0,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/scalar.H:39,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/IOstream.H:49,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/Ostream.H:39,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/UILListIO.C:27,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/UILList.C:92,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/UILList.H:285,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/ILList.H:39,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/IDLList.H:35,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/entry.H:45,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/dictionary.H:53,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/IOdictionary.H:42,
                 from incompressibleTwoPhaseMixture/transportModel.H:39,
                 from incompressibleTwoPhaseMixture/twoPhaseMixture.H:38,
                 from incompressibleTwoPhaseMixture/twoPhaseMixture.C:26:
/opt/openfoam220/src/OpenFOAM/lnInclude/Scalar.H:260:1: note: Foam::floatScalar Foam::exp(Foam::floatScalar)
In file included from /opt/openfoam220/src/OpenFOAM/lnInclude/doubleScalar.H:78:0,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/scalar.H:40,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/IOstream.H:49,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/Ostream.H:39,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/UILListIO.C:27,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/UILList.C:92,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/UILList.H:285,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/ILList.H:39,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/IDLList.H:35,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/entry.H:45,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/dictionary.H:53,
                 from /opt/openfoam220/src/OpenFOAM/lnInclude/IOdictionary.H:42,
                 from incompressibleTwoPhaseMixture/transportModel.H:39,
                 from incompressibleTwoPhaseMixture/twoPhaseMixture.H:38,
                 from incompressibleTwoPhaseMixture/twoPhaseMixture.C:26:
/opt/openfoam220/src/OpenFOAM/lnInclude/Scalar.H:260:1: note: Foam::doubleScalar Foam::exp(Foam::doubleScalar)
In file included from incompressibleTwoPhaseMixture/viscosityModel.H:55:0,
                 from incompressibleTwoPhaseMixture/twoPhaseMixture.H:39,
                 from incompressibleTwoPhaseMixture/twoPhaseMixture.C:26:
/opt/openfoam220/src/OpenFOAM/lnInclude/dimensionedScalar.H:73:19: note: Foam::dimensionedScalar Foam::exp(const dimensionedScalar&)
incompressibleTwoPhaseMixture/twoPhaseMixture.C:163:1: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [Make/linux64GccDPOpt/twoPhaseMixture.o] Error 1

cfd@cfd:~/myCase/mylib/incompressibleTwoPhaseMixture/incompressible$
If I delete the last exp(2), it succeed, does anyone know why? Thanks in advance.

BTW,if I want to over exp(128), how to make it?
sharonyue is offline   Reply With Quote

Old   June 26, 2013, 10:36
Default
  #2
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
exp() is defined for all types, and you are giving it a literal constant. The compiler can't tell which exp() function to call. Try giving it more scope:

scalar::exp(2.0)

or

exp(scalar(2.0))

Share and enjoy!
__________________
~~~
Follow me on twitter @DavidGaden
marupio is offline   Reply With Quote

Old   June 26, 2013, 19:54
Default
  #3
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Torino, Italy
Posts: 675
Rep Power: 8
sharonyue is on a distinguished road
Quote:
Originally Posted by marupio View Post
exp() is defined for all types, and you are giving it a literal constant. The compiler can't tell which exp() function to call. Try giving it more scope:

scalar::exp(2.0)

or

exp(scalar(2.0))

Share and enjoy!
That's cool! exp(scalar(2.0)) works, thanks!!
sharonyue 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
Radiation interface hinca CFX 15 January 26, 2014 18:11
FSI: Pressure and Normal Force don't match with expected values Geraud CFX 6 August 21, 2012 15:34
natural convection mehrdadeng CFX 10 February 25, 2011 06:25
CFX does not continue Shafiul CFX 10 February 17, 2011 08:57
Simulation of a single bubble with a VOF-method Suzzn CFX 18 October 2, 2009 04:18


All times are GMT -4. The time now is 07:40.