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

undefined reference to `Foam::MomentumTransportModel...'

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By mAlletto

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 26, 2020, 16:03
Default undefined reference to `Foam::MomentumTransportModel...'
  #1
New Member
 
Farzad Ahamdi
Join Date: Feb 2012
Location: Iran
Posts: 4
Rep Power: 14
fahmadi is on a distinguished road
Hello everyone

I was trying to use the code provided at 'https://doi.org/10.3390/pr7080542' to implement the smoothed CSF. The code was developed based on OpenFOAM6 and I modified it to be compatible with OpenFOAM8. In the end, I got the following error:

Quote:
interFoam.C.text.startup+0x235f): undefined reference to `Foam::MomentumTransportModel<Foam::geometricOneFi eld, Foam::geometricOneField, Foam::incompressibleMomentumTransportModel, Foam::transportModel>::dictionaryConstructorTableP tr_'
/usr/bin/ld.bfd: interFoam.C.text.startup+0x23ad): undefined reference to `Foam::RASModel<Foam::IncompressibleMomentumTransp ortModel<Foam::transportModel> >::dictionaryConstructorTablePtr_'
/usr/bin/ld.bfd: interFoam.C.text.startup+0x2412): undefined reference to `Foam::LESModel<Foam::IncompressibleMomentumTransp ortModel<Foam::transportModel> >::dictionaryConstructorTablePtr_'
/usr/bin/ld.bfd: Make/linux64GccDPInt32Opt/interFoam.o: in function `Foam::MomentumTransportModel<Foam::geometricOneFi eld, Foam::geometricOneField, Foam::incompressibleMomentumTransportModel, 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&)':
interFoam.C.text._ZN4Foam22MomentumTransportMode lINS_17geometricOneFieldES1_NS_36incompressibleMom entumTransportModelENS_14transportModelEE3NewERKS1 _S6_RKNS_14GeometricFieldINS_6VectorIdEENS_12fvPat chFieldENS_7volMeshEEERKNS7_IdNS_13fvsPatchFieldEN S_11surfaceMeshEEESJ_RKS3_[_ZN4Foam22MomentumTransportModelINS_17geometricOne FieldES1_NS_36incompressibleMomentumTransportModel ENS_14transportModelEE3NewERKS1_S6_RKNS_14Geometri cFieldINS_6VectorIdEENS_12fvPatchFieldENS_7volMesh EEERKNS7_IdNS_13fvsPatchFieldENS_11surfaceMeshEEES J_RKS3_]+0x13a): undefined reference to `Foam::MomentumTransportModel<Foam::geometricOneFi eld, Foam::geometricOneField, Foam::incompressibleMomentumTransportModel, Foam::transportModel>::dictionaryConstructorTableP tr_'
/usr/bin/ld.bfd: interFoam.C.text._ZN4Foam22MomentumTransportMode lINS_17geometricOneFieldES1_NS_36incompressibleMom entumTransportModelENS_14transportModelEE3NewERKS1 _S6_RKNS_14GeometricFieldINS_6VectorIdEENS_12fvPat chFieldENS_7volMeshEEERKNS7_IdNS_13fvsPatchFieldEN S_11surfaceMeshEEESJ_RKS3_[_ZN4Foam22MomentumTransportModelINS_17geometricOne FieldES1_NS_36incompressibleMomentumTransportModel ENS_14transportModelEE3NewERKS1_S6_RKNS_14Geometri cFieldINS_6VectorIdEENS_12fvPatchFieldENS_7volMesh EEERKNS7_IdNS_13fvsPatchFieldENS_11surfaceMeshEEES J_RKS3_]+0x1cb): undefined reference to `Foam::MomentumTransportModel<Foam::geometricOneFi eld, Foam::geometricOneField, Foam::incompressibleMomentumTransportModel, Foam::transportModel>::dictionaryConstructorTableP tr_'
collect2: error: ld returned 1 exit status
Does anyone have an idea what is the reason for the error?

Thanks,
Farzad
fahmadi is offline   Reply With Quote

Old   December 28, 2020, 06:02
Default
  #2
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
Seams the linker does not find some libraries (files which the ending .so)


