Skip to content

Install the OpenFOAM adapter using Spack

Gerasimos Chourdakis edited this page Sep 12, 2019 · 2 revisions

🚧 This page is under construction! 🚧

Installing OpenFOAM and the OpenFOAM-adapter

One we have preCICE installed through Spack, we can also use Spack to install the OpenFOAM-adapter:

$ spack install of-precice

If we don't want to build openFOAM from source, but rather use the one already present in the system (or install with the package manager) we need to add configuration in the ~/.spack/packages.yaml as follows:

packages:
  ...
  ...
  ...
  openfoam-org:
      paths:
        openfoam-org@5.0: /opt/openfoam5
      buildable: False

Openfoam is a virtual dependency (meaning it can satisfied both by openfoam-com and openfoam-org), so we want to select the provider for it.

$ spack install openfoam-org

Note: Spack directly interprets openfoam as openfoam-com. Beware that this can be problematic when combining openfoam and openfoam-org expressions.

As the OpenFOAM-adapter depends on preCICE, we might want to instruct spack to use the preCICE version we just built for installing of-precice. For this we can either supplement spack install of-precice with the identical specifications we used before (with selected boost libraries and Eigen versions and options ), or refer to the recent precice install by its hash:

$ spack find --long precice
-- linux-ubuntu18.04-x86_64 / gcc@7.3.0 -------------------------
dlukq7q precice@develop

Note that precice package we just installed is identified by the hash dlukq7q. Therefore we can reference it when installing the openfoam-adapter with:

$ spack install of-precice ^openfoam-org@5.0 ^/dlukq7q

Troubleshooting

See our Spack Troubleshooting in the preCICE wiki.