CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Error using lookupObject() (https://www.cfd-online.com/Forums/openfoam-programming-development/241724-error-using-lookupobject.html)

Swirl March 16, 2022 09:13

Error using lookupObject()
 
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!

olesen March 16, 2022 10:52

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.

Swirl March 23, 2022 03:21

Quote:

Originally Posted by olesen (Post 824193)
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 March 23, 2022 03:51

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:

https://www.cfd-online.com/Forums/op...tionality.html

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


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