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

error when port 1.5dev to 230

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By xianqiejiao

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 7, 2014, 01:49
Question error when port 1.5dev to 230
  #1
New Member
 
BO
Join Date: Dec 2014
Posts: 21
Rep Power: 11
xianqiejiao is on a distinguished road
Hi every,

I got a code from my friends which was in 1.5dev version. I was trying to port it to the 230 version I am using now. While I am able to fix some bugs, there are some I have now idea and need some help. Actually, some of the errors are similar. I think they are caused from the changes in thermo and turbulence classes. I have attached the codes.

error 1

Code:
ThermoModel/visThermo.C: In constructor ‘Foam::visThermo::visThermo(const Foam::fvMesh&, const volScalarField&, const volScalarField&)’:
ThermoModel/visThermo.C:57:5: error: no matching function for call to ‘Foam::basicThermo::basicThermo(const Foam::fvMesh&)’
     )
     ^
error 2
Code:
In file included from coSigmaY.C:50:0:
createFields.H: In function ‘int main(int, char**)’:
createFields.H:123:68: error: no matching function for call to ‘Foam::incompressibleTwoPhaseMixture::incompressibleTwoPhaseMixture(Foam::volVectorField&, Foam::surfaceScalarField&, const char [5])’
     incompressibleTwoPhaseMixture twoPhaseProperties(U, phi, "Ybar");
                                                                    ^
error 3
Code:
/home/bo/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/IOobject.H:250:35: note:                 const Foam::objectRegistry& Foam::IOobject::db() const
TurbModel/highDensityRatioKEpsilon.C:195:7: error: no matching function for call to ‘Foam::compressible::RASModel::RASModel(const Foam::word&, const volScalarField&, const volVectorField&, const surfaceScalarField&, const Foam::basicThermo&)’
       )
       ^
error 4
Code:
/home/bo/OpenFOAM/OpenFOAM-2.3.0/src/turbulenceModels/compressible/RAS/lnInclude/RASModel.H:109:9: note:   candidate expects 1 argument, 5 provided
In file included from coSigmaY.C:50:0:
createFields.H:245:15: error: cannot declare variable ‘thermo’ to be of abstract type ‘Foam::visThermo’
     visThermo thermo(mesh, rho, Ybar);
error 5
Code:
In file included from coSigmaY.C:50:0:
createFields.H:257:9: error: no matching function for call to ‘Foam::compressible::turbulenceModel::New(Foam::volScalarField&, Foam::volVectorField&, Foam::surfaceScalarField&, Foam::visThermo&)’
         )
         ^
error 6
Code:
/home/bo/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/runTimeSelectionTables.H:76:66: error: cannot allocate an object of abstract type ‘Foam::compressible::RASModels::highDensityRatioKEpsilon’
             return autoPtr< baseType >(new baseType##Type parList);           \
                                                                  ^
Any suggestion is welcome. Thanks very much.
Attached Files
File Type: gz halfcoSigmaY0 .tar.gz (11.2 KB, 5 views)
File Type: gz ThermoModel.tar.gz (4.9 KB, 6 views)
File Type: gz TurbModel.tar.gz (11.2 KB, 5 views)
turbobluestreak likes this.
xianqiejiao is offline   Reply With Quote

Old   December 8, 2014, 02:18
Default
  #2
New Member
 
BO
Join Date: Dec 2014
Posts: 21
Rep Power: 11
xianqiejiao is on a distinguished road
Update:

With the help of google, I have fixed most of the errors. However, there is last one remain.

Code:
ThermoModel/visThermo.C: In constructor ‘Foam::visThermo::visThermo(const Foam::fvMesh&, const Foam::word&)’:
ThermoModel/visThermo.C:58:5: error: no matching function for call to ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField()’
     )
     ^
