Below are my own raw notes when installing.
First follow the instructions at http://www.tfd.chalmers.se/~hani/wikis/haniWiki/index.php?title=Tips_and_tricks_/_FOAM_/_Installation#OpenFOAM-v1906_with_PreCICE_and_Calculix_in_StuDAT_.28non-root.29.2C_Redhat_Enterprise_7_.2C_2019-12-06
Check https://github.com/precice/precice/wiki/Dependencies
We need gcc with support for C++11, e.g. GCC version >= 5. Use a recent gcc version, e.g.:
OFv1906 #Includes gcc-8.2.0, consistent with OpenFOAM compilation
Check with:
gcc --version # Gives: gcc (OpenFOAM) 8.2.0
Other dependencies:
cmake --version # Gives: cmake version 3.11.4, OK
libxml2 is installed, check with:
xmllint --version # Gives: using libxml version 20901
and
xsltproc --version # Gives:
# Using libxml 20901, libxslt 10128 and libexslt 817
# xsltproc was compiled against libxml 20901, libxslt 10128 and libexslt 817
# libxslt 10128 was compiled against libxml 20901
# libexslt 817 was compiled against libxml 20901
Create installation directory
mkdir /chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE
cd /chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE
Install Boost and set environment variables:
wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz
tar xzf boost_1_65_1.tar.gz
rm boost_1_65_1.tar.gz
cd boost_1_65_1
./bootstrap.sh --with-libraries=log,thread,system,filesystem,program_options,test --prefix=/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/boost_1_65_1
./b2 install
BOOST_ROOT=/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/boost_1_65_1
export LIBRARY_PATH=$BOOST_ROOT/lib:$LIBRARY_PATH
export CPLUS_INCLUDE_PATH=$BOOST_ROOT/include:$CPLUS_INCLUDE_PATH
#Added to alias OFv1906:
#export LD_LIBRARY_PATH=$BOOST_ROOT/lib:$LD_LIBRARY_PATH
cd /chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE
'Install' Eigen3 and set environment variables (is only header files, so is not compiled):
wget https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz
tar xzf eigen-3.3.7.tar.gz
rm eigen-3.3.7.tar.gz
export Eigen3_ROOT=/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/eigen-3.3.7
cd /chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE
Install Petsc-3.11.4 (Needs ThirdParty installation of OpenMPI with fortran - and perhaps ThirdParty installation of Gcc with fortran). Note that there is a makePETSC in ThirdParty-v1906, but it is mentioned that it is experimental and there is a missing "\" at the end of line 186. I therefore installed it myself:
git clone -b maint https://bitbucket.org/petsc/petsc petsc
cd petsc
export PETSC_DIR=/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/petsc
./configure --with-debugging=0
make PETSC_DIR=/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/petsc PETSC_ARCH=arch-linux2-c-opt all
make PETSC_DIR=/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/petsc PETSC_ARCH=arch-linux2-c-opt check
#Passed, but got some warnings (perhaps have to also install LaPack):
#/bin/ld: warning: libgfortran.so.3, needed by /lib/../lib64/liblapack.so, may conflict with libgfortran.so.5
Continue:
cd /chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE
There was a problem compiling with system Petsc: '/bin/ld: warning: libmpi.so.0, needed by /chalmers/sw/sup64/petsc-3.11.3/lib/libpetsc.so, may conflict with libmpi.so.40'. I anyway compiled with Petsc since it is needed for the FSI tutorials (only for RBF mappings):
export PETSC_ARCH=arch-linux2-c-opt
export LD_LIBRARY_PATH=$PETSC_DIR/lib:$LD_LIBRARY_PATH
# Especially for SCons
export CPATH=$PETSC_DIR/include:$CPATH
export LIBRARY_PATH=$PETSC_DIR/lib:$LIBRARY_PATH
export PYTHONPATH=$PETSC_DIR/lib
Build preCICE using cmake (from https://github.com/precice/precice/wiki/Building:-Using-CMake)
wget https://github.com/precice/precice/archive/v1.6.1.tar.gz
tar -xzvf v1.6.1.tar.gz
rm v1.6.1.tar.gz
cd precice-1.6.1
mkdir build && cd build
Added flags to cmake below: The environment variables for boost, set above, was not enough (-DBoost* lines). The tests are made with 4 cores, and I install on a 2 core machine, so I had to tell mpirun to oversubscribe (line with --oversubscribe).
If compiling WITHOUT Petsc, add '-DPETSC=OFF \' before line with '..'
cmake -DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DBoost_INCLUDE_DIR:PATH=/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/boost_1_65_1/include \
-DBoost_LIBRARY_DIR_DEBUG:PATH=/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/boost_1_65_1/lib \
-DBoost_LIBRARY_DIR_RELEASE:PATH=/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/boost_1_65_1/lib \
-DPRECICE_CTEST_MPI_FLAGS:STRING=--oversubscribe \
-DCMAKE_INSTALL_PREFIX:PATH=/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/precice-1.6.1 \
..
make -j $(nproc)
#Warning: /bin/ld: warning: libgfortran.so.3, needed by /usr/lib64/liblapack.so, may conflict with libgfortran.so.5
make install
make test_base #Passed!!!
make test #Passed!!!
Make available:
cd /chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906
chmod -R go+Xr preCICE
Now complete the instructions at http://www.tfd.chalmers.se/~hani/wikis/haniWiki/index.php?title=Tips_and_tricks_/_CalculiX_/_Installation
Then continue below.
First complete instructions at http://www.tfd.chalmers.se/~hani/wikis/haniWiki/index.php?title=Tips_and_tricks_/_preCICE_/_Installation#preCICE-1.6.1_for_OFv1906_in_StuDAT_.28non-root.29.2C_Redhat_Enterprise_7_.2C_2019-12-26
Open a new terminal window, and type (Note order for boost, since OFv1906 adds boost_1_64_0 while boost_1_65_1 is said to be necessary for PreCICE. However, I did not see any effect of this):
OFv1906
#Moved to alias OFv1906:
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/precice-1.6.1/lib
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/chalmers/sw/unsup64/CalculiX/yaml-cpp-yaml-cpp-0.6.2/build
#export LD_LIBRARY_PATH=/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/boost_1_65_1/lib:$LD_LIBRARY_PATH
Then, below, we follow the instructions at https://github.com/precice/openfoam-adapter/wiki/Building:
cd /chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/
git clone https://github.com/precice/openfoam-adapter.git openfoam-adapter
export PRECICE_ROOT=/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/precice-1.6.1
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/precice-1.6.1/include/precice
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/chalmers/sw/unsup64/CalculiX/yaml-cpp-yaml-cpp-0.6.2/include # Should not include 'yaml-cpp'
#Moved to alias OFv1906:
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/precice-1.6.1/lib
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/chalmers/sw/unsup64/CalculiX/yaml-cpp-yaml-cpp-0.6.2/build
cd openfoam-adapter
Change in Allwmake:
ADAPTER_TARGET_DIR="${FOAM_SITE_LIBBIN}"
Compilation problems to be fixed, since there are errors reported in BOTH log and wmake.log:
In FSI/Force.C, change:
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"rho",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar(transportProperties.lookup("rho"))
)
);
to:
dimensionedScalar rho
(
"rho",
dimDensity,
transportProperties
);
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"rho",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
rho
)
);
Also, change:
dimensionedScalar nu(transportProperties.lookup("nu"));
to:
dimensionedScalar nu
(
"nu",
dimViscosity,
transportProperties
);
In Adapter.C, change:
} catch (Foam::error) {
to:
} catch (const Foam::error &e) {
There were several problems with unresolved references, without any info about what went wrong. To make the compilation fail upon unresolved references, add to Make/Options, second line:
-Wl,--no-undefined \
Finally, compile:
./Allwmake >& log&
Make available:
cd /chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906
chmod -R go+Xr preCICE
chmod -R go+Xr ../OpenFOAM-v1906
Couple OpenFOAM with OpenFOAM:
OFv1906
#Moved to alias OFv1906:
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/chalmers/sw/unsup64/CalculiX/yaml-cpp-yaml-cpp-0.6.2/build
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/precice-1.6.1/lib
#export LD_LIBRARY_PATH=/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/boost_1_65_1/lib:$LD_LIBRARY_PATH
run
cp -r /chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/openfoam-adapter/tutorials/CHT/flow-over-plate/buoyantPimpleFoam-laplacianFoam .
cd buoyantPimpleFoam-laplacianFoam
./Allrun >& log&
tailf Fluid.log
Use paraFoam on Fluid and Solid, respectively. Note that there is no temperature at time 0.19.
Couple OpenFOAM with Calculix:
OFv1906
run
git clone https://github.com/precice/tutorials.git
cd tutorials/FSI/3D_Tube/OpenFOAM-CalculiX
sed -i s/'pcorr'/'\"(pcorr|pcorrFinal)\"'/g Fluid/system/fvSolution
The following command should NOT be put in background:
./Allrun
To view the progress, open another terminal window and type:
OFv1906
run
cd tutorials/FSI/3D_Tube/OpenFOAM-CalculiX
tail -f Fluid.log
Open one more terminal window and type:
OFv1906
run
cd tutorials/FSI/3D_Tube/OpenFOAM-CalculiX
tail -f Solid.log
When done, you can view the Fluid results using ParaView, as usual.
For the solid part you first have to convert to VTK format. For that you need Python 3, so check with:
python3 --version
If you don't have it you can do:
vcs-select -p python-3.7.3
Then you can do (if you are still in the case directory above):
cd Solid
python3 /chalmers/sw/unsup64/CalculiX/ccx2paraview-2.2/ccx2paraview.py tube.frd vtk
Then you can open the VTK files in ParaView. Unfortunately, our Python3 seems not to have Numpy, so it doesn't work perfectly (yet). We need to improve the viewing of the solid part (later).
I didn't make the following work yet:
tutorials/CHT/heat_exchanger
tutorials/FSI/cylinderFlap/OpenFOAM-CalculiX
tutorials/FSI/flap_perp/OpenFOAM-CalculiX/
This seems to work:
tutorials/SSI/loaded_beam/CalculiX-CalculiX/
You can also try (which should work):
/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/openfoam-adapter/tutorials/CHT/flow-over-plate/buoyantPimpleFoam-laplacianFoam
You can also test only Calculix, without PreCICE coupling:
run
wget http://www.dhondt.de/ccx_2.16.test.tar.bz2
tar xvjf ccx_2.16.test.tar.bz2
rm ccx_2.16.test.tar.bz2
cd CalculiX/ccx_2.16/test
ccx_preCICE beamf
Some links (there is more to find):
http://www.bconverged.com/content/calculix/doc/GettingStarted.pdf
http://www.dhondt.de/ccx_2.16.pdf
https://github.com/precice/precice/wiki/Tutorial-for-FSI-with-OpenFOAM-and-CalculiX
https://github.com/precice/precice/wiki/Tutorial-for-SSI-with-CalculiX