2013年10月の記事一覧

OpenFOAM 2.2 での 熱関連ソルバーの変更

 OpenFOAM 2.2.1 を使って,ブジネスク近似を使わない熱流体解析ソルバーを使おうとした。ソースコードを見たところ,昔より,読みにくくなっていて,戸惑ってしまった。OpenFOAM 2.2.0 から,熱関係のコードが大きく変更されたようだ。

http://www.openfoam.org/version2.2.0/thermophysical.php
”In v2.2.0, there has been significant redesign of thermophysical modelling, to enable more flexible handling of multiple materials, e.g. in multiphase flows, and conjugate heat transfer. ”

 混相流での熱の取扱が柔軟にできるらしい。それによって,混相流を取り扱う下記ソルバで,熱の計算も可能となった。(compressibleTwoPhaseEulerFoamは,2.1でも温度が入っていた。)

http://www.openfoam.org/version2.2.0/thermophysical.php
compressibleTwoPhaseEulerFoam
includes updated thermodynamics to use the run-time selectable form of the total energy equation for each phase, so that is possible to select different energy forms (h or e) separately for the two phases (see below for details).
compressibleInterFoam
includes updated thermodynamics to use the run-time selectable form of thermodynamics, but solves for the mixture temperature equation, derived from the internal energy equation, in order to maintain boundedness and realisablility.

 大きく変更されたのは,”Run-time Selectable Energy Solution Variable”となったこと。これまでは,ソルバーによって,エンタルピー h を解くのか,内部エネルギー e を解くのかが決まっていた。2.2.0 からは,実行時にどちらを解くのかが選択可能となっている。
 ソースコード内部では,he という変数が使われている。これは,"h or e" という意味で名付けられたらしい。この変数名は,いまいちしっくりこない。
 実行時には,constant/thermophysicalProperties ファイルで Thermophysical model を指定する。このモデルの詳細については,ユーザーガイドの 7.1 に解説がある。
http://www.openfoam.org/docs/user/thermophysical.php

 ソースコード内では, h と e とは同じ式で表される。ソース項のみが異なる。そのため,条件演算子(conditional operator)を使って,どちらを使うかを切り替えている。
 条件演算子は,<条件式> ? <真式> : <偽式> の形をとる。?と:の2つの記号をセットで使う,1つの演算子である。
http://ja.wikipedia.org/wiki/%E6%9D%A1%E4%BB%B6%E6%BC%94%E7%AE%97%E5%AD%90

 具体的に,$FOAM_SOLVERS/compressible/rhoPimpleFoam/EEqn.H のコードでは,EEqn の部分で,次の記述がある。
he.name() == "e"
                         ? fvc::div
                                       (
                                           fvc::absolute(phi/fvc::interpolate(rho), U),
                                           p,
                                           "div(phiv,p)"
                                               )
                          : -dpdt
 これは,he.name() が e ならば fvc::div(~) を,e でなければ,-dpdt (the pressure-work term) を使うことになる。

 fvSchemesのdivSchemesでは,hと使うかeを使うかに応じて, div(phi,h) か div(phi,e) を定義しておく必要がある。buoyantPimpleFoam/hotRoom 例題では,両方書いてある。thermophysicalProperties を切り替えても問題がないための処置だろう。
0