443
0
0

当日資料:オープンCAE勉強会@富山 第80回 講習会

Published at May 19, 2020 2:15 p.m.
Edited at May 22, 2020 8:33 p.m.

OpenFOAMを0から始める

オープンCAE勉強会@富山・富山県立大学 中川慎二

概要

はじめて OpenFOAM を使う方を対象とします。

普通の理系大学生としてPCを使えるけれど,OpenFOAM なんて聞いたことないという人を前提とします。

OpenFOAM という(熱)流体シミュレーション・オープンソース・ソフトウェアを使ってみたいけれど,どこからはじめてよいか分らないし,使える環境もない人が,OpenFOAM が動く環境を作ってみる事に挑戦します。

2系統の OpenFOAM を,1つのLinuxマシン(仮想マシン)にインストールして,動作確認が完了することを目標とします。

進め方

zoom を利用したオンライン開催です。

時間 作業
当日まで 仮想マシンのインポート
当日まで OpenFOAM v7 のインストール
当日まで OpenFOAM v1912 のインストール
当日 13:30 勉強会開始  会議リンクは参加者へ連絡します。
当日 参加者自己紹介
当日 14:00 講習開始
当日 OpenFOAMについて 作業内容の確認
当日 2つのOpenFOAMの違い 例題実行
当日 16:30 勉強会終了

Linuxの基本

OpenFOAM を利用するうえで知っておくと便利な,Linuxの基本的なコマンドがまとまっています。初心者は必見です。

OpenFOAM Linux Guide
https://cfd.direct/openfoam/linux-guide/

OpenFOAM Foundation版 の開発社 CFD direct

CFD Direct は OpenFOAM Foundation 版を開発するグループである。

CFD Direct is the manager and primary developer of OpenFOAM, on behalf of the OpenFOAM Foundation, the copyright holder and licensor of OpenFOAM. It's Directors include: Henry Weller, the creator of OpenFOAM; and Chris Greenshields, OpenFOAM co-founder — both also Directors of the OpenFOAM Foundation. CFD Direct provides services for OpenFOAM, including the following

プログラム開発,OpenFOAM搭載クラウドコンピューティング環境,トレーニングなどを提供している。次のようなマニュアル類も公開している。

OpenFOAM User Guide [ Version 7 | Version 6 | Version 5 | Version 4 ]
https://cfd.direct/openfoam/user-guide/

OpenFOAM Linux Guide
https://cfd.direct/openfoam/linux-guide/

OpenFOAM 7 C++ Source Code Guide: The OpenFOAM Foundation
https://cpp.openfoam.org/v7/

下記リンク先で,右上の detail level を変更すると,全体のファイル構造と役割がわかりやすくなるかもしれない。
https://cpp.openfoam.org/v7/files.html

OpenCFD版

公式情報元

OpenFOAM: OpenCFD Ltd 2019. OpenCFD is an affiliate of ESI Group
https://www.openfoam.com/

User Guide
https://www.openfoam.com/documentation/user-guide/

Tutorial Guide
https://www.openfoam.com/documentation/tutorial-guide/

Extended Code Guide
https://www.openfoam.com/documentation/guides/latest/doc/

OpenFOAM® Repositories
https://develop.openfoam.com/Development/openfoam

Pre-compiled Linux binaries に関する説明あり。
https://develop.openfoam.com/Development/openfoam/-/wikis/home

Precompiled packages - debian/ubuntu
https://develop.openfoam.com/Development/openfoam/-/wikis/precompiled/debian

パッケージインストールについて

公式サイトではなく,下記の開発者サイト(コチラも公式)において, debian/ubuntu linux のパッケージについて説明がありました。このサイトの指示にしたがえば,パッケージインストールも可能です。
https://develop.openfoam.com/Development/openfoam/-/wikis/precompiled/debian

その他の linux ディストリビューション についても,Precompiled packages として説明があります。
https://develop.openfoam.com/Development/openfoam/-/wikis/precompiled#sub-packages

インストール場所が /usr/lib/openfoam/openfoam1912/ になったり,一時的に OpenFOAM bash session を開始する openfoam1912 というスクリプトが用意されていたりと,foundation版とは違いがあります。

さらに,実行環境だけ,コンパイル可能,例題付き,など,いくつかの選択が可能です。

ソースコードのコピーライトに関する注意 過去と現在

