CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (http://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   interfacing openFoam - other software (http://www.cfd-online.com/Forums/openfoam-post-processing/96453-interfacing-openfoam-other-software.html)

vittorio.bissaro January 23, 2012 14:08

interfacing openFoam - other software
 
Hi everybody,
- I have a problem when using OpenFoam and I'm looking for "forces" as output.
The output is:
could not load "libforces.so"
[..]

Looking at the last line of .bashrc (whats happens when I open the terminal) I have :

source /opt/openfoam201/etc/bashrc
export PATH=/usr/local/dakota/bin/:$PATH
export LD_LIBRARY_PATH=/usr/local/dakota/lib/:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/lib/:$LD_LIBRARY_PATH

The last three line needed if using Dakota - optimization software.

- If I modify the .bashrc in :

source /opt/openfoam201/etc/bashrc
# export PATH=/usr/local/dakota/bin/:$PATH
# export LD_LIBRARY_PATH=/usr/local/dakota/lib/:$LD_LIBRARY_PATH
# export LD_LIBRARY_PATH=/usr/lib/:$LD_LIBRARY_PATH

everything work and I am able to get my "forces"

What is the problem?
How can I export these folder without loosing the ability to calculate forces?

Thanks a lot and my best wishes to this great forum.
Cheers,

Vittorio

wyldckat January 23, 2012 16:40

Greetings Vittorio,

How about reversing the start-up list?
Quote:

Originally Posted by vittorio.bissaro (Post 340685)
export PATH=/usr/local/dakota/bin/:$PATH
export LD_LIBRARY_PATH=/usr/local/dakota/lib/:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/lib/:$LD_LIBRARY_PATH
source /opt/openfoam201/etc/bashrc

You can also try and figure out which versions of "libforces.so" exist by running:
Code:

(export PATH=$PATH:$LD_LIBRARY_PATH; which libforces.so)
#or: (export PATH=$PATH:$LD_LIBRARY_PATH; which -a libforces.so)

The parenthesis will create a sub-shell, therefore it will not contaminate the working shell environment.

Another thing is to run ldd on "libforces.so" to see what is getting loaded and from where. Example:
Code:

ldd $HOME/OpenFOAM/OpenFOAM-2.1.x/platforms/linux64GccDPOpt/lib/libforces.so
Best regards,
Bruno

vittorio.bissaro January 24, 2012 13:23

Bruno, thanks a lot for helping.
If I try to reverse the start-up list in this case I have a problem with my first called program Dakota and its library.

dakota: symbol lookup error: /usr/local/dakota/lib/libdakota_src.so: undefined symbol: _ZTV14DDaceOASampler

Maybe It's a linux problem, but How can I get independent the two program?
Is it possible to create two different sub-shell enviroment where the different program works without affecting each other?

I do not understand what do you suggest later?
What the goal to figure out what version of libforces.so exist?

Thanks a lot,

Vittorio

wyldckat January 25, 2012 19:02

Hi Vittorio,

Quote:

Originally Posted by vittorio.bissaro (Post 340912)
Bruno, thanks a lot for helping.
If I try to reverse the start-up list in this case I have a problem with my first called program Dakota and its library.

dakota: symbol lookup error: /usr/local/dakota/lib/libdakota_src.so: undefined symbol: _ZTV14DDaceOASampler

:eek: Something crazy is going on there... try commenting the line for OpenFOAM, to see if Dakota still works or not.

Quote:

Originally Posted by vittorio.bissaro (Post 340912)
Maybe It's a linux problem, but How can I get independent the two program?
Is it possible to create two different sub-shell enviroment where the different program works without affecting each other?

Yes, it's possible, but it will seriously depend on how they actually interact! Who calls who and how? Is it the solver that calls a Dakota application, or is it an OpenFOAM application that calls Dakota?

Either way, the following blog post of mine might give you some more information on this subject: Advanced tips for working with the OpenFOAM shell environment
And this one might also come in handy: http://www.cfd-online.com/Forums/ope...tml#post303512 - it's for MATLAB, but the logic might be similar to how you use Dakota.

Quote:

Originally Posted by vittorio.bissaro (Post 340912)
I do not understand what do you suggest later?
What the goal to figure out what version of libforces.so exist?

Because if "libforces.so" isn't loadable by the OpenFOAM application, then it might be because the wrong library might be getting incorrectly loaded.
The other possibility is that one of the Dakota libraries are somehow getting in the way. The following command should also give some more hints as to what gets loaded and from where:
Code:

ldd $FOAM_LIBBIN/libforces.so
Best regards,
Bruno

emiliano February 27, 2013 09:21

Hello there, I had the same problem and I solved it.
The setting-up of the OpenFOAM environment uses a library called "libsampling.so" which has the same name of a DAKOTA library (see the DAKOTA_installation_dir/lib directory). Hence, if you wish to use both the codes, you have to modify one of the two compilation processes in order to rename that library with another name. I did it renaming the OF library as "libOFsampling.so".

Hope it helps!

Regards,
Emiliano

giov_ingr September 1, 2013 15:59

Dear Emiliano,
I have the same compatibility problem between Dakota and OpenFoam, could you please explain me how to compile openFoam substituting libsampling.so with libOFsampling.so.
Do you know how to do it in cmake if I would compile differently Dakota instead of openFoam?

Thank you in advance.
Best regards,
Giovanni

wyldckat September 1, 2013 16:59

Greetings Giovanni,

Run the following commands, with OpenFOAM's shell environment ready to be used:
Code:

foam
sed -i -e 's=libsampling=libOFsampling=' src/sampling/Make/files
find . -name options | xargs sed -i -e 's=-lsampling=-lOFsampling='
rm $FOAM_LIBBIN/libsampling.so
./Allwmake > make.log 2>&1

And when Allwmake is finished, you should have OpenFOAM up and running with the "libOFsampling.so" library!

If by any chance you have OpenFOAM installed in "/opt", then:
  1. Run the following command:
    Code:

    echo "source $(foamEtcFile bashrc)"
  2. Copy the outputted text line.
  3. Switch to root mode, e.g.:
    Code:

    sudo -s
    Or:
    Code:

    su -
  4. Paste the line from step #2 and run it.
  5. Then run the commands from the beginning of this post.
Best regards,
Bruno

giov_ingr September 1, 2013 20:14

Dear Bruno,

Thank you very much for your fast and precise answer.
During the last hours I have been trying to change the libsampling.so in dakota and finally I succeded doing it. Now I have a libdakotasampling.so library in my LD_LIBRARY_PATH.

I suppose that you would have some experience in coupling OpenFoam and Dakota. Could you please address me to some material for shape design optimization?

Best regards,
Giovanni

emiliano September 2, 2013 05:08

Right, I used a similar command

grep -R -i "\-lsampling" * | awk '{a=index($1,":");print substr($1,1,a-1)}' | xargs sed -i 's/lsampling/lOFsampling/'

to be executed in the OF root folder.

Greetings,
Emiliano

wyldckat September 3, 2013 16:50

Greetings to all!

@Giovanni:
Quote:

Originally Posted by giov_ingr (Post 449265)
I suppose that you would have some experience in coupling OpenFoam and Dakota. Could you please address me to some material for shape design optimization?

For better or for worst, personally I've never used Dakota :(
But from the brief searches I've done in the past, on what exists about optimization with Dakota (including OpenFOAM), it's very easy to find things about it online!

Good luck! Best regards,
Bruno

joegi.geo September 10, 2013 20:31

I don't like to change the name of the original libraries, it is just a personal preferences. So the solution for me was to compile dakota as an static library - problem solved -.

jg

Seroga October 14, 2014 14:52

Could you, please, tell how to compile Dakota as a static library?
That would be very helpful for me.

joegi.geo October 14, 2014 15:01

Check this link,

http://openfoamwiki.net/index.php/Si...llation_issues

Seroga October 14, 2014 15:07

Thanks for such a quick answer! I'll do that.

Seroga October 15, 2014 14:07

Finally I managed to build Dakota with static libs and it works. Thanks a lot for your help!
But I have one more question. I needed Boost1.4.9 for Dakota installation. And during the Boost installation it removed OpenFOAM. So after I had Dakota installed I had to reinstall OpenFOAM. During the OpenFOAM installation Boost was removed but as I can see it didn't affected the Dakota. Can you tell me why could it be? Won't it affect Dakota's functionality in future?

joegi.geo October 15, 2014 14:23

Honestly, I have no clue what could be the problem.
Just check if openfoam and dakota are working, if both are working I dont see any reason to worry about.


jg

bjornthe November 11, 2014 16:40

I also ran into this problem. Think it's better to source the OpenFOAM bashrc file from the simulation script instead. In the simulation script it's also possible to change the LD_LIBRARY_PATH. The change is only present while the script executes.


All times are GMT -4. The time now is 15:22.