|
[Sponsors] |
February 26, 2021, 03:53 |
undefined symbol - could not load library
|
#1 |
New Member
Jan
Join Date: Oct 2020
Posts: 11
Rep Power: 6 |
Hey,
I'm currently trying to implement my own RSM Model in OF. For that I just copied the SSG Files in a new directory with the goal to change them later. Before that I tried to compile them after changing their names and all appearances in the files. No Errors so far (nothing really changed, so why should be there erros?). I was using the "makeTemplatedTurbulenceModel" macro. That's the way you should implement your own model, right? Now, I started a test run with the "new" model. Not found... I got a small warning directly at the start (loading my own, new library with the model): Code:
--> FOAM Warning : From function void* Foam::dlOpen(const Foam::fileName&, bool) in file POSIX.C at line 1251 dlopen error : /home/xxx/OpenFOAM/xxx-X/platforms/linux64GccDPInt32Opt/lib/libmySSGLRR.so: undefined symbol: _ZN4Foam8RASModelINS_29IncompressibleTurbulenceModelINS_15turbulenceModelEEEE8typeNameE --> FOAM Warning : From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool) in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 105 could not load "libmySSGLRR.so" Obviously, the library was not load because of a undefined symbol. I figured out it could help to load an extra library with this symbol within it. BUT there is no library with this symbol in it (at least not in the normal directory...) I using OF Version 7 on Ubuntu 20.04.1 LTS. Does anybody have an idea how I can solve this problem? Thanks in advance! Jan |
|
February 26, 2021, 05:04 |
|
#2 |
Senior Member
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 314
Rep Power: 15 |
Hi,
as far as I know, it's better if you replicate the existing files structure in your OF user directory, instead of generating your own library like this. It can also help to implement more models in the future. At least, this is what I do and I had no problems until now. PS: I'm curious about the RSM model you want to implement. ¿Which one is it? |
|
February 26, 2021, 05:11 |
|
#3 |
New Member
Jan
Join Date: Oct 2020
Posts: 11
Rep Power: 6 |
I have to admit thats a good idea. You mean just copy the whole installation of OF and than change the "original" models?
I want to try the SSG-LRR omega model proposed by Eisfeld. The basic idea is to combine the SSG and the LRR with a omega equation and to create a low Re model (like Menters SST). The (I believe original paper) is: "REYNOLDS STRESS MODELLING FOR COMPLEX AERODYNAMIC FLOWS" from Bernhard Eisfeld. You can also check the NASA website: https://turbmodels.larc.nasa.gov/rsm-ssglrr.html |
|
February 26, 2021, 10:31 |
|
#4 |
Senior Member
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 314
Rep Power: 15 |
The idea is to replicate the folders structure. Then, on the wmake files tou just link these libraries to the ones of the installation if needed (e.g. when compiling a new turbulence model just link it to the turbulence model).
|
|
February 26, 2021, 13:19 |
|
#5 |
Senior Member
Join Date: Aug 2015
Posts: 494
Rep Power: 15 |
To add to the discussion, for OF7 specifically, what I've done in the past is :
Like was suggested make folders in e.g. your project directory for src/TurbulenceModels/turbulenceModels/RAS and src/TurbulenceModels/compressible (or incompressible) Then just add new code, without replicating native code, in each folder respectively. An example for compressible LES models can be found here : https://github.com/clapointe2011/public/tree/master/of7. The resulting library can be loaded at runtime to use your custom model. Caelan |
|
June 29, 2022, 07:08 |
|
#6 |
New Member
pisharoti05
Join Date: Feb 2020
Posts: 10
Rep Power: 6 |
Hey Jan!
This might be late, but I have succesfully implemented the SSG/LRR-omega fully turbulent model by Eisfeld et al., (that you're referring to) on OpenFOAM-v2006. You can find the code here: https://github.com/nainapisharoti/SSG-LRR-omega-gamma You can find the complete code for the SSG/LRR-omega model in the "Base folder". The "RAS" folder also has the makeTurbulenceModel.C script which you just have to compile using "wmake" and you should be good to go. I had implemented the fully turbulent model to formulate my transition model SSG/LRR-omega-gamma. If you're interested, you can find the code for that as well in the same repository. Good luck! Naina. |
|
February 15, 2024, 11:20 |
|
#7 |
Member
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3 |
Hi,
I know this is an old thread but I am also looking into implementing changes with the Reynolds Stress models using OpenFOAM. All I am looking to do is simplify the DREff() term in the .C file. I am using OpenFOAM-v9. Prior to introducing any changes to the source code I am first sorting out compiling a new turbulence model. I have found that I am really struggling to compile either the LRR or SSG model in the OpenFOAM environment as compared to compiling a eddy viscosity model. Here are my Make files Options Code:
EXE_INC = \ -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ LIB_LIBS = \ -ltransportModels \ -lmomentumTransportModels \ -lfiniteVolume \ -lmeshTools Code:
mykinematicMomentumTransportModels.C LIB = $(FOAM_USER_LIBBIN)/mykinematicMomentumTransportModels Code:
wmake libso . wmakeLnInclude: linking include files to ./lnInclude Making dependency list for source file mykinematicMomentumTransportModels.C g++ -std=c++14 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3 -DNoRepository -ftemplate-depth-100 -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/momentumTransportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/incompressible/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/transportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/finiteVolume/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/meshTools/lnInclude -IlnInclude -I. -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OpenFOAM/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OSspecific/POSIX/lnInclude -fPIC -c mykinematicMomentumTransportModels.C -o Make/linux64GccDPInt32Opt/mykinematicMomentumTransportModels.o In file included from myLRR.H:219:0, from mykinematicMomentumTransportModels.C:49: myLRR.C: In instantiation of ‘Foam::RASModels::myLRR<BasicMomentumTransportModel>::myLRR(const alphaField&, const rhoField&, const volVectorField&, const surfaceScalarField&, const surfaceScalarField&, const transportModel&, const Foam::word&) [with BasicMomentumTransportModel = Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel>; Foam::RASModels::myLRR<BasicMomentumTransportModel>::alphaField = Foam::geometricOneField; Foam::RASModels::myLRR<BasicMomentumTransportModel>::rhoField = Foam::geometricOneField; Foam::volVectorField = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>; Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>; Foam::RASModels::myLRR<BasicMomentumTransportModel>::transportModel = Foam::kinematicTransportModel]’: /home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/momentumTransportModels/lnInclude/RASModel.H:100:9: required from ‘static Foam::autoPtr<Foam::RASModel<BasicMomentumTransportModel> > Foam::RASModel<BasicMomentumTransportModel>::adddictionaryConstructorToTable<RASModelType>::New(const alphaField&, const rhoField&, const volVectorField&, const surfaceScalarField&, const surfaceScalarField&, const transportModel&) [with RASModelType = Foam::RASModels::myLRR<Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel> >; BasicMomentumTransportModel = Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel>; Foam::RASModel<BasicMomentumTransportModel>::alphaField = Foam::geometricOneField; Foam::RASModel<BasicMomentumTransportModel>::rhoField = Foam::geometricOneField; Foam::volVectorField = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>; Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>; Foam::RASModel<BasicMomentumTransportModel>::transportModel = Foam::kinematicTransportModel]’ /home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/momentumTransportModels/lnInclude/RASModel.H:100:9: required from ‘Foam::RASModel<BasicMomentumTransportModel>::adddictionaryConstructorToTable<RASModelType>::adddictionaryConstructorToTable(const Foam::word&) [with RASModelType = Foam::RASModels::myLRR<Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel> >; BasicMomentumTransportModel = Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel>]’ mykinematicMomentumTransportModels.C:50:1: required from here myLRR.C:219:14: error: ‘bound’ was not declared in this scope bound(epsilon_, this->epsilonMin_); ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ myLRR.C:219:14: note: suggested alternative: ‘found’ bound(epsilon_, this->epsilonMin_); ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ found myLRR.C: In instantiation of ‘void Foam::RASModels::myLRR<BasicMomentumTransportModel>::correct() [with BasicMomentumTransportModel = Foam::IncompressibleMomentumTransportModel<Foam::kinematicTransportModel>]’: mykinematicMomentumTransportModels.C:50:20: required from here myLRR.C:325:10: error: ‘bound’ was not declared in this scope bound(epsilon_, this->epsilonMin_); ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ myLRR.C:325:10: note: suggested alternative: ‘found’ bound(epsilon_, this->epsilonMin_); ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ found make: *** [/home/cfd/OpenFOAM/OpenFOAM-9/wmake/rules/General/transform:26: Make/linux64GccDPInt32Opt/mykinematicMomentumTransportModels.o] Error 1 A link to the thread I originally published is provided OpenFOAM - Implement Change To Modelled Term Reynolds Stress Models (LRR & SSG) |
|
February 15, 2024, 11:33 |
|
#8 |
New Member
pisharoti05
Join Date: Feb 2020
Posts: 10
Rep Power: 6 |
Hey! It seems like you might be missing some header file declarations. Have you made sure you have included the following lines in your header file?
Code:
#include "RASModel.H" #include "ReynoldsStress.H" Maybe you're missin some step there. Regards, Naina. |
|
February 15, 2024, 13:45 |
|
#9 |
Member
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3 |
Hi,
For myLRR.H, both RASModel.H and ReynoldsStress.H have been declared as I have not made any changes to the files barring changing LRR to myLRR Code:
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class Foam::RASModels::myLRR Description Launder, Reece and Rodi Reynolds-stress turbulence model for incompressible and compressible flows. Reference: \verbatim Launder, B. E., Reece, G. J., & Rodi, W. (1975). Progress in the development of a Reynolds-stress turbulence closure. Journal of fluid mechanics, 68(03), 537-566. \endverbatim Including the recommended generalised gradient diffusion model of Daly and Harlow: \verbatim Daly, B. J., & Harlow, F. H. (1970). Transport equations in turbulence. Physics of Fluids (1958-1988), 13(11), 2634-2649. \endverbatim Optional Gibson-Launder wall-reflection is also provided: \verbatim Gibson, M. M., & Launder, B. E. (1978). Ground effects on pressure fluctuations in the atmospheric boundary layer. Journal of Fluid Mechanics, 86(03), 491-511. \endverbatim The default model coefficients are: \verbatim myLRRCoeffs { Cmu 0.09; C1 1.8; C2 0.6; Ceps1 1.44; Ceps2 1.92; Cs 0.25; Ceps 0.15; wallReflection yes; kappa 0.41 Cref1 0.5; Cref2 0.3; couplingFactor 0.0; } \endverbatim SourceFiles myLRR.C \*---------------------------------------------------------------------------*/ #ifndef myLRR_H #define myLRR_H #include "RASModel.H" #include "ReynoldsStress.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
|
February 16, 2024, 06:46 |
|
#11 |
Member
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3 |
Hi,
Here is the output of the command Code:
cfd@UOL-PC-301943:~/OF_cases/myLRR> nm -g myLRR.o nm: 'myLRR.o': No such file |
|
February 16, 2024, 06:49 |
|
#12 |
Member
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3 |
I think that command might be redundant in OF9. As I typed the same thing for a compiled mykOmega and it gave the same output message:
Code:
cfd@UOL-PC-301943:~/OF_cases/mykOmega> wmake libso wmake libso . wmakeLnInclude: linking include files to ./lnInclude Making dependency list for source file mykinematicMomentumTransportModels.C g++ -std=c++14 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3 -DNoRepository -ftemplate-depth-100 -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/momentumTransportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/incompressible/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/transportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/finiteVolume/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/meshTools/lnInclude -IlnInclude -I. -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OpenFOAM/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OSspecific/POSIX/lnInclude -fPIC -c mykinematicMomentumTransportModels.C -o Make/linux64GccDPInt32Opt/mykinematicMomentumTransportModels.o g++ -std=c++14 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3 -DNoRepository -ftemplate-depth-100 -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/momentumTransportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/MomentumTransportModels/incompressible/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/transportModels/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/finiteVolume/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/meshTools/lnInclude -IlnInclude -I. -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OpenFOAM/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-9/src/OSspecific/POSIX/lnInclude -fPIC -fuse-ld=bfd -shared -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPInt32Opt/mykinematicMomentumTransportModels.o -L/home/cfd/OpenFOAM/OpenFOAM-9/platforms/linux64GccDPInt32Opt/lib \ -ltransportModels -lmomentumTransportModels -lfiniteVolume -lmeshTools -o /home/cfd/OpenFOAM/cfd-9/platforms/linux64GccDPInt32Opt/lib/mykinematicMomentumTransportModels.so cfd@UOL-PC-301943:~/OF_cases/mykOmega> nm -g mykOmega.o nm: 'mykOmega.o': No such file |
|
February 16, 2024, 06:54 |
|
#13 |
Senior Member
|
Apologies, my bad.
In case that the compilation of myLRR.C fails, the file myLRR.o is indeed not created. Pls. share output of Code:
nm -g LRR.o |
|
February 16, 2024, 07:02 |
|
#14 |
Member
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3 |
Hi,
I've inputted the same command but for LRR.o, same result Code:
cfd@UOL-PC-301943:~/OF_cases> nm -g LRR.o nm: 'LRR.o': No such file |
|
February 16, 2024, 07:20 |
|
#15 |
Senior Member
|
In the compilation of kEpsilon.C, kOmega.C and LRR.C does succeed (as you claim above), the files kEpsilon.o, kOmega.o and LRR.o should most obviously be created and written somewhere.
|
|
February 16, 2024, 07:57 |
|
#16 |
Member
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3 |
When I compile mykOmega I get a .o file for mykinematicMomentumTransportModels.o
Code:
cfd@UOL-PC-301943:~/OF_cases/mykOmega/Make/linux64GccDPInt32Opt> ls files mykinematicMomentumTransportModels.C.dep mykinematicMomentumTransportModels.o cfd@UOL-PC-301943:~/OF_cases/mykOmega/Make/linux64GccDPInt32Opt> |
|
February 16, 2024, 08:00 |
|
#17 |
Member
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3 |
When I attempt to compile myLRR, the .o file is missing for mykinematicMomentumTransportModels.o
Code:
cfd@UOL-PC-301943:~/OF_cases/myLRR/Make/linux64GccDPInt32Opt> ls files mykinematicMomentumTransportModels.C.dep cfd@UOL-PC-301943:~/OF_cases/myLRR/Make/linux64GccDPInt32Opt> |
|
February 16, 2024, 08:48 |
|
#18 |
Member
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3 |
Okay, I spoke to someone with experience in modifying source code for OpenFOAM. He went through my test case and found that in the myLRR.C file, you have to include the following term:
Code:
#include "simpleLRR.H" #include "fvModels.H" #include "fvConstraints.H" #include "wallDist.H" #include "bound.C" Code:
SIMPLE: Convergence criteria found U: tolerance 1e-05 p: tolerance 1e-05 k: tolerance 1e-05 epsilon: tolerance 1e-05 R: tolerance 1e-05 omega: tolerance 1e-05 Reading field p Reading field U Reading/calculating face flux field phi Selecting incompressible transport model Newtonian Selecting turbulence model type RAS Selecting RAS turbulence model myLRR RAS { model myLRR; turbulence on; printCoeffs on; couplingFactor 0; Cmu 0.09; C1 1.8; C2 0.6; Ceps1 1.44; Ceps2 1.92; Cs 0.25; Ceps 0.15; wallReflection true; kappa 0.41; Cref1 0.5; Cref2 0.3; } Creating MRF zone list from MRFProperties creating MRF zone: SRF No fvModels present No fvConstraints present Starting time loop |
|
February 16, 2024, 10:32 |
|
#19 |
Member
ASR
Join Date: Jan 2023
Location: Leeds, UK
Posts: 52
Rep Power: 3 |
I've now managed to implement my changes and I can successfully compile and run a simulation
The simulation can run in serial or parallel. The only thing I am noticing is for a parallel run some warning symbols appear when decomposing: Code:
--> FOAM Warning : From function void* Foam::dlOpen(const Foam::fileName&, bool) in file POSIX.C at line 1247 dlopen error : /home/cfd/OpenFOAM/cfd-9/platforms/linux64GccDPInt32Opt/lib/libsimpleLRRMomentumTransportModels.so: undefined symbol: _ZTIN4Foam36incompressibleMomentumTransportModelE --> FOAM Warning : From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool) in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 106 could not load "libsimpleLRRMomentumTransportModels.so" FOAM Warning : From function void* Foam::dlOpen(const Foam::fileName&, bool) in file POSIX.C at line 1247 dlopen error : /home/cfd/OpenFOAM/cfd-9/platforms/linux64GccDPInt32Opt/lib/libsimpleLRRMomentumTransportModels.so: undefined symbol: _ZTIN4Foam36incompressibleMomentumTransportModelE --> FOAM Warning : From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool) in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 106 could not load "libsimpleLRRMomentumTransportModels.so" |
|
November 21, 2024, 03:25 |
|
#20 |
New Member
SunTime
Join Date: Nov 2020
Posts: 15
Rep Power: 6 |
Have you solve this problem? I also met the issue. I want to create a base model like kOmegaSSTBase model, and derive other models. Ths same issue happened.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
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 |
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug | unoder | OpenFOAM Installation | 11 | January 30, 2008 21:30 |
G95 + CGNS | Bruno | Main CFD Forum | 1 | January 30, 2007 01:34 |