この記事はオープンソースの流体解析ソフトウェアTrioCFDをインストールして使ってみるためのメモ・備忘録です.
TrioCFDって何?
TrioCFDの前身はTrio_Uというソフトウェアであり,1994年からフランス原子力庁(CAE)原子力エネルギー部門(DEN)が開発しているオープンソースの流体解析ソフトウェアである.現在Trio_UはTRUSTとTrioCFDの2つのソフトウェアから構成されており,TRUSTは離散化スキームなどを扱うカーネル・プラットフォームであり,TRUSTをベースにして高機能なスキーム・モデル(例えばFront-TrackingやLESなど)を扱うのがTrioCFDとなっている.
主な機能・特徴としては,
- ソースコードはC++で記述されている
- Finite Difference Volume(VDF)とFinite Element Volume(VEF)で離散化されている
- 並列計算が可能
- 計算セル要素としてヘキサ・テトラが使用できる.ただし,両者を混在できず,非適合格子も利用できない.
などがあげられる.物理モデルとしては原子力分野での利用目的なので熱流体に強い(と思う).
TrioCFDの情報源
解説記事(論文)はP.-E.Angeli et al.1などがある. 公式のWebページはフランス語のみだが見つけることができる. ソースコードはSOURCEFORGEからダウンロードする.
TrioCFDのインストール
SOURCEFORGEにあるインストールスクリプト(Installer_TrioCFD.sh
)をダウンロードして行う. このスクリプトと同じレポジトリにあるREADME
を読むと使い方がわかる.
# First method if TRUST-1.8.0 platform is not installed:
## Download Installer_TrioCFD.sh
wget http://sourceforge.net/projects/triocfd/files/Installer_TrioCFD.sh
## Execute Installer
chmod +x Installer_TrioCFD.sh
./Installer_TrioCFD.sh
## Option to minimize build. You need to set this variable and then run previous method:
OPTIONS=\"-disable-optionals\"
------------------------------------------------------------------------------------------
# Second method if TRUST-1.8.0 platform is already installed:
wget http://sourceforge.net/projects/triocfd/files/Installer_TrioCFD.sh;
chmod +x Installer_TrioCFD.sh;
./Installer_TrioCFD.sh -with-trust $TRUST_ROOT
------------------------------------------------------------------------------------------
# Third method if TRUST-1.8.0 platform is already installed:
git clone git://git.code.sf.net/p/triocfd/code TrioCFD-1.8.0;
cd TrioCFD-1.8.0;
source $TRUST_ROOT/env_TRUST.sh;
baltik_build_configure -execute;
make optim debug
今回はゼロからのインストールなので"First method"で行う.
Ubuntu 18.04.3 LTSにインストール
今回いつも利用している,OpenFOAMインストール済みのオープンCAE統合環境であるDEXCS2019 for OpenFOAMにTrioCFDのインストールを試みる.DEXCS2019 for OpenFOAMのOSはUbuntu 18.04.3 LTSである.
端末を起動し適当なディレクトリを作成して(今回は~/build
とした),インストール作業を進める.
$ cd
$ mkdir build
$ cd build
$ wget http://sourceforge.net/projects/triocfd/files/Installer_TrioCFD.sh
$ chmod +x Installer_TrioCFD.sh
$ ./Installer_TrioCFD.sh
このインストールスクリプトではTRUSTをまずインストールし,引き続いてTrioCFDをインストールするが,TRUSTのインストールでエラーとなって停止する.ログファイルLOG_TRUST
を確認すると,最後の部分に以下のようなエラー出力が見つかる.
=========================================================================
Some packages needed by TRUST code were not found/correctly installed:
----------------------------------------------------------------
pdflatex is missing...
You cannot generate the PDF documentation of TRUST and its sub-projects unless you install metapackages equivalent to:
1. texlive-latex-base
2. texlive-latex-recommended
3. texlive-fonts-recommended
4. texlive-latex-extra
NOTE1: The names of these packages may differ if your OS is not one of Debian/Ubuntu/Mint
NOTE2: In the case you DO NOT WANT to install it, run:
./configure -without-pdflatex
See previous messages for further details or contact support at trust@cea.fr
=========================================================================
Error !
See /home/takagi/build/LOG_TRUST and contact support at trust@cea.fr
TeX関連のソフトウェアが必要らしいので(TeXでユーザーガイドやマニュアルを生成する),インストールする.
$ sudo apt-get install texlive-latex-base texlive-latex-recommended texlive-fonts-recommended texlive-latex-extra
TeXのインストールが完了したら,再度インストールスクリプトを実行する.
$ ./Installer_TrioCFD.sh
ログファイルとして,LOG_TRUST
とLOG_TrioCFD
ができる.LOG_TRUST
を見ると,各種ライブラリがビルドされているが,以下のエラーにあるとおりLIBPETSC
のビルドで失敗していることがわかる.
===================
Building libraries:
===================
LIBMFFT:OK in 0mn3s
LIBMFFT_C:OK in 0mn5s
LIBSKIT:OK in 0mn2s
LIBLATAFILTER:OK in 0mn4s
LIBICOCOAPI:OK in 0mn2s
LIBLAPACK:OK in 0mn58s
LIBPETSC:error in 0mn1s
A library failed to build. Contact TRUST support.
同じログファイルLOT_TRUST
をさらに確認すると,LIBPETSC
のビルドエラーについて,mpirun
が見つからないことが原因であることがわかる.
****************************************
CUDA support is not activated for PETSc
****************************************
Looking for package scalapack... PETSc needs to build it with --download-scalapack=../scalapack-2.0.2.tgz
Looking for package MUMPS... PETSc needs to build it with --download-mumps=../MUMPS_5.2.0-p1.tar.gz
Looking for package metis... PETSc needs to build it with --download-metis=../metis-5.1.0-p5.tar.gz
Error LIBPETSC can't be installed because mpirun is not found in /usr/lib/x86_64-linux-gnu/openmpi/bin
To workaround, re-configure TRUST with ./configure -force_provided_mpich or ./configure -force_provided_openmpi
makefile:10: recipe for target '/home/takagi/build/TRUST-1.8.0/lib/src/LIBPETSC/petsc/linux_opt/lib/libpetsc.a' failed
make[1]: *** [/home/takagi/build/TRUST-1.8.0/lib/src/LIBPETSC/petsc/linux_opt/lib/libpetsc.a] Error 255
make[1]: Leaving directory '/home/takagi/build/TRUST-1.8.0/ThirdPart/src/LIBPETSC'
BUILD_EXEC=KO
End of code recompilation.
***************
END OF INSTALL.
***************
このエラーを解決するために,TRUSTをconfigure
する際にオプションを付けろ,と指示があるので,指示に従ってTRUSTを再ビルドしてみる.
$ cd ~/build/TRUST-1.8.0
$ ./configure -force_provided_openmpi
$ source env_TRUST.sh
$ make
このインストールはかなり時間がかかる(1時間ぐらい).最後に後処理用のユーティリティをビルドするが,ここで以下のエラーを出力してコンパイルが停止する.
===========================
Building tools and plugins:
===========================
Outils/lance_test_seq_par:OK in 21mn11s
Outils/triou2doxygen:OK in 0mn1s
Outils/lata2dx:OK in 1mn7s
Outils/ICoCo:OK in 0mn10s
Outils/valgrind:OK in 1mn34s
Outils/TRIOXDATA:error in 0mn11s
Outils/doxygen:OK
doc:OK in 2mn6s
Outils/gnuplot:OK in 0mn40s
Outils/Gmsh:error in 2mn43s
Outils/VisIt:
error in 8mn47s
Outils/IHM:OK in 0mn5s
A tool failed to build. Contact TRUST support.
BUILD_TOOLS=KO
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 255c
この段階では,TRIOXDATA
,Gmsh
,VisIt
のインストールに失敗している.しかしながら,TrioCFDのビルドに必要なTRUSTのカーネル部分はビルドできていると推測できるので,ビルド済みのTRUSTをリンクする"Second method"でインストールスクリプトを実行する.
$ cd ~/build
$ ./Installer_TrioCFD.sh -with-trust ./TRUST-1.8.0
インストール終了後,ログファイル(LOG_TrioCFD
)を確認してエラーがなく正常にビルドできていることを確認する.
[100%] Built target list_obj
Scanning dependencies of target exe
[100%] Linking CXX executable /home/takagi/build/TrioCFD/TrioCFD
[100%] Built target exe
Done.
Executable is : /home/takagi/build/TrioCFD/TrioCFD
To use TrioCFD, type: source /home/takagi/build/TrioCFD/env_TrioCFD.sh
まとめ
TrioCFDのインストールはスクリプトで自動でやってくれるが,途中でこけるとエラーを辿っていくのに少し苦戦する(かも).必要なライブリはどんどんインストールディレクトリに入ってくるので,最終的には7GBぐらいのディスクを消費した.
インストールができたので,あとはTRUSTのチュートリアル(TRUST_tutorial.pdf)から始めて楽しむだけである. Let's enjoy!
引用文献
-
Bieder, U., and Fauchet, G., "Overview of the TRIOCFD code: Main features, V&V procedures and typical applications to nuclear engineering", NURETH-16, Chicago, IL, August 30-September 4, 2015. ↩