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

Using "this->lookup" in constructor gives "no matching function for call to"

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 25, 2019, 05:24
Default Using "this->lookup" in constructor gives "no matching function for call to"
  #1
New Member
 
Join Date: Apr 2019
Posts: 12
Rep Power: 7
yummigummi is on a distinguished road
Hello everyone,
I'm trying to modify the viscoelaticModel to read viscosities from a library. My constructor looks as follows:


viscoelasticModel::viscoelasticModel
(
const volVectorField& U,
const surfaceScalarField& phi,
const volScalarField& fluidIndicator
)
:
IOdictionary
(
IOobject
(
"viscoelasticProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
lawPtr_(viscoelasticLaw::New(word::null, U, phi, subDict("rheology"))),
mu1_(this->lookup("mu1")),
mu2_(this->lookup("mu2"))
{}





When I compile the library I get the following error:


viscoelasticModel/viscoelasticModel.C: In constructor ‘Foam::viscoelasticModel::viscoelasticModel(c onst volVectorField&, const surfaceScalarField&, const volScalarField&)’:
viscoelasticModel/viscoelasticModel.C:60:29: error: no matching function for call to ‘Foam::GeometricField<Foam::SymmTensor<double >, Foam::fvPatchField, Foam::volMesh>::GeometricField()’
mu2_(this->lookup("mu2"))



edit: I'm using foam extend 4.1

Thanks a lot!


Paul
yummigummi is offline   Reply With Quote

Old   July 5, 2019, 06:38
Default
  #2
New Member
 
Jochen
Join Date: Oct 2016
Posts: 5
Rep Power: 10
Jo88 is on a distinguished road
Hi Paul,



did you manage to to compile your code? I would like to do something similar and still try to figure out what's the easiest way. I created a new library where I can calculate different temperature shift factors and use them in my viscosity library (viscosityModels) as an input variable to calculate nu.



By the way, I also use foam-extend-4.1


Thanks a lot!
Jochen
Jo88 is offline   Reply With Quote

Old   July 16, 2019, 06:21
Default
  #3
New Member
 
Join Date: Apr 2019
Posts: 12
Rep Power: 7
yummigummi is on a distinguished road
Hey Jochen,


I ended up with a totally different work around where I received my solvent related viscosities from a different class. But I think the problem was that the order of variable declaration in my header file was different, than it was in my .C file. That's why there was the "no matching function to call" error.


I hope it helps you.
Paul
yummigummi is offline   Reply With Quote

Old   July 18, 2019, 04:48
Default
  #4
New Member
 
Jochen
Join Date: Oct 2016
Posts: 5
Rep Power: 10
Jo88 is on a distinguished road
Hey Paul,

thanks for your reply. In the meantime I also switched to a different approach and created a new class (temperatureShiftModel). In this class I will calculate the temperature shift factor and would like to pass it to the viscosity class. Although the code compiles I always get a symbolLookup-Error.

I think I misused pointers or did something generally wrong in exchanging variables between classes. Could you please share a code-example of how managed to pass a variable to another class.

Thanks in advance.

Best
Jochen
Jo88 is offline   Reply With Quote

Old   July 19, 2019, 07:06
Default
  #5
New Member
 
Join Date: Apr 2019
Posts: 12
Rep Power: 7
yummigummi is on a distinguished road
Hey Jochen,


what I did is copying the methods tau(), divTau(volVectorField& U), correct() and read() into my new class. Make sure to copy lawPtr_(viscoelasticLaw::New(word::null, U, phi, subDict("rheology"))) in your .C file of the new class aswell. By including #include "viscoelasticLaw.H" and #include "autoPtr.H" and declaring autoPtr<viscoelasticLaw> lawPtr_; in your header file it should be possible to totally bypass viscoelasticModel.
I guess, you could also do it by inheritance and give a new sub class utilities of viscoelasticModel.


Hope this helps you!
Bye
Paul
yummigummi 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
[snappyHexMesh] How to define to right point for locationInMesh Mirage12 OpenFOAM Meshing & Mesh Conversion 7 March 13, 2016 15:07
Compilation Error: "no matching function for call to ‘div(Foam::volScalarField&)’" abhiv OpenFOAM Programming & Development 1 September 30, 2015 03:47
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 11:23
Elements that limit the Courant number skabilan OpenFOAM Running, Solving & CFD 9 July 3, 2008 13:07
No matching function multiplying tensors for BC Erik OpenFOAM 3 March 20, 2008 14:05


All times are GMT -4. The time now is 04:57.