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

Linking ALGLIB to OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 27, 2011, 14:02
Default Linking ALGLIB to OpenFOAM
  #1
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
Hi,

I've been doing some BC programming and now I got to the point where I need specific functions, not implemented in OpenFOAM.

My goal is to make cnoidal waves, and as a result I need complete elliptic integrals and so on.

My intention is to use existing code instead of having to program the functions if possible. I found a C++ (and more) library with all the functions I need which is called ALGLIB, so I tried linking it to my BC file:

Code:
#include "specialfunctions.h"

...

KElliptic = alglib::ellipticintegralk(mElliptic);
It compiles with a couple of minor warnings, but when I get to run the model and it reaches that line of code the simulation stops and I get the following error:

Code:
interFoam: symbol lookup error: /home/phicau/OpenFOAM/phicau-1.7.1/lib/linux64GccDPOpt/libIHWavesAlpha.so: undefined symbol: _ZN6alglib17ellipticintegralkEd
Any thoughts on how to make it work?

Thanks in advance

Pablo
Phicau is offline   Reply With Quote

Old   June 28, 2011, 05:27
Default
  #2
Member
 
cosimo bianchini
Join Date: Mar 2009
Location: Florence, Tuscany, Italy
Posts: 88
Rep Power: 17
cosimobianchini is on a distinguished road
Send a message via Skype™ to cosimobianchini
Hi Picau,
I also encurred in the need for linking the alglib libraries to some applications in OpenFOAM.
In particular I included the ap.h and the matinv.h headers in the source code of my application and add the reference to the alglib source files and to the object in the Make/options file as follows:

EXE_INC = \
-I$(LIB_SRC)/postProcessing/postCalc \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I/usr/local/src/alglib/cpp/out

EXE_LIBS = \
$(FOAM_LIBBIN)/postCalc.o \
-L/usr/local/src/alglib/cpp/out/ -lalglib \
-lfiniteVolume

Hope you find this helpful
__________________
Cosimo Bianchini

Ergon Research s.r.l.
Via Panciatichi, 92
50127 Florence - ITALY
Tel: +39 055 0763716
Mob: +39 320 9460153
e-mail: cosimo.bianchini@ergonresearch.it
URL: www.ergonresearch.it
cosimobianchini is offline   Reply With Quote

Old   June 28, 2011, 14:40
Default
  #3
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
Hey thanks a lot! Things are easier now:

Fool of me I did not include all the files I needed, since you have to include both the .h and .cpp on the header, so to make "specialfunctions" to work you just need the following includes:

Code:
#include "./cpp/src/specialfunctions.h"
#include "./cpp/src/ap.h"
#include "./cpp/src/alglibinternal.h"

#include "./cpp/src/specialfunctions.cpp"
#include "./cpp/src/ap.cpp"
#include "./cpp/src/alglibinternal.cpp"
Piece of cake
Phicau is offline   Reply With Quote

Old   January 11, 2012, 17:52
Default
  #4
New Member
 
Betsy Seiffert
Join Date: Feb 2011
Location: Honolulu, HI
Posts: 11
Rep Power: 15
Betsy is on a distinguished road
Quote:
Originally Posted by Phicau View Post
Hi,

I've been doing some BC programming and now I got to the point where I need specific functions, not implemented in OpenFOAM.

My goal is to make cnoidal waves, and as a result I need complete elliptic integrals and so on.

My intention is to use existing code instead of having to program the functions if possible. I found a C++ (and more) library with all the functions I need which is called ALGLIB, so I tried linking it to my BC file:

Code:
#include "specialfunctions.h"

...

KElliptic = alglib::ellipticintegralk(mElliptic);
It compiles with a couple of minor warnings, but when I get to run the model and it reaches that line of code the simulation stops and I get the following error:

Code:
interFoam: symbol lookup error: /home/phicau/OpenFOAM/phicau-1.7.1/lib/linux64GccDPOpt/libIHWavesAlpha.so: undefined symbol: _ZN6alglib17ellipticintegralkEd
Any thoughts on how to make it work?

Thanks in advance

Pablo
Hi Pablo - were you able to successfully create cnoidal waves in OF? If so, do you mind sharing your code?
Thanks,
Betsy
Betsy is offline   Reply With Quote

Old   January 11, 2012, 18:07
Default
  #5
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
Hi

yes I currently have a boundary condition that generates cnoidal waves along with several other theories, and includes simultaneous active wave absorption.

However I am in the process of publishing a couple of papers and I cannot give further details for the moment. As soon as the papers are in press I will give some references. I still don't know if the BC code will be available in the future, but I hope it will.

Regards
Phicau is offline   Reply With Quote

Old   January 12, 2012, 03:45
Default
  #6
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Betsy

You might find the following toolbox interesting:

http://openfoamwiki.net/index.php/Contrib/waves2Foam

(Please note that I make commercial for my own work). The toolbox includes a method for generating cnoidal waves.

Kind regards,

Niels
ngj is offline   Reply With Quote

Old   January 12, 2012, 17:15
Default
  #7
New Member
 
Betsy Seiffert
Join Date: Feb 2011
Location: Honolulu, HI
Posts: 11
Rep Power: 15
Betsy is on a distinguished road
Thanks Pablo and Niels for the references, I will take a look at these.
Betsy
Betsy is offline   Reply With Quote

Reply

Tags
alglib, functions, openfoam


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
Cross-compiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingw-w64 wyldckat OpenFOAM Announcements from Other Sources 3 September 8, 2010 07:25
Modified OpenFOAM Forum Structure and New Mailing-List pete Site News & Announcements 0 June 29, 2009 06:56
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 19:07
Adventure of fisrst openfoam installation on Ubuntu 710 jussi OpenFOAM Installation 0 April 24, 2008 15:25
OpenFOAM Debian packaging current status problems and TODOs oseen OpenFOAM Installation 9 August 26, 2007 14:50


All times are GMT -4. The time now is 12:38.