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

How to adjust Make/options

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 11, 2010, 15:28
Default How to adjust Make/options
  #1
Senior Member
 
BastiL
Join Date: Mar 2009
Posts: 530
Rep Power: 20
bastil is on a distinguished road
Hi all,

I have re-written triSurface library (MytriSurface) and placed them in FOAM_USER_LIBDIR. How I want a application to use this library. How do I need to adjust Make/options:

Code:
-I$(LIB_SRC)/MytriSurface/lnInclude
Where is LIB_SRC set and how do I need to change it? It obviously points to FOAM_SRC_DIR but I can not find any environment variable LIB_SRC?

Thanks Bastian
bastil is offline   Reply With Quote

Old   September 5, 2011, 11:41
Default
  #2
Senior Member
 
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 16
linch is on a distinguished road
I also don't see any environment variable LIB_SRC. Where is it defined?

Regards,
illya
linch is offline   Reply With Quote

Old   September 5, 2011, 14:05
Default
  #3
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

( the initial post was a year and a half ago...)

OK, these kinds of variables that aren't in the shell environment, are usually defined somewhere in the wmake folder, also known as $WM_DIR:
Code:
echo $WM_DIR
Now, if you want to find out where it's located in one of those files, you can either use an advanced text editor (such as Kate or Eclipse IDE) or use the following commands:
Code:
cd $WM_DIR
find . | xargs grep 'LIB_SRC' -sl
The second line will use find to list all of the available files and folders; pipe "|" it to xargs for using each item on the list from find on grep. grep will then list the files that have the string we are searching for. Have doubts? Run:
Code:
man find
man xargs
man grep
For the lazy, the answer is as follows: it's defined in "$WM_DIR/Makefile".

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   September 6, 2011, 03:34
Default
  #4
Senior Member
 
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 16
linch is on a distinguished road
Thank you Bruno,

I saw, that the original post is very old, but since there was no answer and I was interested in, I thought I'll take the existing one instead of starting a new one.

Best regards,
Illya
linch is offline   Reply With Quote

Old   September 6, 2011, 15:07
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Illya,

No problem I was more stunned by the fact that the thread didn't receive any answers back then

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   March 11, 2020, 05:27
Default
  #6
Member
 
Andrea Di Ronco
Join Date: Nov 2016
Location: Milano, Italy
Posts: 57
Rep Power: 9
Diro7 is on a distinguished road
Hello Bruno,

sorry for reopening again this years-old thread but I didn't find much about these matters in the forum.

Suppose I'm writing a small custom library with some solvers and a few additional features, let's say boundary conditions or function objects. Using a tree structure similar to the OpenFOAM one now I'm able to compile such features into a single library, to the $(FOAM_USER_LIBBIN) from a customPath/src/myLibrary/ source folder.
To access such functionalities and to link the library to my solvers, now the Make/options file of my solvers should look like:

Code:
EXE_INC = \
    -IcustomPath/src/myLibrary/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
    -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/sampling/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude

EXE_LIBS = \
    -L$(FOAM_USER_LIBBIN) \
    -lmyLibrary \
    -lturbulenceModels \
    -lincompressibleTurbulenceModels \
    -lincompressibleTransportModels \
    -lradiationModels \
    -lfiniteVolume \
    -lsampling \
    -lmeshTools \
    -lfvOptions
Now, the -L$(FOAM_USER_LIBBIN) line specifies to look for library .so files into the $(FOAM_USER_LIBBIN) directory, such that -lmyLibrary allows to find the compiled libmyLibrary.so file. This works just fine so far.

What if I decide to compile more custom libraries separately, and I want to define something like $(LIB_USER_SRC) to point to the customPath/src base folder automatically without having to specify the whole path for each -I line?

I understand that $(LIB_SRC) is defined when calling wmake, and that to define an analogous $(LIB_USER_SRC) I could in principle either modify the wmake folder or create a custom one in my library, but this seems quite overkill.
Another possibility is maybe to define it somehow in the customPath/Allwmake script, but this would prevent me to compile solvers separately during development and testing.

Is there some possibility to define a variable pointing to the base folder within the Make/options file, just as it can be done in the Make/files file?
I know, it's more a curiosity than a real necessity, but I was wondering about it and since you are one the OpenFOAM pros around here maybe you know the tricks!

Thank you!

Andrea
Diro7 is offline   Reply With Quote

Old   March 12, 2020, 00:36
Default
  #7
Senior Member
 
Yogesh Bapat
Join Date: Oct 2010
Posts: 102
Rep Power: 15
ybapat is on a distinguished road
You can set environment variable usign export command in linux. You can set LIB_USER_SRC to path you want.
ybapat 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
Help with ADJUST FUNCTION Munir Ahmed Khan FLUENT 0 August 8, 2008 06:33
ADJUST udf Jubs FLUENT 3 February 12, 2007 06:00
adjust gradient temperature on the cylinder's wall Konrad FLUENT 1 August 28, 2006 07:16
udf ADJUST for recuperer the couple louse each ite hamina FLUENT 1 March 2, 2006 14:54
How to adjust turbulent transport constants? Wang FLUENT 0 December 6, 2000 07:57


All times are GMT -4. The time now is 18:54.