ThermoModel/visThermo.C:58:5: note: candidates are:
In file included from /home/bo/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/GeometricField.H:601:0,
                 from /home/bo/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/GeometricScalarField.H:38,
                 from /home/bo/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/GeometricFields.H:34,
                 from /home/bo/OpenFOAM/OpenFOAM-2.3.0/src/finiteVolume/lnInclude/volFields.H:37,
                 from /home/bo/OpenFOAM/OpenFOAM-2.3.0/src/thermophysicalModels/basic/lnInclude/basicThermo.H:38,
                 from ThermoModel/visThermo.H:38,
                 from ThermoModel/visThermo.C:26:
I tried to make the visThermo looks like psiThermo, but it seem not working...
Any suggestion on this ? Many thanks .
Attached Files
File Type: h visThermo.H (3.3 KB, 9 views)
File Type: c visThermo.C (3.2 KB, 7 views)
xianqiejiao is offline   Reply With Quote

Old   December 8, 2014, 03:01
Default
  #3
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

You've got volScalarField mu_ in class definition but for some reason you've omitted its initialization from visThermo constructor (so compiler tries default constructor with no arguments but there's no such constructor of volScalarField).
alexeym is offline   Reply With Quote

Old   December 8, 2014, 04:25
Smile
  #4
New Member
 
BO
Join Date: Dec 2014
Posts: 21
Rep Power: 11
xianqiejiao is on a distinguished road
Quote:
Originally Posted by alexeym View Post
Hi,

You've got volScalarField mu_ in class definition but for some reason you've omitted its initialization from visThermo constructor (so compiler tries default constructor with no arguments but there's no such constructor of volScalarField).
Thank you for the tips, I forgot the instialization of mu_.
Then I fount another error I have omitted:
Code:
usr/bin/ld: cannot find -lbasicThermophysicalModels
/usr/bin/ld: cannot find -llduSolvers
collect2: error: ld returned 1 exit status
make: *** [/home/bo/OpenFOAM/bo-2.3.0/platforms/linux64GccDPOpt/bin/halfcoSigmaY] Error 1
as I can't find any of these two libs in other solvers, I assume they are version errors. I changed the basicThermophysicalModels to fluidThermophysicalModels and deleted the llduSolvers. I hope this should be fine.

However, after I did this, following error happens:
Code:
createFields.H: In function ‘int main(int, char**)’:
createFields.H:265:9: error: no matching function for call to ‘Foam::compressible::turbulenceModel::New(Foam::volScalarField&, Foam::volVectorField&, Foam::surfaceScalarField&, Foam::visThermo&)’
         )
         ^
createFields.H:265:9: note: candidate is:
In file included from coSigmaY.C:36:0:
/home/bo/OpenFOAM/OpenFOAM-2.3.0/src/turbulenceModels/compressible/turbulenceModel/lnInclude/turbulenceModel.H:144:41: note: static Foam::autoPtr<Foam::compressible::turbulenceModel> Foam::compressible::turbulenceModel::New(const volScalarField&, const volVectorField&, const surfaceScalarField&, const Foam::fluidThermo&, const Foam::word&)
         static autoPtr<turbulenceModel> New
                                         ^
/home/bo/OpenFOAM/OpenFOAM-2.3.0/src/turbulenceModels/compressible/turbulenceModel/lnInclude/turbulenceModel.H:144:41: note:   no known conversion for argument 4 from ‘Foam::visThermo’ to ‘const Foam::fluidThermo&’
It seems to arise from visThermo I used. How should I solve this error now? I used the same way to creat turbulence model in sonicFoam, which uses psiThermo.

Code:
Info << "Creating turbulence model\n" << endl;
    autoPtr<compressible::turbulenceModel> turbulence
    (
        compressible::turbulenceModel::New
        (
            rho,
            U,
            phi,
            thermo
        )
    );
xianqiejiao is offline   Reply With Quote

Old   December 8, 2014, 04:36
Default
  #5
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Here's excerpts from different files that will illustrate final conclusion:

psiThermo.H
Code:
class psiThermo
:
    public fluidThermo
{
...
}
compressible/turbulenceModel/turbulenceModel.H
Code:
...
        //- Construct from components
        turbulenceModel
        (
            const volScalarField& rho,
            const volVectorField& U,
            const surfaceScalarField& phi,
            const fluidThermo& thermoPhysicalModel,
            const word& turbulenceModelName = typeName
        );
...
visThermo.H
Code:
class visThermo : public basicThermo
{
...
}
I.e. turbulenceModel constructor expects fluidThermo, while you give it basicThermo.
alexeym is offline   Reply With Quote

Old   December 8, 2014, 06:54
Default
  #6
New Member
 
BO
Join Date: Dec 2014
Posts: 21
Rep Power: 11
xianqiejiao is on a distinguished road
Ah, I forgot to correct this! It seems that there is no fluidThermo class in the early versions. I change the parent class from basicThermo to fluidThermo and it works.

Then more reference problems show up...... :

Code:
Make/linux64GccDPOpt/coSigmaY.o: In function `main':
coSigmaY.C:(.text.startup+0x19b8): undefined reference to `Foam::incompressibleTwoPhaseMixture::incompressibleTwoPhaseMixture(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::word const&)'
Make/linux64GccDPOpt/visThermo.o: In function `Foam::visThermo::type() const':
visThermo.C:(.text._ZNK4Foam9visThermo4typeEv[_ZNK4Foam9visThermo4typeEv]+0x3): undefined reference to `Foam::visThermo::typeName'
Make/linux64GccDPOpt/visThermo.o: In function `Foam::HashTable<Foam::autoPtr<Foam::visThermo> (*)(Foam::fvMesh const&, Foam::word const&), Foam::word, Foam::string::hash>::iterator Foam::basicThermo::lookupThermo<Foam::visThermo, Foam::HashTable<Foam::autoPtr<Foam::visThermo> (*)(Foam::fvMesh const&, Foam::word const&), Foam::word, Foam::string::hash> >(Foam::dictionary const&, Foam::HashTable<Foam::autoPtr<Foam::visThermo> (*)(Foam::fvMesh const&, Foam::word const&), Foam::word, Foam::string::hash>*)':
visThermo.C:(.text._ZN4Foam11basicThermo12lookupThermoINS_9visThermoENS_9HashTableIPFNS_7autoPtrIS2_EERKNS_6fvMeshERKNS_4wordEES9_NS_6string4hashEEEEENT0_8iteratorERKNS_10dictionaryEPSH_[_ZN4Foam11basicThermo12lookupThermoINS_9visThermoENS_9HashTableIPFNS_7autoPtrIS2_EERKNS_6fvMeshERKNS_4wordEES9_NS_6string4hashEEEEENT0_8iteratorERKNS_10dictionaryEPSH_]+0x873): undefined reference to `Foam::visThermo::typeName'
visThermo.C:(.text._ZN4Foam11basicThermo12lookupThermoINS_9visThermoENS_9HashTableIPFNS_7autoPtrIS2_EERKNS_6fvMeshERKNS_4wordEES9_NS_6string4hashEEEEENT0_8iteratorERKNS_10dictionaryEPSH_[_ZN4Foam11basicThermo12lookupThermoINS_9visThermoENS_9HashTableIPFNS_7autoPtrIS2_EERKNS_6fvMeshERKNS_4wordEES9_NS_6string4hashEEEEENT0_8iteratorERKNS_10dictionaryEPSH_]+0xb6e): undefined reference to `Foam::visThermo::typeName'
Make/linux64GccDPOpt/visThermo.o: In function `Foam::autoPtr<Foam::visThermo> Foam::basicThermo::New<Foam::visThermo>(Foam::fvMesh const&, Foam::word const&)':
visThermo.C:(.text._ZN4Foam11basicThermo3NewINS_9visThermoEEENS_7autoPtrIT_EERKNS_6fvMeshERKNS_4wordE[_ZN4Foam11basicThermo3NewINS_9visThermoEEENS_7autoPtrIT_EERKNS_6fvMeshERKNS_4wordE]+0x14a): undefined reference to `Foam::visThermo::fvMeshConstructorTablePtr_'
Make/linux64GccDPOpt/highDensityRatioKEpsilon.o: In function `Foam::compressible::RASModels::highDensityRatioKEpsilon::type() const':
highDensityRatioKEpsilon.C:(.text._ZNK4Foam12compressible9RASModels24highDensityRatioKEpsilon4typeEv[_ZNK4Foam12compressible9RASModels24highDensityRatioKEpsilon4typeEv]+0x3): undefined reference to `Foam::compressible::RASModels::highDensityRatioKEpsilon::typeName'
collect2: error: ld returned 1 exit status
Is this the error from my option file? But I checked it, it seems to be alright to me.

Code:
EXE_INC = \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
    -I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
    -I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
    -I$(LIB_SRC)/turbulenceModels/

EXE_LIBS = \
    -lfiniteVolume \
    -lmeshTools \
    -lincompressibleTransportModels \
    -lcompressibleRASModels \
    -lcompressibleLESModels \
    -lfluidThermophysicalModels \
    -lthermophysicalFunctions \
    -lspecie \
    -lchemistryModel \
    -lcompressibleTurbulenceModel
xianqiejiao is offline   Reply With Quote

Old   December 8, 2014, 07:59
Default
  #7
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
First, you need to change

Code:
    //- Runtime type information
    TypeName("psiThermo");
into

Code:
    //- Runtime type information
    TypeName("visThermo");
in visThermo.H.

Then you need to add block similar to:

Code:
namespace Foam
{
    defineTypeNameAndDebug(visThermo, 0);
    defineRunTimeSelectionTable(visThermo, fvMesh);
}
in visThermo.C.

See psiThermo implementation in 2.3.x.

Also you need to do the same operation with highDensityRatioKEpsilon class.
alexeym is offline   Reply With Quote

Old   December 8, 2014, 09:08
Default
  #8
New Member
 
BO
Join Date: Dec 2014
Posts: 21
Rep Power: 11
xianqiejiao is on a distinguished road
Thank you for the tips. I have checked visThermo again and compared it to the psiThermo, tried to make them with exactly same structures. Attachments are the updated version.

However, when I finished this, suddenly everything became undeclared...just to name a few in the following:

Code:
ThermoModel/visThermo.C:90:8: error: ‘visThermo’ has not been declared
   void visThermo::setT(const volScalarField& temp)
        ^
ThermoModel/visThermo.C:90:30: error: ‘volScalarField’ does not name a type
   void visThermo::setT(const volScalarField& temp)
                              ^
ThermoModel/visThermo.C:90:46: error: ISO C++ forbids declaration of ‘temp’ with no type [-fpermissive]
   void visThermo::setT(const volScalarField& temp)
                                              ^
ThermoModel/visThermo.C: In function ‘void setT(const int&)’:
ThermoModel/visThermo.C:92:5: error: ‘T_’ was not declared in this scope
     T_ = temp;
     ^
ThermoModel/visThermo.C: At global scope:
ThermoModel/visThermo.C:95:8: error: ‘visThermo’ has not been declared
   void visThermo::update(const volScalarField& rho,const volScalarField& Ybar)
        ^
ThermoModel/visThermo.C:95:32: error: ‘volScalarField’ does not name a type
   void visThermo::update(const volScalarField& rho,const volScalarField& Ybar)
                                ^
ThermoModel/visThermo.C:95:48: error: ISO C++ forbids declaration of ‘rho’ with no type [-fpermissive]
   void visThermo::update(const volScalarField& rho,const volScalarField& Ybar)
                                                ^
ThermoModel/visThermo.C:95:58: error: ‘volScalarField’ does not name a type
   void visThermo::update(const volScalarField& rho,const volScalarField& Ybar)
                                                          ^
ThermoModel/visThermo.C:95:74: error: ISO C++ forbids declaration of ‘Ybar’ with no type [-fpermissive]
   void visThermo::update(const volScalarField& rho,const volScalarField& Ybar)
                                                                          ^
And I also notice there are some fancy error like this:
Code:
ThermoModel/visThermo.C:90:46: error: ISO C++ forbids declaration of ‘temp’ with no type [-fpermissive]
   void visThermo::setT(const volScalarField& temp)
                                              ^
Attached Files
File Type: c visThermo.C (3.7 KB, 10 views)
File Type: h visThermo.H (3.3 KB, 10 views)
xianqiejiao is offline   Reply With Quote

Old   December 8, 2014, 09:37
Default
  #9
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

there's no visThermo class outsize Foam namespace (also there's no volScalarField class outside Foam namespace ).

So all your

Code:
void visThermo::...
{
   ...
}
should be

Code:
void Foam::visThermo::...
{
   ...
}
alexeym is offline   Reply With Quote

Old   December 8, 2014, 22:04
Default
  #10
Member
 
BO WANG
Join Date: Sep 2014
Posts: 37
Rep Power: 11
wang219910611 is on a distinguished road
Hi, thanks very much for the tips. I guess I should go over c++ again before I start my next code.

Anyway, problem solved except this one

Code:
Make/linux64GccDPOpt/coSigmaY.o: In function `main':
coSigmaY.C:(.text.startup+0x19b8): undefined reference to `Foam::incompressibleTwoPhaseMixture::incompressibleTwoPhaseMixture(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::word const&)'
I guess this is my lib problem, here is my option file

Code:
EXE_INC = \
    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
    -I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
    -I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
    -I$(LIB_SRC)/turbulenceModels/


EXE_LIBS = \
    -lfiniteVolume \
    -lmeshTools \
    -lincompressibleTransportModels \
    -lcompressibleRASModels \
    -lcompressibleLESModels \
    -lfluidThermophysicalModels \
    -lthermophysicalFunctions \
    -lspecie \
    -lchemistryModel \
    -lcompressibleTurbulenceModel
as you can see, this is not link to incompressibleTwoPhaseMixture.H file as I made small changes to it, and I put it in my coSigmaY folder. Here is the change:

Code:
incompressibleTwoPhaseMixture
        (
            const volVectorField& U,
            const surfaceScalarField& phi,
            const word& alpha1Name = "alpha1"
        );
I added the last line so I can do this in my creatField.H file:
Code:
incompressibleTwoPhaseMixture twoPhaseProperties(U, phi, "Ybar");
Can I solve this without interrupt my original src file?
wang219910611 is offline   Reply With Quote

Old   December 9, 2014, 02:25
Default
  #11
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
It's rather strange as the constructor for incompressibleTwoPhaseMixture is in libincompressibleTransportModels, and this library is included in your options.

I'm afraid you've again redefined something somewhere and would like others to guess your modifications of the code. And I think this is the case as compiler gladly passes your constructor (which is redefined in your H file) while linker rejects it because it is not implemented.
alexeym is offline   Reply With Quote

Old   December 12, 2014, 01:48
Default
  #12
Member
 
BO WANG
Join Date: Sep 2014
Posts: 37
Rep Power: 11
wang219910611 is on a distinguished road
Hi alexeym,

I turned back to the code this morning. And I think I have managed to fixed it. I linked the code to the original incompressbleTwoPhaseMixture src file and changed its announcement in the creatField.H file accordingly( rather then change the incompressibleTwoPhaseMixture file itself!). Then everything goes well.
Thanks again for your patience and all the advice.

Regards
wang219910611 is offline   Reply With Quote

Reply


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] Paraview 3.98 - errors when saving geometry file pajot ParaView 1 September 28, 2013 10:45
Understanding Port Flow Results Ospi FLUENT 0 July 15, 2013 23:11
IC Engine Exhaust Port Flow Ospi ANSYS 1 July 10, 2013 22:59
IC Engine Exaust Port Flow Ospi FLUENT 0 July 6, 2013 20:34
OpenFOAM Cygwin port updated to 13 brooksmoses OpenFOAM Installation 29 November 30, 2006 05:49


All times are GMT -4. The time now is 21:12.