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/)
-   -   Compile error kEpsilonViollet for OF 2.1.1 (https://www.cfd-online.com/Forums/openfoam-programming-development/104009-compile-error-kepsilonviollet-2-1-1-a.html)

Andreas.Herwig July 1, 2012 18:21

Compile error kEpsilonViollet for OF 2.1.1
 
Hi,

while compiling the kEpsilonViollet model (it is written for OF 1.7 and works fine with OF 1.7)

http://openfoamwiki.net/index.php/Co...EpsilonViollet

under OF 2.1.1 a strange (at least to me) error occurs:

Quote:

kEpsilonViollet/kEpsilonViollet.C: In member function ‘virtual void Foam::incompressible::RASModels::kEpsilonViollet:: correct()’:
kEpsilonViollet/kEpsilonViollet.C:254:9: error: reference to ‘db’ is ambiguous
/opt/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/IOobject.H:246:35: error: candidates are: const Foam::objectRegistry& Foam::IOobject::db() const
/opt/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/IOobject.H:246:35: error: const Foam::objectRegistry& Foam::IOobject::db() const
I am using the latest gcc (version 4.6.2) compiler. By searching the problem in the web i found something which might be related (but I am not sure):

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27775

From the original source code of kEpsilonViollet.C it is the part:

Code:

    const uniformDimensionedVectorField& g_ =
        db().lookupObject<uniformDimensionedVectorField>("g");
    const volScalarField& T_ = db().lookupObject<volScalarField>(TName_);

which causes the problem. By the way: you can find the similar code snippet
Code:

    const uniformDimensionedVectorField& g_ =
        db().lookupObject<uniformDimensionedVectorField>("g");

for example in

alphaFixedPressureFvPatchScalarField.C (from /src/transportModels/...)

which compiles without any problems.

If there is somebody knowing what to do to fix this problem: Thank you very much!

Greetings

Andreas

Andreas.Herwig July 2, 2012 06:25

maybe fixed ?
 
Dear all,

while trying to solve the problem described above i found this thread

http://www.cfd-online.com/Forums/ope...-buoyancy.html

There something similar is discribed and it is said that there is something before the db(). is needed, like ???.db(). So i tried U_.db()

Code:

const uniformDimensionedVectorField& g_ =
        U_.db().lookupObject<uniformDimensionedVectorField>("g");
   
    const volScalarField& T_ = U_.db().lookupObject<volScalarField>(TName_);

and it seems to solve the problem. The objectRegistry seems to be attached to a field and does not exist (anymore?) "stand alone", but maybe someone who knows the openfoam source code better then me should answer on this question.

There are some more parts of the kEpsilonViollet code to modify for to transfer it from OF 1.7 to OF 2.1.1. I will publish the fully transferd version later in this thread after i did some tests e.g. comparing the results of a test case calculated with the original code under OF 1.7 to the results with my transfered code under OF 2.1.1

Best regards

andreas


All times are GMT -4. The time now is 18:07.