CalculiX not being linked to preCICE properly

Greetings,
I am Nithin and I am trying to work with CalculiX and preCICE to conduct FSI simulations as a part of a graduation thesis.

I installed and configured everything required as per instructions.
When I run a standard perpendicular flap tutorial, the fluid solver (pimpleFoam) is working fine but the solid solver (CalculiX) isn’t being initiated.
I have attached all the dependencies and my openfoam adapter folder along with the test case with log files. I have even attached my bashrc script file in PDF format to this discussion.

I’d be really grateful if anyone can kindly point out where I am going wrong.

Thank you.

All the files involved

1 Like

Welcome to the preCICE Discourse, @nithinadidela! :beers:

There are several issues here, some of which are common among many other users.

CalculiX adapter problems

In the file perpflap/Solid.log I see:

./Allrun: line 80: ccx_preCICE: command not found

This means that your system cannot find ccx_preCICE. You can check this by running ccx_preCICE from anywhere in a terminal. When you built the CalculiX adapter, you also noticed this note in the building instructions (after checking that everything built successfully):

After building successfully, the executable ccx_preCICE is located in the bin folder. You may want to add this to your $PATH , or move it to a searchable bin directory.

This you already tried, as I see in your .bashrc:

export PATH="/home/nithin/CalculiX/calculix-adapter-master/bin/ccx_preCICE:$PATH"

but it should actually be:

export PATH="/home/nithin/CalculiX/calculix-adapter-master/bin/:$PATH"

Notice that, after adding this to your .bashrc, you need to open a new terminal (or just do source ~/.bashrc). You can always check environment variables with e.g. echo $PATH.

OpenFOAM adapter problems

In the file flapPerp/Fluid.log, I see that OpenFOAM cannot find the adapter:

Starting time loop

--> FOAM Warning : 
    From function void* Foam::dlOpen(const Foam::fileName&, bool)
    in file POSIX.C at line 1251
    dlopen error : libpreciceAdapterFunctionObject.so: cannot open shared object file: No such file or directory

Usually this happens if something went wrong while building the adapter (always look for any errors/warnings!).

With this hint, I look into your openfoam-adapter/ldd.log:

ldd: /opt/openfoam/platforms/linux64GccDPInt32Opt/lib/include:/home/nithin/OpenFOAM/nithin-7/platforms/linux64GccDPInt32Opt/lib/libpreciceAdapterFunctionObject.so: No such file or directory

So, the linker could not find libpreciceAdapterFunctionObject.so either. Was it even created?

Let’s look into your openfoam-adapter/wmake.log:

wmake libso .
/opt/openfoam7/wmake/makefiles/general:164: *** target pattern contains no '%'.  Stop.

This is a very strange error, which I had to search for and find this hint on StackOverflow:

This error is due to a presence of a ":" . Therefore it no longer supports windows paths.

Which leads me to the question: are you trying to use preCICE on Windows? Probably not, as you have a .bashrc file. But are you maybe mixing up some Windows directory somewhere (e.g. running Windows Subsystem for Linux)?

Note: Although we have tried preCICE on Windows in the past, we don’t currently recommend this and it would be better to use a full Linux installation.

Additional: OpenFOAM version

In your log files I also see that you are using OpenFOAM 7, but I see that you are using the adapter from the master Git branch. This does not support OpenFOAM 7 and you need to change to a different branch. Please read our notes on OpenFOAM versions and preferably install one of the versions supported by the master branch of the adapter.

No preCICE build

I see that in your ~/.bashrc you have:

export PRECICE_ROOT=/home/nithin/precice-1.6.1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PRECICE_ROOT/build/last/

However, I don’t see any build directory in precice-1.6.1 (or any other CMake files). Have you installed preCICE in any other way?

Please also note that it is not necessary anymore to set a PRECICE_ROOT and the link build/last is not created by CMake (which we use as default since preCICE v1.4.0).

Please refer to the following wiki pages to build preCICE:

Since you are using Ubuntu, you can alternatively install a binary package.

1 Like

Thank you so much…
I followed every step of the installation clearly this time and it seems that I have overlooked another error while running “make” during the CalculiX installation.

I’d really appreciate any thoughts or corrections.

