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

Problem compiling solver using lookupOrDefault()

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

Like Tree2Likes
  • 1 Post By Swirl
  • 1 Post By Swirl

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 17, 2022, 11:41
Default Problem compiling solver using lookupOrDefault()
  #1
Member
 
Join Date: Jun 2020
Posts: 49
Rep Power: 5
Swirl is on a distinguished road
Hello everyone,

I am currently trying to modify the reactingFoam solver. I am adding the function to define Schmidt numbers for each species using a subdict in the combustionProperties file.

In the first stage this was done using a simple lookup() command and worked perfectly. Now I want to add a functionality, that sets the Schmidt number to 1 for all species, where there is no entry in the dict. For that I intend to use lookupOrDefault(). This is the line of code I am using for that particular operation:

Code:
scalar Sck = readScalar(SchmidtNrDict.lookupOrDefault(Y[i].name(), 1.0));
When trying to compile this, I get the following error message:

Code:
no matching function for call to 'readScalar(double)'
As far as I understand there is a mismatch between the input type of readScalar() and the output of lookupOrDefault(), but I can't figure out exactly what it is.

It would be great if someone could help me find the mistake! Thanks!
rol97 likes this.
Swirl is offline   Reply With Quote

Old   January 17, 2022, 11:54
Default Solved
  #2
Member
 
Join Date: Jun 2020
Posts: 49
Rep Power: 5
Swirl is on a distinguished road
Ok, I solved the problem. In case anyone ever runs into this problem again (or perhaps I am just extremely bad at programming ) the lookupOrDefault() function automatically returns the value of the entry you are searching for. This means that readScalar() was unnecessary.

Correct code is:

Code:
scalar Sck = SchmidtNrDict.lookupOrDefault<scalar>(Y[i].name(), 1.0);
rol97 likes this.
Swirl is offline   Reply With Quote

Reply

Tags
compilation error, lookupordefault, readscalar

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in compiling Euler Local Ddt scheme in existing solver? BSengupta OpenFOAM 0 March 17, 2020 21:15
Is there a problem in the Euler solver? Combas SU2 4 March 28, 2014 15:48
Problem with compiling new solver palazi88 OpenFOAM Programming & Development 2 December 24, 2013 19:52
Problem in Compiling the solver m.maneshi OpenFOAM Running, Solving & CFD 4 November 3, 2010 02:07
Mashing Problem? ji CFX 2 April 4, 2002 05:03


All times are GMT -4. The time now is 11:06.