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

Undefined symbol error after compiling a new LES model

Register Blogs Community New Posts Updated Threads Search

Like Tree12Likes
  • 1 Post By ctl
  • 7 Post By Artur
  • 1 Post By huangxianbei
  • 1 Post By Artur
  • 1 Post By hy1112006
  • 1 Post By Artur

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 24, 2011, 17:29
Default Undefined symbol error after compiling a new LES model
  #1
New Member
 
Abhijit Joshi
Join Date: May 2011
Location: Atlanta, GA
Posts: 5
Rep Power: 15
jabhiji is on a distinguished road
Hi all,

I am developing a new LES turbulence model, using the existing models in OpenFOAM as a starting point and there are no errors during the compilation of the new model. However, when I use this new model for the channel395 simulation (instead of the default oneEqEddy model), I get the following error:

channelFoam: symbol lookup error:/OpenFOAM/OpenFOAM-2.0.0/platforms/linux64GccDPOpt/lib/libincompressibleLESModels.so: undefined symbol: _ZN4Foam14incompressible9LESModels16subgridSGSStre ss4readEv

SubgridSGSstress is a new class created one level below LESModels, similar to classes like GenSGSStress or GenEddyVisc. This new class (SubgridSGSStress) has a model called subgridTLS, which directly computes the subgrid stress.

While using channelFoam, I specified subgridTLS as the LESModel.

Actually, after compiling the new models, even the original models do not work with channelFoam (I get the same error above if I switch back to using oneEqEddy). Thus, this compilation using the new model sort of corrupts the entire OpenFOAM installation and I need to re-install in order to make channelFoam work again for the channel395 tutorial.

Any suggestions on what causes this problem will be greatly appreciated.

Thanks,

- jabhiji
jabhiji is offline   Reply With Quote

Old   June 26, 2011, 23:07
Default LES implementation undefined symbol problem solved
  #2
ctl
New Member
 
Christopher
Join Date: Jun 2011
Posts: 1
Rep Power: 0
ctl is on a distinguished road
Hey jabhiji,

I ran in the same or similar problem and just solved it, maybe the same will work for you. I've developed a custom (lighthill equation) solver based on the pisoFoam solver and haven't tested this on any other solver. The LES model I incorporated is a selective Smagorinsky model.

To do this I have created a selectiveSmagorinsky.H and .C file, based on the normal Smagorinsky files, in which I added some extra functions which basically alter the SGS values throughout the field. Also I copied the option file from src/turbulenceModels/incompressible/LES/Make and the files document simply reads:

selectiveSmagorinsky.C
LIB = $(FOAM_USER_LIBBIN)/libmyTurbulenceModels

On compilation I encountered an error: the GenEddyVisc.H file could not be found. Looking at the selectiveSmagorinsky.depp file I noticed that the compiler was looking locally for this file instead of using the file from the installation directory(does anybody knows why? I tried changing the option file without succes..). I fixed this problem by copying the GenEddyVisc.H file to the local directory (the same needed to be done for LESModel.H). It compiled but now gave a similar error to what you had.

Then I tried to make a link using in a terminal:

sudo ln -s /absolute file path to/GenEddyVisc.H /absolute path to lnInclude folder(placed in folder with source code)

Also in my selectiveSmagorinsky.H file I made a direct reference to the source folder hence using (I think this is the most important part):

#include "incompressible/LES/GenEddyVisc/GenEddyVisc.H"

Further I adapted the dependency file to fix the references.

I don't know what exactly solved the problem but now it runs. (using only the direct referencing of the include file worked for one computer but was not sufficient for an other). Using decomposePar I still get warnings (but domain gets decomposed nonetheless ), the solver works perfectly without a warning.

Hopefully this post is a bit useful for you. It's my first on this forum so I hope I was not too elaborate or to short.

Good luck!

Christopher
wyldckat likes this.
ctl is offline   Reply With Quote

Old   June 27, 2011, 20:02
Default
  #3
New Member
 
Abhijit Joshi
Join Date: May 2011
Location: Atlanta, GA
Posts: 5
Rep Power: 15
jabhiji is on a distinguished road
Hello Christopher,

Thanks a lot for your detailed explanation. I have not checked whether this works for me yet, but will keep you posted.

Regards,

jabhiji
jabhiji is offline   Reply With Quote

Old   December 3, 2013, 06:59
Default
  #4
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 20
Artur will become famous soon enough
Hi,

Today I faced a very similar problem when compiling a new LES model:

Code:
--> FOAM Warning : 
    From function dlOpen(const fileName&, const bool)
    in file POSIX.C at line 1179
    dlopen error : /home/akl1g09/OpenFOAM/akl1g09-2.2.2/platforms/linux64GccDPOpt/lib/libdynamicSmagorinskyModel.so: undefined symbol: _ZTIN4Foam14incompressible9LESModels11GenEddyViscE
Changing the Make/options file so that it includes the following:

Code:
    -lincompressibleTurbulenceModel \
    -lincompressibleLESModels \
