Below are my own raw notes when installing.
First complete the 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
This is intended to be used with preCICE-1.6.1 and OpenFOAM-v1906 (compiled with ThirdParty Gcc.8.2.0).
OFv1906
mkdir /chalmers/sw/unsup64/CalculiX
cd /chalmers/sw/unsup64/CalculiX
Below I followed instructions at https://github.com/precice/calculix-adapter/wiki/Installation-instructions-for-CalculiX:
CalculiX consists of the solver, called "CCX" and a pre- and postprocessing software with graphical user interface "CGX" (not installed here). The installation procedure of CalculiX is described in the README files of the respective packages, but we also give you the necessary information here.
Since CalculiX also depends on ARPACK and SPOOLES we first need to install them.
Download SPOOLES and extract it in a separate directory:
wget http://www.netlib.org/linalg/spooles/spooles.2.2.tgz
mkdir SPOOLES.2.2
tar zxvf spooles.2.2.tgz -C SPOOLES.2.2
rm spooles.2.2.tgz
cd SPOOLES.2.2
Edit by hand configuration file Make.inc to change the compiler version in line 14-15
CC = gcc
#CC = /usr/lang-4.0/bin/cc
Now build the library:
make lib
cd /chalmers/sw/unsup64/CalculiX
Download Arpack and patch:
wget https://www.caam.rice.edu/software/ARPACK/SRC/arpack96.tar.gz
wget https://www.caam.rice.edu/software/ARPACK/SRC/patch.tar.gz
Unpack them (they will be unpacked in the newly created directory ARPACK)
tar xzfv arpack96.tar.gz
tar xzfv patch.tar.gz
rm arpack96.tar.gz patch.tar.gz
cd ARPACK
Edit by hand ARmake.inc to specify build instructions. The following changes will depend on the directory structure of your system:
Line 28: Change home = $(HOME)/ARPACK to /chalmers/sw/unsup64/CalculiX/ARPACK
Line 115: Change MAKE = /bin/make to e.g. MAKE = make (if needed) NOT NEEDED!!!
Line 120: Change SHELL = /bin/sh to e.g. SHELL = sh (if needed) NOT NEEDED!!!
Lines 104 - 105: Specify your fortran compiler and compiler flags, e.g. for the gnu systems: DO THIS!!!
FC = gfortran
#FFLAGS = -O -cg89
Line 35: Modify the platform suffix for the library and remember it, since Calculix adapter makefile will depend on it ( by default it will use suffix INTEL for Linux and MAC for mac systems). For example change PLAT = SUN4 to PLAT = INTEL. In StuDAT, use PLAT = INTEL!!!
You will probably get linking errors related to ETIME, which you can bypass: In the file UTIL/second.f append * to the beginning of line 24 ( that comments it out ). DO THIS!!!
* EXTERNAL ETIME
Now we are ready to build the library with:
make lib
cd /chalmers/sw/unsup64/CalculiX
The adapter has furthermore yaml-cpp as a dependency. Either install it through your OS or e.g. (adapt the version) DO THIS!!!
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
cd yaml-cpp-yaml-cpp-0.6.2
mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=ON ..
make
After building, make sure that you make yaml-cpp discoverable by setting e.g. your LD_LIBRARY_PATH. You don't need this for the CalculiX adapter, but you would need it e.g. for the OpenFOAM adapter.
Note: If you use Boost 1.67 or newer, then you also need to install yaml-cpp 0.6 or newer. Similarly, for an older Boost version, you also need an older yaml-cpp. Unfortunately, this is not related to the adapter's code.
cd /chalmers/sw/unsup64/CalculiX
The following compilation requires that preCICE is available.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/precice-1.6.1/lib
export PKG_CONFIG_PATH=/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/precice-1.6.1/build/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/boost_1_65_1/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/petsc/arch-linux2-c-opt/lib:$LD_LIBRARY_PATH
Install Calculix with preCICE adapter (adapt the VERSION in the link, see the beginning of the adapter's README.md to find out which one you need).
wget http://www.dhondt.de/ccx_2.15.src.tar.bz2
tar xvjf ccx_2.15.src.tar.bz2
rm ccx_2.15.src.tar.bz2
The source code is now in CalculiX/ccx_2.15/src directory
Download and unzip the adapter (e.g. in the CalculiX folder)
cd /chalmers/sw/unsup64/CalculiX/CalculiX
wget https://github.com/precice/calculix-adapter/archive/master.zip
unzip master.zip
rm master.zip
cd calculix-adapter-master
Now in the calculix-adapter-master folder edit the Makefile to set path to libraries (SPOOLES, CCX, ARPACK, YAML):
# Path to original CalculiX source (e.g. $(HOME)/ccx_2.15/src )
CCX = /chalmers/sw/unsup64/CalculiX/CalculiX/ccx_2.15/src
# Path to SPOOLES main directory (e.g. $(HOME)/SPOOLES.2.2 )
SPOOLES = /chalmers/sw/unsup64/CalculiX/SPOOLES.2.2
# Path to ARPACK main directory (e.g. $(HOME)/ARPACK )
ARPACK = /chalmers/sw/unsup64/CalculiX/ARPACK
# Path to yaml-cpp prefix (e.g. $(HOME)/yaml-cpp, should contain "include" and "build")
YAML = /chalmers/sw/unsup64/CalculiX/yaml-cpp-yaml-cpp-0.6.2
and build with
make
Note: The adapter overwrites parts of CalculiX and builds it. You do not need to build CalculiX separately.
Got warning, but it finished compiling:
/bin/ld: warning: libgfortran.so.3, needed by //usr/lib64/liblapack.so.3, may conflict with libgfortran.so.5
Coupled CalculiX is now in the bin folder under the name ccx_preCICE. You may move this file to a path known by your system, or add this to your PATH (careful when doing this!). See the adapter's README.md for details.
export PATH=$PATH:/chalmers/sw/unsup64/CalculiX/CalculiX/calculix-adapter-master/bin
Needed to run:
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/sup64/gcc-8.1.0/lib64
Get tutorials:
run
mkdir PreCICE
cd PreCICE
git clone https://github.com/precice/tutorials.git
Test:
run
cp -r PreCICE/tutorials/FSI/3D_Tube/OpenFOAM-CalculiX .
cd OpenFOAM-CalculiX
#Manually copy pcorr to pcorrFinal in Fluid/system/fvSolution
./Allrun #Can't be put in background, it seems!
Post-processing (after installing the converter below):
cd Solid
python3 /chalmers/sw/unsup64/CalculiX/ccx2paraview-2.2/ccx2paraview.py tube.frd vtk
cd ..
foamToVTK -case Fluid
paraview #Read vtk files
Problem:
run
cp -r PreCICE/tutorials/CHT/heat_exchanger .
cd heat_exchanger/buoyantSimpleFoam-CalculiX
./Download_meshes
./Allrun >& log&
Error:
Outer-Fluid: it 1 of 1 | dt# 1 | t 0 of 500 | dt 1 | max dt 1 | ongoing yes | dt complete no | write-initial-data |
Initializing coupling data
Adapter writing coupling data...
ASSERTION FAILED
Location: void precice::impl::SolverInterfaceImpl::writeBlockScalarData(int, int, const int*, const double*)
File: /chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/precice-1.6.1/src/precice/impl/SolverInterfaceImpl.cpp:1066
Rank: 0
Failed expression: valueIndices != nullptr
0# getStacktrace[abi:cxx11]() in /chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/precice-1.6.1/lib/libprecice.so.1.6.1
1# precice::impl::SolverInterfaceImpl::writeBlockScalarData(int, int, int const*, double const*) in /chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/precice-1.6.1/lib/libprecice.so.1.6.1
2# precicec_writeBlockScalarData in /chalmers/sw/unsup64/OpenFOAM/ThirdParty-v1906/preCICE/precice-1.6.1/lib/libprecice.so.1.6.1
3# 0x00000000005B936D in ccx_preCICE
4# 0x00000000005BA076 in ccx_preCICE
5# 0x00000000005A622E in ccx_preCICE
6# 0x000000000040B40A in ccx_preCICE
7# __libc_start_main in /lib64/libc.so.6
8# 0x00000000004133D3 in ccx_preCICE
Tests with Calculix only:
run
wget http://www.dhondt.de/ccx_2.16.test.tar.bz2
tar xvjf ccx_2.16.test.tar.bz2
cd CalculiX/ccx_2.16/test
ccx_preCICE beamf
See:
Other test cases:
ls *.inp
See: http://www.dhondt.de/cgx_2.16.INSTALL
(Failing) Attempt, according to instructions at above link:
OFv1906
cd /chalmers/sw/unsup64/CalculiX
wget http://www.dhondt.de/cgx_2.16.1.all.tar.bz2
bzip2 -d cgx_2.16.1.all.tar.bz2
tar xf cgx_2.16.1.all.tar
cd CalculiX/cgx_2.16.1/src
The Makefile should start with:
CFLAGS = -O2 -Wall -Wno-narrowing \
-I./ \
-I/usr/include \
-I/usr/include/GL \
-I../../libSNL/src \
-I../../glut-3.5/src \
-I/usr/include/X11
The file cgx.h should contain:
#elif defined AFLIB
#define HELPFILE {"/chalmers/sw/unsup64/CalculiX/CalculiX/cgx_2.16.1/doc/cgx/cgx.html",\
"/chalmers/sw/unsup64/CalculiX/CalculiX/ccx_2.15/doc/ccx/ccx.html",\
"/chalmers/sw/unsup64/CalculiX/CalculiX/cgx_2.16.1/doc/aflib/aflib.pdf"}
#else
#define HELPFILE {"/chalmers/sw/unsup64/CalculiX/CalculiX/cgx_2.16.1/doc/cgx/cgx.html",\
"/chalmers/sw/unsup64/CalculiX/CalculiX/ccx_2.16.1/doc/ccx/ccx.html"}
#endif
Compile and make visible:
make >& log_make&
export PATH=$PATH:/chalmers/sw/unsup64/CalculiX/CalculiX/cgx_2.16.1/src
EITHER compile the documentation:
cd ../doc
latex2html cgx
OR download it (here not in the correct directory):
cd /chalmers/sw/unsup64/CalculiX
wget http://www.dhondt.de/cgx_2.16.htm.tar.bz2
bzip2 -d cgx_2.16.htm.tar.bz2
tar xf cgx_2.16.htm.tar
mv CalculiX/cgx_2.16/doc/cgx/* CalculiX/cgx_2.16.1/doc/cgx
rm -r CalculiX/cgx_2.16
Make available:
cd /chalmers/sw/unsup64
chmod -R go+Xr CalculiX
Test (in OFv1906 environment):
OGv1906
export PATH=$PATH:/chalmers/sw/unsup64/CalculiX/CalculiX/cgx_2.16.1/src
firefox file:///chalmers/sw/unsup64/CalculiX/CalculiX/cgx_2.16.1/doc/cgx/index.html&
cgx -b dummy.fbd
Error message, not fixed:
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
GLUT: Fatal Error in cgx: visual with necessary capabilities not found.
See: https://github.com/imirzov/ccx2paraview
Needs Python 3 (seems like numpy is not installed):
vcs-select -u python-3.7.3
'Install' (only Python scripts):
cd /chalmers/sw/unsup64/CalculiX
wget https://github.com/imirzov/ccx2paraview/archive/v2.2.tar.gz
tar xzf v2.2.tar.gz
rm v2.2.tar.gz
Test:
cd $FOAM_RUN/PreCICE/CalculiX-CalculiX
python3 /chalmers/sw/unsup64/CalculiX/ccx2paraview-2.2/ccx2paraview.py beamf.frd vtu
In ParaView, WarpByVector, Vector U, Scale Factor 0.0001
cd /chalmers/sw/unsup64
chmod -R go+Xr CalculiX
Now continue at http://www.tfd.chalmers.se/~hani/wikis/haniWiki/index.php?title=Tips_and_tricks_/_preCICE_/_Installation#PreCICE_OpenFOAM-adapter: