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

Linking ALGLIB to OpenFOAM

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   June 27, 2011, 13:02
Default Linking ALGLIB to OpenFOAM
  #1
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Posts: 233
Rep Power: 7
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, 04:27
Default
  #2
Member
 
cosimo bianchini
Join Date: Mar 2009
Location: Florence, Tuscany, Italy
Posts: 88
Rep Power: 8
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

Energy Engineering Department "S. Stecco"
University of Florence
Via di S.Marta, 3
50139 Florence - ITALY
Tel: +39 055 4796575
Fax: +39 055 4796342
Mob: +39 320 9460153
e-mail: cosimo.bianchini@htc.de.unifi.it
URL: www.htc.de.unifi.it
cosimobianchini is offline   Reply With Quote

Old   June 28, 2011, 13:40
Default
  #3
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Posts: 233
Rep Power: 7
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: 6
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
Posts: 233
Rep Power: 7
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: Rotterdam, The Netherlands
Posts: 1,595
Rep Power: 24
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: 6
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

Thread Tools
Display Modes

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 On
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 06:25
Modified OpenFOAM Forum Structure and New Mailing-List pete Site News & Announcements 0 June 29, 2009 05:56
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 18:07
Adventure of fisrst openfoam installation on Ubuntu 710 jussi OpenFOAM Installation 0 April 24, 2008 14:25
OpenFOAM Debian packaging current status problems and TODOs oseen OpenFOAM Installation 9 August 26, 2007 13:50


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