0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

RHEL7にOpenFOAM-10をインストール

Last updated at Posted at 2023-07-14

はじめに

会社の計算サーバー(RHEL7)にOpenFOAM-10をインストールしてほしいと頼まれて試行錯誤した結果をまとめました。公式ページではDockerを使ったインストール手順が書かれていますが、なぜか上手くいかなかったのでソースコードをコンパイルしてインストールしました。
OpenFOAM-11のインストールも試してみましたが、ParaViewのバージョンが上がりQt 5.12をRHEL7にインストールできなかったためインストールできませんでした。

The OpenFOAM FoundationがリリースしているOpenFOAMはGcc&Ubuntu以外の対応があまりできていないようなので、RHELにおいてはOpenCFDが提供している方(openfoam-v2212など)を使う方がよさそうです。

環境

OS: RHEL 7.9

手順

以下はすべて管理者権限で実行します。まず依存パッケージをインストールします。

yum install openmpi openmpi-devel bison zlib-devel flex flex-devel gnuplot \
      readline-devel ncurses-devel libXt-devel boost-devel \
      qt5-qtbase-devel qt5-qttools-devel qt5-qtx11extras-devel

OpenFOAMのコンパイルにはgcc 5.4以上が必要なので、devtoolset-7をインストールします。

yum install devtoolset-7

またCMakeも新しいバージョンが必要なので、最新版のバイナリを公式ページからダウンロードしておきます。

wget https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4-linux-x86_64.sh
chmod +x cmake-3.26.4-linxu-x86_64.sh
mkdir /opt/cmake/cmake-3.26
./cmake-3.26.4-linxu-x86_64.sh --prefix=/opt/cmake/cmake-3.26 --skip-license

公式ページに従ってソースコードを/opt/OpenFOAMの下にダウンロードします。

mkdir /opt/OpenFOAM
cd /opt/OpenFOAM
wget -O - http://dl.openfoam.org/source/10 | tar xvz
wget -O - http://dl.openfoam.org/third-party/10 | tar xvz
mv OpenFOAM-10-version-10 OpenFOAM-10
mv ThirdParty-10-version-10 ThirdParty-10

次にOpenFOAMのバグを修正します。$WM_PROJECT_DIR/src/OpenFOAM/db/dictionary/entry/entryIO.Cの159行目を下記の様に修正します。

- && functionName == functionEntries::inputSyntaxEntry::typeName
+ && functionName == functionEntries::inputSyntaxEntry::typeName_()

ここまでで準備ができたのでコンパイルします。

export PATH="/opt/cmake/cmake-3.26/bin:/usr/lib64/qt5/bin:/usr/lib64/openmpi/bin:$PATH"
scl enable devtoolset-7 bash
source /opt/OpenFOAM/OpenFOAM-10/etc/bashrc
cd /opt/OpenFOAM/ThirdParty-10
./Allwmake
# ParaViewをコンパイルするときの並列数は環境変数WM_NCOMPPROCSで指定できる。
export WM_NCOMPPROCS=20
./makeParaView
wmRefresh
cd /opt/OpenFOAM/OpenFOAM-10
# OpenFOAMを並列コンパイルするときの並列数はjオプションで指定できる。
./Allwmake -j 20 
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?