INSTALL PRECICE - CENTOS 7¶
Building: Using CMake¶
You could find the Roadmap in - follow the instructions on the right side of the page:
https://github.com/precice/precice/wiki/Roadmap
And you could find the binaries in - if you have Ubuntu it is easy to install the .deb file:
https://github.com/precice/precice/releases
Install the required dependencies and make sure you are using a recent CMake version. For Ubuntu 18.04 or newer:
sudo apt update && \
sudo apt install build-essential cmake libeigen3-dev libxml2-dev petsc-dev libboost-all-dev python-dev python-numpy
To build precice:
mkdir build && cd build
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
make -j $(nproc)
to test precice:
make test_base
and:
make test
Now go to Linking to preCICE with:
cmake CMAKE_PREFIX_PATH=~/software .
or to use preCICE from it’s build directory:
cmake -Dprecice_DIR=/precice/build/dir .
Depending on the configuration of ld it might look by default into /usr/local/lib or not. This might lead to linking problems and can be either solved by adding /usr/local/lib to the LD_LIBRARY_PATH
Now go to tutorials.
Install openFoam 5.x¶
Install Calculix¶
Dependencies¶
For CENTOS and other distributions
CMake versions can easily be added via the binaries here.
C++ compiler (with support for C++11, GCC version >= 5)
CMake (version high enough to support your boost version)
Eigen3:
Download the latest epel-release:
http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/
rpm -Uvh epel-release*rpm
yum install eigen3-devel
Make a soft link of Eigen folder into /usr/local/bin/
Test Eigen with the code:
#include <iostream> #include <Eigen/Dense> using Eigen::MatrixXd; int main() { MatrixXd m(2,2); m(0,0) = 3; m(1,0) = 2.5; m(0,1) = -1; m(1,1) = m(1,0) + m(0,1); std::cout << m << std::endl; }
Save the file into my_program.cpp and run it by:
g++ my_program.cpp -o my_program
When you run the program, it produces the following output::
3 -1
2.5 1.5
Boost (version >= 1.65.1) https://pkgs.org/download/boost:
wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz tar -xzf boost_1_* cd boost_1_* ./bootstrap.sh ./b2 install --with=all
This install boost in user local, if you want to install in a different place i.e /opt/boost use:
wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz
tar -xzf boost_1_*
cd boost_1_*
./bootstrap.sh --prefix=/opt/boost
./b2 install --prefix=/opt/boost --with=all
I had a lot of problems with precice 1.4.1 becuase it did’t find the path for boost include
To keep things simple, let’s start by using a header-only library. The following program reads a sequence of integers from standard input, uses Boost.Lambda to multiply each number by three, and writes them to standard output:
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
using namespace boost::lambda;
typedef std::istream_iterator<int> in;
std::for_each(
in(std::cin), in(), std::cout << (_1 * 3) << " " );
}
Copy the text of this program into a file called example.cpp.
Now, in the directory where you saved example.cpp, issue the following command::
c++ -I path/to/boost_1_65_0 example.cpp -o example
To test the result, type::
echo 1 2 3 | ./example
If you instal boost in /opt/bosst Set the PATH into .bashrc appending the line:
export PATH=opt/boost/include/${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/opt/boost/lib
libxml2
PETSc (optional) (version >= 3.6):
git clone -b maint https://bitbucket.org/petsc/petsc cd petsc export PETSC_DIR=`pwd` export PETSC_ARCH=x86_64 ./config/configure.py --with-shared=1 --with-x=0 --with-mpi=1 --download-hypre=1 make PETSC_DIR=/opt/petsc PETSC_ARCH=x86_64 all make PETSC_DIR=/opt/petsc PETSC_ARCH=x86_64 check
If occurs the error:
*******************Error detected during compile or link!******************* See http://www.mcs.anl.gov/petsc/documentation/faq.html /opt/petsc/src/snes/examples/tutorials ex19 ********************************************************************************* ping `hostname`
If it fails The machine has a funky network configuration and for some reason MPICH is unable to communicate between processes with the socket connections it has established. This can happen even if you are running MPICH on just one machine. Often you will find that ping hostname fails with this network configuration; that is processes on the machine cannot even connect to the same machine. You can try completely disconnecting your machine from the network and see if make test then works or speaking with your system adminstrator.
Python (optional) (with NumPy)
MPI (optional) (warning: problems with MPI_Ports using OpenMPI >= 2)
SCons (deprecated)
yaml-cpp 0.51 from https://github.com/jbeder/yaml-cpp/releases
OpenFoam6
Download preCICE¶
Download and unpack the latest release of preCICE (replace x.y.z with the actual version):
wget https://github.com/precice/precice/archive/vx.y.z.tar.gz
tar -xzvf vx.y.z.tar.gz
cd precice-x.y.z
Or from the installatoion directory (i.e. /opt):
git clone https://github.com/precice/precice.git
I also downloaded and tar libprecice1.4.0-bionic.tar.gz
Build preCICE¶
Use CMake to configure and build preCICE.
See CMake Options for a list of common options to use and Troubleshooting in case of any issues. We strongly recommend to build preCICE as a shared library. Note that the default prefix is /usr/local and you may want to change that.:
mkdir build && cd build
scl enable devtoolset-7 bash # To run gcc 7 instead 4.8.5
# unset ELPA # To avoid compiling warning
cmake3 -DBUILD_SHARED_LIBS=ON .. # this build libraries as dynamic
sudo make install
test preCICE¶
run:
make test_base
This executes the base test set.
To execute all tests, including tests known to hang or fail due to dependency issues, run:
make test
Also run this test:
$PRECICE_ROOT/tools/compileAndTest.py -t --run_test="\!@MPI_Ports"
When I ran this test, I received the error message:
/opt/precice-1.4.1/build/testprecice: error while loading shared libraries: libboost_timer.so.1.65.1: cannot open shared object file: No such file or directory
To solve this:
echo -e "\n/usr/local/lib" | sudo tee -a /etc/ld.so.conf
sudo ldconfig
install preCICE to the prefix¶
To install preCICE to the prefix run:
make install
You may have to add <prefix>/lib/pkconfig to your PKG_CONFIG_PATH in order for pkgconfig to be able to locate it.
I have to use:
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
export PATH=/usr/local/cuda-10.1/bin:/usr/local/cuda-10.1/NsightCompute-2019.1${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH
export PATH="$PATH:/usr/lib64/openmpi-2.1.1/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib64/openmpi-2.1.1/lib/openmpi"
#export BOOST_ROOT=/usr/local/boost/
export LD_LIBRARY_PATH="usr/local/lib:$LD_LIBRARY_PATH"
export PATH=/usr/local/bin/eigen3/${PATH:+:${PATH}}
export PETSC_DIR=/opt/petsc/
export PETSC_ARCH=x86_64
export LD_LIBRARY_PATH=/opt/libprecice1.4.1-bionic/bin:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/libprecice1.4.1/build:${LD_LIBRARY_PATH}
export PRECICE_ROOT=/opt/precice-1.4.1
# User specific aliases and functions
alias rapid='source /opt/RapidCFD/RapidCFD-dev/etc/bashrc WM_COMPILER_TYPE=system WM_COMPILER=Gcc48 WM_LABEL_SIZE=64 WM_MPLIB=OPENMPI FOAMY_HEX_MESH=yes'
alias rapid='source /opt/RapidCFD/RapidCFD-dev/etc/bashrc WM_LABEL_SIZE=64 WM_MPLIB=OPENMPI FOAMY_HEX_MESH=yes'
alias of5x='source \/opt/OpenFOAM/OpenFOAM-5.x/etc/bashrc $FOAM_SETTINGS'
Pages for installation help¶
yaml-cpp install¶
Download yaml-cpp 0.6.2:
yaml-cpp-yaml-cpp-0.6.2.tar.gz
tar xf yaml-cpp-yaml-cpp-0.6.2.tar.gz
scl enable devtoolset-7 bashrc
cd yamy-cpp-yaml-cpp-0.6.2
mkdir build
cd build
sudo chown -R hgasca:users .
cmake3 -DBOOST_ROOT=$BOOST_ROOT -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
sudo make install
Plate duct openfoam-openfoam¶
Clone and download The adapter: then go to openfoam-adapter-OpenFOAM5.x folder and run:
scl enable devtoolset-7 bash
of5x
./Allclean
./Allwmake
If errors review the .log file and use Precice Lobby for the fastest solution.
Run tutorial case¶
go to the folder and run:
cd tutorials/CHT/flow-over-plate/buoyantPimpleFoam-laplacianFoam
of6
./Allclean
./Allrun
To understand:
https://github.com/precice/openfoam-adapter/wiki/OpenFOAM-setup-(fluid)
Review Fluid.log in order to see if the adapter is running.
Open paraview
Open /CHT/flow-over-plate/buoyantPimpleFoam-laplacianFoam/Fluid/Fluid.foam and
/CHT/flow-over-plate/buoyantPimpleFoam-laplacianFoam/Solid/Solid.foam to postprocess