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

Error using lookupObject()

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 16, 2022, 09:13
Default Error using lookupObject()
  #1
Member
 
Join Date: Jun 2020
Posts: 49
Rep Power: 5
Swirl is on a distinguished road
Hi everyone,

I am working on a modified Version of the PaSR combustion model. In that I need to access a volScalarField which is being generated by my solver called "f".

I am trying to do this using the code

Code:
const volScalarField& F = this->mesh().lookupObject<volScalarField>("f");
However, this yields the error

Code:
Error: Expected primary-expression before ">" token
Does anyone know, how to fix this?
Thank you very much!
Swirl is offline   Reply With Quote

Old   March 16, 2022, 10:52
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Check that you have "volFields.H" included somewhere, it could be that it simply does not know what volScalarField is in your chunk of code.
olesen is offline   Reply With Quote

Old   March 23, 2022, 03:21
Default
  #3
Member
 
Join Date: Jun 2020
Posts: 49
Rep Power: 5
Swirl is on a distinguished road
Quote:
Originally Posted by olesen View Post
Check that you have "volFields.H" included somewhere, it could be that it simply does not know what volScalarField is in your chunk of code.
Unfortunately, that didnt help :-(
PaSR combustion model allready uses references to other volScalarFields, but those are stored in the turbulence model and can be accessed differently.
Swirl is offline   Reply With Quote

Old   March 23, 2022, 03:51
Default
  #4
Member
 
Join Date: Jun 2020
Posts: 49
Rep Power: 5
Swirl is on a distinguished road
Ok, I seemingly managed to solve the problem.

When I change the code to

Code:
const volScalarField& F = this->mesh().objectRegistry::lookupObject<volScalarField>("f");
it compiles without error. Here is another thread, where a similar issue was discussed:

Problem with lookupObject functionality

I still don't understand the issue, as my C++ knowledge is very slim, but maybe this helps others who encounter this problem.
Swirl is offline   Reply With Quote

Reply

Tags
lookupobject


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 with lookupObject functionality Tobi OpenFOAM Programming & Development 9 May 19, 2021 05:46
Accessing old fields: lookupObject at user defined time em17 OpenFOAM Programming & Development 4 October 7, 2019 07:10
Question about lookupObject function NewKid OpenFOAM Programming & Development 13 February 14, 2019 03:32
lookupObject nimasam OpenFOAM Running, Solving & CFD 3 June 15, 2012 12:23
lookupObject nimasam OpenFOAM Bugs 0 July 3, 2011 07:55


All times are GMT -4. The time now is 21:51.