CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Compile error kEpsilonViollet for OF 2.1.1 (

Andreas.Herwig July 1, 2012 18:21

Compile error kEpsilonViollet for OF 2.1.1

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

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


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):

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


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

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

    const 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!



Andreas.Herwig July 2, 2012 06:25

maybe fixed ?
Dear all,

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

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()


const 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


All times are GMT -4. The time now is 00:39.