CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

error: cannot allocate an object of abstract type...

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 24, 2013, 04:39
Default error: cannot allocate an object of abstract type...
  #1
New Member
 
Bojan Sekutkovski
Join Date: Oct 2012
Posts: 19
Rep Power: 13
Bojan is on a distinguished road
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
Bojan is offline   Reply With Quote

Old   November 5, 2013, 11:45
Default The solution:
  #2
New Member
 
Bojan Sekutkovski
Join Date: Oct 2012
Posts: 19
Rep Power: 13
Bojan is on a distinguished road
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())
);
}



Bojan is offline   Reply With Quote

Old   February 16, 2017, 10:08
Post Evaporation model
  #3
New Member
 
Join Date: Feb 2017
Posts: 3
Rep Power: 9
leofang is on a distinguished road
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
leofang is offline   Reply With Quote

Old   February 16, 2017, 15:36
Default
  #4
New Member
 
Bojan Sekutkovski
Join Date: Oct 2012
Posts: 19
Rep Power: 13
Bojan is on a distinguished road
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!
Bojan is offline   Reply With Quote

Old   February 22, 2017, 12:02
Default
  #5
New Member
 
Join Date: Feb 2017
Posts: 3
Rep Power: 9
leofang is on a distinguished road
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?
leofang is offline   Reply With Quote

Old   February 22, 2017, 12:26
Default
  #6
New Member
 
Bojan Sekutkovski
Join Date: Oct 2012
Posts: 19
Rep Power: 13
Bojan is on a distinguished road
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"
Bojan is offline   Reply With Quote

Reply

Tags
compressible, error, komegasstsas, lesmodel


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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 00:21
Simulation of Radial Fan with simpleFoam MRF nash OpenFOAM Running, Solving & CFD 2 November 5, 2015 10:12
rhoSimpleFoam claco OpenFOAM 7 April 20, 2010 04:32
Problems with Turbulence Modeling ezsoal OpenFOAM Running, Solving & CFD 4 November 26, 2009 15:12
Flow Around a Cylinder ronaldo OpenFOAM 5 September 18, 2009 08:13


All times are GMT -4. The time now is 16:09.