instead of just the former seems to have solved the issue. Thought I'd share in case anyone else runs into the same thing.

Peace,

Artur
Bernhard, Elham, JackW and 4 others like this.
Artur is offline   Reply With Quote

Old   August 13, 2014, 08:46
Default
  #5
Senior Member
 
Huang Xianbei
Join Date: Sep 2013
Location: Yangzhou,China
Posts: 302
Rep Power: 14
huangxianbei is on a distinguished road
Quote:
Originally Posted by Artur View Post
Hi,

Today I faced a very similar problem when compiling a new LES model:

Code:
--> FOAM Warning : 
    From function dlOpen(const fileName&, const bool)
    in file POSIX.C at line 1179
    dlopen error : /home/akl1g09/OpenFOAM/akl1g09-2.2.2/platforms/linux64GccDPOpt/lib/libdynamicSmagorinskyModel.so: undefined symbol: _ZTIN4Foam14incompressible9LESModels11GenEddyViscE
Changing the Make/options file so that it includes the following:

Code:
    -lincompressibleTurbulenceModel \
    -lincompressibleLESModels \
instead of just the former seems to have solved the issue. Thought I'd share in case anyone else runs into the same thing.

Peace,

Artur
Thank you very much. This is exactly the best solution.
Artur likes this.
huangxianbei is offline   Reply With Quote

Old   March 6, 2015, 05:08
Default undefined symbol: _ZTIN4Foam14incompressible9LESModels11GenEddyViscE
  #6
New Member
 
Yi Han
Join Date: Oct 2013
Location: Laramie WY
Posts: 15
Rep Power: 13
hy1112006 is on a distinguished road
Quote:
Originally Posted by huangxianbei View Post
Thank you very much. This is exactly the best solution.
Hi, huangxianbei,

Can I ask where to add

-lincompressibleTurbulenceModel \
-lincompressibleLESModels \

Can you show me the path?
Thank you so much!
hy1112006 is offline   Reply With Quote

Old   March 6, 2015, 05:12
Default
  #7
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 20
Artur will become famous soon enough
Quote:
Originally Posted by Artur View Post
Changing the Make/options file so that it includes the following:
This refers to a file called "options" inside the "Make" folder inside your model's folder (where all the other .C and .H files are).

You're supposed to add the lines following this line
[CODE]EXE_LIBS = \[\CODE]

Make sure to place a backslash at the end of each line except for the last one.

A
hy1112006 likes this.
Artur is offline   Reply With Quote

Old   March 6, 2015, 05:36
Default
  #8
New Member
 
Yi Han
Join Date: Oct 2013
Location: Laramie WY
Posts: 15
Rep Power: 13
hy1112006 is on a distinguished road
Quote:
Originally Posted by Artur View Post
This refers to a file called "options" inside the "Make" folder inside your model's folder (where all the other .C and .H files are).

You're supposed to add the lines following this line
[CODE]EXE_LIBS = \[\CODE]

Make sure to place a backslash at the end of each line except for the last one.

A
Hi A,

Thanks so much! It seems that we need put my own model's name in the corresponding "options" file. And it did work!

THanks!
Artur likes this.
hy1112006 is offline   Reply With Quote

Old   November 24, 2015, 06:19
Default
  #9
Member
 
Fengjiao Bian
Join Date: Nov 2013
Location: beijing
Posts: 30
Rep Power: 13
jiaojiao is on a distinguished road
Hi, I meet the same problem,but i cannot understand how to realize [CODE]EXE_LIBS = \[\CODE],could you tell me more detail?thanks very much!
Quote:
Originally Posted by Artur View Post
This refers to a file called "options" inside the "Make" folder inside your model's folder (where all the other .C and .H files are).

You're supposed to add the lines following this line
[CODE]EXE_LIBS = \[\CODE]

Make sure to place a backslash at the end of each line except for the last one.

A
jiaojiao is offline   Reply With Quote

Old   November 24, 2015, 06:23
Default
  #10
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 20
Artur will become famous soon enough
It refers to something like this:

Code:
LIB_LIBS = \
    -L$(FOAM_USER_LIBBIN) -ldynamicSmagorinskyModel \
    -lincompressibleTurbulenceModel \
    -lincompressibleLESModels \
    -lfluidThermophysicalModels \
    -lspecie \
    -lLESdeltas \
    -lLESfilters\
    -lfiniteVolume \
    -lmeshTools
Note how I link my own libraries which are located in FOAM_USER_LIBBIN.

Hope this helps

A
amuzeshi likes this.
Artur is offline   Reply With Quote

Old   November 24, 2015, 07:01
Default
  #11
Member
 
Fengjiao Bian
Join Date: Nov 2013
Location: beijing
Posts: 30
Rep Power: 13
jiaojiao is on a distinguished road
Hi,thanks for your reply, I should add this to every make/options one by one or i could use one command to finish it ?
Quote:
Originally Posted by Artur View Post
It refers to something like this:

Code:
LIB_LIBS = \
    -L$(FOAM_USER_LIBBIN) -ldynamicSmagorinskyModel \
    -lincompressibleTurbulenceModel \
    -lincompressibleLESModels \
    -lfluidThermophysicalModels \
    -lspecie \
    -lLESdeltas \
    -lLESfilters\
    -lfiniteVolume \
    -lmeshTools
Note how I link my own libraries which are located in FOAM_USER_LIBBIN.

Hope this helps

A
jiaojiao is offline   Reply With Quote

Old   November 24, 2015, 07:32
Default
  #12
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 20
Artur will become famous soon enough
I'm not really sure what you mean. Are you compiling a big set of libraries where errors like the one further up in this thread occur? Because normally you wouldn't need to make this an automated process since you have to type this in only once for every new utility you devise. Probably easier just to keep a "blank" version somewhere to kick off each new model or whatever you're trying to code up. Please be a bit more specific about what your problem actually is.

A
Artur is offline   Reply With Quote

Old   November 24, 2015, 07:49
Default
  #13
Member
 
Fengjiao Bian
Join Date: Nov 2013
Location: beijing
Posts: 30
Rep Power: 13
jiaojiao is on a distinguished road
Dear A,I am not combiling a big set of libraries.I simulate a tutorial of SOWFA,which is on the OpenFoam platform.When I run the script,it always display such warning
[--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : /gpfs/automountdir/gpfs1/software/OpenFOAM/OpenFOAM-2.3.0/platforms/linux64GccDPOpt/lib/libuserincompressibleLESModels.so: undefined symbol: _ZTIN4Foam14incompressible9LESModels11GenEddyViscE
--> FOAM Warning :
From function dlLibraryTable:pen(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "libuserincompressibleLESModels.so"]
I am not sure whether it has influence in simulation,because it still can simulate.
Quote:
Originally Posted by Artur View Post
I'm not really sure what you mean. Are you compiling a big set of libraries where errors like the one further up in this thread occur? Because normally you wouldn't need to make this an automated process since you have to type this in only once for every new utility you devise. Probably easier just to keep a "blank" version somewhere to kick off each new model or whatever you're trying to code up. Please be a bit more specific about what your problem actually is.

A
jiaojiao is offline   Reply With Quote

Old   December 15, 2021, 11:01
Default
  #14
New Member
 
Join Date: Aug 2020
Posts: 20
Rep Power: 6
Agavi is on a distinguished road
Hi everyone,

I had the same problem yesterday while making my own function object but the above soltuions didn't solve it. I'm no expert in OpenFOAM and I just copied the function object yPlus to base my FO on it. While I was cleaning up the implementations in my yPlus.C copy to write my own code, I deleted the implementation of

void Foam::functionObjects::yPlus::writeFileHeader(cons t label i)
{}

as I dind't need it.

This function is declared in one of the classes that yPlus inherets from and therefore the compiler didn't complain about not having an implementation, but when I tried to run the code I was getting the 'undefined symbol' error.

I'm just posting this here as I coulnd't find that source of error in the forum, maybe it will be of help to someone in the future

Cheers
Agavi is offline   Reply With Quote

Old   December 16, 2021, 05:00
Default
  #15
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 20
Artur will become famous soon enough
Thanks for sharing your experience, always worth doing it!


To expand a bit on that, the writeFileHeader routine is declared as a pure virtual member of the logFiles class:
Code:
virtual void writeFileHeader(const label i=0) = 0;
This means that, by definition, it has to be declared in each derived class as per C++ standard (https://www.geeksforgeeks.org/pure-v...tract-classes/).


Happy foaming,


Artur
Artur is offline   Reply With Quote

Old   December 16, 2021, 08:08
Default
  #16
New Member
 
Join Date: Aug 2020
Posts: 20
Rep Power: 6
Agavi is on a distinguished road
Thanks a lot Artur!

Do you know why the compiler didn't identify that as a compilation error?

Thanks

Markella
Agavi is offline   Reply With Quote

Old   December 18, 2021, 15:18
Default
  #17
Senior Member
 
Artur's Avatar
 
Artur
Join Date: May 2013
Location: Southampton, UK
Posts: 372
Rep Power: 20
Artur will become famous soon enough
Hi

I'm not sure, to be completely honest, I'd have to dig a bit deeper into it.


Cheers


A
Artur 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
libudf error: undefined symbol: Prashanth FLUENT 6 August 22, 2019 01:24
Problem with compiling my boundary conditions peita OpenFOAM Running, Solving & CFD 5 October 6, 2015 10:16
help for different between les model (subgrid-scale model) liuyuxuan FLUENT 1 October 2, 2009 16:25
Statically Compiling OpenFOAM Issues herzfeldd OpenFOAM Installation 21 January 6, 2009 10:38
2-equation model of LES and source code M.R.Hadian Main CFD Forum 0 February 3, 2002 06:00


All times are GMT -4. The time now is 03:39.