|
[Sponsors] |
error: cannot allocate an object of abstract type... |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 24, 2013, 05:39 |
error: cannot allocate an object of abstract type...
|
#1 |
New Member
Bojan Sekutkovski
Join Date: Oct 2012
Posts: 19
Rep Power: 14 |
Hello,
After successful compilation of OpenFOAM-1.6-ext on Ubuntu 12.04 64bit, i tried to add a compressible LES turbulence model to the library, i.e. kOmegaSSTSAS turbulence model. I managed to compile this model and use it within versions of OpenFOAM 2.0, and I got nice results. Making minor changes to the code, I almost have succeeded to compile it within the OpenFOAM-1.6-ext. The following error message appears after running command "wmake" or "wmake libso" (short version): error: cannot allocate an object of abstract type ‘Foam::compressible::LESModels::kOmegaSSTSAS’ kOmegaSSTSAS/kOmegaSSTSAS.H:77:7: note: because the following virtual functions are pure within ‘Foam::compressible::LESModels::kOmegaSSTSAS’: Or full version: wmake libso SOURCE=kOmegaSSTSAS/kOmegaSSTSAS.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/home/bojan/OpenFOAM/OpenFOAM-1.6-ext/src/turbulenceModels -I/home/bojan/OpenFOAM/OpenFOAM-1.6-ext/src/turbulenceModels/LES/LESdeltas/lnInclude -I/home/bojan/OpenFOAM/OpenFOAM-1.6-ext/src/turbulenceModels/LES/LESfilters/lnInclude -I/home/bojan/OpenFOAM/OpenFOAM-1.6-ext/src/thermophysicalModels/basic/lnInclude -I/home/bojan/OpenFOAM/OpenFOAM-1.6-ext/src/meshTools/lnInclude -I/home/bojan/OpenFOAM/OpenFOAM-1.6-ext/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/bojan/OpenFOAM/OpenFOAM-1.6-ext/src/OpenFOAM/lnInclude -I/home/bojan/OpenFOAM/OpenFOAM-1.6-ext/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64Gcc46DPOpt/kOmegaSSTSAS.o In file included from kOmegaSSTSAS/kOmegaSSTSAS.H:60:0, from kOmegaSSTSAS/kOmegaSSTSAS.C:26: lnInclude/LESModel.H: In static member function ‘static Foam::autoPtr<Foam::compressible::LESModel> Foam::compressible::LESModel::adddictionaryConstru ctorToTable<LESModelType>::New(const volScalarField&, const volVectorField&, const surfaceScalarField&, const Foam::basicThermo&) [with LESModelType = Foam::compressible::LESModels::kOmegaSSTSAS, Foam::volScalarField = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>, Foam::volVectorField = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>, Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>]’: lnInclude/LESModel.H:128:1: instantiated from ‘Foam::compressible::LESModel::adddictionaryConstr uctorToTable<LESModelType>::adddictionaryConstruct orToTable(const Foam::word&) [with LESModelType = Foam::compressible::LESModels::kOmegaSSTSAS]’ kOmegaSSTSAS/kOmegaSSTSAS.C:44:1: instantiated from here lnInclude/LESModel.H:116:9: error: cannot allocate an object of abstract type ‘Foam::compressible::LESModels::kOmegaSSTSAS’ kOmegaSSTSAS/kOmegaSSTSAS.H:77:7: note: because the following virtual functions are pure within ‘Foam::compressible::LESModels::kOmegaSSTSAS’: lnInclude/LESModel.H:215:37: note: virtual Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::compressible::LESModel::alphaEff() const lnInclude/LESModel.H:116:9: warning: control reaches end of non-void function [-Wreturn-type] make: *** [Make/linux64Gcc46DPOpt/kOmegaSSTSAS.o] Error 1 Actually, I've found the problem...after removing the following line from kOmegaSSTSAS.C, the building goes successfully: addToRunTimeSelectionTable(LESModel, kOmegaSSTSAS, dictionary); I've been comparing kOmegaSSTSAS.C & kOmegaSSTSAS.H with other turbulence model files, but without a little success... I'm not sure if I have to add some lines to files and options files in Make folder...? Regards! Regards |
|
November 5, 2013, 12:45 |
The solution:
|
#2 |
New Member
Bojan Sekutkovski
Join Date: Oct 2012
Posts: 19
Rep Power: 14 |
After two weeks of searching for a solution, the problem was solved by adding the following function definition in kOmegaSSTSAS.H file:
//- Return thermal conductivity virtual tmp<volScalarField> alphaEff() const { return tmp<volScalarField> ( new volScalarField("alphaEff", alphaSgs_ + alpha()) ); } |
|
February 16, 2017, 11:08 |
Evaporation model
|
#3 |
New Member
Join Date: Feb 2017
Posts: 3
Rep Power: 9 |
Hi Bojan,
I have encountered same problem when I am trying to implement an old code to OpenFoam 3.0 the message I am receiving is error: cannot allocate an object of abstract type ‘Foam::MyEvaporationStA<Foam::ReactingCloud<Foam:: ThermoCloud<Foam::KinematicCloud<Foam::Cloud<Foam: :ReactingParcel<Foam::ThermoParcel<Foam::Kinematic Parcel<Foam:article> > > > > > > >’ return autoPtr< baseType >(new baseType##Type parList); \ ^ MyEvaporationStA is my own evaporation model which is under src/Lagrangian/intermediate/submodels/Reacting/PhaseChangeModels. I am just wondering how did you determine what virtual member needs to be added to the .C file. Thanks a lot for your help |
|
February 16, 2017, 16:36 |
|
#4 |
New Member
Bojan Sekutkovski
Join Date: Oct 2012
Posts: 19
Rep Power: 14 |
Hi Leofang,
Actually, I have found problem inside of my error log, you can see it in my post. It is exactly at the end of error log: Foam::compressible::LESModel::alphaEff() const lnInclude/LESModel.H:116:9: warning: control reaches end of non-void function [-Wreturn-type] make: *** [Make/linux64Gcc46DPOpt/kOmegaSSTSAS.o] Error 1 Best regards! |
|
February 22, 2017, 13:02 |
|
#5 |
New Member
Join Date: Feb 2017
Posts: 3
Rep Power: 9 |
Thanks for your reply Bojan. Unfortunately I still couldn't figure out how to change my source code to mitigate this problem. For your case do you remember why do your have to add virtual function to your header file?
|
|
February 22, 2017, 13:26 |
|
#6 |
New Member
Bojan Sekutkovski
Join Date: Oct 2012
Posts: 19
Rep Power: 14 |
Hi,
I don't remember exactly, but I think I had to add the virtual function since it was defined in the base class of LES models, called: "class LESModel" |
|
Tags |
compressible, error, komegasstsas, lesmodel |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM.org] compile error in dynamicMesh and thermophysicalModels libraries | NickG | OpenFOAM Installation | 3 | December 30, 2019 01:21 |
Simulation of Radial Fan with simpleFoam MRF | nash | OpenFOAM Running, Solving & CFD | 2 | November 5, 2015 11:12 |
rhoSimpleFoam | claco | OpenFOAM | 7 | April 20, 2010 05:32 |
Problems with Turbulence Modeling | ezsoal | OpenFOAM Running, Solving & CFD | 4 | November 26, 2009 16:12 |
Flow Around a Cylinder | ronaldo | OpenFOAM | 5 | September 18, 2009 09:13 |