Have you already followed our instructions to build CalculiX, as well as SPOOLES?

What did you set for SPOOLES in the CalculiX adapter Makefile?

The address of the SPPOOLES directory $(Home)/SPOOLES

I am sorry for the earlier comment…
I figured the CalculiX make part…

Now, I am caught up in a preCICE “build” error

I am pretty sure this is a minor mistake that i am doing but i am unable to figure what…

I figured the CalculiX make part…

What was the issue? Please write it here so that you help future readers. :wink:

The latest error you get (while linking) is:

/usr/bin/ld: cannot find -lboost::regex

How/where have you installed Boost? Which version? If you installed it in a local directory, did you add it to your LD_LIBRARY_PATH?

The boost master folder is in home/Boost_1.67
Since it’s a local directory, how should I link it?

You can try adding the following to your ~/.bashrc (and reloading it):

# ==== boost ====
BOOST_ROOT=$HOME/Boost_1.67
export LIBRARY_PATH=$BOOST_ROOT/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=$BOOST_ROOT/lib:$LD_LIBRARY_PATH
export CPLUS_INCLUDE_PATH=$BOOST_ROOT/include:$CPLUS_INCLUDE_PATH

Make sure that the path $HOME/Boost_1.67/lib exists.

1 Like

Okay… Now I think I get it…
I was clueless about boost…
So, I just followed this discussion of yours and filled in some parts which were not there in the installation guide…
Now, I’ll do what you have suggested for boost and strictly stick to your github repository instructions page… https://github.com/precice/openfoam-adapter/issues/18

Although I do have one more doubt
You suggested that I clone from Openfoam7 branch repository of openfoam-adapter
Which I think is this…


I need to clone this repository and stick to the installation guide, am I correct?

P. S. Sorry, I am really new to anything related open source. I really appreciate your time.

1 Like

This is correct, you can get it with:

git clone https://github.com/precice/openfoam-adapter.git -b OpenFOAM7

I just now updated that branch, so please do a git pull to update it in your system and rebuild.

Hi,
I still cannot fine the build/last directory…
I suppressed the python dependency while building of precice using Cmake…Is it because of that?
Also, while running “make” file while building CalculiX adapter i get this error

What do I do?

Since you have built preCICE from source and installed it in a local directory, you need to set the PKG_CONFIG_PATH as well.

I still cannot fine the build/last directory…

Where did you read about the build/last directory? This is not relevant/recommended in the latest versions of preCICE and we should remove any traces of it from the documentation.

Hello,
Pardon me about the build/last part…I got it from a discussion…

I took every one of your advice and re did the whole thing. There were no errors this time although I got this.

From the documentation I realise that that you used preCICE as a static library, but I didn’t specify its dependencies correctly.
Will that be a problem going forward doing FSI simulations with CalculiX and openFoam?

P.S. I am almost there. Thanks for all the help until now.

Now this is about the OpenFOAM and we should move to a different topic. Could you please open a new one and post this and the output of ldd.log? Feel free to link to this topic as well, for the history.

Hello,
So I got this same error when making the adapter so I used the guidelines here. Mine was already #include “precice/SolverInterfaceC.h” in the PreciceInterface.c file so I tried changing it to precice/bindings/c/SolverInterfaceC.h which I was quite positive would not work. I am not sure where this file is located for me and so I am uncertain about the file path to put in to allow the adapter to fully make.

Would appreciate y’all’s help

So, I was able to locate where this file is and I changed the path in PreciceInterface.c from
#include “precice/SolverInterfaceC.h” to
#include “precice-2.3.0/extras/bindings/c/include/precice/SolverInterfaceC.h” but still got an error.

How did you get/build preCICE?
Seems like you did not install preCICE.

https://precice.org/installation-source-installation.html

I ran the commands on the website and got this:

