# preCICE, Singularity & OpenFOAM

**URL:** <https://precice.discourse.group/t/precice-singularity-openfoam/147>\
**Category:** Installing preCICE\
**Tags:** openfoam, docker, singularity\
**Created:** [January 31, 2020, 5:12pm UTC](https://precice.discourse.group/t/precice-singularity-openfoam/147 "2020-01-31T17:12:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jun\_leng](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@jun\_leng](https://precice.discourse.group/u/jun_leng)\
**Post date:** [January 31, 2020, 5:12pm UTC](https://precice.discourse.group/t/precice-singularity-openfoam/147/1 "2020-01-31T17:12:31Z")

</div>

Hi, everyone,

I met a problem when I coupled preCICE with OpenFOAM. OpenFOAM has been installed through Singularity container [https://sylabs.io/guides/3.5/user-guide/](https://sylabs.io/guides/3.5/user-guide/) on our school’s HPC (Centos 7). But preCICE was built with Cmake directly on the HPC. Is it possible to connect preCICE with OpenFOAM which is built in Singularity or other containers? Or do I need to install OpenFOAM on the HPC without Singularity?

Thanks~

---

<div class="post-metadata">

**Author:** ![Makis](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/makis/32/25_2.png) [@Makis](https://precice.discourse.group/u/Makis)\
**Post date:** [January 31, 2020, 6:06pm UTC](https://precice.discourse.group/t/precice-singularity-openfoam/147/2 "2020-01-31T18:06:01Z")

</div>

Hi @jun_leng,

I have not worked with Singularity, but I assume it works very similarly to Docker.

Docker containers are (in the application layer) isolated systems and cannot access external libraries. Therefore, no, you will not be able to link to preCICE, at least not easily.

If you want to stick to OpenFOAM through a container, you could try building the adapter inside the container (see [how we do it for our system tests](https://github.com/precice/systemtests/blob/develop/adapters/Dockerfile.openfoam-adapter)). Then, you could specify in the `precice-config.xml` that you want to [use TCP sockets](https://github.com/precice/precice/wiki/Communication-Configuration) and you could specify a shared directory as the `exchange-directory`.

During the initialization phase, each participant writes a file with its (network) address into the `exchange-directory` path. If both participants can access this, then they can find each other.

---

<div class="post-metadata">

**Author:** ![jun\_leng](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@jun\_leng](https://precice.discourse.group/u/jun_leng)\
**Post date:** [January 31, 2020, 6:21pm UTC](https://precice.discourse.group/t/precice-singularity-openfoam/147/3 "2020-01-31T18:21:09Z")

</div>

Thank you! @Makis I will have a try.
