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

Error: no matching function for call ... rho

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By quarkz

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 19, 2022, 23:09
Default Error: no matching function for call ... rho
  #1
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 414
Rep Power: 19
quarkz is on a distinguished road
Hi,

I'm trying to compile a code from another author (https://github.com/krajit/sixDoFDynamicMotion). It is a code which allows the use of 6dof in solidBodyMotionFunction.

It works for OF1812 but not later versions. I'm trying to use it on v1912 and v2112.

The error line is :

Code:
rhoName_(SBMFCoeffs.lookupOrDefault<word>("rho", "rho"))
and the compiling error is:

Code:
sixDoFDynamicMotion.C: In constructor ‘Foam::solidBodyMotionFunctions::sixDoFDynamicMotion::sixDoFDynamicMotion(const Foam::dictionary&, const Foam::Time&)’:
sixDoFDynamicMotion.C:72:66: error: no matching function for call to ‘Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion(const Foam::dictionary&, const Foam::dictionary&)’
   72 |           rhoName_(SBMFCoeffs.lookupOrDefault<word>("rho", "rho"))
      |                                                                  ^
In file included from sixDoFDynamicMotion.H:47,
                 from sixDoFDynamicMotion.C:31:
/usr/lib/openfoam/openfoam2112/src/sixDoFRigidBodyMotion/lnInclude/sixDoFRigidBodyMotion.H:225:9: note: candidate: ‘Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion(const Foam::sixDoFRigidBodyMotion&)’
  225 |         sixDoFRigidBodyMotion(const sixDoFRigidBodyMotion&);
      |         ^~~~~~~~~~~~~~~~~~~~~
/usr/lib/openfoam/openfoam2112/src/sixDoFRigidBodyMotion/lnInclude/sixDoFRigidBodyMotion.H:225:9: note:   candidate expects 1 argument, 2 provided
/usr/lib/openfoam/openfoam2112/src/sixDoFRigidBodyMotion/lnInclude/sixDoFRigidBodyMotion.H:217:9: note: candidate: ‘Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion(const Foam::dictionary&, const Foam::dictionary&, const Foam::Time&)’
  217 |         sixDoFRigidBodyMotion
      |         ^~~~~~~~~~~~~~~~~~~~~
/usr/lib/openfoam/openfoam2112/src/sixDoFRigidBodyMotion/lnInclude/sixDoFRigidBodyMotion.H:217:9: note:   candidate expects 3 arguments, 2 provided
/usr/lib/openfoam/openfoam2112/src/sixDoFRigidBodyMotion/lnInclude/sixDoFRigidBodyMotion.H:214:9: note: candidate: ‘Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion(const Foam::Time&)’
  214 |         sixDoFRigidBodyMotion(const Time&);
      |         ^~~~~~~~~~~~~~~~~~~~~
/usr/lib/openfoam/openfoam2112/src/sixDoFRigidBodyMotion/lnInclude/sixDoFRigidBodyMotion.H:214:9: note:   candidate expects 1 argument, 2 provided
make: *** [/usr/lib/openfoam/openfoam2112/wmake/rules/General/transform:35: Make/linux64GccDPInt32Opt/sixDoFDynamicMotion.o] Error 1
Can someone help? My C++ knowledge is rather poor and I tried to subsitute rho in different ways but it just won't work.
quarkz is offline   Reply With Quote

Old   April 28, 2022, 02:57
Default
  #2
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 414
Rep Power: 19
quarkz is on a distinguished road
Hi,

I tried to compare sixDoFRigidBodyMotion.H between v1812 and v2112.

One key difference is:

v2112
Code:
// Constructors

        //- Construct null
        sixDoFRigidBodyMotion(const Time&);

        //- Construct from constant and state dictionaries
        sixDoFRigidBodyMotion
        (
            const dictionary& dict,
            const dictionary& stateDict,
            const Time& time
        );

        //- Construct as copy
        sixDoFRigidBodyMotion(const sixDoFRigidBodyMotion&);
and

v1812
Code:
// Constructors

        //- Construct null
        sixDoFRigidBodyMotion();

        //- Construct from constant and state dictionaries
        sixDoFRigidBodyMotion
        (
            const dictionary& dict,
            const dictionary& stateDict
        );

        //- Construct as copy
        sixDoFRigidBodyMotion(const sixDoFRigidBodyMotion&);
So how must I modify my code to accomodate this change?

Thanks
quarkz is offline   Reply With Quote

Old   April 28, 2022, 06:24
Default
  #3
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 414
Rep Power: 19
quarkz is on a distinguished road
After some trial and error, and some luck, I think I finally got it working

Code:
motion_(SBMFCoeffs,SBMFCoeffs),
should be changed to:

Code:
motion_(SBMFCoeffs,SBMFCoeffs,time_.time()),
Guess I was looking at the wrong error too!
isulovsky likes this.
quarkz 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
[mesh manipulation] RefineMesh Error and Foam warning jiahui_93 OpenFOAM Meshing & Mesh Conversion 4 March 3, 2018 12:32
[mesh manipulation] refineMesh Error mohsen.boojari OpenFOAM Meshing & Mesh Conversion 3 March 1, 2018 23:07
Warning message C4133 while compiling Arminius Fluent UDF and Scheme Programming 0 October 2, 2017 12:44
compressible flow in turbocharger riesotto OpenFOAM 50 May 26, 2014 02:47
OpenFOAM static build on Cray XT5 asaijo OpenFOAM Installation 9 April 6, 2011 13:21


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