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 compiling kEpsilon model (https://www.cfd-online.com/Forums/openfoam-programming-development/211745-error-compiling-kepsilon-model.html)

gu1 November 18, 2018 16:57

Error compiling kEpsilon model
 
Hello,

I'm trying to compile a kEpsilon template (https://github.com/OpenFOAM/OpenFOAM...lon/kEpsilon.C on OpenFOAM 5.x) and am encountering two errors, which are described in the link: https://paste.ubuntu.com/p/DHHHqrgcnz/

It's a bit difficult to explain my goal, but believe me, it's very important to me. When I comment the lines from 144 to 208 (kEpsilon.C), I can compile the solver avoiding ERROR 1.
I can compile (avoiding the ERRO2 described in the link) the solver when I comment lines 254 and 256 (kEpsilon.C).

I hope you can help me.

mAlletto November 19, 2018 08:58

From you error I assume you took a kEpsilon model from versions prior to 3.0 and tried to compile it with a newer version. In the newer versions (from 3.0 on I guess) you need to write epsEqn.ref().relax();


Have a look at https://www.openfoam.com/documentati...8C_source.html

gu1 November 19, 2018 10:10

Thanks, I was able to compile (... yes, the version is 2.4.x).

Now there is only one ERROR to solve my problem...

mAlletto November 19, 2018 10:49

can you post the error in this thread?

gu1 November 19, 2018 10:53

Thank you very much for your attention ... it's very important to me.

Quote:

$ wmake

Making dependency list for source file mykEpsilon.C
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam5/src/finiteVolume/lnInclude -I/opt/openfoam5/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam5/src/OpenFOAM/lnInclude -I/opt/openfoam5/src/OSspecific/POSIX/lnInclude -fPIC -c turbulent/mykEpsilon/mykEpsilon.C -o Make/linux64GccDPInt32Opt/turbulent/mykEpsilon/mykEpsilon.o
turbulent/mykEpsilon/mykEpsilon.C: In member function ‘virtual Foam::tmp<Foam::GeometricField<Foam::SymmTensor<do uble>, Foam::fvPatchField, Foam::volMesh> > Foam::mykEpsilon::R() const’:
turbulent/mykEpsilon/mykEpsilon.C:157:17: error: ‘((const Foam::mykEpsilon*)this)->Foam::turbulent::U’ does not have class type
U.time().timeName(),
^
/opt/openfoam5/wmake/rules/General/transform:25: recipe for target 'Make/linux64GccDPInt32Opt/turbulent/mykEpsilon/mykEpsilon.o' failed
make: *** [Make/linux64GccDPInt32Opt/turbulent/mykEpsilon/mykEpsilon.o] Error 1

mAlletto November 19, 2018 13:08

You have to write probably something like this->U_ instead of U_

gu1 November 19, 2018 13:43

I was able to solve my problem Michael (replaces U.time().timeName(), with runTime_.timeName(),.. I hope this solution is correct.). Thank you very much.
But now I've got a new problem ... I've created a way to read an external library (it's highlighted below):

Quote:

turbulenceModel::turbulenceModel
(
const volVectorField& U,
const surfaceScalarField& phi,
const dictionary& dict
)
:
IOdictionary
(
IOobject
(
"stressProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
rho_(dict.lookup("rho")),
tau_(dict.lookup("lambda")),
lawPtr_(RASModel::New(word::null, U, phi, subDict("stress")))
{}
...Even after compiling successfully, when I run the solver, it shows the error:

Quote:

kEpsilonTurbulentFoam: symbol lookup error: kEpsilonTurbulentFoam: undefined symbol: _ZN4Foam17viscoelasticModelC1ERKNS_14GeometricFiel dINS_6VectorIdEENS_12fvPatchFieldENS_7volMeshEEERK NS1_IdNS_13fvsPatchFieldENS_11surfaceMeshEEE
Funny that he had previously presented a similar error...:
Quote:

$ kEpsilonTurbulentFoam

kEpsilonTurbulentFoam: symbol lookup error: /home/cae/OpenFOAM/cae-5.0/platforms/linux64GccDPInt32Opt/lib/libturbkEpsilonModel.so: undefined symbol: _ZN4Foam15RASModel8typeName
Can you solve any of these? Especially the last...

gu1 November 21, 2018 06:08

I still get the error below if you can help me...:
Quote:

$ kEpsilonTurbulentFoam

kEpsilonTurbulentFoam: symbol lookup error: /home/cae/OpenFOAM/cae-5.0/platforms/linux64GccDPInt32Opt/lib/libturbkEpsilonModel.so: undefined symbol: _ZN4Foam15RASModel8typeName
I tried everything I read in the forums but it did not work out.

EDIT1: I discovered some things about the error...
... in the kEpsilon.C:

Quote:

namespace Foam
{
defineTypeNameAndDebug(kEpsilon, 0);
// addToRunTimeSelectionTable(RASModel, kEpsilon, dictionary); //error!
}
If I compile with this commented line, it compiles right, BUT... when I try to compile the solver that fetches that library (a solver based on the PISO algorithm) it gives the following error:

Quote:

/home/cae/OpenFOAM/cae-5.0/platforms/linux64GccDPInt32Opt/lib/libkEpsilonModel.so: undefined reference to para `Foam::RASModel::New(Foam::word const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::dictionary const&)'
/home/cae/OpenFOAM/cae-5.0/platforms/linux64GccDPInt32Opt/lib/libkEpsilonModel.so: undefined reference to para `Foam::RASModel::correct()'
collect2: error: ld returned 1 exit status
/opt/openfoam5/wmake/makefiles/general:140: recipe for target '/home/cae/OpenFOAM/cae-5.0/platforms/linux64GccDPInt32Opt/bin/kEpsilonTurbulentFoam' failed
make: *** [/home/cae/OpenFOAM/cae-5.0/platforms/linux64GccDPInt32Opt/bin/kEpsilonTurbulentFoam] Error 1
If I compile with the uncommented line, it does not compile (kEpsilon.C) ... it throws error.

Quote:

$ wmake
Making dependency list for source file kEpsilon.C
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam5/src/finiteVolume/lnInclude -I/opt/openfoam5/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam5/src/OpenFOAM/lnInclude -I/opt/openfoam5/src/OSspecific/POSIX/lnInclude -fPIC -c RASModel/kEpsilon/kEpsilon.C -o Make/linux64GccDPInt32Opt/RASModel/kEpsilon/kEpsilon.o
In file included from /opt/openfoam5/src/OpenFOAM/lnInclude/token.H:49:0,
from /opt/openfoam5/src/OpenFOAM/lnInclude/Istream.H:47,
from /opt/openfoam5/src/OpenFOAM/lnInclude/ISstream.H:39,
from /opt/openfoam5/src/OpenFOAM/lnInclude/IOstreams.H:38,
from /opt/openfoam5/src/OpenFOAM/lnInclude/VectorSpace.C:27,
from /opt/openfoam5/src/OpenFOAM/lnInclude/VectorSpace.H:233,
from /opt/openfoam5/src/OpenFOAM/lnInclude/Vector.H:44,
from /opt/openfoam5/src/OpenFOAM/lnInclude/vector.H:39,
from /opt/openfoam5/src/OpenFOAM/lnInclude/fieldTypes.H:35,
from /opt/openfoam5/src/finiteVolume/lnInclude/volFieldsFwd.H:37,
from /opt/openfoam5/src/finiteVolume/lnInclude/fvmDdt.H:38,
from /opt/openfoam5/src/finiteVolume/lnInclude/fvm.H:43,
from lnInclude/RASModel.H:44,
from RASModel/kEpsilon/kEpsilon.H:42,
from RASModel/kEpsilon/kEpsilon.C:26:
lnInclude/RASModel.H: In instantiation of ‘static Foam::autoPtr<Foam::RASModel> Foam::RASModel::adddictionaryConstructorToTable<RA SModelType>::New(const Foam::word&, const volVectorField&, const surfaceScalarField&, const Foam::dictionary&) [with RASModelType = Foam::kEpsilon; Foam::volVectorField = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>; Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>]’:
lnInclude/RASModel.H:115:9: required from ‘Foam::RASModel::adddictionaryConstructorToTable<R ASModelType>::adddictionaryConstructorToTable(cons t Foam::word&) [with RASModelType = Foam::kEpsilon]’
RASModel/kEpsilon/kEpsilon.C:37:5: required from here
/opt/openfoam5/src/OpenFOAM/lnInclude/runTimeSelectionTables.H:72:64: error: invalid new-expression of abstract class type ‘Foam::kEpsilon’
return autoPtr<baseType>(new baseType##Type parList); \
^
lnInclude/RASModel.H:115:9: note: in expansion of macro ‘declareRunTimeSelectionTable’
declareRunTimeSelectionTable
^
In file included from RASModel/kEpsilon/kEpsilon.C:26:0:
RASModel/kEpsilon/kEpsilon.H:53:7: note: because the following virtual functions are pure within ‘Foam::kEpsilon’:
class kEpsilon
^
In file included from RASModel/kEpsilon/kEpsilon.H:42:0,
from RASModel/kEpsilon/kEpsilon.C:26:
lnInclude/RASModel.H:227:37: note: virtual Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::RASModel::divDevRhoReff(Foam::volVectorField &) const
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const = 0;
^
/opt/openfoam5/wmake/rules/General/transform:25: recipe for target 'Make/linux64GccDPInt32Opt/RASModel/kEpsilon/kEpsilon.o' failed
make: *** [Make/linux64GccDPInt32Opt/RASModel/kEpsilon/kEpsilon.o] Error 1

mAlletto November 21, 2018 13:06

probably you tried to follows the steps in tutorials how to add a new turbulence model for OF versions prior to 3.0


In this blog http://hassankassem.me/posts/newturbulencemodel/ it is described how to do it for versions from 3.0 on


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