27/06/2019 OpenCFD Release OpenFOAM® v1906 リリースノート

This year OpenCFD celebrates its 15 years since it first brought you OpenFOAM - version 1.0 in December 2004 - as free and open source.

In preparing for this 15 year anniversary of OpenFOAM we referenced historic copyrights for some source code files in the OpenFOAM-v1906 release for the period prior to 2011 which may have caused some confusion; this was inadvertent on our part - the intention was to highlight OpenCFD’s contribution and long-standing commitment to OpenFOAM, and not to claim intellectual property that OpenCFD had in fact previously transferred to OpenFOAM Foundation Inc and OpenFOAM Foundation Ltd. We rectified the text as of 4th November 2019 - users are cautioned to use source files from after that date to the extent possible.

Windowsで使うには

Windows 10 では,WSLと呼ばれる仕組みがあり,Windows上に Linux をインストールすることができる。この仕組みを利用して,Linux用のOpenFOAMをWindows上で使用することができる。

Linux 用 Windows サブシステムとは
https://docs.microsoft.com/ja-jp/windows/wsl/about?redirectedfrom=MSDN

blueCFD-Core 2017-2
    OpenFOAM 5 ベース.MSys2でコンパイルされている。バイナリインストーラがオープンソースで公開されている。

Installation/Windows @ OpenFOAM Wiki
https://openfoamwiki.net/index.php/Installation/Windows

Docker for Windows
 Windows 10 Pro 等では,Docker を利用することができる.(Hyper-Vを有効にするに必要がある→Virtualboxとの併用は不可であった。もうすぐ,両者を併用できるようになる。)

もうすぐ(2020年5月のアップデート)、「Docker Desktop」が「Windows 10 Home」の「WSL 2」に対応するといわれている。これによって,ほとんどすべての Windows 10 ユーザーが,WSL2 上で Docker を利用できる。Docker形式で提供されるOpenFOAMが利用しやすくなる。
https://forest.watch.impress.co.jp/docs/news/1239275.html
https://www.docker.com/blog/docker-desktop-for-windows-home-is-here/

例題実行演習

公式 User Guide で説明されている標準例題を実行し,基本的な操作方法と,ファイルの意味などを確認する。

当日用資料へのリンク:はじめてのOpenFOAM(スライドPDF)+runtimeポスト処理付き例題zipファイル(20200523フォルダをご覧ください)

上記リンク先から,cavity.zip ファイルを取得してください。標準例題との違いは,次の2点です。

  • controlDict に,runtimePostProcessing のためのファイルをインクルード
  • system ディレクトリに,ポスト処理を記述したディクショナリ visualization ファイルを追加

今回は,標準例題に加えて,v1906で使い勝手のよくなった計算実行時可視化・画像再生についても,確認します。流線やベクトルを描画した png画像ファイルを,計算終了時に自動生成してみます。

https://www.openfoam.com/documentation/guides/latest/doc/guide-fos-graphics-runtime-postprocessing.html

foundation版では,VTK format ファイルは書き出せます。このファイルを Paraviewで読み込んで表示する必要があります。

https://cfd.direct/openfoam/user-guide/v7-graphs-monitoring/#x33-2580006.3.3

ご質問など 問合せ先

関連ページ

事前作業用資料

オープンCAE勉強会@富山 第80回 講習会
OpenFOAMを0から始める:仮想マシンのインポート
https://nakagawa-lab.kibe.la/shared/entries/4513d835-b606-4db9-8815-b5fa5a8dda5d

OpenFOAM v7 のインストール
https://nakagawa-lab.kibe.la/shared/entries/db222dc8-a65d-4138-8702-8e5331186614

OpenFOAM v1912 のインストール
https://nakagawa-lab.kibe.la/shared/entries/b81a7cf5-53eb-456b-8d30-f3bb61013634

当日用資料

当日資料:オープンCAE勉強会@富山 第80回 講習会 ← この資料

当日講習資料補足:オープンCAE勉強会@富山(第80回)
https://nakagawa-lab.kibe.la/shared/entries/a6fa6eae-af46-472d-a1a5-40ff2a81c207

Dockerメモ
https://nakagawa-lab.kibe.la/shared/entries/66644ada-6ade-4d03-b4bb-580bf785d435

付録
講習用配布マシンの説明
https://nakagawa-lab.kibe.la/shared/entries/07261560-338e-4b5f-9fb9-13e446e1381f