mishal49@DESKTOP-LGSKB8J:~/precice/precice-2.3.0$ sudo make install
[sudo] password for mishal49:
– Found Git: /usr/bin/git (found version “2.25.1”)
– Revision status: Detection failed
[ 0%] Built target GitRevision
[ 61%] Built target precice
[ 61%] Built target binprecice
[100%] Built target testprecice
Install the project…
– Install configuration: “Release”
– Up-to-date: /root/precice/lib/libprecice.so.2.3.0
– Up-to-date: /root/precice/lib/libprecice.so.2
– Up-to-date: /root/precice/lib/libprecice.so
– Up-to-date: /root/precice/include/precice/SolverInterface.hpp
– Up-to-date: /root/precice/include/precice/types.hpp
– Up-to-date: /root/precice/include/precice/SolverInterfaceC.h
– Up-to-date: /root/precice/include/precice/SolverInterfaceFortran.hpp
– Up-to-date: /root/precice/bin/binprecice
– Up-to-date: /root/precice/share/precice/examples
– Up-to-date: /root/precice/share/precice/examples/solverdummies
– Up-to-date: /root/precice/share/precice/examples/solverdummies/fortran
– Up-to-date: /root/precice/share/precice/examples/solverdummies/fortran/solverdummy.f90
– Up-to-date: /root/precice/share/precice/examples/solverdummies/fortran/README.md
– Up-to-date: /root/precice/share/precice/examples/solverdummies/fortran/CMakeLists.txt
– Up-to-date: /root/precice/share/precice/examples/solverdummies/cpp
– Up-to-date: /root/precice/share/precice/examples/solverdummies/cpp/README.md
– Up-to-date: /root/precice/share/precice/examples/solverdummies/cpp/CMakeLists.txt
– Up-to-date: /root/precice/share/precice/examples/solverdummies/cpp/test.cmake
– Up-to-date: /root/precice/share/precice/examples/solverdummies/cpp/solverdummy.cpp
– Up-to-date: /root/precice/share/precice/examples/solverdummies/README.md
– Up-to-date: /root/precice/share/precice/examples/solverdummies/precice-config.xml
– Up-to-date: /root/precice/share/precice/examples/solverdummies/solverdummies.doxys
– Up-to-date: /root/precice/share/precice/examples/solverdummies/c
– Up-to-date: /root/precice/share/precice/examples/solverdummies/c/solverdummy.c
– Up-to-date: /root/precice/share/precice/examples/solverdummies/c/README.md
– Up-to-date: /root/precice/share/precice/examples/solverdummies/c/CMakeLists.txt
– Up-to-date: /root/precice/lib/cmake/precice/preciceTargets.cmake
– Installing: /root/precice/lib/cmake/precice/preciceTargets-release.cmake
– Up-to-date: /root/precice/lib/cmake/precice/preciceConfig.cmake
– Up-to-date: /root/precice/lib/cmake/precice/preciceConfigVersion.cmake
– Up-to-date: /root/precice/share/man/man1
– Up-to-date: /root/precice/share/man/man1/binprecice.1.gz
– Up-to-date: /root/precice/lib/pkgconfig
– Installing: /root/precice/lib/pkgconfig/libprecice.pc
– Up-to-date: /root/precice/share/doc/libprecice2/copyright
– Installing: /root/precice/share/lintian/overrides/libprecice2
– Up-to-date: /root/precice/share/doc/libprecice2/changelog.gz
mishal49@DESKTOP-LGSKB8J:~/precice/precice-2.3.0$ sudo make test_install
Scanning dependencies of target test_install
[100%] Testing the installation using the C++ solverdummy
– The CXX compiler identification is GNU 9.3.0
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Looking for C++ include pthread.h
– Looking for C++ include pthread.h - found
– Performing Test CMAKE_HAVE_LIBC_PTHREAD
– Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
– Looking for pthread_create in pthreads
– Looking for pthread_create in pthreads - not found
– Looking for pthread_create in pthread
– Looking for pthread_create in pthread - found
– Found Threads: TRUE
– Configuring done
– Generating done
– Build files have been written to: /home/mishal49/precice/precice-2.3.0/TestInstall
Scanning dependencies of target solverdummy
[ 50%] Building CXX object CMakeFiles/solverdummy.dir/solverdummy.cpp.o
[100%] Linking CXX executable solverdummy
[100%] Built target solverdummy
UpdateCTestConfiguration from :/home/mishal49/precice/precice-2.3.0/TestInstall/DartConfiguration.tcl
UpdateCTestConfiguration from :/home/mishal49/precice/precice-2.3.0/TestInstall/DartConfiguration.tcl
Test project /home/mishal49/precice/precice-2.3.0/TestInstall
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph…
Checking test dependency graph end
test 1
Start 1: precice.solverdummy

