Skip to content

Instantly share code, notes, and snippets.

@nicholascw
Last active December 21, 2019 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicholascw/7bf8ac11c5983dedd2c34430e6d5bf32 to your computer and use it in GitHub Desktop.
Save nicholascw/7bf8ac11c5983dedd2c34430e6d5bf32 to your computer and use it in GitHub Desktop.
Install SU2+Calculix+preCICE bundle for current user
#!/bin/bash
# Install SU2+Calculix+preCICE bundle for current user
#
# Usage: curl -L https://biuu.ga/getspc | bash | tee install.log
# Author: Nicholas Wang
# Date: Dec 20, 2019
# Based on:
# Ubuntu: 18.04 (bionic)
# CalculiX: 2.15
# SU2: 6.0.0
# preCICE: 1.6.1
# License: WTFPL
echo "
#################################
# Install SU2+Calculix+preCICE #
# bundle for current user #
#################################
# Usage: curl -L https://biuu.ga/getspc | bash | tee install.log
# Author: Nicholas Wang
# Date: Dec 20, 2019
# Based on:
# Ubuntu: 18.04 (bionic)
# CalculiX: 2.15
# SU2: 6.0.0
# preCICE: 1.6.1
# License: WTFPL
Checking system updates and install required packages...
"
sudo apt -y update
sudo apt -y full-upgrade
sudo apt -y install build-essential git cmake dh-autoreconf gcc
cd $HOME
mkdir -p $HOME/su2_calculix_precice_kit
cd su2_calculix_precice_kit
echo "Installing libprecice prebuilt package..."
#install libprecice
wget https://github.com/precice/precice/releases/download/v1.6.1/libprecice1.6.1-bionic.deb
sudo apt install -f -y ./libprecice1.6.1-bionic.deb
rm ./libprecice1.6.1-bionic.deb
echo "Installed libprecice version 1.6.1."
#su2-adapter
echo "Installing su2-adapter..."
wget https://github.com/su2code/SU2/archive/v6.0.0.tar.gz
tar xzf v6.0.0.tar.gz
rm v6.0.0.tar.gz
git clone https://github.com/precice/su2-adapter.git
export SU2_HOME="$HOME/su2_calculix_precice_kit/SU2-6.0.0"
cd su2-adapter
./su2AdapterInstall
cd $SU2_HOME
./configure --prefix=$SU2_HOME --enable-mpi
make -j8
cd $HOME/su2_calculix_precice_kit
echo "su2-adapter Installed."
export SU2_HOME="$HOME/su2_calculix_precice_kit/SU2-6.0.0"
export SU2_RUN="$SU2_HOME/bin"
export PATH=$PATH:$SU2_RUN
export PYTHONPATH=$SU2_RUN:$PYTHONPATH
#calculix-adapter
echo "Preparing for calculix-adapter"
#SPOOLES
echo "Building SPOOLES..."
wget http://www.netlib.org/linalg/spooles/spooles.2.2.tgz
mkdir SPOOLES
tar xzf spooles.2.2.tgz -C SPOOLES
rm spooles.2.2.tgz
cd SPOOLES
sed -i -e 's/\/usr\/lang-4.0\/bin\/cc/gcc/g' Make.inc
make lib
cd $HOME/su2_calculix_precice_kit
#ARPACK
echo "Building ARPACK..."
wget https://www.caam.rice.edu/software/ARPACK/SRC/arpack96.tar.gz
wget https://www.caam.rice.edu/software/ARPACK/SRC/patch.tar.gz
tar xzf arpack96.tar.gz
tar xzf patch.tar.gz
rm arpack96.tar.gz patch.tar.gz
cd ARPACK
echo '--- ARmake.inc 1996-04-26 14:12:57.000000000 -0500
+++ ARmake.inc2 2019-12-20 20:20:33.325701945 -0600
@@ -25,14 +25,14 @@
# | other than your home directory. |
# %--------------------------------------%
#
-home = $(HOME)/ARPACK
+home = $(HOME)/su2_calculix_precice_kit/ARPACK
#
# %--------------------------------------%
# | The platform identifier to suffix to |
# | the end of library names |
# %--------------------------------------%
#
-PLAT = SUN4
+PLAT = INTEL
#
# %------------------------------------------------------%
# | The directories to find the various pieces of ARPACK |
@@ -101,8 +101,8 @@
# | for your system. |
# %-----------------------------------------%
#
-FC = f77
-FFLAGS = -O -cg89
+FC = gfortran
+#FFLAGS = -O -cg89
LDFLAGS =
CD = cd
@@ -112,12 +112,12 @@
LN = ln
LNFLAGS = -s
-MAKE = /bin/make
+MAKE = make
RM = rm
RMFLAGS = -f
-SHELL = /bin/sh
+SHELL = sh
#
# %----------------------------------------------------------------%
# | The archiver and the flag(s) to use when building an archive |' > /tmp/ARPACK.patch;
patch ARmake.inc /tmp/ARPACK.patch
rm /tmp/ARPACK.patch
sed -i -e 's/ EXTERNAL ETIME/\* EXTERNAL ETIME/g' UTIL/second.f
make lib
cd $HOME/su2_calculix_precice_kit
#YAML-CPP
echo "Building yaml-cpp..."
wget https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-0.6.2.zip
unzip yaml-cpp-0.6.2.zip
rm yaml-cpp-0.6.2.zip
mv yaml-cpp-yaml-cpp-0.6.2 yaml-cpp
cd yaml-cpp
mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=ON ..
make -j8
export LD_LIBRARY_PATH="$HOME/su2_calculix_precice_kit/yaml-cpp/build:$LD_LIBRARY_PATH"
cd $HOME/su2_calculix_precice_kit
echo "Building ccx_preCICE"
wget http://www.dhondt.de/ccx_2.15.src.tar.bz2
tar xjf ccx_2.15.src.tar.bz2
rm ccx_2.15.src.tar.bz2
wget https://github.com/precice/calculix-adapter/archive/master.zip
unzip master.zip
rm master.zip
mv calculix-adapter-master calculix-adapter
cd calculix-adapter
sed -i -e 's/PathTo/su2_calculix_precice_kit/g' Makefile
make -j8
CALCULIX_RUN="$HOME/su2_calculix_precice_kit/calculix-adapter/bin"
cd $HOME/su2_calculix_precice_kit
echo "Compiled ccx_preCICE."
echo "Inserting new environment variables..."
echo 'export SU2_HOME="$HOME/su2_calculix_precice_kit/SU2-6.0.0"
export SU2_RUN="$SU2_HOME/bin"
export PATH=$PATH:$SU2_RUN:$CALCULIX_RUN
export PYTHONPATH=$SU2_RUN:$PYTHONPATH
export LD_LIBRARY_PATH="$HOME/su2_calculix_precice_kit/yaml-cpp/build:$LD_LIBRARY_PATH"
' >> $HOME/.profile
echo 'export SU2_HOME="$HOME/su2_calculix_precice_kit/SU2-6.0.0"
export SU2_RUN="$SU2_HOME/bin"
export PATH=$PATH:$SU2_RUN:$CALCULIX_RUN
export PYTHONPATH=$SU2_RUN:$PYTHONPATH
export LD_LIBRARY_PATH="$HOME/su2_calculix_precice_kit/yaml-cpp/build:$LD_LIBRARY_PATH"
' >> $HOME/.bashrc
echo "Install succeeded! Enjoy!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment