OpenFOAM preCICE

本文最后更新于:2021年10月27日 晚上

This is abstract.

preCICE is an open-source coupling library for partitioned multi-physics simulations, including, but not restricted to fluid-structure interaction and conjugate heat transfer simulations.

Get essentials

sudo apt update
sudo apt install build-essential pkg-config cmake git
sudo apt install python3-dev python3-numpy python-is-python3 python3-pip
sudo apt install libeigen3-dev libxml2-dev libboost-all-dev petsc-dev

Build OpenFOAM before you start, you can get OpenFOAM using apt too.

wget https://github.com/precice/precice/archive/v2.3.0.tar.gz
tar -xzvf v2.3.0.tar.gz
cd precice-2.3.0
mkdir build
cmake -B build
cmake --build build --parallel

git clone --branch=master --depth 1 https://github.com/precice/openfoam-adapter
cd openfoam-adapter
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
./Allwmake
cd ..
wget http://www.dhondt.de/cgx_2.13.all.tar.bz2
tar xvjf cgx_2.13.all.tar.bz2
cd CalculiX/cgx_2.13/src
make -j
mkdir ~/opt/CalculiX
cp cgx ~/opt/CalculiX/
mkdir SPOOLES.2.2
cd SPOOLES.2.2
wget http://www.netlib.org/linalg/spooles/spooles.2.2.tgz
tar xvzf spooles.2.2.tgz

Make.inc

14  CC = gcc
15 #  CC = /usr/lang-4.0/bin/cc
make lib
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 xvzf arpack96.tar.gz
tar xvzf patch.tar.gz
cd ARPACK

ARmake.inc

 28 #home = $(HOME)/ARPACK
 29 home = $(HOME)/build/ARPACK

116 #MAKE    = /bin/make
117 MAKE    = make

105 #FC      = f77
106 FC      = gfortran
107 #FFLAGS = -O -cg89

 36 #PLAT = SUN4
 37 PLAT = INTEL

UTIL/second.f

24 *     EXTERNAL           ETIME
make lib
wget http://www.dhondt.de/ccx_2.16.src.tar.bz2
tar xvjf ccx_2.16.src.tar.bz2
cd CalculiX/ccx_2.16/src
make
wget https://github.com/precice/calculix-adapter/archive/master.zip
unzip master.zip
cd calculix-adapter-master

The adapter is built using GNU Make. The Makefile contains a few variables on top, which need to be adapted to your system:

  1. CCX: Location of the original CalculiX solver (CCX) source code (“src” directory)
    • Example: $(HOME)/CalculiX/ccx_2.16/src
  2. SPOOLES_INCLUDE: Include flags for SPOOLES
    • Example 1: SPOOLES_INCLUDE = -I/usr/include/spooles/ (installed)
    • Example 2: SPOOLES_INCLUDE = -I$(HOME)/SPOOLES.2.2/ (source)
  3. SPOOLES_LIBS: Library flags for SPOOLES
    • Example 1: SPOOLES_LIBS = -lspooles (installed)
    • Example 2: SPOOLES_LIBS = $(HOME)/SPOOLES.2.2/spooles.a (source)
  4. ARPACK_INCLUDE: Include flags for ARPACK
    • Example 1: ARPACK_INCLUDE = (installed, nothing needed)
    • Example 2: ARPACK_INCLUDE = -I$(HOME)/ARPACK (source)
  5. ARPACK_LIBS: Library flags for ARPACK
    • Example 1: ARPACK_LIBS = -larpack -llapack -lblas (installed)
    • Example 2: ARPACK_LIBS = $(HOME)/ARPACK/libarpack_INTEL.a (source)
  6. YAML_INCLUDE: Include flags for yaml-cpp
    • Example 1: YAML_INCLUDE = -I/usr/include/ (installed)
    • Example 2: YAML_INCLUDE = -I$(HOME)/yaml-cpp/include (source)
  7. YAML_LIBS: Library flags for yaml-cpp
    • Example 1: YAML_LIBS = -lyaml-cpp (installed)
    • Example 2: YAML_LIBS = -L$(HOME)/yaml-cpp/build -lyaml-cpp (source)

You may also want to adjust the compiler FC from mpifort to mpif90 or to any other compiler your system uses.


本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!