CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Undefined symbol error after compiling a new LES model (http://www.cfd-online.com/Forums/openfoam-programming-development/89893-undefined-symbol-error-after-compiling-new-les-model.html)

jabhiji June 24, 2011 16:29

Undefined symbol error after compiling a new LES model
 
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

ctl June 26, 2011 22:07

LES implementation undefined symbol problem solved
 
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.:D

Good luck!

Christopher

jabhiji June 27, 2011 19:02

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

Artur December 3, 2013 06:59

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

huangxianbei August 13, 2014 07:46

Quote:

Originally Posted by Artur (Post 464564)
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.

hy1112006 March 6, 2015 05:08

undefined symbol: _ZTIN4Foam14incompressible9LESModels11GenEddyViscE
 
Quote:

Originally Posted by huangxianbei (Post 505745)
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!

Artur March 6, 2015 05:12

Quote:

Originally Posted by Artur (Post 464564)
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 March 6, 2015 05:36

Quote:

Originally Posted by Artur (Post 534842)
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!

jiaojiao November 24, 2015 06:19

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 (Post 534842)
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


Artur November 24, 2015 06:23

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 November 24, 2015 07:01

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 (Post 574741)
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


Artur November 24, 2015 07:32

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 November 24, 2015 07:49

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::open(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 (Post 574760)
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



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