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/)
-   -   undefined reference to `Foam::TurbulenceModel<Foam::geometricOneField, Foam::geometri (https://www.cfd-online.com/Forums/openfoam-programming-development/234400-undefined-reference-foam-turbulencemodel-foam-geometriconefield-foam-geometri.html)

3014214149 March 4, 2021 21:34

undefined reference to `Foam::TurbulenceModel<Foam::geometricOneField, Foam::geometri
 
Hello, everyone.

I'm compiling a new solver in OpenFOAM 4.1. I met an error.

Code:

Make/linux64GccDPInt32Opt/simpleNNFoam.o: In function `Foam::TurbulenceModel<Foam::geometricOneField, Foam::geometricOneField, Foam::incompressibleTurbulenceModel, Foam::transportModel>::New(Foam::geometricOneField const&, Foam::geometricOneField const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::transportModel const&, Foam::word const&)':
simpleNNFoam.C:(.text._ZN4Foam15TurbulenceModelINS_17geometricOneFieldES1_NS_29incompressibleTurbulenceModelENS_14transportModelEE3NewERKS1_S6_RKNS_14GeometricFieldINS_6VectorIdEENS_12fvPatchFieldENS_7volMeshEEERKNS7_IdNS_13fvsPatchFieldENS_11surfaceMeshEEESJ_RKS3_RKNS_4wordE[_ZN4Foam15TurbulenceModelINS_17geometricOneFieldES1_NS_29incompressibleTurbulenceModelENS_14transportModelEE3NewERKS1_S6_RKNS_14GeometricFieldINS_6VectorIdEENS_12fvPatchFieldENS_7volMeshEEERKNS7_IdNS_13fvsPatchFieldENS_11surfaceMeshEEESJ_RKS3_RKNS_4wordE]+0x35a): undefined reference to `Foam::TurbulenceModel<Foam::geometricOneField, Foam::geometricOneField, Foam::incompressibleTurbulenceModel, Foam::transportModel>::dictionaryConstructorTablePtr_'
collect2: error: ld returned 1 exit status
/home/cbq/OpenFOAM/OpenFOAM-4.1/wmake/makefiles/general:132: recipe for target '/home/cbq/OpenFOAM/cbq-4.1/platforms/linux64GccDPInt32Opt/bin/simpleNNFoam' failed

My option file is
Code:

EXE_INC = \
    -I/home/cbq/anaconda3/envs/mytorch/lib/python3.6/site-packages/torch/lib \
    -I/home/cbq/anaconda3/envs/mytorch/lib \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude \
    -I$(LIB_SRC)/sampling/lnInclude \
    -I/home/cbq/run/test/transportModels \
    -I/home/cbq/run/test/transportModels/testincompressible/testsinglePhaseTransportModel \
    -I/home/cbq/run/test/TurbulenceModels/turbulenceModels/reynoldsNet/lnInclude \
    -I/home/cbq/run/test/TurbulenceModels/turbulenceModels/lnInclude \
    -I/home/cbq/run/test/TurbulenceModels/testincompressible/lnInclude \



EXE_LIBS = \
    -lprotobuf -lglog -lgflags -lpthread \
    -L/home/cbq/OpenFOAM/cbq-4.1/platforms/linux64GccDPInt32Opt/lib \
    -L/home/cbq/anaconda3/envs/mytorch/lib/python3.6/site-packages/torch/lib \
    -lc10 \
    -lcaffe2 \
    -L/home/cbq/anaconda3/envs/mytorch/lib \
    -lmkl_intel_lp64 \
    -lmkl_gnu_thread \
    -lmkl_core \
    -lmkl_rt \
    -lprotobuf \
    -lreynoldsnet \
    -ltestturbulenceModels \
    -ltestincompressibleTurbulenceModels \
    -ltestincompressibleTransportModels \
    -lfiniteVolume \
    -lmeshTools \
    -lfvOptions \
    -lsampling \

The libraries of turbulenceModels, incompressibleTurbulenceModels, incompressibleTransportModels are all modified. So I added "test" as prefix. But I didn't change namespace. For example, the testincompressibleTurbulenceModel.C is
Code:

/*---------------------------------------------------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    |
    \\  /    A nd          | Copyright (C) 2013-2014 OpenFOAM Foundation
    \\/    M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

\*---------------------------------------------------------------------------*/

#include "testincompressibleTurbulenceModel.H"

// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

namespace Foam
{
    defineTypeNameAndDebug(incompressibleTurbulenceModel, 0);
}


// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

Foam::incompressibleTurbulenceModel::incompressibleTurbulenceModel
(
    const geometricOneField&,
    const volVectorField& U,
    const surfaceScalarField& alphaRhoPhi,
    const surfaceScalarField& phi,
    const word& propertiesName
)
:
    turbulenceModel
    (
        U,
        alphaRhoPhi,
        phi,
        propertiesName
    )
{}


Foam::tmp<Foam::volScalarField>
Foam::incompressibleTurbulenceModel::mu() const
{
    return nu();
}


Foam::tmp<Foam::scalarField>
Foam::incompressibleTurbulenceModel::mu(const label patchi) const
{
    return nu(patchi);
}


Foam::tmp<Foam::volScalarField>
Foam::incompressibleTurbulenceModel::mut() const
{
    return nut();
}


Foam::tmp<Foam::scalarField>
Foam::incompressibleTurbulenceModel::mut(const label patchi) const
{
    return nut(patchi);
}


Foam::tmp<Foam::volScalarField>
Foam::incompressibleTurbulenceModel::muEff() const
{
    return nuEff();
}


Foam::tmp<Foam::scalarField>
Foam::incompressibleTurbulenceModel::muEff(const label patchi) const
{
    return nuEff(patchi);
}


// ************************************************************************* //

Could anyone help me?


All times are GMT -4. The time now is 15:56.