Run Fenics adapter of preCICE when FEniCS runs with Docker

If Fenics runs with docker, it is possible to run Fenics adapter of Precice?

Hi @namanpurwar93,

I assume that you are using the docker image provided by FEniCS. If you want to get preCICE running with this image, there are two necessary steps that you will have to do:

1. Install preCICE and the FEniCS adapter on top of the FEniCS image

Using the provided FEniCS docker image as a basis you can install preCICE and the FEniCS adapter just on top by following the instructions for a “normal” installation provided here and here.

If you get into trouble, taking a look at our systemtests might be helpful, even though the setup is not identical: In our tests an image with preCICE is the basis, then we put FEniCS and the adapter on top. Note that we do not use the official FEniCS docker image, but we install FEniCS via apt.

In the end both approaches result in an image of FEniCS with preCICE and the FEniCS-adapter being installed.

2. Connect the FEniCS+preCICE image to something else

As a next step you probably want to connect your image with FEniCS+preCICE to something else - for example OpenFOAM.

I assume that there are many different ways how you could achieve this. However, I only have experience with the approach that we are using in our tests. Here, we use docker-compose to connect several docker images. This test, for example runs the heat-heat tutorial by connecting two instances of FEniCS+preCICE.

An alternative approach I could imagine is to connect your FEniCS+preCICE docker image to another solver that is running directly on your system (i.e. no docker on the “other side”). Warning: I have no practical experience with this approach and it is really just an idea.

Hi @BenjaminRodenberg, Thank you for the response. I tried to do this, but finally I have to couple FEniCS with OpenFOAM, which is running directly on my system. So, it appears that they cannot communicate with each other. In my group, we use FEniCS with Anaconda also. Will coupling Fenics in a conda environment happen with OpenFOAM running directly or it will also have the same problem?

@namanpurwar93 in principle, and as far you don’t use MPI for inter-participant communication (but TCP sockets), it does not really matter where the two solvers run. They could even be on different computers, as they connect to each other through the network. In order to find each other, they write network addresses in the precice-run/ directory. This directory is created inside the exchange-directory (see wiki page on communication), which both participants need to have access to.

Long story short, just mount a volume in your Docker container and use the (absolute) path of it as your exchange-directory.