probably you forgot something in the file Make/options
fahmadi likes this.
mAlletto is offline   Reply With Quote

Old   December 28, 2020, 15:54
Default
  #3
New Member
 
Farzad Ahamdi
Join Date: Feb 2012
Location: Iran
Posts: 4
Rep Power: 14
fahmadi is on a distinguished road
Thanks Dear Michael, I will look into this.
fahmadi is offline   Reply With Quote

Old   August 26, 2023, 14:42
Default My solution
  #4
New Member
 
Matthias Lang
Join Date: Jun 2023
Posts: 6
Rep Power: 3
Lang is on a distinguished road
Hello everyone,

Although this thread is nearly 3 years old, I've encountered a very similar (if not identical) issue. After much effort, I've managed to find the solution. I hope that by sharing this, others won't have to go through weeks of frustration like I did.

Let me begin by describing my specific problem before delving into the solution I discovered below:

I needed to make modifications to a method within the 'multiphaseInterSystem' class. To achieve this, I duplicated the 'multiphaseSystem' class folder, which inherits from 'multiphaseInterSystem'. I then renamed this duplicated class to 'myMultiphaseSystem' and adjusted the 'Make/files' and 'Make/options' accordingly. I systematically replaced all instances of 'multiphaseSystem' with 'myMultiphaseSystem' using the command "sed -i s/multiphaseSystem/myMultiphaseSystem/g *".

The compilation of the library proceeded without errors or issues. I proceeded to duplicate the 'icoReactingMultiphaseInterFoam' solver. I replaced all instances of 'multiphaseSystem' with 'myMultiphaseSystem' (again using the "sed" command from above), added my custom library to 'Make/options', and made necessary modifications to 'Make/files'. However, upon compiling this application, I encountered the following error:

Quote:
undefined reference to `Foam::TurbulenceModel<Foam::geometricOneField, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>, Foam::compressibleTurbulenceModel, Foam::multiphaseInter::myMultiphaseSystem>::dictio naryConstructorTable(Foam::word const&)'

[...]

undefined reference to `Foam::TurbulenceModel<Foam::geometricOneField, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>, Foam::compressibleTurbulenceModel, Foam::multiphaseInter::myMultiphaseSystem>::dictio naryConstructorTablePtr_'
I spent a considerable amount of time under the assumption that the issue was related to library linking.
Contrary to my expectations, the error wasn't directly tied to the library I was modifying. (I believe it's connected to the Runtime Selection Model (RTS) PLEASE correct me if I'm wrong. I am unfamiliar with this subject).
As indicated by the error message, the problem involves a "constructor table."


Now, let me share the solution:


I found that the file "compressibleMultiPhaseTurbulenceModels.C," located one subdirectory above the class I duplicated ("multiphaseSystem"), contained instances of the term 'multiphaseSystem'. I identified this using the 'grep' command in Linux. Therefore, I duplicated the "compressibleMultiPhaseTurbulenceModels" file, replaced all occurrences of 'multiphaseSystem' with 'myMultiphaseSystem' (using jet again the sed command as mentioned above), adjusted the 'Make/files' and options accordingly, and compiled this library.
Upon replacing the old 'compressibleMultiPhaseTurbulenceModels' library with the updated version, the problem was resolved, and the error messages vanished.

I hope this explanation proves helpful to someone grappling with a similar issue. I'd greatly appreciate it if someone could provide a more detailed explanation of what exactly I did here to solve the problem. While I suspect it involves the RTS, I'm not entirely certain.

Wishing you all the best with your OpenFOAM projects.

Best regards,
Matthias
Lang is offline   Reply With Quote

Reply

Tags
compile solver, interfoam, openfoam6, openfoam8


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
Adding Libraries to OpenFOAM MCrossover97 OpenFOAM Programming & Development 10 February 23, 2024 03:34
can not complie fluentDataToFoam in OF2.1.1 hewei OpenFOAM Pre-Processing 20 September 8, 2018 10:19
LiencubiclowRemodel nzy102 OpenFOAM Bugs 14 January 10, 2012 09:53
compile error about FJMPI chiven OpenFOAM Installation 11 March 31, 2010 07:27
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 20:08


All times are GMT -4. The time now is 07:17.