1: Test command: /usr/bin/cmake “-DDUMMY_EXE=/home/mishal49/precice/precice-2.3.0/TestInstall/solverdummy” “-DDUMMY_CONFIG=/home/mishal49/precice/precice-2.3.0/examples/solverdummies/cpp/…/precice-config.xml” “-V” “-P” “/home/mishal49/precice/precice-2.3.0/examples/solverdummies/cpp/test.cmake”
1: Test timeout computed to be: 10000000
1: Running Two Solverdummies
1: Using executable: /home/mishal49/precice/precice-2.3.0/TestInstall/solverdummy
1: Using config: /home/mishal49/precice/precice-2.3.0/examples/solverdummies/cpp/…/precice-config.xml
1: DUMMY: Running solver dummy with preCICE config file “/home/mishal49/precice/precice-2.3.0/examples/solverdummies/cpp/…/precice-config.xml”, participant name “SolverTwo”, and mesh name “MeshTwo”.
1: preCICE: This is preCICE version 2.3.0
1: preCICE: Revision info: no-info [Git failed/Not a repository]
1: preCICE: Configuration: Release (Debug and Trace log unavailable)
1: preCICE: Configuring preCICE with configuration “/home/mishal49/precice/precice-2.3.0/examples/solverdummies/cpp/…/precice-config.xml”
1: preCICE: I am participant “SolverTwo”
1: preCICE: Setting up master communication to coupling partner/s
1: preCICE: Masters are connected
1: preCICE: Setting up preliminary slaves communication to coupling partner/s
1: preCICE: Receive global mesh MeshOne
1: preCICE: Prepare partition for mesh MeshTwo
1: preCICE: Setting up slaves communication to coupling partner/s
1: preCICE: Slaves are connected
1: preCICE: Compute “read” mapping from mesh “MeshOne” to mesh “MeshTwo”.
1: preCICE: Mapping distance min:0 max:0 avg: 0 var: 0 cnt: 3
1: preCICE: iteration: 1 of 2, time-window: 1 of 2, time: 0, time-window-size: 1, max-timestep-length: 1, ongoing: yes, time-window-complete: no, write-iteration-checkpoint
1: DUMMY: Writing iteration checkpoint
1: preCICE: Compute “write” mapping from mesh “MeshTwo” to mesh “MeshOne”.
1: preCICE: Mapping distance min:0 max:0 avg: 0 var: 0 cnt: 3
1: preCICE: min iteration convergence measure: #it = 1 of 5, conv = false
1: preCICE: iteration: 2 of 2, time-window: 1 of 2, time: 0, time-window-size: 1, max-timestep-length: 1, ongoing: yes, time-window-complete: no, read-iteration-checkpoint
1: DUMMY: Reading iteration checkpoint
1: preCICE: min iteration convergence measure: #it = 2 of 5, conv = false
1: preCICE: Time window completed
1: preCICE: iteration: 1 of 2, time-window: 2 of 2, time: 1, time-window-size: 1, max-timestep-length: 1, ongoing: yes, time-window-complete: yes, write-iteration-checkpoint
1: DUMMY: Advancing in time
1: DUMMY: Writing iteration checkpoint
1: preCICE: min iteration convergence measure: #it = 1 of 5, conv = false
1: preCICE: iteration: 2 of 2, time-window: 2 of 2, time: 1, time-window-size: 1, max-timestep-length: 1, ongoing: yes, time-window-complete: no, read-iteration-checkpoint
1: DUMMY: Reading iteration checkpoint
1: preCICE: min iteration convergence measure: #it = 2 of 5, conv = false
1: preCICE: Time window completed
1: preCICE: iteration: 1 of 2, time-window: 3 of 2, time: 2, time-window-size: 1, max-timestep-length: 1, ongoing: no, time-window-complete: yes,
1: DUMMY: Advancing in time
1: preCICE: Synchronize participants and close communication channels
1: DUMMY: Closing C++ solver dummy…
1: Success!
1/1 Test #1: precice.solverdummy … Passed 0.41 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) = 0.41 sec
[100%] Built target test_install