CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Compiling (https://www.cfd-online.com/Forums/openfoam/86411-compiling.html)

Andrea_85 March 22, 2011 08:16

Compiling
 
Hi all,

What should I do to compile the libraries in my home directory?
I knew that to compile a solver (say for example interFoam.C) in your home directory just add USER in interFoam / Make / files, like:

interFoam.C
EXE = $ (FOAM_USER_APPBIN) / interFoam

when i compile interfoam however I noticed that the libraries that adds are not those of my home. (-I/opt/OpenFOAM....)


Making dependency list for source file interFoam.C
SOURCE=interFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/opt/OpenFOAM/OpenFOAM-1.7.0/src/transportModels -I/opt/OpenFOAM/OpenFOAM-1.7.0/src/transportModels/incompressible/lnInclude -I/opt/OpenFOAM/OpenFOAM-1.7.0/src/transportModels/interfaceProperties/lnInclude -I/opt/OpenFOAM/OpenFOAM-1.7.0/src/turbulenceModels/incompressible/turbulenceModel -I/opt/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-1.7.0/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-1.7.0/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/interFoam.o
/opt/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/readPISOControls.H: In function ‘int main(int, char**)’:
/opt/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/readPISOControls.H:11: warning: unused variable ‘transonic’
/opt/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/readPISOControls.H:14: warning: unused variable ‘nOuterCorr’
/opt/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/readPISOControls.H:3: warning: unused variable ‘nCorr’
/opt/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/readPISOControls.H:8: warning: unused variable ‘momentumPredictor’
/opt/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/readPISOControls.H:11: warning: unused variable ‘transonic’
/opt/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/readPISOControls.H:14: warning: unused variable ‘nOuterCorr’
g++ -m64 -Dlinux64 -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/opt/OpenFOAM/OpenFOAM-1.7.0/src/transportModels -I/opt/OpenFOAM/OpenFOAM-1.7.0/src/transportModels/incompressible/lnInclude -I/opt/OpenFOAM/OpenFOAM-1.7.0/src/transportModels/interfaceProperties/lnInclude -I/opt/OpenFOAM/OpenFOAM-1.7.0/src/turbulenceModels/incompressible/turbulenceModel -I/opt/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-1.7.0/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-1.7.0/src/OSspecific/POSIX/lnInclude -fPIC Make/linux64GccDPOpt/interFoam.o -L/opt/OpenFOAM/OpenFOAM-1.7.0/lib/linux64GccDPOpt \
-linterfaceProperties -lincompressibleTransportModels -lincompressibleRASModels -lincompressibleLESModels -lfiniteVolume -lOpenFOAM -liberty -ldl -lm -o /home/aferrari/OpenFOAM/aferrari-1.7.0/applications/bin/linux64GccDPOpt/interFoam


I would leave clean the original version of OF and make changes in my home directory, so how can I do to include the correct libraries?

Thanks
andrea

andrea.pasquali March 22, 2011 10:36

Hi,
I like to keep together the old and the new one.
In you case I'll create a new directory "myInterFoam" with myInterFoam.C and Make/file:

myInterFoam.C
EXE = $(FOAM_APPBIN)/myInterFoam

Ciao

Andrea

Andrea_85 March 22, 2011 11:00

Hi Andrea,

I did not understand very well what you mean. My problem is not compiling myinterFoam.C, the problem is that I do not know how to include "mylibrary".

I have to change myinterFoam/Make/option and add the correct path for "library"?

something like:


EXE_INC = \
// -I$(LIB_SRC)/transportModels \
// -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
// -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
// -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
// -I$(LIB_SRC)/finiteVolume/lnInclude

-I$/home/../transportModels \
-I$/home/../transportModels/incompressible/lnInclude \
-I$/home/../transportModels/interfaceProperties/lnInclude \
-I$/home/../turbulenceModels/incompressible/turbulenceModel \
-I$/home/../finiteVolume/lnInclude


EXE_LIBS = \
-linterfaceProperties \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lincompressibleRASModels \
-lincompressibleLESModels \
-lfiniteVolume


Thanks
andrea

andrea.pasquali March 22, 2011 11:36

Hi Andrea,
I understood you want to compile a new interFoam without changing the src.
If you want to use your libs in your new solver I don't know if adding -I$/home/.. it works, you can try.
If you have the .H files of your libs you can copy them in myInterFoam folder and include them in .C file.

Andrea

Andrea_85 March 22, 2011 11:48

Thanks for the help.
I need to include a new interfaceProperties.H. So you say that it is enough to put the new interfaceProperties.C and interfaceProperties.H in myinterFoam directory and then use #include" " from interFoam.C.

I have to change the Make/option file? Can i delete the line

-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \

-linterfaceProperties \

to be sure that i'm using the new library ?

Thanks
andrea

andrea.pasquali March 22, 2011 12:07

You can try.
Or also you can compile your myInterfaceProperties lib under src/transportModels with "wmake libso" and check in lib you have:

libmyInterfaceProperties.so

Then you compile myInterFoam with

-I$(LIB_SRC)/transportModels/myInterfaceProperties/lnInclude \

in option file

Andrea

Andrea_85 March 22, 2011 12:52

Ok, i did it and it runs.
Thank you very much

andrea


All times are GMT -4. The time now is 19:52.