I was able to install the preCICE library by means of spack (works like a charm coupling two instances of OpenFOAM) but I have run into some errors when attempting to use python with preCICE.
I am trying to install the python bindings for preCICE via pip3 for Python 3.8, which was easy enough, however when I test the bindings with the solverdummy.py scripts included in the github repository I encounter the following error.
python3 solverdummy.py precice-config.xml SolverOne MeshOne Traceback (most recent call last): > File âsolverdummy.pyâ, line 5, in > import precice > File â/gscratch/sw/contrib/OpenFOAM7-CESG/ThirdParty-7/Anaconda3/lib/python3.8/site-packages/precice/init.pyâ, line 3, in > from cyprecice import Interface, action_read_iteration_checkpoint, action_write_iteration_checkpoint, action_write_initial_data, get_version_information > ImportError: /gscratch/sw/contrib/OpenFOAM7-CESG/ThirdParty-7/Anaconda3/lib/python3.8/site-packages/cyprecice.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZNK7precice15SolverInterface9getMeshIDERKSs
Seems that it stops from reading an âundefined symbolâ when importing the precice module within python. I tried to install pyprecice by means of the other methods listed here but havenât had any success.
Is there someone here who could provide some insight into how I can resolve this?
Nevermind, issue was resolved. I figured out how to install the pyprecice package and was able to run the test case successfully. Sorry to spam the forum with my non-issue.
I downloaded the source code from a previous version (v2.1.1.2) of pyprecice and compiled using the command âpython3 setup.py installâ within the unzipped folder.
preCICE: This is preCICE version 2.0.2
preCICE: Revision info: no-info [Git failed/Not a repository]
preCICE: Configuring preCICE with configuration: âprecice-config.xmlâ
preCICE: Setting up master communication to coupling partner/s
preCICE: Masters are connected
preCICE: Setting up preliminary slaves communication to coupling partner/s
preCICE: Receive global mesh MeshOne
preCICE: Prepare partition for mesh MeshTwo
preCICE: Setting up slaves communication to coupling partner/s
preCICE: Slaves are connected
preCICE: Compute read mapping from mesh âMeshOneâ to mesh âMeshTwoâ.
preCICE: Mapping distance min:0 max:0 avg: 0 var: 0 cnt: 3
preCICE: it 1 of 2 | dt# 1 of 2 | t 0 | dt 1 | max dt 1 | ongoing yes | dt complete no | write-iteration-checkpoint |
DUMMY: Writing iteration checkpoint
DUMMY: Advancing in time
preCICE: Compute write mapping from mesh âMeshTwoâ to mesh âMeshOneâ.
preCICE: Mapping distance min:0 max:0 avg: 0 var: 0 cnt: 3
preCICE: min iteration convergence measure: #it = 1 of 5, conv = false
preCICE: it 2 of 2 | dt# 1 of 2 | t 0 | dt 1 | max dt 1 | ongoing yes | dt complete no | read-iteration-checkpoint |
DUMMY: Reading iteration checkpoint
DUMMY: Advancing in time
preCICE: min iteration convergence measure: #it = 2 of 5, conv = false
preCICE: Time window completed
preCICE: it 1 of 2 | dt# 2 of 2 | t 1 | dt 1 | max dt 1 | ongoing yes | dt complete yes | write-iteration-checkpoint |
DUMMY: Writing iteration checkpoint
DUMMY: Advancing in time
preCICE: min iteration convergence measure: #it = 1 of 5, conv = false
preCICE: it 2 of 2 | dt# 2 of 2 | t 1 | dt 1 | max dt 1 | ongoing yes | dt complete no | read-iteration-checkpoint |
DUMMY: Reading iteration checkpoint
DUMMY: Advancing in time
preCICE: min iteration convergence measure: #it = 2 of 5, conv = false
preCICE: Time window completed
preCICE: it 1 of 2 | dt# 3 of 2 | t 2 | dt 1 | max dt 1 | ongoing no | dt complete yes |
Run finished at Fri Feb 26 14:34:04 2021
Global runtime = 149ms / 0.149s
Number of processors = 1
Rank: 0
Event | Count | Total[ms] | Max[ms] | Min[ms] | Avg[ms] | Time Ratio |
Great to hear that you could fix it. Since you have installed everything via Spack I wanted to add that there is a package for the Python bindings in Spack. It is called py-pyprecice. We are currently updating the Spack recipe of the bindings for the most recent versions of preCICE, but up to version 2.1.1 there should be suitable bindings integrated in the current Spack.