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

Compile old solver in new version of OF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 18, 2019, 00:08
Default Compile old solver in new version of OF
  #1
New Member
 
Fantastic Boy
Join Date: Oct 2017
Posts: 11
Rep Power: 8
kit607 is on a distinguished road
Hi everyone.

I have OF 6 installed on the server but I wanted to compile a solver from OF141 to validate a test case. I am facing a problem with configure the
Code:
wmake/options
. In the files, there is EXE_INC and EXE_LIBS. I want to set that both to read the files but I got no idea how to set the path.

The original file is
Code:
EXE_INC = \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/turbulenceModels \
    -I$(LIB_SRC)/transportModels

EXE_LIBS = \
    -lincompressibleTurbulenceModels \
    -lincompressibleTransportModels \
    -lfiniteVolume \
    -lmeshTools \
    /* $(LIB_WM_OPTIONS_DIR)/libfbsdmalloc.o */
and I modified it to
Code:
EXE_INC = \
    -I</home/mgt-aaibe/OpenFOAM/mgt-aaibe-6/src>/finiteVolume/lnInclude \
    -I</home/mgt-aaibe/OpenFOAM/mgt-aaibe-6/src>/turbulenceModels \
    -I</home/mgt-aaibe/OpenFOAM/mgt-aaibe-6/src>/transportModels

EXE_LIBS = \
    -lincompressibleTurbulenceModels \
    -lincompressibleTransportModels \
    -lfiniteVolume \
    -lmeshTools \
    /* $(LIB_WM_OPTIONS_DIR)/libfbsdmalloc.o */
In
HTML Code:
https://cfd.direct/openfoam/user-guide/v7-compiling-applications/
, it shows
Code:
EXE_INC = \\
        -I<directoryPath1> \\
so I followed it but I not sure is that correct.

The second question is where is the LIBS store? I need to set it to read from my own directory too.

Appreciate your help.
kit607 is offline   Reply With Quote

Old   September 18, 2019, 02:11
Default
  #2
Member
 
Join Date: Dec 2018
Location: Darmstadt, Germany
Posts: 87
Rep Power: 7
raumpolizei is on a distinguished road
Hey there,
unless the libraries you are using are not provided in your openfoam version (lets call it OF-standard), you do not need to change the paths. To better understand, just type in your console (after sourcing your new openfoam version):
Code:
echo $FOAM_SRC
If, however, you need to provide all paths in a hard coded manner (not the best idea, especially if you are using the same code on different machines), you should correct

EXE_INC = \
-I</home/mgt-aaibe/OpenFOAM/mgt-aaibe-6/src>/finiteVolume/lnInclude \

to

EXE_INC = \
-I/home/mgt-aaibe/OpenFOAM/mgt-aaibe-6/src/finiteVolume/lnInclude \


in a same way you can get the path to the libraries with:
Code:
echo $FOAM_LIBBIN
But again, you do not need to specify the path in wmake files as the $FOAM_LIBBIN path is already included by default (which is why you never see any additional path included in common OF applications). Hope this helps. Good Luck!
RP
raumpolizei is offline   Reply With Quote

Old   September 18, 2019, 04:22
Default
  #3
New Member
 
Fantastic Boy
Join Date: Oct 2017
Posts: 11
Rep Power: 8
kit607 is on a distinguished road
Hi Raumpolizei,

Thank for your quick response. The reason that I want to add all the path to the new solver is that I want to use the old solver from OF 1.4.1 in OF 6. I noticed there is a lot of changes been made when they release the new version especially from OF 2 to OF3. Therefore, I think is will be better for me to add the path to read the library.

Also, may I know what is the correct expression adding the new path to the libraries? Is it the below is a correct expression? Can you provide me an example on that too?

Code:
-L/home/mgt-aaibe/OpenFOAM/mgt-aaibe-6/lincompressibleTurbulenceModels
Thank you very much!
kit607 is offline   Reply With Quote

Old   September 18, 2019, 05:06
Default
  #4
Member
 
Join Date: Dec 2018
Location: Darmstadt, Germany
Posts: 87
Rep Power: 7
raumpolizei is on a distinguished road
Hey,
do I understand you correctly, you would like to compile an application in OF6 using libraries from OF 1.4? Even if that would be working, by doing that you would lose all the new functionalities of OF6. Generally, as you said, the code may have changed a lot which could be problematic (using a mix of OF6 and OF1.4 libraries will probably also not work). The clean way to do it would be to use the new OF6 libraries and then go over the compile errors one after another. So basically just use the same Make/files and Make/options with your new OF version sourced. You can still post the error message here (And also the Make/files & Make/options)

To your second question: In order to include a path so that the libraries to be linked with can be found, you need the following syntax (90% sure, should be the way though):


-L<directoryContainingLibraryPath> \
-l<aLibraryInThatDirectory>


Your example becomes:

Code:
-L/home/mgt-aaibe/OpenFOAM/mgt-aaibe-6 \
-lincompressibleTurbulenceModels
which will not work correctly if there is another library in any other included path with the same name (for instance in $FOAM_LIBBIN, see previous post).
raumpolizei is offline   Reply With Quote

Old   September 18, 2019, 06:37
Default
  #5
New Member
 
Fantastic Boy
Join Date: Oct 2017
Posts: 11
Rep Power: 8
kit607 is on a distinguished road
Hi there,

Basically I want to compile a solver from OF 1.4 with it's own libraries in OF6 where the UEqn.H and pEqn.H is v1.4.

Is it possible for me to set only the new solver will access the OF1.4 libraries and other remains as OF6?

Thank you.
kit607 is offline   Reply With Quote

Reply

Tags
compile solver


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
PEMFC model with FLUENT brahimchoice FLUENT 22 April 19, 2020 15:44
Unable to compile solver hwsv07 OpenFOAM Programming & Development 10 February 21, 2018 09:41
Converting custom solver from old version to openFoam4.1 Nigel Bruce Khan OpenFOAM Running, Solving & CFD 2 August 11, 2017 10:45
Working directory via command line Luiz CFX 4 March 6, 2011 20:02
How to compile an unsteady solver based on solver of MRFSimpleFoam? renyun0511 OpenFOAM Running, Solving & CFD 0 April 27, 2010 11:16


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