|
[Sponsors] |
Linking Error: undefined reference to `Foam::viscoelasticLaw::New(.. |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 20, 2019, 07:50 |
Linking Error: undefined reference to `Foam::viscoelasticLaw::New(..
|
#1 |
New Member
Join Date: Apr 2019
Posts: 12
Rep Power: 7 |
Hello everyone,
when compiling my solver I get an linking error and I couldn't find a solution yet. Maybe you can help. I get the following error: Code:
/home/pauls/foam/pauls-4.0/lib/linux64GccDPOpt/libviscoFreeSurface.so: undefined reference to `Foam::viscoelasticLaw::New(Foam::word const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::faPatchField, Foam::areaMesh> const&, Foam::GeometricField<double, Foam::faePatchField, Foam::edgeMesh> const&, Foam::dictionary const&)' collect2: error: ld returned 1 exit status Code:
viscoelasticModel::viscoelasticModel ( const volVectorField& U, const surfaceScalarField& phi ) : IOdictionary ( IOobject ( "viscoelasticProperties", U.time().constant(), U.db(), IOobject::MUST_READ, IOobject::NO_WRITE ) ), lawPtr_(viscoelasticLaw::New(word::null, U, phi, subDict("rheology"))) {} The core feature of the bubbleInterTrackFoam is calculation exact conditions at the bubble Interface. I am using this interface velocity Us and interface flux Phis data to calculate a surface stress term and predict viscoelastic behaviour. All interface related calculations are done in a class called freeSurface in which I implemented the lawPtr. Since the interface data is calculated after constructing the class I initialize with a lawPtrPtr pointer, that I later return dereferenced when I access the lawPtr. Code:
freeSurface::freeSurface ( dynamicFvMesh& m, const volScalarField& rho, volVectorField& Ub, volScalarField& Pb, const surfaceScalarField& sfPhi ) : . . . mesh_(m), rho_(rho), U_(Ub), p_(Pb), phi_(sfPhi), . . . lawPtrPtr_(NULL) {} Code:
void freeSurface::makeLawPtr() const { if (debug) { Info<< "freeSurface::makeLawPtr() : " << "making viscosity law pointer" << endl; } // It is an error to attempt to recalculate // if the pointer is already set if (lawPtrPtr_) { FatalErrorIn("freeSurface::makeLawPtr()") << "viscosity LawPtr alreay exists" << abort(FatalError); } const areaVectorField& Us_ = Us(); const edgeScalarField& phis_ = Phis(); IOdictionary freeSurfaceProperties ( IOobject ( "freeSurfaceProperties", U_.mesh().time().constant(), U_.mesh(), IOobject::MUST_READ, IOobject::NO_WRITE ) ); lawPtrPtr_ = new autoPtr<viscoelasticLaw> ( viscoelasticLaw::New(word::null, U_, phi_, Us_, phis_, freeSurfaceProperties.subDict("rheology")) ); } Code:
autoPtr<viscoelasticLaw>& freeSurface::lawPtr() { if (!lawPtrPtr_) { makeLawPtr(); } return *lawPtrPtr_; } const autoPtr<viscoelasticLaw>& freeSurface::lawPtr() const { if (!lawPtrPtr_) { makeLawPtr(); } return *lawPtrPtr_; } Code:
EXE_INC = \ -I$(WM_PROJECT_USER_DIR)/src/viscoelasticTransportModels \ -I$(WM_PROJECT_USER_DIR)/src/viscoelasticTransportModels/viscoelastic/lnInclude \ -I$(WM_PROJECT_USER_DIR)/src/finiteArea/lnInclude \ -I../include \ -I../freeSurface/lnInclude \ -I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude EXE_LIBS = \ -L$(FOAM_USER_LIBBIN) \ -lviscoelasticTransportModels \ -lviscoFreeSurface \ -lfiniteAreaMod \ -L$(FOAM_LIBBIN) \ -ldynamicFvMesh \ -ldynamicMesh \ -lmeshTools \ -lfiniteVolume \ -llduSolvers \ -L$(MESQUITE_LIB_DIR) -lmesquite Cheers Paul |
|
December 3, 2019, 07:57 |
|
#2 |
New Member
Join Date: Apr 2019
Posts: 12
Rep Power: 7 |
Well guys, in the end I still don't know what caused the error but I was able to fix it with a different work around.
I am using a Code:
mutable viscoelasticModel* modelPtr_ Code:
void freeSurface::makeModelPtr() const { if (debug) { Info<< "freeSurface::makeModelPtr() : " << "making viscosity law pointer" << endl; } // It is an error to attempt to recalculate // if the pointer is already set if (modelPtr_) { FatalErrorIn("freeSurface::makeModelPtr()") << "viscosity ModelPtr alreay exists" << abort(FatalError); } modelPtr_= new viscoelasticModel(U_, phi_, Us(), Phis()); } The Object is returned by this method: Code:
viscoelasticModel& freeSurface::modelPtr() { if (!modelPtr_) { makeModelPtr(); } return *modelPtr_; } Code:
tmp<volSymmTensorField> freeSurface::tau() { return modelPtr().tau(); } Hope this helps you, if youre running in the same problem. Paul |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Second Derivative Zero - Boundary Condition | fu-ki-pa | OpenFOAM | 11 | March 27, 2021 05:28 |
LEMOS InflowGenerator | r_gordon | OpenFOAM Running, Solving & CFD | 103 | December 18, 2018 01:58 |
OpenFOAM 1.6-ext git installation on Ubuntu 11.10 x64 | Attesz | OpenFOAM Installation | 45 | January 13, 2012 13:38 |
OpenFOAM on MinGW crosscompiler hosted on Linux | allenzhao | OpenFOAM Installation | 127 | January 30, 2009 20:08 |
G95 + CGNS | Bruno | Main CFD Forum | 1 | January 30, 2007 01:34 |