-
-
Notifications
You must be signed in to change notification settings - Fork 85
Building
To build the adapter, you need to install a few dependencies and then execute the Allwmake
script.
- Install a compatible OpenFOAM distribution.
- Install the preCICE headers and library, following its building instructions.
- If you want to use preCICE as a static library, check and adjust its dependencies in
Allwmake
(ADAPTER_PRECICE_DEP
).
- If you want to use preCICE as a static library, check and adjust its dependencies in
-
Download the adapter or (better) install git and clone this repository:
git clone https://github.com/precice/openfoam-adapter.git
.- Depending on your OpenFOAM version, you may need to change to a different git branch.
- Execute the build script:
./Allwmake
.- See and adjust the configuration in the beginning of the script first, if needed.
- Check for any error messages and suggestions at the end.
The -DADAPTER_DEBUG_MODE
flag inside ADAPTER_PREP_FLAGS
activates additional debug messages. You may also change the target directory or specify the number of threads to use for the compilation. See the comments in Allwmake
for more.
In order to upgrade the adapter, or before you build for another OpenFOAM version, run ./Allclean
first. Get the latest version using git pull
.
Next: configure and load the adapter or run a tutorial.
The following are common problems that may appear during building the OpenFOAM adapter if something went wrong in the described steps. Make sure to always check for error messages at every step before continuing to the next.
The Allwmake
script prints the environment variables it uses in the beginning (as well as in allwmake.log
) and it writes the building commands in the file wmake.log
. Afterwards, it checks (using ldd
) if the library was linked correctly and writes the output to ldd.log
. Please check these files and include them in your report if you have need help.
The most important information in these files is the -I
and -L
flags used during compilation and linking.
If in the beginning of the simulation you get the following warning:
Starting time loop
--> FOAM Warning :
From function void* Foam::dlOpen(const Foam::fileName&, bool)
in file POSIX.C at line 1604
dlopen error : libprecice.so: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 105
**could not load "libpreciceAdapterFunctionObject.so"**
--> FOAM Warning :
From function bool Foam::dlLibraryTable::open(const Foam::dictionary&, const Foam::word&, const TablePtr&) [with TablePtr = Foam::HashTable<Foam::autoPtr<Foam::functionObject> (*)(const Foam::word&, const Foam::Time&, const Foam::dictionary&), Foam::word, Foam: :string::hash>*]
in file lnInclude/dlLibraryTableTemplates.C at line 62
Could not open library "libpreciceAdapterFunctionObject.so"
--> FOAM Warning :
Unknown function type preciceAdapterFunctionObject
then this probably means that something went wrong while building the OpenFOAM adapter. Check the files wmake.log
(for building errors) and ldd.log
(for runtime linking errors). Make sure that, when you run the simulation, you have the same OpenFOAM and any other required environment variables as when you built the adapter.
If everything during building has gone well, the adapter must be installed into your $FOAM_USER_LIBBIN
directory. Check that it exists (ls $FOAM_USER_LIBBIN
) and that ldd $FOAM_USER_LIBBIN/libpreciceAdapterFunctionObject.so
does not return any errors.
Note that the simulation will continue without loading the adapter and there will be no coupling.
This is an info/warning message that is printed when WMake tries to distinguish between the object files it already has (and can save time by not recompiling them) and the files it needs to compile. You can safely ignore this message.
This is a common problem e.g. when installing dependencies in non-system directories. Have a look in the page linking to preCICE.
Make sure to build both preCICE as a shared library (i.e. .so
, not .a
).
More information on precice.org. Subscribe to the preCICE mailing list.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Please use "precice.org" for the attribution.